Advertisement
Guest User

Untitled

a guest
Jun 11th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.72 KB | None | 0 0
  1.     #CHUNK 4
  2.     pos = chunks[3][0]
  3.     table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  4.     table += struct.pack('<I',struct.unpack('>I',filedata[pos+0x4:pos+0x8])[0])
  5.     tablecount = struct.unpack('>I',filedata[pos+0x8:pos+0xc])[0]
  6.     table += struct.pack('<I',tablecount)
  7.     pos += 0xc
  8.    
  9.     for i in range(0,tablecount):
  10.         table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  11.         vertexsize = struct.unpack('>I',filedata[pos+0x4:pos+0x8])[0]
  12.         table += struct.pack('<I',vertexsize)
  13.         vertexcount = struct.unpack('>I',filedata[pos+0x8:pos+0xc])[0]
  14.         table += struct.pack('<I',vertexcount)
  15.         #table += struct.pack('<I',struct.unpack('>I',filedata[pos+0xc:pos+0x10])[0])
  16.         table += struct.pack('<I',0x0) #should always be 0 or the game jumps out of loading model?
  17.         pos += 0x10
  18.        
  19.         if vertexsize == 0x20:
  20.             for a in range(0,vertexcount):
  21.                 lenmoved = 0
  22.                 for b in range(0,vertexsize,0x4):
  23.                     if lenmoved == 0x10:
  24.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos:pos+0x1])[0])
  25.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x1:pos+0x2])[0])
  26.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x2:pos+0x3])[0])
  27.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x3:pos+0x4])[0])
  28.                     else:
  29.                         table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  30.                     pos += 0x4
  31.                     lenmoved += 0x4
  32.  
  33.         elif vertexsize == 0x30:
  34.             for a in range(0,vertexcount):
  35.                 lenmoved = 0
  36.                 for b in range(0,vertexsize,0x4):
  37.                     if lenmoved == 0x10 or lenmoved == 0xc:
  38.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos:pos+0x1])[0])
  39.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x1:pos+0x2])[0])
  40.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x2:pos+0x3])[0])
  41.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x3:pos+0x4])[0])
  42.                     else:
  43.                         table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  44.                     pos += 0x4
  45.                     lenmoved += 0x4
  46.                    
  47.         elif vertexsize == 0x70:
  48.             for a in range(0,vertexcount):
  49.                 lenmoved = 0
  50.                 for b in range(0,vertexsize,0x4):
  51.                     if lenmoved == 0x40 or lenmoved == 0x44 or lenmoved == 0x48 or lenmoved == 0x4c:
  52.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos:pos+0x1])[0])
  53.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x1:pos+0x2])[0])
  54.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x2:pos+0x3])[0])
  55.                         table += struct.pack('>B',struct.unpack('>B',filedata[pos+0x3:pos+0x4])[0])
  56.                     else:
  57.                         table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  58.                     pos += 0x4
  59.                     lenmoved += 0x4
  60.  
  61.         else:
  62.             if vertexsize != 0x8 and vertexsize != 0x18:
  63.                 print 'Unknown vertex size %x at loc %x\nNot sure if this will affect the game.' % (vertexsize,pos)
  64.                
  65.             for a in range(0,vertexcount):
  66.                 for b in range(0,vertexsize,0x4):
  67.                     table += struct.pack('<I',struct.unpack('>I',filedata[pos:pos+0x4])[0])
  68.                     pos += 0x4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement