summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorIIMarckus <iimarckus@gmail.com>2012-01-17 00:38:55 -0700
committerIIMarckus <iimarckus@gmail.com>2012-01-17 00:38:55 -0700
commit2a557c5343ef6cece3c77b2e355354cac148bcf2 (patch)
treeadbef0bd69ef5aedf169ee4aa0b52404b1177bc5 /extras
parent65eb5944b34d96cbf3dbcb0a2bbcc5847feeeea0 (diff)
parent362fd20ef478b07c26727a6e8fc50f84959c7b91 (diff)
Merge.
hg-commit-id: ad6ea1f1fb26
Diffstat (limited to 'extras')
-rw-r--r--extras/analyze_texts.py23
-rw-r--r--extras/make_map_size_constants.py21
2 files changed, 35 insertions, 9 deletions
diff --git a/extras/analyze_texts.py b/extras/analyze_texts.py
index 36d80413..780bc08e 100644
--- a/extras/analyze_texts.py
+++ b/extras/analyze_texts.py
@@ -385,7 +385,7 @@ def find_missing_08s(all_texts):
def text_pretty_printer_at(start_address, label="SomeLabel"):
commands = parse_text_script(start_address, None, None)
- needs_to_begin_with_0 = False
+ needs_to_begin_with_0 = True #how should this be determined?
wanted_command = None
if needs_to_begin_with_0:
@@ -403,11 +403,28 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
first_line = True
for this_command in commands.keys():
- if not "lines" in commands[this_command].keys(): continue
+ if not "lines" in commands[this_command].keys():
+ command = commands[this_command]
+ if command["type"] == 0x1:
+ if first_line:
+ output = "\n"
+ output += label + ": ; " + hex(start_address) + "\n"
+ first_line = False
+ p1 = command["pointer"][0]
+ p2 = command["pointer"][1]
+
+ #remember to account for big endian -> little endian
+ output += spacing + "TX_RAM $" + hex(p2)[2:] + hex(p1)[2:] + "\n"
+
+ byte_count += 3
+
+ #everything else is for $0s, really
+ continue
lines = commands[this_command]["lines"]
#add the ending byte to the last line- always seems $57
- lines[len(lines.keys())-1].append(commands[1]["type"])
+ #this should already be in there, but it's not because of a bug in the text parser
+ lines[len(lines.keys())-1].append(commands[len(commands.keys())-1]["type"])
if first_line:
output = "\n"
diff --git a/extras/make_map_size_constants.py b/extras/make_map_size_constants.py
index 70be3b02..c40a4514 100644
--- a/extras/make_map_size_constants.py
+++ b/extras/make_map_size_constants.py
@@ -3,27 +3,36 @@
#date: 2012-01-15
#dump map height/width constants
import extract_maps
-from pretty_map_headers import map_name_cleaner
+from pretty_map_headers import map_name_cleaner, map_constants
-def get_map_size_constants():
+def get_map_size_constants(do_sed=False):
output = ""
+ sed_lines = ""
for map_id in extract_maps.map_headers.keys():
if map_id in extract_maps.bad_maps: continue #skip
map2 = extract_maps.map_headers[map_id]
base_name = map_name_cleaner(map2["name"], None)[:-2]
+ constant_name = map_constants[map_id]
height = int(map2["y"], 16)
width = int(map2["x"], 16)
output += "; " + base_name + "_h map_id=" + str(map_id) + "\n"
- output += base_name + "Height EQU $%.2x\n" % (height)
- output += base_name + "Width EQU $%.2x\n" % (width)
+ output += constant_name + "_HEIGHT EQU $%.2x\n" % (height)
+ output += constant_name + "_WIDTH EQU $%.2x\n" % (width)
output += "\n"
- return output
+
+ sed_lines += "sed -i 's/" + base_name + "Height/" + constant_name + "_HEIGHT" + "/g' common.asm" + "\n"
+ sed_lines += "sed -i 's/" + base_name + "Width/" + constant_name + "_WIDTH" + "/g' common.asm" + "\n"
+
+ if do_sed:
+ return sed_lines
+ else:
+ return output
if __name__ == "__main__":
extract_maps.load_rom()
extract_maps.load_map_pointers()
extract_maps.read_all_map_headers()
- print get_map_size_constants()
+ print get_map_size_constants(do_sed=True)