diff --git a/Patch.py b/Patch.py index 5ec6a341..96b24b47 100644 --- a/Patch.py +++ b/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 diff --git a/Rom.py b/Rom.py index 78271d14..50b61a60 100644 --- a/Rom.py +++ b/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(