2022-03-21 21:53:02 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2022-05-11 13:18:24 -04:00
|
|
|
import os, sys, shutil
|
2022-03-21 21:53:02 -04:00
|
|
|
import shutil
|
2022-05-11 13:18:24 -04:00
|
|
|
from rom_info import Z64Rom
|
|
|
|
import rom_chooser
|
2022-04-19 13:16:06 -04:00
|
|
|
|
|
|
|
def BuildOTR(xmlPath, rom):
|
2022-03-21 21:53:02 -04:00
|
|
|
shutil.copytree("assets", "Extract/assets")
|
|
|
|
|
2022-05-11 13:18:24 -04:00
|
|
|
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
|
|
|
|
execStr += " ed -i %s -b %s -fl CFG/filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, rom)
|
2022-03-21 21:53:02 -04:00
|
|
|
|
|
|
|
print(execStr)
|
|
|
|
exitValue = os.system(execStr)
|
|
|
|
if exitValue != 0:
|
|
|
|
print("\n")
|
|
|
|
print("Error when building the OTR file...", file=os.sys.stderr)
|
|
|
|
print("Aborting...", file=os.sys.stderr)
|
|
|
|
print("\n")
|
|
|
|
|
2022-04-19 13:16:06 -04:00
|
|
|
def main():
|
2022-05-11 13:18:24 -04:00
|
|
|
rom_path = rom_chooser.chooseROM()
|
|
|
|
rom = Z64Rom(rom_path)
|
2022-03-31 19:42:44 -04:00
|
|
|
|
2022-04-03 15:48:44 -04:00
|
|
|
if (os.path.exists("Extract")):
|
2022-03-21 21:53:02 -04:00
|
|
|
shutil.rmtree("Extract")
|
2022-05-11 13:18:24 -04:00
|
|
|
|
|
|
|
BuildOTR("../soh/assets/xml/" + rom.version.xml_ver + "/", rom_path)
|
2022-03-21 21:53:02 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-04-19 13:16:06 -04:00
|
|
|
main()
|