Au, acabat

This commit is contained in:
2026-01-27 17:35:30 +01:00
parent e05713ae2a
commit 39e5e8f70c
21 changed files with 505 additions and 65908 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import sys
# Rango del checksum
desp = 0x2000
numBytes = 0x2000
firstByte = desp + 0x200
lastByte = desp + numBytes - 1
checksum1 = desp + 0x270
checksum2 = desp + 0x271
# Offset del contador de armarios
CONTADOR = 0x0295C
def calc_checksum(buffer):
total = 0
for i in range(firstByte, lastByte + 1):
if i not in (checksum1, checksum2):
total += buffer[i]
total += 3328
buffer[checksum1] = total % 256
buffer[checksum2] = (total >> 8) % 256
if len(sys.argv) != 3:
print("Uso: python3 set_contador_armarios.py save_in.srm save_out.srm")
sys.exit(1)
infile = sys.argv[1]
outfile = sys.argv[2]
with open(infile, "rb") as f:
buf = bytearray(f.read())
# Poner el contador a 0x80
buf[CONTADOR] = 0x4F
# Recalcular checksum
calc_checksum(buf)
with open(outfile, "wb") as f:
f.write(buf)
print("Hecho:", outfile)