summaryrefslogtreecommitdiff
path: root/tools/dumprelocs.py
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-29 11:11:11 -0500
committerColin Noga <Tempus@chronometry.ca>2012-03-29 11:11:11 -0500
commit2e5153002bccc3722dbacaa62b729493d2c2bf89 (patch)
tree0d235a689a0d7c831293dff206833f2d8efb277a /tools/dumprelocs.py
parent128ab59a90b26c54e18f8823adc26d37115fb5f5 (diff)
parent7bbab722a388bc63ec195a48c22c7060e3fab999 (diff)
downloadkamek-2e5153002bccc3722dbacaa62b729493d2c2bf89.tar.gz
kamek-2e5153002bccc3722dbacaa62b729493d2c2bf89.zip
merging changes to latest pull
Diffstat (limited to '')
-rw-r--r--tools/dumprelocs.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/dumprelocs.py b/tools/dumprelocs.py
new file mode 100644
index 0000000..d5773e3
--- /dev/null
+++ b/tools/dumprelocs.py
@@ -0,0 +1,19 @@
+import struct
+up = struct.Struct('>II').unpack
+u32 = struct.Struct('>I').unpack
+
+data = open('NewerASM/pal_dlrelocs.bin', 'rb').read()
+addr_offset = struct.unpack('>xxxxxxxxI', data[0:0xC])[0] - 0xC
+data = data[0xC:]
+
+reloc_count = addr_offset / 8
+
+for i in xrange(reloc_count):
+ entry = up(data[i*8:i*8+8])
+ reltype = entry[0] >> 24
+ addr_id = entry[0] & 0xFFFFFF
+ offset = entry[1]
+
+ offs = addr_offset+(addr_id*4)
+ print "%2d: %08x => %08x" % (reltype, offset, u32(data[offs:offs+4])[0])
+