mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 14:54:53 -04:00
d/config: re-organize decompiler/config and eliminate most of the duplication (#2185)
Reasons for doing so include: 1. This should stop the confusion around editing the wrong config file's flags -- when for example, extracting a level. Common settings can be in one central place, with bespoke overrides being provided for each version 2. Less verbose way of supporting multiple game versions. You don't have to duplicate the entire `type_casts` file for example, just add or override the json objects required. 3. Makes the folder structure consistent, Jak 1's `all-types` is now in a `jak1` folder, etc.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1_ntsc_black_label.jsonc iso_data decompiler_out\
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1\jak1_config.jsonc iso_data decompiler_out\ --version ntsc_v1
|
||||
pause
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1_jp.jsonc iso_data decompiler_out\
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1\jak1_config.jsonc iso_data decompiler_out\ --version jp
|
||||
pause
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1_pal.jsonc iso_data decompiler_out\
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1\jak1_config.jsonc iso_data decompiler_out\ --version pal
|
||||
pause
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1_us2.jsonc iso_data decompiler_out\
|
||||
out\build\Release\bin\decompiler decompiler\config\jak1\jak1_config.jsonc iso_data decompiler_out\ --version ntsc_v2
|
||||
pause
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
out\build\Release\bin\decompiler decompiler\config\jak2_ntsc_v1.jsonc iso_data\ decompiler_out\
|
||||
out\build\Release\bin\decompiler decompiler\config\jak2\jak2_config.jsonc iso_data\ decompiler_out\ --version ntsc_v1
|
||||
pause
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
cd ..\..
|
||||
git update-index --assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc decompiler\config\jak2_ntsc_v1.jsonc
|
||||
git update-index --assume-unchanged decompiler\config\jak1\jak1_config.jsonc decompiler\config\jak2\jak2_config.jsonc
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
cd ..\..
|
||||
git update-index --no-assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc decompiler\config\jak2_ntsc_v1.jsonc
|
||||
git update-index --no-assume-unchanged decompiler\config\jak1\jak1_config.jsonc decompiler\config\jak2\jak2_config.jsonc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cd ..\..
|
||||
python3 scripts\gsrc\update-gsrc-via-refs.py --game jak2 --decompiler out\build\Release\bin\decompiler.exe --decompiler_config .\decompiler\config\jak2_ntsc_v1.jsonc
|
||||
pause
|
||||
python3 scripts\gsrc\update-gsrc-via-refs.py --game jak2 --decompiler out\build\Release\bin\decompiler.exe --decompiler_config .\decompiler\config\jak2\jak2_config.jsonc --version ntsc_v1
|
||||
pause
|
||||
|
||||
@@ -13,6 +13,7 @@ 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("--version", help="The decomp config version", 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()
|
||||
|
||||
@@ -51,6 +52,8 @@ for file_name in file_names:
|
||||
"./decompiler/config/{}".format(args.decompiler_config),
|
||||
"./iso_data",
|
||||
"./decompiler_out",
|
||||
"--version",
|
||||
args.version,
|
||||
"--config-override",
|
||||
'{{"allowed_objects": ["{}"]}}'.format(file_name),
|
||||
]
|
||||
|
||||
@@ -31,10 +31,7 @@ def get_gsrc_path_from_filename(game_name, file_name):
|
||||
return path
|
||||
|
||||
def get_alltypes_path_from_game(game_name):
|
||||
if game_name == "jak1":
|
||||
return "./decompiler/config/all-types.gc"
|
||||
else:
|
||||
return "./decompiler/config/jak2/all-types.gc"
|
||||
return "./decompiler/config/{}/all-types.gc".format(game_name)
|
||||
|
||||
def get_ref_path_from_filename(game_name, file_name, ref_folder):
|
||||
file_list = get_file_list(game_name)
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# Directory of this script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
"${DIR}"/../../build/decompiler/decompiler "${DIR}"/../../decompiler/config/jak1_ntsc_black_label.jsonc "${DIR}"/../../iso_data "${DIR}"/../../decompiler_out
|
||||
"${DIR}"/../../build/decompiler/decompiler "${DIR}"/../../decompiler/config/jak1/jak1_config.jsonc "${DIR}"/../../iso_data "${DIR}"/../../decompiler_out --version ntsc_v1
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# Directory of this script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
"${DIR}"/../../build/decompiler/decompiler "${DIR}"/../../decompiler/config/jak2_ntsc_v1.jsonc "${DIR}"/../../iso_data/ "${DIR}"/../../decompiler_out
|
||||
"${DIR}"/../../build/decompiler/decompiler "${DIR}"/../../decompiler/config/jak2/jak2_config.jsonc "${DIR}"/../../iso_data/ "${DIR}"/../../decompiler_out --version ntsc_v1
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
GAME=jak1
|
||||
DECOMP_CONFIG=jak1_ntsc_black_label.jsonc
|
||||
DECOMP_CONFIG=jak1/jak1_config.jsonc
|
||||
DECOMP_CONFIG_VERSION=ntsc_v1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: "3.13"
|
||||
version: 3
|
||||
|
||||
vars:
|
||||
GOALC_BIN_RELEASE_DIR: './build/goalc'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: "3.13"
|
||||
version: 3
|
||||
|
||||
vars:
|
||||
GOALC_BIN_RELEASE_DIR: './build/goalc'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: "3.13"
|
||||
version: 3
|
||||
|
||||
vars:
|
||||
GOALC_BIN_RELEASE_DIR: './out/build/Release/bin'
|
||||
|
||||
+21
-13
@@ -12,7 +12,8 @@ args = parser.parse_args()
|
||||
# TODO - read from defaults
|
||||
file = {
|
||||
"GAME": "jak1",
|
||||
"DECOMP_CONFIG": "jak1_ntsc_black_label.jsonc"
|
||||
"DECOMP_CONFIG": "jak1/jak1_config.jsonc",
|
||||
"DECOMP_CONFIG_VERSION": "ntsc_v1"
|
||||
}
|
||||
|
||||
env_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), ".env")
|
||||
@@ -36,20 +37,25 @@ if args.info:
|
||||
valid_games = ["jak1", "jak2"]
|
||||
|
||||
decomp_config_map = {
|
||||
"jak1": "jak1/jak1_config.jsonc",
|
||||
"jak2": "jak2/jak2_config.jsonc",
|
||||
}
|
||||
|
||||
decomp_config_version_map = {
|
||||
"jak1": {
|
||||
"ntscv1": "jak1_ntsc_black_label.jsonc",
|
||||
"ntscv2": "jak1_us2.jsonc",
|
||||
"pal": "jak1_pal.jsonc",
|
||||
"ntscjp": "jak1_jp.jsonc"
|
||||
"ntscv1": "ntsc_v1",
|
||||
"ntscv2": "ntsc_v2",
|
||||
"pal": "pal",
|
||||
"ntscjp": "jp"
|
||||
},
|
||||
"jak2": {
|
||||
"ntscv1": "jak2_ntsc_v1.jsonc"
|
||||
"ntscv1": "ntsc_v1"
|
||||
}
|
||||
}
|
||||
|
||||
default_config_map = {
|
||||
"jak1": "jak1_ntsc_black_label.jsonc",
|
||||
"jak2": "jak2_ntsc_v1.jsonc"
|
||||
default_config_version_map = {
|
||||
"jak1": "ntsc_v1",
|
||||
"jak2": "ntsc_v1"
|
||||
}
|
||||
|
||||
if args.game:
|
||||
@@ -58,13 +64,15 @@ if args.game:
|
||||
sys.exit(1)
|
||||
curr = file["GAME"]
|
||||
file["GAME"] = args.game
|
||||
if (curr != file["GAME"]) or file["DECOMP_CONFIG"] not in decomp_config_map[file["GAME"]]:
|
||||
file["DECOMP_CONFIG"] = default_config_map[file["GAME"]]
|
||||
if (curr != file["GAME"]) or file["DECOMP_CONFIG_VERSION"] not in decomp_config_version_map[file["GAME"]]:
|
||||
file["DECOMP_CONFIG"] = decomp_config_map[file["GAME"]]
|
||||
file["DECOMP_CONFIG_VERSION"] = default_config_version_map[file["GAME"]]
|
||||
if args.decomp_config:
|
||||
if args.decomp_config not in decomp_config_map[file["GAME"]]:
|
||||
if args.decomp_config not in decomp_config_version_map[file["GAME"]]:
|
||||
print("Unsupported decomp config '{}' for game '{}'".format(args.decomp_config, file["GAME"]))
|
||||
sys.exit(1)
|
||||
file["DECOMP_CONFIG"] = decomp_config_map[file["GAME"]][args.decomp_config]
|
||||
file["DECOMP_CONFIG"] = decomp_config_map[file["GAME"]]
|
||||
file["DECOMP_CONFIG_VERSION"] = decomp_config_version_map[file["GAME"]][args.decomp_config]
|
||||
|
||||
with open(env_path, 'w') as env_file:
|
||||
for item in file.items():
|
||||
|
||||
Reference in New Issue
Block a user