mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
add more text bytes for abbreviations
hg-commit-id: 95383d94746e
This commit is contained in:
parent
53f6e08cfb
commit
20c54ccd58
|
@ -40,7 +40,7 @@ def process_00_subcommands(start_address, end_address):
|
||||||
"""split this text up into multiple lines
|
"""split this text up into multiple lines
|
||||||
based on subcommands ending each line"""
|
based on subcommands ending each line"""
|
||||||
lines = {}
|
lines = {}
|
||||||
subsection = extract_maps.rom[start_address:end_address]
|
subsection = extract_maps.rom[start_address:end_address+1]
|
||||||
|
|
||||||
line_count = 0
|
line_count = 0
|
||||||
current_line = []
|
current_line = []
|
||||||
|
@ -308,7 +308,8 @@ def parse_text_script(text_pointer, text_id, map_id, txfar=False):
|
||||||
else:
|
else:
|
||||||
#if len(commands) > 0:
|
#if len(commands) > 0:
|
||||||
# print "Unknown text command " + hex(command_byte) + " at " + hex(offset) + ", script began with " + hex(commands[0]["type"])
|
# print "Unknown text command " + hex(command_byte) + " at " + hex(offset) + ", script began with " + hex(commands[0]["type"])
|
||||||
print "Unknown text command at " + hex(offset) + " - command: " + hex(ord(extract_maps.rom[offset])) + " on map_id=" + str(map_id) + " text_id=" + str(text_id)
|
if debug:
|
||||||
|
print "Unknown text command at " + hex(offset) + " - command: " + hex(ord(extract_maps.rom[offset])) + " on map_id=" + str(map_id) + " text_id=" + str(text_id)
|
||||||
|
|
||||||
#end at the first unknown command
|
#end at the first unknown command
|
||||||
end = True
|
end = True
|
||||||
|
|
|
@ -323,10 +323,15 @@ char_conversion = [
|
||||||
("y", 0xB8),
|
("y", 0xB8),
|
||||||
("z", 0xB9),
|
("z", 0xB9),
|
||||||
("é", 0xBA),
|
("é", 0xBA),
|
||||||
|
("'d", 0xBB),
|
||||||
|
("'l", 0xBC),
|
||||||
("'s", 0xBD),
|
("'s", 0xBD),
|
||||||
("'t", 0xBE),
|
("'t", 0xBE),
|
||||||
|
("'v", 0xBF),
|
||||||
("'", 0xE0),
|
("'", 0xE0),
|
||||||
("-", 0xE3),
|
("-", 0xE3),
|
||||||
|
("'r", 0xE4),
|
||||||
|
("'m", 0xE5),
|
||||||
("?", 0xE6),
|
("?", 0xE6),
|
||||||
("!", 0xE7),
|
("!", 0xE7),
|
||||||
(".", 0xE8),
|
(".", 0xE8),
|
||||||
|
@ -652,6 +657,12 @@ def print_tx_far(tx_far):
|
||||||
lines = text_far[0]["lines"]
|
lines = text_far[0]["lines"]
|
||||||
label = "_" + map_name_cleaner(map2["name"], None)[:-2] + "Text" + str(text_id)
|
label = "_" + map_name_cleaner(map2["name"], None)[:-2] + "Text" + str(text_id)
|
||||||
|
|
||||||
|
#add the ending byte on the next line
|
||||||
|
#lines[len(lines.keys())+1] = [text_far[1]["type"]]
|
||||||
|
|
||||||
|
#add the ending byte to the last line- always seems $57
|
||||||
|
lines[len(lines.keys())-1].append(text_far[1]["type"])
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
output += label + ":\n"
|
output += label + ":\n"
|
||||||
first = True
|
first = True
|
||||||
|
@ -664,6 +675,7 @@ def print_tx_far(tx_far):
|
||||||
|
|
||||||
quotes_open = False
|
quotes_open = False
|
||||||
first_byte = True
|
first_byte = True
|
||||||
|
was_byte = False
|
||||||
byte_count = 0
|
byte_count = 0
|
||||||
for byte in line:
|
for byte in line:
|
||||||
if byte in txt_bytes:
|
if byte in txt_bytes:
|
||||||
|
@ -679,17 +691,26 @@ def print_tx_far(tx_far):
|
||||||
if quotes_open:
|
if quotes_open:
|
||||||
output += "\""
|
output += "\""
|
||||||
quotes_open = False
|
quotes_open = False
|
||||||
output += ", " + constant_abbreviation_bytes[byte]
|
if not first_byte:
|
||||||
|
output += ", "
|
||||||
|
output += constant_abbreviation_bytes[byte]
|
||||||
else:
|
else:
|
||||||
if quotes_open:
|
if quotes_open:
|
||||||
output += "\""
|
output += "\""
|
||||||
quotes_open = False
|
quotes_open = False
|
||||||
output += ", $" + hex(byte)[2:]
|
|
||||||
|
#if you want the ending byte on the last line
|
||||||
|
#if not (byte == 0x57 or byte == 0x50 or byte == 0x58):
|
||||||
|
output += ", "
|
||||||
|
|
||||||
|
output += "$" + hex(byte)[2:]
|
||||||
|
was_byte = True
|
||||||
|
|
||||||
#add a comma unless it's the end of the line
|
#add a comma unless it's the end of the line
|
||||||
if byte_count+1 != len(line):
|
#if byte_count+1 != len(line):
|
||||||
output += ", "
|
# output += ", "
|
||||||
|
|
||||||
|
first_byte = False
|
||||||
byte_count += 1
|
byte_count += 1
|
||||||
#close final quotes
|
#close final quotes
|
||||||
if quotes_open:
|
if quotes_open:
|
||||||
|
|
|
@ -225,10 +225,15 @@ char["x"] = "$B7"
|
||||||
char["y"] = "$B8"
|
char["y"] = "$B8"
|
||||||
char["z"] = "$B9"
|
char["z"] = "$B9"
|
||||||
char["é"] = "$BA"
|
char["é"] = "$BA"
|
||||||
|
char["'d"] = "$BB"
|
||||||
|
char["'l"] = "$BC"
|
||||||
char["'s"] = "$BD"
|
char["'s"] = "$BD"
|
||||||
char["'t"] = "$BE"
|
char["'t"] = "$BE"
|
||||||
|
char["'v"] = "$BF"
|
||||||
char["'"] = "$E0"
|
char["'"] = "$E0"
|
||||||
char["-"] = "$E3"
|
char["-"] = "$E3"
|
||||||
|
char["'r"] = "$E4"
|
||||||
|
char["'m"] = "$E5"
|
||||||
char["?"] = "$E6"
|
char["?"] = "$E6"
|
||||||
char["!"] = "$E7"
|
char["!"] = "$E7"
|
||||||
char["."] = "$E8"
|
char["."] = "$E8"
|
||||||
|
|
Loading…
Reference in a new issue