pr dump review changes
This commit is contained in:
@@ -26,4 +26,3 @@ Thumbs.db
|
|||||||
build/
|
build/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.ddump
|
*.ddump
|
||||||
*.lnk
|
|
||||||
|
|||||||
+8
-8
@@ -1,21 +1,21 @@
|
|||||||
.include "asm/macros.inc"
|
.include "asm/macros.inc"
|
||||||
.include "constants/constants.inc"
|
.include "constants/constants.inc"
|
||||||
|
|
||||||
.section .rodata
|
.section .rodata
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
gUnknown_862B810:: @ 862B810
|
gUnknown_862B810:: @ 862B810
|
||||||
.string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 26}others$"
|
.string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 26}others$"
|
||||||
|
|
||||||
gUnknown_862B832:: @ 862B832
|
gUnknown_862B832:: @ 862B832
|
||||||
.string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L$"
|
.string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L$"
|
||||||
|
|
||||||
gUnknown_862B84B:: @ 862B84B
|
gUnknown_862B84B:: @ 862B84B
|
||||||
.string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $"
|
.string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $"
|
||||||
|
|
||||||
gUnknown_862B86C:: @ 862B86C
|
gUnknown_862B86C:: @ 862B86C
|
||||||
.string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $"
|
.string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $"
|
||||||
|
|
||||||
gUnknown_0862B88D:: @ 862B88D
|
gUnknown_0862B88D:: @ 862B88D
|
||||||
.string "{CLEAR 11}a{CLEAR 6}b{CLEAR 6}c{CLEAR 26}d{CLEAR 6}e{CLEAR 6}f{CLEAR 6} {CLEAR 30}.$"
|
.string "{CLEAR 11}a{CLEAR 6}b{CLEAR 6}c{CLEAR 26}d{CLEAR 6}e{CLEAR 6}f{CLEAR 6} {CLEAR 30}.$"
|
||||||
@@ -49,7 +49,7 @@ gUnknown_0862B9AE:: @ 862B9AE
|
|||||||
|
|
||||||
gUnknown_0862B9C7:: @ 862B9C7
|
gUnknown_0862B9C7:: @ 862B9C7
|
||||||
.string "{CLEAR 12}!{CLEAR 17}?{CLEAR 16}♂{CLEAR 16}♀{CLEAR 16}/{CLEAR 17}-$"
|
.string "{CLEAR 12}!{CLEAR 17}?{CLEAR 16}♂{CLEAR 16}♀{CLEAR 16}/{CLEAR 17}-$"
|
||||||
|
|
||||||
gUnknown_0862B9E0:: @ 862B9E0
|
gUnknown_0862B9E0:: @ 862B9E0
|
||||||
.string "{CLEAR 11}…{CLEAR 16}“{CLEAR 16}”{CLEAR 18}‘{CLEAR 19}’{CLEAR 18} $"
|
.string "{CLEAR 11}…{CLEAR 16}“{CLEAR 16}”{CLEAR 18}‘{CLEAR 19}’{CLEAR 18} $"
|
||||||
|
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
path = 'data'
|
|
||||||
|
|
||||||
asm_filenames = []
|
|
||||||
labels = {}
|
|
||||||
baseroms = []
|
|
||||||
new_baseroms = {}
|
|
||||||
|
|
||||||
# get data asm filenames
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk(path):
|
|
||||||
for filename in filenames:
|
|
||||||
ext = os.path.splitext(filename)[1]
|
|
||||||
if ext == '.s' or ext == '.inc':
|
|
||||||
asm_filenames.append(os.path.join(dirpath, filename))
|
|
||||||
|
|
||||||
# get existing labels
|
|
||||||
with open('pokeemerald.map') as map_file:
|
|
||||||
for line in map_file:
|
|
||||||
m = re.match(r'^ +0x([0-9a-f]{8,8}) +([A-Za-z_][A-Za-z_0-9]*)$', line)
|
|
||||||
if m:
|
|
||||||
addr = int(m.group(1), 16)
|
|
||||||
sym = m.group(2)
|
|
||||||
labels[addr] = sym
|
|
||||||
if addr >= 0x8000000 and addr < 0x81DB67C:
|
|
||||||
labels[addr+1] = sym
|
|
||||||
|
|
||||||
# get baseroms
|
|
||||||
for filename in asm_filenames:
|
|
||||||
with open(filename,encoding='utf8') as asm_file:
|
|
||||||
for line in asm_file:
|
|
||||||
m = re.match(r'^\s*\.incbin\s+"baserom.gba"\s*,\s*(0x[0-9a-fA-F]+|[0-9]+)\s*,\s*(0x[0-9a-fA-F]+|[0-9]+)', line)
|
|
||||||
if m:
|
|
||||||
file_offset = int(m.group(1), 0)
|
|
||||||
size = int(m.group(2), 0)
|
|
||||||
baseroms.append((file_offset, size))
|
|
||||||
|
|
||||||
# replace addresses with labels
|
|
||||||
for filename in asm_filenames:
|
|
||||||
with open(filename,encoding='utf8') as asm_file:
|
|
||||||
lines = asm_file.readlines()
|
|
||||||
with open(filename,'w',encoding='utf8',newline='\n') as asm_file:
|
|
||||||
for line in lines:
|
|
||||||
label = ''
|
|
||||||
m = re.match(r'^\s*.4byte\s+0x([0-9a-fA-F]+)\s*$', line)
|
|
||||||
if m:
|
|
||||||
addr = int(m.group(1), 16)
|
|
||||||
if addr in labels:
|
|
||||||
label = labels[addr]
|
|
||||||
else:
|
|
||||||
for (file_offset, size) in baseroms:
|
|
||||||
begin = 0x8000000 + file_offset
|
|
||||||
end = begin + size
|
|
||||||
if addr >= begin and addr < end:
|
|
||||||
label = 'gUnknown_{:08X}'.format(addr)
|
|
||||||
if file_offset not in new_baseroms:
|
|
||||||
new_baseroms[file_offset] = [file_offset]
|
|
||||||
new_file_offset = addr - 0x8000000
|
|
||||||
if new_file_offset not in new_baseroms[file_offset]:
|
|
||||||
new_baseroms[file_offset].append(new_file_offset)
|
|
||||||
break
|
|
||||||
if label != '':
|
|
||||||
asm_file.write('\t.4byte {}\n'.format(label))
|
|
||||||
else:
|
|
||||||
asm_file.write(line)
|
|
||||||
|
|
||||||
# split baseroms
|
|
||||||
for filename in asm_filenames:
|
|
||||||
with open(filename,encoding='utf8') as asm_file:
|
|
||||||
lines = asm_file.readlines()
|
|
||||||
with open(filename,'w',encoding='utf8',newline='\n') as asm_file:
|
|
||||||
for line in lines:
|
|
||||||
m = re.match(r'^\s*\.incbin\s+"baserom.gba"\s*,\s*(0x[0-9a-fA-F]+|[0-9]+)\s*,\s*(0x[0-9a-fA-F]+|[0-9]+)', line)
|
|
||||||
if m:
|
|
||||||
file_offset = int(m.group(1), 0)
|
|
||||||
size = int(m.group(2), 0)
|
|
||||||
end = file_offset + size
|
|
||||||
if file_offset in new_baseroms:
|
|
||||||
new_offsets = new_baseroms[file_offset]
|
|
||||||
new_offsets.sort()
|
|
||||||
for index, offset in enumerate(new_offsets[:-1]):
|
|
||||||
next_offset = new_offsets[index + 1]
|
|
||||||
cur_size = next_offset - offset
|
|
||||||
asm_file.write('gUnknown_{0:08X}:: @ {0:X}\n'.format(0x8000000 + offset))
|
|
||||||
asm_file.write('\t.incbin "baserom.gba", 0x{:x}, 0x{:x}\n\n'.format(offset, cur_size))
|
|
||||||
last_offset = new_offsets[-1]
|
|
||||||
asm_file.write('gUnknown_{0:08X}:: @ {0:X}\n'.format(0x8000000 + last_offset))
|
|
||||||
asm_file.write('\t.incbin "baserom.gba", 0x{:x}, 0x{:x}\n\n'.format(last_offset, end - last_offset))
|
|
||||||
else:
|
|
||||||
asm_file.write(line)
|
|
||||||
else:
|
|
||||||
asm_file.write(line)
|
|
||||||
Reference in New Issue
Block a user