jak-project/scripts/gsrc/utils.py
Tyler Wilding b3c58d2247
scripts: Add a (hopefully) better goal_src updating script (#1769)
* scripts: cleanup scripts directory some more

* stash, getting there

* stash again

* closer!

* it works! decently....cleanup time and add some extra features

* minor cleanup
2022-08-19 11:30:07 -04:00

32 lines
777 B
Python

import json
import os
jak1_files = None
jak2_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)
def get_file_list(game_name):
if game_name == "jak1":
return jak1_files
else:
return jak2_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:
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