aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-04-29 11:40:31 +0200
committerAstatin <[email protected]>2025-04-29 11:40:31 +0200
commit7faf16e4453f935ee1159d32ddc2a6501ea91bbb (patch)
tree5719a1f712ec896e41b3e4773322ffb083d132d0 /scripts
parentfb689cdc68b8d1da3d988da43671bd0ddb063e88 (diff)
Give a turn for the enemies to turn around when bunny is behind them
Diffstat (limited to 'scripts')
-rw-r--r--scripts/set_checksums.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/set_checksums.py b/scripts/set_checksums.py
new file mode 100644
index 0000000..e05d1cf
--- /dev/null
+++ b/scripts/set_checksums.py
@@ -0,0 +1,24 @@
+import sys
+
+if len(sys.argv) != 2:
+ raise ValueError("Rom file must be specified as first argument")
+
+rom_filename = sys.argv[1]
+
+rom_file = open(rom_filename, 'r+b')
+
+rom_file.seek(0x0134)
+
+header = rom_file.read(0x19)
+
+header_checksum = 0
+for b in header:
+ header_checksum = (header_checksum - int(b) - 1) & 0xff
+
+print("HEADER CHECKSUM =", hex(header_checksum), file=sys.stderr)
+
+rom_file.seek(0x014d)
+
+rom_file.write(bytes(bytearray([header_checksum])))
+
+rom_file.close()