BPS support

This commit is contained in:
aerinon
2022-02-17 14:00:00 -07:00
parent ccb7ced735
commit b024311aaa
14 changed files with 451 additions and 9 deletions

8
Rom.py
View File

@@ -119,6 +119,13 @@ class LocalRom(object):
ret.write_bytes(int(address), values)
return ret
def verify_base_rom(self):
# verify correct checksum of baserom
basemd5 = hashlib.md5()
basemd5.update(self.buffer)
if JAP10HASH != basemd5.hexdigest():
raise RuntimeError('Supplied Base Rom does not match known MD5 for JAP(1.0) release.')
def patch_base_rom(self):
# verify correct checksum of baserom
basemd5 = hashlib.md5()
@@ -165,7 +172,6 @@ class LocalRom(object):
with open(local_path('data/base2current.json'), 'w') as fp:
json.dump(patches, fp, separators=(',', ':'))
def write_crc(self):
crc = (sum(self.buffer[:0x7FDC] + self.buffer[0x7FE0:]) + 0x01FE) & 0xFFFF
inv = crc ^ 0xFFFF