Advertisement
Guest User

Untitled

a guest
Nov 10th, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.00 KB | None | 0 0
  1. class GAFile:
  2.     def __init__(self, bs, mdlList):
  3.         self.bs = bs
  4.         self.mdlList = mdlList
  5.         bs.setEndian(NOE_BIGENDIAN)
  6.  
  7.     def check(self):
  8.         return self.bs.readUInt() <= self.bs.getSize() and [self.bs.readUInt() for i in range(3)][2] == 0x11  # ?
  9.  
  10.     def load(self):
  11.         bs = self.bs
  12.  
  13.         addr = bs.readUInt()
  14.         unk  = bs.readUInt()
  15.         unk  = bs.readUInt()
  16.         unk0 = bs.readUInt()  # 0x11
  17.  
  18.         loop = bs.readUInt()
  19.         flag = bs.readUInt()
  20.         numFrames = bs.readUInt()
  21.         numBones  = bs.readUInt()
  22.  
  23.         addrBones  = bs.readUInt()
  24.         addr1  = bs.readUInt()
  25.         addr2  = bs.readUInt()
  26.         addr3  = bs.readUInt()
  27.  
  28.         bs.seek(addrBones)
  29.         bones = [{
  30.             'id':    bs.readUInt(),
  31.             'unk':   bs.readUInt(),
  32.             'start': bs.readUInt(),
  33.             'num':   bs.readUInt(),
  34.         } for i in range(numBones)]
  35.  
  36.         for x in bones:
  37.             bs.seek(addr1 + x['start'] * 0xC)
  38.             x[1] = [{
  39.                 'unk0': [bs.readUByte() for j in range(4)],
  40.                 'lastFrame': bs.readUShort(),
  41.                 'num': bs.readUShort(),
  42.                 'unk2': bs.readUShort(),  # 0
  43.                 'start': bs.readUShort(),
  44.             } for i in range(x['num'])]
  45.  
  46.             for y in x[1]:
  47.                 bs.seek(addr3 + y['start'] * 0x4)
  48.                 y[1] = [{
  49.                     'unke0': bs.readUByte(),
  50.                     'frame': bs.readUByte(),
  51.                     'unke1': bs.readUByte(),
  52.                     'unke2': bs.readUByte(),
  53.                 } for i in range(y['num'])]
  54.  
  55.         for x in bones:
  56.             for y in x:
  57.                 if y != 1:
  58.                     print(y + ':', x[y])
  59.             for y in x[1]:
  60.                 for z in y:
  61.                     if z != 1:
  62.                         print('\t', z + ':', y[z])
  63.                 for z in y[1]:
  64.                     print('\t\t', z)
  65.             print()
  66.  
  67.         return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement