summaryrefslogtreecommitdiff
path: root/extras/analyze_texts.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-01-11 01:40:53 -0600
committerBryan Bishop <kanzure@gmail.com>2012-01-11 01:40:53 -0600
commitb3ab0153b31145cb2d2aea06b4aba3589c47530b (patch)
treef1a04cd3f46b734f1a11cb234d959bf066aa894b /extras/analyze_texts.py
parentd73fb7c62ba8973db9a96554ce883b4de7ec5436 (diff)
analyze_texts to find missing texts in pokered.asm
hg-commit-id: 7361a900a8ad
Diffstat (limited to 'extras/analyze_texts.py')
-rw-r--r--extras/analyze_texts.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/extras/analyze_texts.py b/extras/analyze_texts.py
index bec4f96f..3d1e894d 100644
--- a/extras/analyze_texts.py
+++ b/extras/analyze_texts.py
@@ -461,6 +461,37 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
print output
return output
+def is_label_in_asm(label):
+ for line in analyze_incbins.asm:
+ if label in line:
+ if line[0:len(label)] == label:
+ return True
+ return False
+
+def find_undone_texts():
+ if analyze_incbins.asm == None:
+ analyze_incbins.load_asm()
+
+ for map_id in extract_maps.map_headers:
+ #skip bad maps
+ if map_id in extract_maps.bad_maps: continue
+
+ map2 = extract_maps.map_headers[map_id]
+ name = map_name_cleaner(map2["name"], None)[:-2] + "Text"
+
+ for text_id in map2["referenced_texts"]:
+ label = name + str(text_id)
+
+ if len(extract_maps.map_headers[map_id]["texts"][text_id].keys()) == 0: continue
+ if len(extract_maps.map_headers[map_id]["texts"][text_id][0].keys()) == 0: continue
+
+ try:
+ address = extract_maps.map_headers[map_id]["texts"][text_id][0]["start_address"]
+ except:
+ address = extract_maps.map_headers[map_id]["texts"][text_id][1]["start_address"]
+
+ if not is_label_in_asm(label):
+ print label + " map_id=" + str(map_id) + " text_id=" + str(text_id) + " at " + hex(address)
if __name__ == "__main__":
extract_maps.load_rom()
@@ -482,5 +513,7 @@ if __name__ == "__main__":
print "total text commands: " + str(total_text_commands)
print "total text scripts: " + str(should_be_total)
print "missing 08s: " + str(missing_08s)
+ print "\n\n"
- text_pretty_printer_at(0x800b1)
+ #text_pretty_printer_at(0x800b1)
+ find_undone_texts()