Files
jak-project/scripts/gsrc/utils.py
T
Hat Kid 9a4929ac0c decomp3: some engine files (#3319)
- `vector-h`
- `gravity-h`
- `bounding-box-h`
- `matrix-h`
- `quaternion-h`
- `euler-h`
- `transform-h`
- `geometry-h`
- `trigonometry-h`
- `transformq-h`
- `bounding-box`
- `matrix`
- `matrix-compose`
- `transform`
- `quaternion`
- `euler`
- `trigonometry`

Not a whole lot of changes, just a couple of new functions and one new
file (`matrix-compose`).
2024-01-20 10:42:51 -05:00

56 lines
1.5 KiB
Python

import json
import os
jak1_files = None
jak2_files = None
jak3_files = None
with open('./goal_src/jak1/build/all_objs.json', 'r') as f:
jak1_files = json.load(f)
with open('./goal_src/jak2/build/all_objs.json', 'r') as f:
jak2_files = json.load(f)
with open('./goal_src/jak3/build/all_objs.json', 'r') as f:
jak3_files = json.load(f)
def get_file_list(game_name):
match game_name:
case "jak1":
return jak1_files
case "jak2":
return jak2_files
case "jak3":
return jak3_files
def get_gsrc_path_from_filename(game_name, file_name):
file_list = get_file_list(game_name)
src_path = ""
for f in file_list:
if f[2] != 3 and f[2] != 5:
continue
if f[0] == file_name:
src_path = f[4]
break
path = "./goal_src/{}/{}/{}.gc".format(game_name, src_path, file_name)
if not os.path.exists(path):
print("couldn't find {} in /goal_src/{}!".format(file_name, game_name))
exit(1)
return path
def get_alltypes_path_from_game(game_name):
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)
src_path = ""
for f in file_list:
if f[2] != 3 and f[2] != 5:
continue
if f[0] == file_name:
src_path = f[4]
break
if src_path == "":
print("couldn't determine ref path for {}:{}!".format(game_name, file_name))
exit(1)
path = os.path.join(ref_folder, game_name, src_path, "{}_REF.gc".format(file_name))
return path