mirror of
https://github.com/open-goal/jak-project
synced 2026-06-16 23:00:49 -04:00
Decompiler fixes + decompiling (#276)
* decomp pad * more decompilation * update * fix test name
This commit is contained in:
@@ -6,7 +6,7 @@ import argparse
|
||||
### Example usage: python3 scripts/decomp_progress.py ~/jak-project/goal_src
|
||||
|
||||
def get_goal_files(root_dir):
|
||||
"""Get all GOAL source files under root_dir"""
|
||||
"""Get all GOAL source files under root_dir."""
|
||||
return [goal_file for file in os.walk(root_dir) for goal_file in glob.glob(os.path.join(file[0], '*.gc'))]
|
||||
|
||||
def lines_in_file(file_path):
|
||||
@@ -17,7 +17,7 @@ def lines_in_file(file_path):
|
||||
return lines
|
||||
|
||||
|
||||
def print_table(stats):
|
||||
def print_table(stats, total_gc_files):
|
||||
total_lines = 0
|
||||
print("| {: <24} | {: <6} |".format("file name", "lines"))
|
||||
print("-------------------------------------")
|
||||
@@ -29,6 +29,7 @@ def print_table(stats):
|
||||
print("-------------------------------------")
|
||||
estimated_lines = 500000
|
||||
print("Progress: {}/{} lines ({:.2f}%)".format(total_lines, estimated_lines, 100. * total_lines / estimated_lines))
|
||||
print("{}/{} files modified from template ({:.2f}%)".format(len(stats), total_gc_files, 100. * len(stats)/total_gc_files))
|
||||
|
||||
|
||||
|
||||
@@ -39,12 +40,19 @@ def main():
|
||||
all_files = get_goal_files(args.goal_src)
|
||||
|
||||
file_stats = []
|
||||
|
||||
total_gc_files = 0
|
||||
excluded_files = {"all_files.gc", "goal-lib.gc"}
|
||||
|
||||
|
||||
for fn in all_files:
|
||||
short_name = os.path.basename(fn)
|
||||
line_count = lines_in_file(fn)
|
||||
|
||||
if short_name in excluded_files:
|
||||
continue
|
||||
|
||||
total_gc_files += 1
|
||||
|
||||
if line_count == 7 or short_name in excluded_files:
|
||||
# the template has 7 lines, just skip it.
|
||||
continue
|
||||
@@ -52,7 +60,7 @@ def main():
|
||||
file_stats.append((short_name, line_count))
|
||||
file_stats.sort(key=lambda x: x[1])
|
||||
|
||||
print_table(file_stats)
|
||||
print_table(file_stats, total_gc_files)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user