summaryrefslogtreecommitdiff
path: root/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-16 15:22:39 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-16 15:22:39 -0500
commit9671a0daa91480df3f080f9e411924d3ddad6433 (patch)
tree7f5c1901de82c3eb1976f0ddab85984c1633864d /crystal.py
parent69d502d6cf97759415024fc307ecc9b1ffe83c8a (diff)
handle dragon shrine recursion (but not others?)
original-commit-id: a53b5ae051d0d1d054da2ff0ee64247ea1663ee2
Diffstat (limited to 'crystal.py')
-rw-r--r--crystal.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/crystal.py b/crystal.py
index c32724c..687b8b6 100644
--- a/crystal.py
+++ b/crystal.py
@@ -30,6 +30,8 @@ if not hasattr(json, "read"):
spacing = "\t"
+lousy_dragon_shrine_hack = [0x18d079, 0x18d0a9, 0x18d061, 0x18d091]
+
#table of pointers to map groups
#each map group contains some number of map headers
map_group_pointer_table = 0x94000
@@ -5775,12 +5777,19 @@ class Asm:
# its' probably being injected in some get_dependencies() somewhere
print "don't know why ScriptPointerLabelParam is getting to this point?"
return
- start_address = new_object.address
#first some validation
if not hasattr(new_object, "address"):
print "object needs to have an address property: " + str(new_object)
return
+
+ start_address = new_object.address
+
+ # skip this dragon shrine script calling itself
+ # what about other scripts that call themselves ?
+ if start_address in lousy_dragon_shrine_hack:
+ print "skipping 0x18d079 in dragon shrine for a lousy hack"
+ return
if not hasattr(new_object, "label") and hasattr(new_object, "is_valid") and not new_object.is_valid():
return
@@ -5847,6 +5856,10 @@ class Asm:
self.parts.remove(object)
found = True
break
+ elif object.address <= start_address < object.last_address:
+ print "this is probably a script that is looping back on itself?"
+ found = True
+ break
#insert before the current object
elif object.address > end_address:
#insert_before = index of object
@@ -6104,6 +6117,10 @@ def get_label_for(address):
if type(address) != int:
raise Exception, "get_label_for requires an integer address, got: " + str(type(address))
+ # lousy hack to get around recursive scripts in dragon shrine
+ if address in lousy_dragon_shrine_hack:
+ return None
+
#the old way
for thing in all_labels:
if thing["address"] == address: