mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
LADX: generate without rom (#4278)
This commit is contained in:
@@ -7,9 +7,7 @@ h2b = binascii.unhexlify
|
||||
|
||||
|
||||
class ROM:
|
||||
def __init__(self, filename, patches=None):
|
||||
data = open(Utils.user_path(filename), "rb").read()
|
||||
|
||||
def __init__(self, data, patches=None):
|
||||
if patches:
|
||||
for patch in patches:
|
||||
data = bsdiff4.patch(data, patch)
|
||||
@@ -64,18 +62,10 @@ class ROM:
|
||||
self.banks[0][0x14E] = checksum >> 8
|
||||
self.banks[0][0x14F] = checksum & 0xFF
|
||||
|
||||
def save(self, file, *, name=None):
|
||||
def save(self):
|
||||
# don't pass the name to fixHeader
|
||||
self.fixHeader()
|
||||
if isinstance(file, str):
|
||||
f = open(file, "wb")
|
||||
for bank in self.banks:
|
||||
f.write(bank)
|
||||
f.close()
|
||||
print("Saved:", file)
|
||||
else:
|
||||
for bank in self.banks:
|
||||
file.write(bank)
|
||||
return b"".join(self.banks)
|
||||
|
||||
def readHexSeed(self):
|
||||
return self.banks[0x3E][0x2F00:0x2F10].hex().upper()
|
||||
|
||||
Reference in New Issue
Block a user