mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
d/jak2: pass through all simple / non-blocked *-part, *-ocean and *-scenes files (#2048)
A big one... I figure even if we would like to change the way the particle/scene code is output -- it'd be easier to find patterns with it all decompiled. I've updated my script so it can easily be used to mass update these files: ```bash task update-gsrc-glob GLOB="**/*-part*.gc" ``` > for example will update gsrc files with `part` in their name -- if they are in ref tests (so uncompleted ones aren't touched) I found a few issues along the way that I'll have to make issues for soon.
This commit is contained in:
@@ -1 +1,2 @@
|
||||
rapidfuzz
|
||||
GitPython
|
||||
|
||||
@@ -7,24 +7,40 @@ repo = Repo("./")
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import glob
|
||||
|
||||
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)
|
||||
parser.add_argument("--file_pattern", help="Provide a glob pattern to find files, instead of using git status. Relative to the reference test folder", type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Get a list of changed files, as well as new files
|
||||
file_names = set()
|
||||
for item in repo.index.diff(None):
|
||||
path = item.b_rawpath.decode("utf-8")
|
||||
if args.game in path and "_REF" in path:
|
||||
file_names.add(os.path.basename(path).replace("_REF.gc", ""))
|
||||
def get_files_via_git():
|
||||
file_names = set()
|
||||
for item in repo.index.diff(None):
|
||||
path = item.b_rawpath.decode("utf-8")
|
||||
if args.game in path and "_REF" in path:
|
||||
file_names.add(os.path.basename(path).replace("_REF.gc", ""))
|
||||
|
||||
for item in repo.untracked_files:
|
||||
path = item
|
||||
if args.game in path and "_REF" in path:
|
||||
file_names.add(os.path.basename(path).replace("_REF.gc", ""))
|
||||
for item in repo.untracked_files:
|
||||
path = item
|
||||
if args.game in path and "_REF" in path:
|
||||
file_names.add(os.path.basename(path).replace("_REF.gc", ""))
|
||||
return file_names
|
||||
|
||||
def get_files_via_glob():
|
||||
file_names = set()
|
||||
for file in glob.glob("./test/decompiler/reference/{}/{}".format(args.game, args.file_pattern), recursive=True):
|
||||
file_names.add(os.path.basename(file).replace("_REF.gc", ""))
|
||||
return file_names
|
||||
|
||||
# Get a list of changed files, as well as new files
|
||||
file_names = []
|
||||
if args.file_pattern:
|
||||
file_names = get_files_via_glob()
|
||||
else:
|
||||
file_names = get_files_via_git()
|
||||
|
||||
for file_name in file_names:
|
||||
print("Decompiling - {}".format(file_name))
|
||||
|
||||
Reference in New Issue
Block a user