summaryrefslogtreecommitdiff
path: root/gbz80disasm.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-01-27 17:13:18 -0600
committerBryan Bishop <kanzure@gmail.com>2013-01-27 17:13:18 -0600
commit457c03a49f6f63aeb551fecf71887b360e6c51ee (patch)
tree6d68ea603ad50d4c80c8baf65c085dadc4c524a8 /gbz80disasm.py
parent2b6ca1f9a8db402167eb930e2ce830322c7204a9 (diff)
make gbz80disasm work with python2.6 again
There was an incompatible change to the json module api between py26 and py27, causing gbz80disasm to not work with py26. The fix is to simply alias the new loads method to the old read function. A possibly better plan might be to not support py26 at all. original-commit-id: db5208b41f8a505f68ddbccb34dca206df9ca77e
Diffstat (limited to 'gbz80disasm.py')
-rw-r--r--gbz80disasm.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gbz80disasm.py b/gbz80disasm.py
index aab39db..f2ba483 100644
--- a/gbz80disasm.py
+++ b/gbz80disasm.py
@@ -4,10 +4,12 @@ import os
import sys
from copy import copy, deepcopy
from ctypes import c_int8
-import json
import random
+import json
-spacing = "\t"
+# New versions of json don't have read anymore.
+if not hasattr(json, "read"):
+ json.read = json.loads
from romstr import RomStr
@@ -19,6 +21,8 @@ def load_rom(filename="../baserom.gbc"):
file_handler.close()
return rom
+spacing = "\t"
+
temp_opt_table = [
[ "ADC A", 0x8f, 0 ],
[ "ADC B", 0x88, 0 ],
@@ -557,7 +561,7 @@ all_labels = {}
def load_labels(filename="labels.json"):
global all_labels
if os.path.exists(filename):
- all_labels = json.loads(open(filename, "r").read())
+ all_labels = json.read(open(filename, "r").read())
else:
print "You must run crystal.scan_for_predefined_labels() to create \"labels.json\". Trying..."
import crystal