Some attempt at making the save buffer human readable, and renamed joypad.c funcs (#490)

* 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

* fix a whole heaping spaghetti pile of warnings

* stack sizes and header depdendancies

* more warns

* fix bug oops

* t

* Update Makefile

Create extract_boot.py

* Update extract_custom_boot.py

* somehow this blew up again in the merge

* Update Makefile

* fix these

* Delete extract_boot.py

* simplification

* Sage is stoopid

* Update controller.c

* permissions

* Update get-binutils.sh

* automatically determine the CIC type at build time

* input renames

* ok pretty happy with the save macros now

* Update save_data.c

* b

* d

* ah

* rename this macro

* yeah

* Update Makefile

---------

Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>
This commit is contained in:
Fazana
2025-03-26 14:52:23 +00:00
committed by GitHub
co-authored by Ryan Myers
parent 3f48db7616
commit 50ae503e3b
21 changed files with 498 additions and 237 deletions
+38 -14
View File
@@ -17,9 +17,15 @@ def N64GetCIC(data: bytes) -> int:
0xACC8580A: 6106,
}.get(crc, 0)
# Extract a boot bin from the given rom, provided the setup is correct
def boot_extract(input_file, output_file="boot_custom.bin"):
mods_missing = True
cictype = 6103
if not (os.path.isfile(input_file)):
print(input_file + " cannot be found. Check the spelling in your input.")
return
if not (input_file.endswith(".z64")):
print("ROM file must be .z64. Use https://hack64.net/tools/swapper.php to convert.")
return
@@ -28,7 +34,7 @@ def boot_extract(input_file, output_file="boot_custom.bin"):
f.seek(0x40)
data = f.read(0xFC0)
if os.path.isdir('mods'):
if os.path.isdir("mods"):
print("Mods folder detected, outputting there.")
output_file = "./mods/boot_custom.bin"
mods_missing = False
@@ -41,18 +47,18 @@ def boot_extract(input_file, output_file="boot_custom.bin"):
cictype = 6102
else:
print("CIC: " + str(cictype))
if os.path.isfile("Makefile"):
print("Makefile detected, modifying CIC type.")
with open("Makefile", 'r') as f:
lines = f.readlines()
with open("Makefile", 'w') as f:
for line in lines:
if line.startswith("BOOT_CIC ?="):
f.write("BOOT_CIC ?= " + str(cictype) + "\n")
else:
f.write(line)
if os.path.isfile("./build/asm/header.s.o"):
os.remove("./build/asm/header.s.o")
#if os.path.isfile("Makefile"):
# print("Makefile detected, modifying CIC type.")
# with open("Makefile", 'r') as f:
# lines = f.readlines()
# with open("Makefile", 'w') as f:
# for line in lines:
# if line.startswith("BOOT_CIC ?="):
# f.write("BOOT_CIC ?= " + str(cictype) + "\n")
# else:
# f.write(line)
if os.path.isfile("./build/asm/header.s.o"):
os.remove("./build/asm/header.s.o")
with open(output_file, "wb") as f:
@@ -63,4 +69,22 @@ def boot_extract(input_file, output_file="boot_custom.bin"):
else:
print("Finished!")
boot_extract(sys.argv[1])
# Read the current custom boot bin and return its CIC
def boot_write():
if not os.path.isdir("mods"):
print("0")
return
if not os.path.isfile("mods/boot_custom.bin"):
print("0")
return
with open("./mods/boot_custom.bin", "rb") as f:
data = f.read(0xFC0)
cictype = N64GetCIC(data)
if (cictype == 0):
cictype = 6102
print(cictype)
if (len(sys.argv) > 1):
boot_extract(sys.argv[1])
else:
boot_write()