summaryrefslogtreecommitdiff
path: root/tools/mapfile_tool.py
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-04 23:14:52 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-04 23:14:52 -0500
commit1c3e5a0b1c62829d78960c4d99e4928ccf73625f (patch)
tree66d70e39ff1b29d656d65d32ba7291735baba79e /tools/mapfile_tool.py
parent2a444dcd0e6227649964fda92b436e95c9a08c1b (diff)
downloadkamek-1c3e5a0b1c62829d78960c4d99e4928ccf73625f.tar.gz
kamek-1c3e5a0b1c62829d78960c4d99e4928ccf73625f.zip
Added Newer nullsubs for dynamic use, improved mapfile a little (mostly error output), updated newer and summer sun with nullsub fixes.
Diffstat (limited to '')
-rwxr-xr-xtools/mapfile_tool.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/mapfile_tool.py b/tools/mapfile_tool.py
index 92e53ad..3556d0d 100755
--- a/tools/mapfile_tool.py
+++ b/tools/mapfile_tool.py
@@ -215,28 +215,39 @@ def do_mapfile(src, dest, fix_offset):
def work_on_hook(hook, id, func):
- #print 'doing %s (%s) for %s' % (hook['name'], hook['type'], id)
+
+ try:
+ t = hook['type']
- t = hook['type']
+ if t == 'patch':
+ error = 'missing addr'
+
+ hook['addr_%s' % id] = func(hook['addr_%s' % original])
- if t == 'patch':
- hook['addr_%s' % id] = func(hook['addr_%s' % original])
+ elif t == 'branch_insn' or t == 'add_func_pointer':
+ error = 'missing src_addr'
- elif t == 'branch_insn' or t == 'add_func_pointer':
- hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original])
+ hook['src_addr_%s' % id] = func(hook['src_addr_%s' % original])
- if 'target_func_%s' % original in hook:
- hook['target_func_%s' % id] = func(hook['target_func_%s' % original])
+ if 'target_func_%s' % original in hook:
+ error = 'missing target_func'
- elif t == 'nop_insn':
- area = hook['area_%s' % original]
- if isinstance(area, list):
- start = func(area[0])
- new_area = [start, start + (area[1] - area[0])]
- else:
- new_area = func(area)
+ hook['target_func_%s' % id] = func(hook['target_func_%s' % original])
- hook['area_%s' % id] = new_area
+ elif t == 'nop_insn':
+ error = 'missing area'
+
+ area = hook['area_%s' % original]
+ if isinstance(area, list):
+ start = func(area[0])
+ new_area = [start, start + (area[1] - area[0])]
+ else:
+ new_area = func(area)
+
+ hook['area_%s' % id] = new_area
+
+ except:
+ print 'Key Error %s for %s (%s) for %s' % (error, hook['name'], hook['type'], id)
#if hook['name'] == 'WM_onCreate': print hook