shithub: pokecrystal

Download patch

ref: 0e2ab04353bf5fa3114aa87e77e5366af6aa942c
parent: 381d3e76b73302672c0d568600f78f15f5cd0fcf
author: Bryan Bishop <[email protected]>
date: Wed Feb 27 16:38:53 EST 2013

update automatic main.asm insertion

This updates the automatic parsing of main.asm to catch cases of INCBINs
pulling in files that end in .asm, .lz, .1bpp, and .2bpp. This is
necessary because otherwise the parser tries to figure out the start and
end addresses expressed on the INCBIN line, details not present on these
types of lines in the asm.

Asm and Asm.insert_all are now back in working condition.

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -6752,7 +6752,7 @@
         asm_list = AsmList(asm)
         bank = 0
         for line in asm_list:
-            if line[0:6] == "INCBIN" or line[1:6] == "INCBIN":
+            if (line[0:6] == "INCBIN" or line[1:6] == "INCBIN") and not any([contaminant+"\"" in line for contaminant in [".2bpp", ".1bpp", ".asm", ".lz"]]):
                 thing = Incbin(line, bank=bank)
             elif line[0:7] == "SECTION":
                 thing = AsmSection(line)
@@ -6817,11 +6817,13 @@
 
         # check if the object is already inserted
         if new_object in self.parts:
-            print "object was previously inserted ("+str(new_object)+")"
+            print "object was previously inserted ("+str(new_object)+"; " + hex(new_object.address) + ")"
             return
         # check by label
-        if self.is_label_name_in_file(new_object.label.name):
-            print "object was previously inserted ("+str(new_object)+") by label: "+new_object.label.name
+        other_obj = self.is_label_name_in_file(new_object.label.name)
+        if other_obj:
+            other_obj = other_obj.object
+            print "object was previously inserted ("+new_object.label.name+" at "+hex(new_object.address)+") by "+other_obj.label.name+" at "+hex(other_obj.address)
             return
         # check by address
         #if self.does_address_have_label(new_object.address):