mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
update analyze_texts to find missing $08s
hg-commit-id: 298a5ffd0d98
This commit is contained in:
parent
48199b4916
commit
edbfce9ad3
|
@ -3,6 +3,7 @@
|
||||||
#date: 2012-01-06
|
#date: 2012-01-06
|
||||||
#analyze texts, how many commands are unknown?
|
#analyze texts, how many commands are unknown?
|
||||||
import extract_maps
|
import extract_maps
|
||||||
|
import analyze_incbins #for asm
|
||||||
try:
|
try:
|
||||||
from pretty_map_headers import map_name_cleaner
|
from pretty_map_headers import map_name_cleaner
|
||||||
except Exception, exc: pass
|
except Exception, exc: pass
|
||||||
|
@ -367,6 +368,21 @@ def analyze_texts():
|
||||||
extract_maps.map_headers[map_id]["texts"] = map2["texts"]
|
extract_maps.map_headers[map_id]["texts"] = map2["texts"]
|
||||||
return 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__":
|
if __name__ == "__main__":
|
||||||
extract_maps.load_rom()
|
extract_maps.load_rom()
|
||||||
extract_maps.load_map_pointers()
|
extract_maps.load_map_pointers()
|
||||||
|
@ -374,6 +390,8 @@ if __name__ == "__main__":
|
||||||
text_output = analyze_texts()
|
text_output = analyze_texts()
|
||||||
#print text_output
|
#print text_output
|
||||||
|
|
||||||
|
missing_08s = find_missing_08s(text_output)
|
||||||
|
|
||||||
print "\n\n---- stats ----\n\n"
|
print "\n\n---- stats ----\n\n"
|
||||||
|
|
||||||
popular_text_commands = sorted(totals.iteritems(), key=itemgetter(1), reverse=True)
|
popular_text_commands = sorted(totals.iteritems(), key=itemgetter(1), reverse=True)
|
||||||
|
@ -384,3 +402,4 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
print "total text commands: " + str(total_text_commands)
|
print "total text commands: " + str(total_text_commands)
|
||||||
print "total text scripts: " + str(should_be_total)
|
print "total text scripts: " + str(should_be_total)
|
||||||
|
print "missing 08s: " + str(missing_08s)
|
||||||
|
|
Loading…
Reference in a new issue