Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CHUNK 4
- pos = chunks[3][0]
- 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])
- tablecount = struct.unpack('>I',filedata[pos+0x8:pos+0xc])[0]
- table += struct.pack('<I',tablecount)
- pos += 0xc
- for i in range(0,tablecount):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- vertexsize = struct.unpack('>I',filedata[pos+0x4:pos+0x8])[0]
- table += struct.pack('<I',vertexsize)
- vertexcount = struct.unpack('>I',filedata[pos+0x8:pos+0xc])[0]
- table += struct.pack('<I',vertexcount)
- #table += struct.pack('<I',struct.unpack('>I',filedata[pos+0xc:pos+0x10])[0])
- table += struct.pack('<I',0x0) #should always be 0 or the game jumps out of loading model?
- pos += 0x10
- if vertexsize == 0x20:
- for a in range(0,vertexcount):
- lenmoved = 0
- for b in range(0,vertexsize,0x4):
- if lenmoved == 0x10:
- 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
- elif vertexsize == 0x30:
- for a in range(0,vertexcount):
- lenmoved = 0
- for b in range(0,vertexsize,0x4):
- if lenmoved == 0x10 or lenmoved == 0xc:
- 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
- elif vertexsize == 0x70:
- for a in range(0,vertexcount):
- lenmoved = 0
- for b in range(0,vertexsize,0x4):
- if lenmoved == 0x40 or lenmoved == 0x44 or lenmoved == 0x48 or lenmoved == 0x4c:
- 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
- else:
- if vertexsize != 0x8 and vertexsize != 0x18:
- print 'Unknown vertex size %x at loc %x\nNot sure if this will affect the game.' % (vertexsize,pos)
- for a in range(0,vertexcount):
- for b in range(0,vertexsize,0x4):
- table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
- pos += 0x4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement