summaryrefslogtreecommitdiff
path: root/extras/romstr.py
diff options
context:
space:
mode:
authorSanky <gsanky@gmail.com>2013-02-18 09:44:03 +0100
committerSanky <gsanky@gmail.com>2013-02-18 09:44:03 +0100
commit5af3f92d9080cb874b6c46aa5b52c2a6cdab24f0 (patch)
tree8015ecccde657f918e55d6194ef5d1eeec1fea4d /extras/romstr.py
parentc616889fcf0361746a9f1c13fab6f463cce43687 (diff)
parentf860c98d26d8d3babe1ec123a72ee9d5f3ddd145 (diff)
Merge https://github.com/kanzure/pokecrystal
Diffstat (limited to 'extras/romstr.py')
-rw-r--r--extras/romstr.py10
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)