handle dragon shrine recursion (but not others?)

This commit is contained in:
Bryan Bishop 2012-05-16 15:22:39 -05:00
parent 34c6b38da6
commit a53b5ae051

View File

@ -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: