Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. import sys
  2. from struct import unpack
  3.  
  4. with open('hud_questinfo.gui', 'rb') as content_file:
  5. #with open('hud_name.gui', 'rb') as content_file:
  6.     content = content_file.read()
  7.    
  8. if content[0:3]!='GUI':
  9.     sys.exit(0)
  10.    
  11. off = content[8:8+4]
  12. offI = unpack("I",off)
  13. print("FileSize: %08x" % offI)
  14.  
  15. poff = content[0xC8:0xC8+4]
  16. poffI = unpack("I",poff)[0]
  17.  
  18. off = content[0x168:0x168+4]
  19. offI = unpack("I",off)[0]
  20.  
  21. i=offI
  22. print("PropertiesValArray: %08x" % poffI)
  23. print("PropertiesTextArray: %08x" % i)
  24. print("Len of content: %08x" % len(content))
  25. texts=[]
  26. textdict={}
  27. while (i<len(content))and(content[i]!='\x00'):
  28.     s=""
  29.     while content[i]!='\x00':
  30.         s += content[i]
  31.         i += 1
  32.     texts.append((i-offI-len(s),s))
  33.     textdict[i-offI-len(s)] = s
  34.     i+=1
  35.  
  36. print("Texts:")
  37. for (i,s) in texts:
  38.     print("%08x %s" % (i,s))
  39.    
  40. print("Property values:")
  41.  
  42. i = poffI
  43. while (i<len(content))and(content[i]!='\x00'):
  44.     u = unpack("I",content[i:i+4])[0]
  45.     i+=16
  46.     toff = unpack("I",content[i:i+4])[0]
  47.     i+=8
  48.     v = unpack("I",content[i:i+4])[0]
  49.     if toff == 0:
  50.         break
  51.     if toff not in textdict:
  52.         print("%08x not found" % toff)
  53.         break;
  54.     t=textdict[toff]
  55.     print("offset: 0x%08x roffset: 0x%08x unkn:% 4d text:%40s val:% 4d [0x%08x]" % (i-8-16,i-poffI-8-16,u,t,v,v))
  56.     i+=8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement