Decompilation: Next batch of files (#539)

* decomp: `collide-frag-h`

* decomp: `effect-control-h`

* decomp: `cam-update-h`

* decomp: `collide-func`

variable pass failed on ray-plane-intersect: invalid unordered_map<K, T> key

* decomp: `cylinder` with vector dot product issue

* decomp: `debug-sphere`

* decomp: `generic`

* decomp: fix `effect-control-h`

* scripts: improve decomp-next script

* decomp: Fix `debug-sphere` issues via type casting

* decomp: Add `collide-frag-h` to reference tests

* scripts: Add script to add a new reference test

* decomp: Add `cam-update-h` to reference tests

* goalc: Fix empty let removal issue

* decomp: Not adding cylinder to goal_src yet either

* decomp: Add `debug-sphere` to reference tests

* decomp: Attempt to finish `generic` but blocked by decomp issue

https://github.com/water111/jak-project/issues/563

* linting

* decomp: Resolve failing tests

* decomp: Address feedback
This commit is contained in:
Tyler Wilding
2021-06-06 23:01:30 -04:00
committed by GitHub
parent c19bcd37aa
commit 698d96cc4e
23 changed files with 865 additions and 188 deletions
+34
View File
@@ -0,0 +1,34 @@
# Decompiles and adds the file to the reference test folder
from jak1_file_list import file_list
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--file")
args = parser.parse_args()
if not args.file:
print("No --file argument provided!")
exit(1)
import os
# TODO - make customizable
if not os.path.exists("./decompiler_out/jak1/{}_disasm.gc".format(args.file)):
print("File not already decompiled!")
exit(1)
src_path = ""
for f in file_list:
if f[2] != 3:
continue
if f[0] == args.file:
src_path = f[4]
break
if not os.path.exists("./test/decompiler/reference/{}".format(src_path)):
os.makedirs("./test/decompiler/reference/{}".format(src_path))
import shutil
shutil.copy("./decompiler_out/jak1/{}_disasm.gc".format(args.file), "./test/decompiler/reference/{}/{}_REF.gc".format(src_path, args.file))
print("Copied!")
+20 -20
View File
@@ -3,15 +3,10 @@ from jak1_file_list import file_list
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--skip", type=int)
parser.add_argument("--file")
parser.add_argument("--list", type=int)
args = parser.parse_args()
skip_count = 0
if args.skip:
skip_count = args.skip
def update_file(file):
new_file_contents = []
print("Next file to decompile is - " + file[0])
@@ -34,20 +29,25 @@ if args.file:
if file[0] == args.file:
update_file(file)
else:
list_of_eligible = []
list_eligible = []
for file in file_list:
with open("goal_src/" + file[4] + "/" + file[0] + ".gc") as f:
if file[2] != 3:
continue
if len(list_eligible) > args.list:
break
src_path = "goal_src/" + file[4] + "/" + file[0] + ".gc"
with open(src_path) as f:
lines = f.readlines()
if skip_count <= 0 and len(lines) <= 7:
if args.list:
list_of_eligible.append(file[0])
if len(list_of_eligible) >= args.list:
break
else:
update_file(file)
break
elif not args.list and len(lines) <= 7:
skip_count = skip_count - 1
if len(list_of_eligible) > 0:
print("The next 10 files that need to be decompiled:")
print(*list_of_eligible, sep = "\n")
if len(lines) <= 7:
list_eligible.append("{} - Empty".format(file[0]))
else:
# Check for TODOs
count_todos = 0
for line in lines:
if "TODO" in line:
count_todos = count_todos + 1
if count_todos > 0:
list_eligible.append("{} - {} TODOs - {}".format(file[0], count_todos, src_path))
if len(list_eligible) > 0:
print("The next {} files that need to be addressed:".format(args.list))
print(*list_eligible, sep = "\n")