ref: edbfce9ad3da45649d5939de261e003048d41013
parent: 48199b4916426cb90251b4c722e0db7627f6d928
author: Bryan Bishop <kanzure@gmail.com>
date: Tue Jan 10 11:32:25 EST 2012
update analyze_texts to find missing $08s hg-commit-id: 298a5ffd0d98
--- a/extras/analyze_texts.py
+++ b/extras/analyze_texts.py
@@ -3,6 +3,7 @@
#date: 2012-01-06
#analyze texts, how many commands are unknown?
import extract_maps
+import analyze_incbins #for asm
try:
from pretty_map_headers import map_name_cleaner
except Exception, exc: pass
@@ -367,6 +368,21 @@
extract_maps.map_headers[map_id]["texts"] = map2["texts"]
return texts
+def find_missing_08s(all_texts):
+ """determines which $08s have yet to be inserted
+ based on their start addresses"""
+ missing_08s = 0
+ for map_id in all_texts.keys():
+ for text_id in all_texts[map_id].keys():
+ for line_id in all_texts[map_id][text_id].keys():
+ if not line_id == 0:
+ current_line = all_texts[map_id][text_id][line_id]
+ if "type" in current_line.keys():
+ if current_line["type"] == 0x8:
+ missing_08s += 1
+ print "missing $08 on map_id=" + str(map_id) + " text_id=" + str(text_id) + " line_id=" + str(line_id) + " at " + hex(current_line["start_address"])
+ return missing_08s
+
if __name__ == "__main__":
extract_maps.load_rom()
extract_maps.load_map_pointers()
@@ -374,6 +390,8 @@
text_output = analyze_texts()
#print text_output
+ missing_08s = find_missing_08s(text_output)
+
print "\n\n---- stats ----\n\n"
popular_text_commands = sorted(totals.iteritems(), key=itemgetter(1), reverse=True)
@@ -384,3 +402,4 @@
print "total text commands: " + str(total_text_commands)
print "total text scripts: " + str(should_be_total)
+ print "missing 08s: " + str(missing_08s)