Create basepatch in proper directory if required.
This commit is contained in:
parent
95742ddb98
commit
e1bfa8780c
4
Patch.py
4
Patch.py
|
@ -49,11 +49,11 @@ def generate_patch(rom: bytes, metadata: Optional[dict] = None) -> bytes:
|
|||
return generate_yaml(patch, metadata)
|
||||
|
||||
|
||||
def create_patch_file(rom_file_to_patch: str, server: str = "") -> str:
|
||||
def create_patch_file(rom_file_to_patch: str, server: str = "", destination: str = None) -> str:
|
||||
bytes = generate_patch(load_bytes(rom_file_to_patch),
|
||||
{
|
||||
"server": server}) # allow immediate connection to server in multiworld. Empty string otherwise
|
||||
target = os.path.splitext(rom_file_to_patch)[0] + ".bmbp"
|
||||
target = destination if destination else os.path.splitext(rom_file_to_patch)[0] + ".bmbp"
|
||||
write_lzma(bytes, target)
|
||||
return target
|
||||
|
||||
|
|
3
Rom.py
3
Rom.py
|
@ -105,8 +105,7 @@ class LocalRom(object):
|
|||
if self.verify(self.buffer):
|
||||
with open(local_path('basepatch.sfc'), 'wb') as stream:
|
||||
stream.write(self.buffer)
|
||||
create_patch_file(local_path('basepatch.sfc'))
|
||||
os.rename(local_path('basepatch.bmbp'), os.path.join('data', 'basepatch.bmbp'))
|
||||
create_patch_file(local_path('basepatch.sfc'), destination=local_path(os.path.join('data', 'basepatch.bmbp')))
|
||||
os.remove(local_path('data/base2current.json'))
|
||||
else:
|
||||
raise RuntimeError(
|
||||
|
|
Loading…
Reference in New Issue