jak-project/scripts/gsrc/skeleton_creation/generate_dgo_proj.py
Tyler Wilding 22bae7fbe0
g/jak2: Add missing DGO files to game.gp lost in the shuffle (#2178)
When I cleaned up the `game.gp` some DGOs were no longer referenced
because my first dependency script omitted them -- thinking they weren't
required. From the perspective of the source files they indeed weren't
required but we still have to produce the DGO file.

also works around #2177
2023-01-30 20:45:45 -05:00

37 lines
1.1 KiB
Python

# Generates the `(cgo-file...` lines for the game.gp file
# Attempts to put DGOs in the correct order based on the file order in `all_objs`
import json
common_deps = '("$OUT/obj/cty-guard-turret-button.o")'
ignored_dgos = ["ENGINE", "KERNEL", "ART", "COMMON", "GAME", "NO-XGO"]
dgos_encountered = set()
dgos_handled = set()
jak2_files = None
with open("./goal_src/jak2/build/all_objs.json", "r") as f:
jak2_files = json.load(f)
# Enumerate the files, order is dictated by code files (version 3)
# At the end we will fill in any dgos that weren't considerd "required"
lines = []
for file in jak2_files:
file_name = file[0]
version = file[2]
dgo_list = file[3]
for dgo in dgo_list:
dgos_encountered.add(dgo)
if version == 3:
dgo = dgo_list[0]
if dgo.lower() not in dgos_handled and dgo not in ignored_dgos:
dgos_handled.add(dgo.lower())
lines.append('(cgo-file "{}.gd" {})'.format(dgo.lower(), common_deps))
for dgo in dgos_encountered:
if dgo.lower() not in dgos_handled and dgo not in ignored_dgos:
lines.append('(cgo-file "{}.gd" {})'.format(dgo.lower(), common_deps))
for line in lines:
print(line)