shithub: pokecrystal

Download patch

ref: 7cfe92c50673926167c42e3ef73d5cd7fe6c67d5
parent: 2b08f91d983063014255cb109509a51c6ad08b3d
author: Bryan Bishop <[email protected]>
date: Sun Apr 15 10:39:13 EDT 2012

MapHeader parsing looks correct

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -5509,8 +5509,9 @@
         self.bank = HexByte(address=address)
         self.tileset = HexByte(address=address+1)
         self.permission = DecimalParam(address=address+2)
+        self.second_map_header_address = calculate_pointer(ord(rom[address+3])+(ord(rom[address+4])<<8), self.bank.byte)
         #TODO: is the bank really supposed to be 0x25 all the time ??
-        self.second_map_header = SecondMapHeader(calculate_pointer(ord(rom[address+3])+(ord(rom[address+4])<<8), self.bank.byte), map_group=self.map_group, map_id=self.map_id, debug=self.debug)
+        #self.second_map_header = SecondMapHeader(self.second_map_header_address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
         self.location_on_world_map = HexByte(address=address+5)
         self.music = HexByte(address=address+6)
         self.time_of_day = DecimalParam(address=address+7)
@@ -5555,10 +5556,9 @@
         "fishing": fishing_group,
     }
     print "second map header address is: " + hex(second_map_header_address)
-    map_header.update(old_parse_second_map_header_at(second_map_header_address, debug=debug))
-    map_header.update(old_parse_map_event_header_at(map_header["event_address"], map_group=map_group, map_id=map_id, debug=debug))
-    #maybe this next one should be under the "scripts" key?
-    map_header.update(old_parse_map_script_header_at(map_header["script_address"], map_group=map_group, map_id=map_id, debug=debug))
+    #map_header.update(old_parse_second_map_header_at(second_map_header_address, debug=debug))
+    #map_header.update(old_parse_map_event_header_at(map_header["event_address"], map_group=map_group, map_id=map_id, debug=debug))
+    #map_header.update(old_parse_map_script_header_at(map_header["script_address"], map_group=map_group, map_id=map_id, debug=debug))
     return map_header
 
 class SecondMapHeader:
@@ -6204,8 +6204,10 @@
             if map_id == "offset": continue #skip the "offset" address for this map group
             if debug: print "map_group is: " + str(group_id) + "  map_id is: " + str(map_id)
             map_header_offset = offset + ((map_id - 1) * map_header_byte_size)
-            parsed_map = parse_map_header_at(map_header_offset, map_group=group_id, map_id=map_id, debug=debug)
-            map_names[group_id][map_id].update(parsed_map)
+            old_parsed_map = old_parse_map_header_at(map_header_offset, map_group=group_id, map_id=map_id, debug=debug)
+            new_parsed_map = parse_map_header_at(map_header_offset, map_group=group_id, map_id=map_id, debug=debug)
+            map_names[group_id][map_id]["header_new"] = new_parsed_map
+            map_names[group_id][map_id]["header_old"] = old_parsed_map
             map_names[group_id][map_id]["header_offset"] = map_header_offset
 
 #map names with no labels will be generated at the end of the structure