Bps patching
This commit is contained in:
12
Rom.py
12
Rom.py
@@ -8,6 +8,8 @@ import random
|
|||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import bps.apply
|
||||||
|
import bps.io
|
||||||
|
|
||||||
from BaseClasses import CollectionState, ShopType, Region, Location, DoorType
|
from BaseClasses import CollectionState, ShopType, Region, Location, DoorType
|
||||||
from DoorShuffle import compass_data, DROptions, boss_indicator
|
from DoorShuffle import compass_data, DROptions, boss_indicator
|
||||||
@@ -112,16 +114,14 @@ class LocalRom(object):
|
|||||||
if JAP10HASH != basemd5.hexdigest():
|
if JAP10HASH != basemd5.hexdigest():
|
||||||
logging.getLogger('').warning('Supplied Base Rom does not match known MD5 for JAP(1.0) release. Will try to patch anyway.')
|
logging.getLogger('').warning('Supplied Base Rom does not match known MD5 for JAP(1.0) release. Will try to patch anyway.')
|
||||||
|
|
||||||
|
orig_buffer = self.buffer.copy()
|
||||||
|
|
||||||
# extend to 2MB
|
# extend to 2MB
|
||||||
self.buffer.extend(bytearray([0x00] * (0x200000 - len(self.buffer))))
|
self.buffer.extend(bytearray([0x00] * (0x200000 - len(self.buffer))))
|
||||||
|
|
||||||
# load randomizer patches
|
# load randomizer patches
|
||||||
with open(local_path('data/base2current.json'), 'r') as stream:
|
with open(local_path('data/base2current.bps'), 'rb') as stream:
|
||||||
patches = json.load(stream)
|
bps.apply.apply_to_bytearrays(bps.io.read_bps(stream), orig_buffer, self.buffer)
|
||||||
for patch in patches:
|
|
||||||
if isinstance(patch, dict):
|
|
||||||
for baseaddress, values in patch.items():
|
|
||||||
self.write_bytes(int(baseaddress), values)
|
|
||||||
|
|
||||||
# verify md5
|
# verify md5
|
||||||
patchedmd5 = hashlib.md5()
|
patchedmd5 = hashlib.md5()
|
||||||
|
|||||||
BIN
data/base2current.bps
Normal file
BIN
data/base2current.bps
Normal file
Binary file not shown.
@@ -1,2 +1,3 @@
|
|||||||
aenum
|
aenum
|
||||||
fast-enum
|
fast-enum
|
||||||
|
python-bps-continued
|
||||||
Reference in New Issue
Block a user