From b0284c9fe25414d8927932abb127bdcc176cf192 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 16 Aug 2020 11:13:50 +0200 Subject: [PATCH] Make all final roms 4 MiB to hide enemizer --- Main.py | 2 +- Rom.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Main.py b/Main.py index fe62cbb5..42e5af51 100644 --- a/Main.py +++ b/Main.py @@ -235,7 +235,7 @@ def main(args, seed=None): "-nohints" if not world.hints[ player] else "")) if not args.outputname else '' rompath = output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc') - rom.write_to_file(rompath) + rom.write_to_file(rompath, hide_enemizer=True) if args.create_diff: Patch.create_patch_file(rompath) return player, team, bytes(rom.name).decode() diff --git a/Rom.py b/Rom.py index 4ea5eb5f..f8a020bc 100644 --- a/Rom.py +++ b/Rom.py @@ -44,7 +44,16 @@ class LocalRom(object): def write_bytes(self, startaddress: int, values): self.buffer[startaddress:startaddress + len(values)] = values - def write_to_file(self, file): + def write_to_file(self, file, hide_enemizer=False): + + if hide_enemizer: + extra_zeroes = 0x400000 - len(self.buffer) + logging.info(extra_zeroes) + if extra_zeroes > 0: + buffer = self.buffer + bytes([0x00] * extra_zeroes) + with open(file, 'wb') as outfile: + outfile.write(buffer) + return with open(file, 'wb') as outfile: outfile.write(self.buffer)