jak-project/scripts/gsrc/check-gsrc-file.py

68 lines
2 KiB
Python
Raw Normal View History

decomp: finish the remainder of untouched gameplay code (#893) * decomp: finish `sidekick` * decomp: got a lot of `target` done * decompiler: Add support for non power of 2 offsets for inline arr access * decomp: finish `target` mostly * decomp: finish `water` * decomp: finished `robotboss-weapon` * decomp: finish `robotboss-misc` * decomp: finish the majority of `robotboss` * blocked: `racer` has an issue around entering a state * blocked: `target-racer` done mostly, but NYI case in one function * blocked: `racer-states` mostly finished, but bitfield issue * blocked: `billy` on state decomping * blocked: `bully` on state decomping * waiting: `rolling-lightning-mole` waiting on navigate for 2 funcs * blocked: `rolling-robber` finished but `s6-1` issue * blocked: `ogreboss` uint64's for types cant label load em! * blocked: `mother-spider` state decompilation * half-done `target-flut` * blocked: `target-flut` some sort of new bitfield state * some improvements in `racer-states` with my new-found knowledge * progress: started on `target-death` * blocked: `target-death` handle casts * decomp: finish `collide-reaction-racer` * blocked: `target-handler` handler forced to return `none` * decomp: 99% of `target2` finished * decomp: finish `target2` * gsrc: update * update post merge * address feedback * scripts: add script to detect decomp issues * fix wide-spread `collide-shape` method missing arg * some small things i changed from master * address feedback * fix typeconsistency issue
2021-11-24 00:33:10 -05:00
import re
from jak1_file_list import file_list
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("--files")
args = parser.parse_args()
files = args.files.split(",")
throw_error = False
method_split_pattern = re.compile('t9-\d+\s\(method-of-object')
function_split_pattern = re.compile('\(t9-\d+\)')
decomp: finish the remainder of untouched gameplay code (#893) * decomp: finish `sidekick` * decomp: got a lot of `target` done * decompiler: Add support for non power of 2 offsets for inline arr access * decomp: finish `target` mostly * decomp: finish `water` * decomp: finished `robotboss-weapon` * decomp: finish `robotboss-misc` * decomp: finish the majority of `robotboss` * blocked: `racer` has an issue around entering a state * blocked: `target-racer` done mostly, but NYI case in one function * blocked: `racer-states` mostly finished, but bitfield issue * blocked: `billy` on state decomping * blocked: `bully` on state decomping * waiting: `rolling-lightning-mole` waiting on navigate for 2 funcs * blocked: `rolling-robber` finished but `s6-1` issue * blocked: `ogreboss` uint64's for types cant label load em! * blocked: `mother-spider` state decompilation * half-done `target-flut` * blocked: `target-flut` some sort of new bitfield state * some improvements in `racer-states` with my new-found knowledge * progress: started on `target-death` * blocked: `target-death` handle casts * decomp: finish `collide-reaction-racer` * blocked: `target-handler` handler forced to return `none` * decomp: 99% of `target2` finished * decomp: finish `target2` * gsrc: update * update post merge * address feedback * scripts: add script to detect decomp issues * fix wide-spread `collide-shape` method missing arg * some small things i changed from master * address feedback * fix typeconsistency issue
2021-11-24 00:33:10 -05:00
missing_res_tag_pattern = re.compile('(sv-\d{2,} int)')
decompiler_error_pattern = re.compile(';; ERROR')
missing_arg = re.compile('local-vars.*none\)')
decomp: finish the remainder of untouched gameplay code (#893) * decomp: finish `sidekick` * decomp: got a lot of `target` done * decompiler: Add support for non power of 2 offsets for inline arr access * decomp: finish `target` mostly * decomp: finish `water` * decomp: finished `robotboss-weapon` * decomp: finish `robotboss-misc` * decomp: finish the majority of `robotboss` * blocked: `racer` has an issue around entering a state * blocked: `target-racer` done mostly, but NYI case in one function * blocked: `racer-states` mostly finished, but bitfield issue * blocked: `billy` on state decomping * blocked: `bully` on state decomping * waiting: `rolling-lightning-mole` waiting on navigate for 2 funcs * blocked: `rolling-robber` finished but `s6-1` issue * blocked: `ogreboss` uint64's for types cant label load em! * blocked: `mother-spider` state decompilation * half-done `target-flut` * blocked: `target-flut` some sort of new bitfield state * some improvements in `racer-states` with my new-found knowledge * progress: started on `target-death` * blocked: `target-death` handle casts * decomp: finish `collide-reaction-racer` * blocked: `target-handler` handler forced to return `none` * decomp: 99% of `target2` finished * decomp: finish `target2` * gsrc: update * update post merge * address feedback * scripts: add script to detect decomp issues * fix wide-spread `collide-shape` method missing arg * some small things i changed from master * address feedback * fix typeconsistency issue
2021-11-24 00:33:10 -05:00
for file in files:
src_path = ""
for f in file_list:
if f[2] != 3:
continue
if f[0] == file:
src_path = f[4]
break
if not os.path.exists("./goal_src/{}".format(src_path)):
print("{} couldn't find in /goal_src!".format(file))
throw_error = True
continue
file_path = "./goal_src/{}/{}.gc".format(src_path, file)
with open(file_path) as f:
for lineno, line in enumerate(f):
method_split_match = method_split_pattern.search(line)
if method_split_match:
print("method_split - {}:{}".format(file_path, lineno + 1))
throw_error = True
continue
function_split_match = function_split_pattern.search(line)
if function_split_match:
print("function_split - {}:{}".format(file_path, lineno + 1))
throw_error = True
continue
decomp: finish the remainder of untouched gameplay code (#893) * decomp: finish `sidekick` * decomp: got a lot of `target` done * decompiler: Add support for non power of 2 offsets for inline arr access * decomp: finish `target` mostly * decomp: finish `water` * decomp: finished `robotboss-weapon` * decomp: finish `robotboss-misc` * decomp: finish the majority of `robotboss` * blocked: `racer` has an issue around entering a state * blocked: `target-racer` done mostly, but NYI case in one function * blocked: `racer-states` mostly finished, but bitfield issue * blocked: `billy` on state decomping * blocked: `bully` on state decomping * waiting: `rolling-lightning-mole` waiting on navigate for 2 funcs * blocked: `rolling-robber` finished but `s6-1` issue * blocked: `ogreboss` uint64's for types cant label load em! * blocked: `mother-spider` state decompilation * half-done `target-flut` * blocked: `target-flut` some sort of new bitfield state * some improvements in `racer-states` with my new-found knowledge * progress: started on `target-death` * blocked: `target-death` handle casts * decomp: finish `collide-reaction-racer` * blocked: `target-handler` handler forced to return `none` * decomp: 99% of `target2` finished * decomp: finish `target2` * gsrc: update * update post merge * address feedback * scripts: add script to detect decomp issues * fix wide-spread `collide-shape` method missing arg * some small things i changed from master * address feedback * fix typeconsistency issue
2021-11-24 00:33:10 -05:00
missing_res_tag_match = missing_res_tag_pattern.search(line)
if missing_res_tag_match:
print("missing_res_tag - {}:{}".format(file_path, lineno + 1))
throw_error = True
continue
decompiler_error_match = decompiler_error_pattern.search(line)
if decompiler_error_match:
print("decompiler_error - {}:{}".format(file_path, lineno + 1))
throw_error = True
continue
missing_arg_match = missing_arg.search(line)
if missing_arg_match:
print("missing_arg - {}:{}".format(file_path, lineno + 1))
throw_error = True
continue
decomp: finish the remainder of untouched gameplay code (#893) * decomp: finish `sidekick` * decomp: got a lot of `target` done * decompiler: Add support for non power of 2 offsets for inline arr access * decomp: finish `target` mostly * decomp: finish `water` * decomp: finished `robotboss-weapon` * decomp: finish `robotboss-misc` * decomp: finish the majority of `robotboss` * blocked: `racer` has an issue around entering a state * blocked: `target-racer` done mostly, but NYI case in one function * blocked: `racer-states` mostly finished, but bitfield issue * blocked: `billy` on state decomping * blocked: `bully` on state decomping * waiting: `rolling-lightning-mole` waiting on navigate for 2 funcs * blocked: `rolling-robber` finished but `s6-1` issue * blocked: `ogreboss` uint64's for types cant label load em! * blocked: `mother-spider` state decompilation * half-done `target-flut` * blocked: `target-flut` some sort of new bitfield state * some improvements in `racer-states` with my new-found knowledge * progress: started on `target-death` * blocked: `target-death` handle casts * decomp: finish `collide-reaction-racer` * blocked: `target-handler` handler forced to return `none` * decomp: 99% of `target2` finished * decomp: finish `target2` * gsrc: update * update post merge * address feedback * scripts: add script to detect decomp issues * fix wide-spread `collide-shape` method missing arg * some small things i changed from master * address feedback * fix typeconsistency issue
2021-11-24 00:33:10 -05:00
if throw_error:
print("found potential problems!")
exit(1)
else:
print("looks good!")