diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | tools/disasm_coverage.py | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -53,7 +53,7 @@ tools tools/pkmncompress tools/gfx: .PHONY: coverage coverage: tools/disasm_coverage.py $(ROM) - $(PYTHON3) $< -m $(ROM:.gb=.map) -b 0x40 + $(PYTHON) $< -m $(ROM:.gb=.map) -b 0x40 # Remove files generated by the build process. .PHONY: clean diff --git a/tools/disasm_coverage.py b/tools/disasm_coverage.py index 6c1c030..39d1960 100644 --- a/tools/disasm_coverage.py +++ b/tools/disasm_coverage.py @@ -29,8 +29,13 @@ if __name__ == "__main__": rows_per_bank = bank_size // (width * bpp) r = MapReader() - with open(args.mapfile, 'r', encoding= "utf-8") as f: - l = f.readlines() + try: + with open(args.mapfile, 'r') as f: + l = f.readlines() + except UnicodeDecodeError: + # Python 3 seems to choke on the file's encoding, but the `encoding` keyword only works on Py3 + with open(args.mapfile, 'r', encoding= "utf-8") as f: + l = f.readlines() r.read_map_data(l) hit_data = [[0] * width for _ in range(height)] |