SHARE
TWEET

Wwise PCK Extractor

Nicknine Jan 3rd, 2019 (edited) 246 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Wwise packages (PCK)
  2.  
  3. idstring "AKPK"
  4.  
  5. # Detect endianness.
  6. goto 0x08
  7. get TEST long
  8. endian guess TEST
  9.  
  10. goto 0x04
  11. get HEADER_SIZE long
  12. get FLAG long
  13. get SEC1_SIZE long # Languages
  14. get SEC2_SIZE long # Banks
  15. get SEC3_SIZE long # Sounds
  16.  
  17. xmath SUM "SEC1_SIZE + SEC2_SIZE + SEC3_SIZE + 0x10"
  18. if SUM == HEADER_SIZE
  19.     # Initial version.
  20.     math VERSION = 1
  21. else
  22.     # 2012 revision which added the fourth section and changed file size from 64-bit to 32-bit.
  23.     math VERSION = 2
  24.     get SEC4_SIZE long
  25. endif
  26.  
  27. savepos SEC1_OFF
  28. callfunction PARSE_LANGUAGES 1
  29.  
  30. xmath SEC2_OFF "SEC1_OFF + SEC1_SIZE"
  31. goto SEC2_OFF
  32.  
  33. # Extract banks.
  34. set EXT string "bnk"
  35. callfunction PARSE_TABLE 1
  36.  
  37. # Extract sounds.
  38. set EXT string "wem"
  39. callfunction PARSE_TABLE 1
  40.  
  41. startfunction PARSE_LANGUAGES
  42.     get LANGS long
  43.     for i = 0 < LANGS
  44.         get NAME_OFFSET long
  45.         get ID long
  46.        
  47.         savepos PREV_OFF
  48.         math NAME_OFFSET + SEC1_OFF
  49.         goto NAME_OFFSET
  50.         get LANG_NAME string
  51.         strlen NAME_LEN LANG_NAME
  52.        
  53.         # Language names may be stored as UTF-16 or UTF-8 depending on the platform.
  54.         # Lame UTF-16 detection.
  55.         if VERSION == 1 || NAME_LEN < 2
  56.             goto NAME_OFFSET
  57.             get LANG_NAME unicode
  58.         endif
  59.        
  60.         putarray 0 ID LANG_NAME
  61.         goto PREV_OFF
  62.     next i
  63. endfunction
  64.  
  65. startfunction PARSE_TABLE
  66.     get FILES long
  67.     for i = 0 < FILES
  68.         get ID long
  69.         get MULT long
  70.         if VERSION == 1
  71.             get SIZE longlong
  72.         else
  73.             get SIZE long
  74.         endif  
  75.         get OFFSET long
  76.         get LANG long
  77.        
  78.         if MULT != 0
  79.             math OFFSET * MULT
  80.         endif
  81.        
  82.         getarray LANG_NAME 0 LANG
  83.        
  84.         if LANG_NAME != "sfx"
  85.             string NAME p "%s/%u.%s" LANG_NAME ID EXT
  86.         else
  87.             string NAME p "%u.%s" ID EXT
  88.         endif
  89.         log NAME OFFSET SIZE
  90.     next i
  91. endfunction
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top