TrainerFragments pointing to 0x26ef should be ignored

This commit is contained in:
Bryan Bishop 2012-04-21 18:24:54 -05:00
parent 2588ff6255
commit 26e0ee9545

View File

@ -2246,13 +2246,17 @@ class TrainerFragment(Command):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
address = kwargs["address"] address = kwargs["address"]
print "TrainerFragment address=" + hex(address) print "TrainerFragment address=" + hex(address)
if not is_valid_address(address) or address in [0x26ef]: return self.address = address
Command.__init__(self, *args, **kwargs)
self.last_address = self.address + self.size self.last_address = self.address + self.size
if not is_valid_address(address) or address in [0x26ef]:
self.include_in_asm = False
return
script_parse_table[self.address : self.last_address] = self script_parse_table[self.address : self.last_address] = self
Command.__init__(self, *args, **kwargs)
def get_dependencies(self): def get_dependencies(self):
deps = [] deps = []
if not is_valid_address(self.address): return deps
deps.append(self.params[3]) deps.append(self.params[3])
deps.extend(self.params[3].get_dependencies()) deps.extend(self.params[3].get_dependencies())
deps.append(self.params[4]) deps.append(self.params[4])
@ -2282,10 +2286,12 @@ class TrainerFragment(Command):
class TrainerFragmentParam(PointerLabelParam): class TrainerFragmentParam(PointerLabelParam):
"""used by PeopleEvent to point to trainer data""" """used by PeopleEvent to point to trainer data"""
def parse(self): def parse(self):
address = calculate_pointer_from_bytes_at(self.address, bank=self.bank) address = calculate_pointer_from_bytes_at(self.address, bank=self.bank)
self.calculated_address = address self.calculated_address = address
if address == 0x26ef:
self.dependencies = []
else:
trainerfrag = TrainerFragment(address=address, map_group=self.map_group, map_id=self.map_id, debug=self.debug) trainerfrag = TrainerFragment(address=address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
self.dependencies = [trainerfrag] self.dependencies = [trainerfrag]
PointerLabelParam.parse(self) PointerLabelParam.parse(self)