Splat merge (#470)

* First pass

* Fix n64crc and add submodules properly

* Fix other versions

* Match func_8005B818 for v80 code.

* Formatting

* Fix build for JPN in last commit. Still broken in post v77 roms though.

* Fix builds for other versions.

* Match load_menu_text for other versions.

* Fix progress script

* update m2c

* Modify asset tools to remove the LD script code.

* Fix asm file macro inclue

* Get a working splat version for us_1.0 to build from the assets tool.

* update asm differ

* Update tools again

* Fix the makefile to only compile assets when requested. This will build all versions successfully, and compile assets for us_1.0 when requested.

* First round of suggestions

* Small cleanup

* Fix the gcc_generate.py path.

* Make entrypointThreadStack

* Small addition to the last commit

* "Fix" score script. Still need to fix the score values themselves, but at least it runs and is kind of close.

* Much closer matching score script

* Fix the splat version due to a breaking change in 0.33.0 for this repo for now.

* Fix the main function name

* Add gitignore entries

* Fix the padding problem to be handled by objcopy instead of a binary pad from splat.

* Update the README and change dependencies to setup.

* Have a hasm header that can be tweaked.

* Still calculate the checksum on no_verify builds or they won't work.

* Add support for boot_custom.bin

* Fix custom boot ld code.

* Fix score script

* Fix gcc building.

* Update m2c

* Fix warning, stop ignoring mod assets, and add some handy make rules.

* Uggh, serves me right for not testing.

* First stab at modifiable entrypoint.

* Fix typo, and small README change

* Stop n64crd from defaulting to returning 6105, so we can properly fail if the CIC checksum fails. Also, fix the

* Extract custom boot script

* Update automated scripts.

* Woops, fixed the MAXCONTROLLERS thing now.

* Add the method for building binutils back. Sorry!

* Only use -m32 when the longbit says we're on a 64 bit platform.

* Woops....

* Hopefully fix arm detection for raspi ido downloads.
This commit is contained in:
Ryan Myers
2025-03-25 09:07:00 -04:00
committed by GitHub
parent 59f86699a1
commit 6db9a8d6ea
513 changed files with 33145 additions and 85304 deletions
+25 -32
View File
@@ -1,37 +1,36 @@
#!/usr/bin/env python3
import argparse
import git
import os
import subprocess
import sys
from colour import Color
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.join(script_dir, "..", "..")
asm_dir = os.path.join(root_dir, "asm", "non_matchings")
asm_lib_dir = os.path.join(root_dir, "lib", "asm", "non_matchings")
build_dir = os.path.join(root_dir, "build", "us_1.0")
elf_path = os.path.join(build_dir, "dkr.elf")
asm_dir = os.path.join(root_dir, "asm")
build_dir = os.path.join(root_dir, "build")
elf_path = os.path.join(build_dir, "dkr.us.v77.elf")
def get_func_sizes():
try:
result = subprocess.run(['objdump', '-x', elf_path], stdout=subprocess.PIPE)
result = subprocess.run(["objdump", "-x", elf_path], stdout=subprocess.PIPE)
nm_lines = result.stdout.decode().split("\n")
except:
print(f"Error: Could not run objdump on {elf_path} - make sure that the project is built")
print(
f"Error: Could not run objdump on {elf_path} - make sure that the project is built"
)
sys.exit(1)
sizes = {}
total = 0
for line in nm_lines:
if " F " in line:
#This will filter out "weak" functions like fcos.
if "g F" in line or "l F" in line:
components = line.split()
size = int(components[4], 16)
name = components[5]
#Labels are coming through here as functions, and this finds and ignores them
if name[0:4] != "L800":
if not name.startswith(".L") or not name.startswith("D_"):
total += size
sizes[name] = size
@@ -42,12 +41,7 @@ def get_nonmatching_funcs():
for root, dirs, files in os.walk(asm_dir):
for f in files:
if f.endswith(".s"):
funcs.add(f[:-2])
for root, dirs, files in os.walk(asm_lib_dir):
for f in files:
if f.endswith(".s"):
if f.endswith(".s") and not f.startswith(".L"):
funcs.add(f[:-2])
return funcs
@@ -65,7 +59,6 @@ def get_funcs_sizes(sizes, matchings, nonmatchings):
# print(func)
else:
nmsize += sizes[func]
#print("% s,%i" % (func, sizes[func]))
return msize, nmsize
@@ -79,7 +72,9 @@ def main(args):
nonmatching_funcs = get_nonmatching_funcs()
matching_funcs = all_funcs - nonmatching_funcs
matching_size, nonmatching_size = get_funcs_sizes(func_sizes, matching_funcs, nonmatching_funcs)
matching_size, nonmatching_size = get_funcs_sizes(
func_sizes, matching_funcs, nonmatching_funcs
)
if len(all_funcs) == 0:
funcs_matching_ratio = 0.0
@@ -88,16 +83,9 @@ def main(args):
funcs_matching_ratio = (len(matching_funcs) / len(all_funcs)) * 100
matching_ratio = (matching_size / total_size) * 100
if args.csv:
version = 1
git_object = git.Repo().head.object
timestamp = str(git_object.committed_date)
git_hash = git_object.hexsha
csv_list = [str(version), timestamp, git_hash, str(len(all_funcs)), str(len(nonmatching_funcs)),
str(len(matching_funcs)), str(total_size), str(nonmatching_size), str(matching_size)]
print(",".join(csv_list))
elif args.shield_json:
if args.shield_json:
import json
from colour import Color
# https://shields.io/endpoint
color = Color("#50ca22", hue=lerp(0, 105/255, matching_ratio / 100))
@@ -110,13 +98,18 @@ def main(args):
else:
if matching_size + nonmatching_size != total_size:
print("Warning: category/total size mismatch!\n")
print(f"{len(matching_funcs)} matched functions / {len(all_funcs)} total ({funcs_matching_ratio:.2f}%)")
print(f"{matching_size} matching bytes / {total_size} total ({matching_ratio:.2f}%)")
print(
f"{len(matching_funcs)} matched functions / {len(all_funcs)} total ({funcs_matching_ratio:.2f}%)"
)
print(
f"{matching_size} matching bytes / {total_size} total ({matching_ratio:.2f}%)"
)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Reports progress for the project")
parser.add_argument("--csv", action="store_true")
parser = argparse.ArgumentParser(
description="Calculate the progress of the project"
)
parser.add_argument("--shield-json", action="store_true")
args = parser.parse_args()