Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def tableNUNV(filedata,tablestart):
- tablelen = struct.unpack('>I',filedata[tablestart+0x8:tablestart+0xc])[0]
- table = ''
- for i in range(tablestart,tablestart+0x8,0x4):
- table += filedata[i+0x3:i+0x4] + filedata[i+0x2:i+0x3] + filedata[i+0x1:i+0x2] + filedata[i:i+0x1]
- #table += 'VNUN0100'
- table += struct.pack('<I',tablelen)
- entrycount = struct.unpack('>I',filedata[tablestart+0xc:tablestart+0x10])[0]
- table += struct.pack('<I',entrycount)
- pos = tablestart+0x10
- for i in range(0,entrycount):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- table += struct.pack('<I',struct.unpack('>I',filedata[pos+0x4:pos+0x8])[0])
- entrycount2 = struct.unpack('>I',filedata[pos+0x8:pos+0xc])[0]
- table += struct.pack('<I',entrycount2)
- pos += 0xc
- for a in range(0,entrycount2):
- for b in range(0,25): #64 bytes in total
- if b == 0x1:
- entrycount3 = struct.unpack('>I',filedata[pos:pos+0x4])[0]
- elif b == 0x2:
- entrycount4 = struct.unpack('>I',filedata[pos:pos+0x4])[0]
- elif b == 0x3:
- entrycount5 = struct.unpack('>I',filedata[pos:pos+0x4])[0]
- if b == 24:
- table += struct.pack('>B',struct.unpack('>B',filedata[pos:pos+0x1])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x1:pos+0x2])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x2:pos+0x3])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x3:pos+0x4])[0])
- else:
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
- tmpcount1 = entrycount3 * 0x10
- tmpcount1 /= 0x4
- for b in range(0,tmpcount1):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
- tmpcount1 = (entrycount3*0x2)+entrycount3
- tmpcount1 += tmpcount1
- tmpcount1 += tmpcount1
- tmpcount1 += tmpcount1
- tmpcount1 /= 0x4
- for b in range(0,tmpcount1):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
- tmpcount1 = (entrycount4*0x2)+entrycount4
- tmpcount1 *= 0x10
- tmpcount1 /= 0x4
- lenmoved = 0
- for b in range(0,tmpcount1):
- if lenmoved == 0x24:
- table += struct.pack('>B',struct.unpack('>B',filedata[pos:pos+0x1])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x1:pos+0x2])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x2:pos+0x3])[0])
- table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x3:pos+0x4])[0])
- else:
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
- lenmoved += 0x4
- if lenmoved == 0x30:
- lenmoved = 0
- tmpcount1 = entrycount5
- tmpcount1 += tmpcount1
- tmpcount1 += tmpcount1
- tmpcount1 /= 0x4
- for b in range(0,tmpcount1):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
- return table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement