From 57200b6cf75040b9696ae54bdac69d5e452a2c48 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 3 Feb 2013 15:18:06 -0600 Subject: simplify load_rom in gbz80disasm --- extras/romstr.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'extras/romstr.py') diff --git a/extras/romstr.py b/extras/romstr.py index d2eea44ae..5701f19ae 100644 --- a/extras/romstr.py +++ b/extras/romstr.py @@ -46,15 +46,17 @@ class RomStr(str): return "RomStr(too long)" @classmethod - def load(cls, crystal=True, red=False): + def load(cls, filename=None, crystal=True, red=False): """ Loads a ROM into a RomStr. """ - if crystal and not red: + if crystal and not red and not filename: file_handler = open("../baserom.gbc", "r") - elif red and not crystal: + elif red and not crystal and not filename: file_handler = open("../pokered-baserom.gbc", "r") + elif filename not in ["", None]: + file_handler = open(filename, "rb") else: - raise Exception, "not sure which rom to load?" + raise Exception("not sure which rom to load?") bytes = file_handler.read() file_handler.close() return RomStr(bytes) -- cgit v1.2.3