mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 06:54:31 -04:00
d3cc739e43
This attempts to get into master whatever work was done in this PR / it's earlier PR https://github.com/open-goal/jak-project/pull/3965 I don't want this work to be lost / floating around in massive PRs. However the changes are: - switch to ntsc_v1 instead of PAL as the development target, as we have done for all other games - remove most of the copied-from-jak2/3 changes as they need to be confirmed during the decompilation process not just assumed - avoids committing any changes to `game/kernel/common` as it was not clear to me if these were changes made in jak x's kernel that were not properly broken out into it's own functions. We don't want to accidentally introduce bugs into jak1-3's kernel code. - in other words, if the change in the kernel only happens in jak x...it should likely be specific to jak x's kernel, not common. --------- Co-authored-by: VodBox <dillon@vodbox.io> Co-authored-by: yodah <greenboyyodah@gmail.com>
110 lines
3.0 KiB
Python
110 lines
3.0 KiB
Python
import argparse
|
|
import os
|
|
import pprint
|
|
import sys
|
|
|
|
parser = argparse.ArgumentParser("update-env")
|
|
parser.add_argument("--game", help="The name of the game", type=str)
|
|
parser.add_argument("--decomp_config", help="The decompiler config file", type=str)
|
|
parser.add_argument("--info", help="Just print out current settings", action='store_true')
|
|
args = parser.parse_args()
|
|
|
|
# TODO - read from defaults
|
|
file = {
|
|
"GAME": "jak1",
|
|
"DECOMP_CONFIG": "jak1/jak1_config.jsonc",
|
|
"DECOMP_CONFIG_VERSION": "ntsc_v1"
|
|
}
|
|
|
|
env_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), ".env")
|
|
|
|
if not os.path.exists(env_path):
|
|
with open(env_path, 'w') as env_file:
|
|
for item in file.items():
|
|
env_file.write("{}={}\n".format(item[0], item[1]))
|
|
|
|
with open(env_path, 'r') as env_file:
|
|
flags = env_file.readlines()
|
|
for flag in flags:
|
|
tokens = flag.split("=")
|
|
if tokens[0] in file:
|
|
file[tokens[0]] = tokens[1].strip()
|
|
|
|
if args.info:
|
|
print(file)
|
|
sys.exit(0)
|
|
|
|
valid_games = ["jak1", "jak2", "jak3", "jakx"]
|
|
|
|
decomp_config_map = {
|
|
"jak1": "jak1/jak1_config.jsonc",
|
|
"jak2": "jak2/jak2_config.jsonc",
|
|
"jak3": "jak3/jak3_config.jsonc",
|
|
"jakx": "jakx/jakx_config.jsonc"
|
|
}
|
|
|
|
decomp_config_version_map = {
|
|
"jak1": {
|
|
"ntscv1": "ntsc_v1",
|
|
"ntscv2": "ntsc_v2",
|
|
"pal": "pal",
|
|
"ntscjp": "jp"
|
|
},
|
|
"jak2": {
|
|
"ntscv1": "ntsc_v1",
|
|
"ntscv2": "ntsc_v2",
|
|
"pal": "pal",
|
|
"ntscjp": "jp",
|
|
"ntscko": "kor"
|
|
},
|
|
# TODO other versions
|
|
"jak3": {
|
|
"ntscv1": "ntsc_v1",
|
|
"pal": "pal"
|
|
},
|
|
"jakx": {
|
|
"ntscv1": "ntsc_v1",
|
|
"pal": "pal"
|
|
}
|
|
}
|
|
|
|
default_config_version_map = {
|
|
"jak1": "ntsc_v1",
|
|
"jak2": "ntsc_v1",
|
|
"jak3": "ntsc_v1",
|
|
"jakx": "ntsc_v1"
|
|
}
|
|
|
|
type_consistency_filter_map = {
|
|
"jak1": "Jak1TypeConsistency",
|
|
"jak2": "Jak2TypeConsistency",
|
|
"jak3": "Jak3TypeConsistency",
|
|
"jakx": "JakXTypeConsistency"
|
|
}
|
|
|
|
if args.game:
|
|
if args.game not in valid_games:
|
|
print("Unsupported game '{}'".format(args.game))
|
|
sys.exit(1)
|
|
curr = file["GAME"]
|
|
file["GAME"] = args.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"]]
|
|
file["TYPE_CONSISTENCY_TEST_FILTER"] = type_consistency_filter_map[file["GAME"]]
|
|
if args.decomp_config:
|
|
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"]]
|
|
file["DECOMP_CONFIG_VERSION"] = decomp_config_version_map[file["GAME"]][args.decomp_config]
|
|
file["TYPE_CONSISTENCY_TEST_FILTER"] = type_consistency_filter_map[file["GAME"]]
|
|
|
|
with open(env_path, 'w') as env_file:
|
|
for item in file.items():
|
|
env_file.write("{}={}\n".format(item[0], item[1]))
|
|
|
|
print("Task settings updated")
|
|
pp = pprint.PrettyPrinter(indent=2)
|
|
pp.pprint(file)
|