You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
handle dragon shrine recursion (but not others?)
This commit is contained in:
@@ -30,6 +30,8 @@ if not hasattr(json, "read"):
|
|||||||
|
|
||||||
spacing = "\t"
|
spacing = "\t"
|
||||||
|
|
||||||
|
lousy_dragon_shrine_hack = [0x18d079, 0x18d0a9, 0x18d061, 0x18d091]
|
||||||
|
|
||||||
#table of pointers to map groups
|
#table of pointers to map groups
|
||||||
#each map group contains some number of map headers
|
#each map group contains some number of map headers
|
||||||
map_group_pointer_table = 0x94000
|
map_group_pointer_table = 0x94000
|
||||||
@@ -5775,12 +5777,19 @@ class Asm:
|
|||||||
# its' probably being injected in some get_dependencies() somewhere
|
# its' probably being injected in some get_dependencies() somewhere
|
||||||
print "don't know why ScriptPointerLabelParam is getting to this point?"
|
print "don't know why ScriptPointerLabelParam is getting to this point?"
|
||||||
return
|
return
|
||||||
start_address = new_object.address
|
|
||||||
|
|
||||||
#first some validation
|
#first some validation
|
||||||
if not hasattr(new_object, "address"):
|
if not hasattr(new_object, "address"):
|
||||||
print "object needs to have an address property: " + str(new_object)
|
print "object needs to have an address property: " + str(new_object)
|
||||||
return
|
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():
|
if not hasattr(new_object, "label") and hasattr(new_object, "is_valid") and not new_object.is_valid():
|
||||||
return
|
return
|
||||||
@@ -5847,6 +5856,10 @@ class Asm:
|
|||||||
self.parts.remove(object)
|
self.parts.remove(object)
|
||||||
found = True
|
found = True
|
||||||
break
|
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
|
#insert before the current object
|
||||||
elif object.address > end_address:
|
elif object.address > end_address:
|
||||||
#insert_before = index of object
|
#insert_before = index of object
|
||||||
@@ -6104,6 +6117,10 @@ def get_label_for(address):
|
|||||||
if type(address) != int:
|
if type(address) != int:
|
||||||
raise Exception, "get_label_for requires an integer address, got: " + str(type(address))
|
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
|
#the old way
|
||||||
for thing in all_labels:
|
for thing in all_labels:
|
||||||
if thing["address"] == address:
|
if thing["address"] == address:
|
||||||
|
Reference in New Issue
Block a user