diff --git a/Rom.py b/Rom.py index 7ba8b6a1..91b34682 100644 --- a/Rom.py +++ b/Rom.py @@ -1501,10 +1501,12 @@ def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, spr if any(options.values()): ColorF = z3pr.ColorF + data_dir = local_path("data") if is_bundled() else None + def next_color(): return ColorF(local_random.random(), local_random.random(), local_random.random()) - z3pr.randomize(rom.buffer, "maseya", next_color, options) + z3pr.randomize(rom.buffer, "maseya", next_color, options, data_dir) else: logging.warning("Could not find z3pr palette shuffle. " "If you want improved palette shuffling please install the maseya-z3pr package.") diff --git a/setup.py b/setup.py index 2281a7d3..9240f1a7 100644 --- a/setup.py +++ b/setup.py @@ -113,6 +113,16 @@ for data in extra_data: os.makedirs(buildfolder / "Players", exist_ok=True) shutil.copyfile("playerSettings.yaml", buildfolder / "Players" / "playerSettings.yaml") +try: + from maseya import z3pr +except ImportError: + print("Maseya Palette Shuffle not found, skipping data files.") +else: + # maseya Palette Shuffle exists and needs its data files + print("Maseya Palette Shuffle found, including data files...") + file = z3pr.__file__ + installfile(Path(os.path.dirname(file)) / "data", keep_content=True) + qusb2sneslog = buildfolder / "QUsb2Snes" / "log.txt" if os.path.exists(qusb2sneslog): os.remove(qusb2sneslog) @@ -120,7 +130,7 @@ if os.path.exists(qusb2sneslog): if signtool: for exe in exes: print(f"Signing {exe.targetName}") - os.system(signtool+exe.targetName) + os.system(signtool + exe.targetName) manifest_creation()