mirror of
https://github.com/pret/pokered.git
synced 2024-10-23 15:08:23 +00:00
starting to work with text command $01
hg-commit-id: e5bcd78d262b
This commit is contained in:
parent
242a02aaa7
commit
1661e1890b
1 changed files with 27 additions and 10 deletions
|
@ -101,30 +101,47 @@ def parse_text_script(text_pointer, text_id, map_id):
|
||||||
|
|
||||||
command = {"type": command_byte,
|
command = {"type": command_byte,
|
||||||
"start_address": offset,
|
"start_address": offset,
|
||||||
"end_address": offset + 3,
|
"end_address": offset + 3, #last byte belonging to this command
|
||||||
"pointer": pointer, #parameter
|
"pointer": pointer, #parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += 3 + 1
|
offset += 3 + 1
|
||||||
add_command_byte_to_totals(0x17)
|
|
||||||
elif command_byte == 0x50 or command_byte == 0x57 or command_byte == 0x58: #end text
|
elif command_byte == 0x50 or command_byte == 0x57 or command_byte == 0x58: #end text
|
||||||
command = {"type": command_byte,
|
command = {"type": command_byte,
|
||||||
"start_address": offset,
|
"start_address": offset,
|
||||||
"end_address": offset,
|
"end_address": offset,
|
||||||
}
|
}
|
||||||
add_command_byte_to_totals(command_byte)
|
|
||||||
|
|
||||||
#this byte simply indicates to end the script
|
#this byte simply indicates to end the script
|
||||||
end = True
|
end = True
|
||||||
else:
|
elif command_byte == 0x1:
|
||||||
add_command_byte_to_totals(command_byte)
|
#01 = text from RAM. [01][2-byte pointer]
|
||||||
|
size = 3 #total size, including the command byte
|
||||||
|
pointer_byte1 = ord(extract_maps.rom[offset+1])
|
||||||
|
pointer_byte2 = ord(extract_maps.rom[offset+2])
|
||||||
|
|
||||||
|
command = {"type": command_byte,
|
||||||
|
"start_address": offset+1,
|
||||||
|
"end_address": offset+2, #last byte belonging to this command
|
||||||
|
"pointer": [pointer_byte1, pointer_byte2], #RAM pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
#view near these bytes
|
||||||
|
subsection = extract_maps.rom[offset:offset+size+1] #peak ahead
|
||||||
|
for x in subsection:
|
||||||
|
print hex(ord(x))
|
||||||
|
print "--"
|
||||||
|
|
||||||
|
offset += 2 + 1 #go to the next byte
|
||||||
|
print "next command is: " + hex(ord(extract_maps.rom[offset])) + " ... we are at command number: " + str(command_counter) + " near " + hex(offset) + " on map_id=" + str(map_id) + " for text_id=" + str(text_id)
|
||||||
|
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)
|
#print "Unknown text command at " + hex(offset)
|
||||||
|
|
||||||
#end at the first unknown command
|
#end at the first unknown command
|
||||||
end = True
|
end = True
|
||||||
|
add_command_byte_to_totals(command_byte)
|
||||||
|
|
||||||
commands[command_counter] = command
|
commands[command_counter] = command
|
||||||
command_counter += 1
|
command_counter += 1
|
||||||
|
@ -157,11 +174,11 @@ def analyze_texts():
|
||||||
|
|
||||||
if commands[command_id]["type"] == 0x17:
|
if commands[command_id]["type"] == 0x17:
|
||||||
TX_FAR = parse_text_script(commands[command_id]["pointer"], text_id, map_id)
|
TX_FAR = parse_text_script(commands[command_id]["pointer"], text_id, map_id)
|
||||||
if len(TX_FAR.keys()) > 0:
|
if debug:
|
||||||
print "TX_FAR object: " + str(TX_FAR)
|
if len(TX_FAR.keys()) > 0:
|
||||||
print TX_FAR[TX_FAR.keys()[0]]
|
#print "TX_FAR object: " + str(TX_FAR)
|
||||||
print "processing a TX_FAR at " + hex(commands[command_id]["pointer"]) + "... first byte is: " + str(ord(extract_maps.rom[commands[command_id]["pointer"]])) + " .. offset: " + hex(commands[command_id]["pointer"])
|
print "processing a TX_FAR at " + hex(commands[command_id]["pointer"]) + "... first byte is: " + str(ord(extract_maps.rom[commands[command_id]["pointer"]])) + " .. offset: " + hex(commands[command_id]["pointer"])
|
||||||
#sys.exit(0)
|
##sys.exit(0)
|
||||||
|
|
||||||
commands[command_id]["TX_FAR"] = TX_FAR
|
commands[command_id]["TX_FAR"] = TX_FAR
|
||||||
#map2["texts"][text_id][command_id]["TX_FAR"] = parse_text_script(command["pointer"], text_id, map_id)
|
#map2["texts"][text_id][command_id]["TX_FAR"] = parse_text_script(command["pointer"], text_id, map_id)
|
||||||
|
|
Loading…
Reference in a new issue