Remove cn hack on checksummer

This commit is contained in:
Angie 2023-11-02 14:58:49 -03:00
parent 2dd68365e4
commit 81126c77f0
2 changed files with 4 additions and 15 deletions

View File

@ -313,11 +313,11 @@ tidy:
$(ROM): $(ELF)
$(OBJCOPY) -O binary $< $(@:.z64=.bin)
$(CHECKSUMMER) $(@:.z64=.bin) $@ $(VERSION)
$(CHECKSUMMER) $(@:.z64=.bin) $@
$(ROMC): $(ROM) tools/compressor/compress_segments.$(VERSION).csv
$(ROM_COMPRESSOR) $(ROM) $(ROMC:.z64=.bin) $(ELF) tools/compressor/compress_segments.$(VERSION).csv $(VERSION)
$(CHECKSUMMER) $(ROMC:.z64=.bin) $@ $(VERSION)
$(CHECKSUMMER) $(ROMC:.z64=.bin) $@
$(ELF): $(LINKER_SCRIPTS)
$(LD) $(ENDIAN) $(LDFLAGS) -Map $(LD_MAP) $(foreach ld, $(LINKER_SCRIPTS), -T $(ld)) -o $@ $(filter %.o, $^)

View File

@ -23,7 +23,7 @@ def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def updateChecksum(romBytes: bytearray, version: str, forceChecksum: bool):
def updateChecksum(romBytes: bytearray):
# Detect CIC
cicKind = ipl3checksum.detectCIC(romBytes)
if cicKind is None:
@ -37,13 +37,6 @@ def updateChecksum(romBytes: bytearray, version: str, forceChecksum: bool):
printDebug(f"checksum1: {calculatedChecksum[0]:X}")
printDebug(f"checksum2: {calculatedChecksum[1]:X}")
if version == "cn":
# cn has a garbage checksum value, so we just use the orignal one instead of a calculated one
if not forceChecksum:
printDebug(f"Not updating checksum on cn")
return
printDebug(f"Updating checksum on cn")
# Write checksum
struct.pack_into(f">II", romBytes, 0x10, calculatedChecksum[0], calculatedChecksum[1])
@ -53,16 +46,12 @@ def updaterMain():
parser.add_argument("in_rom", help="input rom filename")
parser.add_argument("out_rom", help="output rom filename")
parser.add_argument("version", help="version to process")
parser.add_argument("-d", "--debug", help="Enable debug prints", action="store_true")
parser.add_argument("-c", "--checksum", help="Force always updating the checksum header", action="store_true")
args = parser.parse_args()
inPath = Path(args.in_rom)
outPath = Path(args.out_rom)
version = args.version
forceChecksum: bool = args.checksum
global DEBUGGING
DEBUGGING = args.debug
@ -72,7 +61,7 @@ def updaterMain():
romBytes = bytearray(inPath.read_bytes())
updateChecksum(romBytes, version, forceChecksum)
updateChecksum(romBytes)
outPath.parent.mkdir(parents=True, exist_ok=True)
outPath.write_bytes(romBytes)