mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-24 16:12:32 +13:00
Merge.
hg-commit-id: ad6ea1f1fb26
This commit is contained in:
commit
2a557c5343
4 changed files with 998 additions and 988 deletions
1024
common.asm
1024
common.asm
File diff suppressed because it is too large
Load diff
918
constants.asm
918
constants.asm
File diff suppressed because it is too large
Load diff
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue