Nicknine

Wwise PCK Extractor

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