jak-project/scripts/update-game-text-id.py
ManDude bd1718dc9c
A lot of fixes (game is 100%'able!) (#1118)
* a crapton of fixes

* Update cavecrystal-light.gc

* damn you

* fix bunnies

* change codegen for int -> float cast (just add sign extension now)

* fix test

* this file is tagged anyway

* fix some stack types

* remove bad camera debug funcs

* add more heap bars and entity pick menu

* finish entity menu and make `music-flava` enum

* fix some `process-taskable` fields

* citadel sage crash fix

* fix citadel drop plats

* fix tests

* fix some casts

* update refs

* finish `village3-obs` and `snow-ball`

* Update README.md

* fix sidekick too

* fix issue?

* more entity inspect hardcoded checks

* more

* use `*display-actor-anim*` for something!

* CRAP

* also clear actor anim when deselecting entity

* *display-actor-anim* already renders this!

* do not display `path` tag info

* entity debug inspect tool

* one more

* make debug string even larger

* missing res tag types

* more polish and more known tags

* last few
2022-01-31 20:44:54 -05:00

43 lines
1.2 KiB
Python

## Given a list of files(comma delimited), decompile it, then place it under the specified placeholder (if it exists)
## if the placeholder doesn't exist, error out
## the placeholder is `;; DECOMP BEGINS`
import os
print("Copying game-text-id enum")
begin_str = ";; GAME-TEXT-ID ENUM BEGINS"
end_str = ";; GAME-TEXT-ID ENUM ENDS"
enum_lines = []
with open('./decompiler/config/all-types.gc') as f:
lines = f.readlines()
found_enum = False
for line in lines:
if found_enum and end_str in line:
break
if found_enum:
enum_lines.append(line)
if begin_str in line:
found_enum = True
new_texth_lines = []
with open('goal_src/engine/ui/text-h.gc') as f:
lines = f.readlines()
found_enum = False
for line in lines:
if begin_str in line:
found_enum = True
new_texth_lines.append(begin_str + "\n")
new_texth_lines += enum_lines
new_texth_lines.append(end_str + "\n")
continue
if end_str in line:
found_enum = False
continue
if found_enum:
continue
new_texth_lines.append(line)
os.remove('goal_src/engine/ui/text-h.gc')
with open('goal_src/engine/ui/text-h.gc', "w") as f:
f.writelines(new_texth_lines)
print("game-text-id enum updated!")