From 5e8e92cd8f403cbfebc4469a1aee252212e42045 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 27 Mar 2012 21:38:52 +0200 Subject: Kamek/Newer now support dynamic linking --- tools/dumprelocs.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tools/dumprelocs.py (limited to 'tools/dumprelocs.py') 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]) + -- cgit v1.2.3