mirror of
https://github.com/pret/pokemon-reverse-engineering-tools.git
synced 2026-08-27 20:54:08 -05:00
get an address given a label
original-commit-id: 82f7e983068e723f99a1da85c5c36a560599abc3
This commit is contained in:
10
romstr.py
10
romstr.py
@@ -93,6 +93,16 @@ class RomStr(str):
|
||||
# load the labels from the file
|
||||
self.labels = json.loads(open(filename, "r").read())
|
||||
|
||||
def get_address_for(self, label):
|
||||
""" Returns the address of a label. This is slow and could be improved
|
||||
dramatically.
|
||||
"""
|
||||
label = str(label)
|
||||
for address in self.labels.keys():
|
||||
if self.labels[address] == label:
|
||||
return address
|
||||
return None
|
||||
|
||||
def length(self):
|
||||
""" len(self)
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user