Files
jak-project/scripts/gsrc/update-gsrc-via-refs.py
T
Tyler Wilding d264779173 d/jak2: finish glist | glist-h | camera | cam-interface | cam-states-dbg | cam-combiner | cam-debug | cam-start (#1829)
* d/jak2: finish `glist` and `glist-h` partially done `time-of-day`

* d/jak2: finish `camera` and `cam-interface`

* d/jak2: partially finish `cam-master` `cam-states`, and `cam-update` finish `cam-states-dbg` `cam-combiner` `cam-debug` and `cam-start`

* tests: update ref tests

* scripts: add scripts to automatically update gsrc files

* d/jak2: update gsrc
2022-08-31 19:22:47 -04:00

41 lines
1.3 KiB
Python

# Updates files in gsrc if they are modified in the reference test folder
# Uses git
# TODO - get new untracked files as well
import subprocess
from git import Repo
repo = Repo("./")
import argparse
import os
parser = argparse.ArgumentParser("update-gsrc-via-refs")
parser.add_argument("--game", help="The name of the game", type=str)
parser.add_argument("--decompiler", help="The path to the decompiler", type=str)
parser.add_argument("--decompiler_config", help="The decomp config", type=str)
args = parser.parse_args()
for item in repo.index.diff(None):
path = item.b_rawpath.decode("utf-8")
if args.game in path and "_REF" in path:
file_name = os.path.basename(path).replace("_REF.gc", "")
print("Decompiling - {}".format(file_name))
# Decompile file
subprocess.run(
[
args.decompiler,
"./decompiler/config/{}".format(args.decompiler_config),
"./iso_data",
"./decompiler_out",
"--config-override",
'{{"allowed_objects": ["{}"]}}'.format(file_name),
]
)
print("Updating - {}".format(file_name))
# Update gsrc
os.system(
"python ./scripts/gsrc/update-from-decomp.py --game {} --file {}".format(
args.game, file_name
)
)