Automatically strip headered Roms
This commit is contained in:
parent
90ce999fd3
commit
ac2f1860d5
9
Rom.py
9
Rom.py
|
@ -44,7 +44,7 @@ class LocalRom(object):
|
||||||
|
|
||||||
def __init__(self, file, patch=True):
|
def __init__(self, file, patch=True):
|
||||||
with open(file, 'rb') as stream:
|
with open(file, 'rb') as stream:
|
||||||
self.buffer = bytearray(stream.read())
|
self.buffer = read_rom(stream)
|
||||||
if patch:
|
if patch:
|
||||||
self.patch_base_rom()
|
self.patch_base_rom()
|
||||||
|
|
||||||
|
@ -94,6 +94,13 @@ class LocalRom(object):
|
||||||
inv = crc ^ 0xFFFF
|
inv = crc ^ 0xFFFF
|
||||||
self.write_bytes(0x7FDC, [inv & 0xFF, (inv >> 8) & 0xFF, crc & 0xFF, (crc >> 8) & 0xFF])
|
self.write_bytes(0x7FDC, [inv & 0xFF, (inv >> 8) & 0xFF, crc & 0xFF, (crc >> 8) & 0xFF])
|
||||||
|
|
||||||
|
def read_rom(stream):
|
||||||
|
"Reads rom into bytearray and strips off any smc header"
|
||||||
|
buffer = bytearray(stream.read())
|
||||||
|
if len(buffer)%0x400 == 0x200:
|
||||||
|
buffer = buffer[0x200:]
|
||||||
|
return buffer
|
||||||
|
|
||||||
class Sprite(object):
|
class Sprite(object):
|
||||||
default_palette = [255, 127, 126, 35, 183, 17, 158, 54, 165, 20, 255, 1, 120, 16, 157,
|
default_palette = [255, 127, 126, 35, 183, 17, 158, 54, 165, 20, 255, 1, 120, 16, 157,
|
||||||
89, 71, 54, 104, 59, 74, 10, 239, 18, 92, 42, 113, 21, 24, 122,
|
89, 71, 54, 104, 59, 74, 10, 239, 18, 92, 42, 113, 21, 24, 122,
|
||||||
|
|
Loading…
Reference in New Issue