shithub: pokecrystal

Download patch

ref: d331a28c7a437d1f7d6fe12ded986edab0b0e566
parent: bd33188588f43b1f3ac71f62af7155af936c8fc1
author: Bryan Bishop <[email protected]>
date: Sun Apr 8 09:40:55 EDT 2012

get_label_for improvements (use script_parse_table if possible)

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -5965,10 +5965,21 @@
     global all_labels
     if type(address) != int:
         raise Exception, "get_label_for requires an integer address"
+
+    #the old way
     for thing in all_labels:
         if thing["address"] == address:
             return thing["label"]
-    return None
+    
+    #the new way
+    if is_script_already_parsed_at(address):
+        obj = script_parse_table[address]
+        if hasattr(obj, "label"):
+            return getattr(obj, "label")
+        else:
+            return "AlreadyParsedNoDefaultUnknownLabel_" + hex(address)
+
+    return "NotYetParsed_"+hex(address)
 
 def remove_quoted_text(line):
     """get rid of content inside quotes