Merge branch 'decomp/cleanup-alltypes' of https://github.com/xTVaser/jak-project into xTVaser-decomp/cleanup-alltypes2

This commit is contained in:
water 2021-05-09 17:09:40 -04:00
commit c5922df12e
3 changed files with 31 additions and 483 deletions

View file

@ -30,3 +30,6 @@ tasks:
decomp-list:
cmds:
- python ./scripts/next-decomp-file.py --list
cleanup-all-types:
cmds:
- python ./scripts/cleanup-all-types.py

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
# all-types.gc can easily drift
# initially it's populated with many types that are unknown (these are commented out)
# but when we manually replace them, it's easy to forget to delete the duplicate commented out variant.
#
# additionally, ideally we'd be organizing them as well but this can come later (dont want to manually move all the type defs!)
# (deftype) or (define-extern)
# if we find a deftype or define-extern that has a define-extern with ;; unknown type on the same line, delete it!
import os
new_file = []
with open("./decompiler/config/all-types.gc") as f:
symbols_found = []
lines = f.readlines()
for line in lines:
if line.startswith("(deftype") or line.startswith("(define-extern") or line.startswith(";;(define-extern"):
symbol = line.split(" ")[1]
if symbol in symbols_found and "unknown type" in line:
continue
else:
symbols_found.append(symbol)
new_file.append(line)
os.remove("./decompiler/config/all-types.gc")
with open("./decompiler/config/all-types.gc", "w") as f:
f.writelines(new_file)