Include z3pr's data files in the frozen package.

Warning: requires dev6 version of it
This commit is contained in:
Fabian Dill 2020-08-25 13:27:34 +02:00
parent 2096d6ae5b
commit 606f1fd4f8
2 changed files with 14 additions and 2 deletions

4
Rom.py
View File

@ -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.")

View File

@ -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()