diff options
author | Sanky <gsanky@gmail.com> | 2013-02-18 09:44:03 +0100 |
---|---|---|
committer | Sanky <gsanky@gmail.com> | 2013-02-18 09:44:03 +0100 |
commit | 5af3f92d9080cb874b6c46aa5b52c2a6cdab24f0 (patch) | |
tree | 8015ecccde657f918e55d6194ef5d1eeec1fea4d /extras/romstr.py | |
parent | c616889fcf0361746a9f1c13fab6f463cce43687 (diff) | |
parent | f860c98d26d8d3babe1ec123a72ee9d5f3ddd145 (diff) |
Merge https://github.com/kanzure/pokecrystal
Diffstat (limited to 'extras/romstr.py')
-rw-r--r-- | extras/romstr.py | 10 |
1 files changed, 6 insertions, 4 deletions
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) |