Byvar

eso_mnf_audio_only.bms

Feb 6th, 2014
405
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. idstring 0 "MES2"
  2. get NAME basename 0
  3.  
  4. endian little
  5. get DUMMY short 0
  6. get NUMBER_DAT_FILES byte 0
  7. get DUMMY long 0
  8. get EOF_OFFSET long 0
  9. comtype ZLIB
  10. endian big
  11. get NEXTBLOCK_TYPE short 0
  12. if NEXTBLOCK_TYPE == 0
  13. print %NEXTBLOCK_TYPE%
  14. get DUMMY short 0
  15. get BLOCK_SZ long 0
  16. goto BLOCK_SZ 0 SEEK_CUR
  17. get BLOCK_SZ long 0
  18. goto BLOCK_SZ 0 SEEK_CUR
  19. goto 0x02 0 SEEK_CUR
  20. endif
  21. goto 0x08 0 SEEK_CUR #unknown part
  22. get FILECOUNT long 0
  23. goto 0x4 0 SEEK_CUR #2nd file count
  24.  
  25. get BLOCK_SZ long 0 #block 1 size
  26. get BLOCK_ZSZ long 0 #block 1 compressed size
  27. savepos OFFSET 0
  28. clog MEMORY_FILE OFFSET BLOCK_ZSZ BLOCK_SZ 0
  29. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  30.  
  31. get BLOCK_SZ long 0 #block 2 size
  32. get BLOCK_ZSZ long 0 #block 2 compressed size
  33. savepos OFFSET 0
  34. clog MEMORY_FILE2 OFFSET BLOCK_ZSZ BLOCK_SZ 0
  35. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  36.  
  37. get BLOCK_SZ long 0 #block 3 size
  38. get BLOCK_ZSZ long 0 #block 3 compressed size
  39. savepos OFFSET 0
  40. clog MEMORY_FILE3 OFFSET BLOCK_ZSZ BLOCK_SZ 0
  41. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  42.  
  43. savepos OFFSET 0
  44.  
  45. ###################################### EXTRACTION ######################################
  46. endian little
  47. for i = 0 < FILECOUNT
  48. get FILE_NUMBER long MEMORY_FILE2
  49. get UNKNOWN long MEMORY_FILE2 # unknown
  50. get FILE_SZ long MEMORY_FILE3
  51. get FILE_ZSZ long MEMORY_FILE3
  52. get FILE_NAME_HASH long MEMORY_FILE3
  53. get FILE_OFFSET long MEMORY_FILE3
  54. get FILE_COMTYPE byte MEMORY_FILE3 # 0 = no compression, 1 = zlib, 2 = snappy
  55. get FILE_ARCHIVE_NUM byte MEMORY_FILE3
  56. get DUMMY short MEMORY_FILE3 # unknown
  57. if FILE_ARCHIVE_NUM < 204
  58. string ARCHIVE_NAME p= "%s%04d.dat" NAME FILE_ARCHIVE_NUM
  59. open FDSE ARCHIVE_NAME 1
  60. set UNKNOWN long FILE_OFFSET
  61. if FILE_COMTYPE == 0
  62. math UNKNOWN += FILE_SZ
  63. else
  64. math UNKNOWN += FILE_ZSZ
  65. endif
  66. get ARCHIVE_SZ asize 1
  67. if UNKNOWN < ARCHIVE_SZ
  68. string FILE_NAME = "__"
  69. string FILE_NAME += FILE_NUMBER
  70. if FILE_COMTYPE == 0
  71. log MEMORY_FILE4 FILE_OFFSET FILE_SZ 1
  72. elif FILE_COMTYPE == 1
  73. comtype ZLIB_NOERROR
  74. clog MEMORY_FILE4 FILE_OFFSET FILE_ZSZ FILE_SZ 1
  75. elif FILE_COMTYPE == 2
  76. comtype SNAPPY
  77. clog MEMORY_FILE4 FILE_OFFSET FILE_ZSZ FILE_SZ 1
  78. endif
  79. get FILE_SZ asize MEMORY_FILE4
  80. if FILE_SZ > 20
  81. getdstring FILETYPE 3 MEMORY_FILE4
  82. # print %FILETYPE%
  83. if FILETYPE ^ "RIF"
  84. goto 0x14 MEMORY_FILE4 SEEK_SET
  85. get WAVE_TYPE short MEMORY_FILE4
  86. string FILE_NAME += "."
  87. string FILE_NAME += FILE_ARCHIVE_NUM
  88. string FILE_NAME += "."
  89. string FILE_NAME += WAVE_TYPE
  90. string FILE_NAME += ".wav"
  91. log FILE_NAME 0 FILE_SZ MEMORY_FILE4
  92. elif FILETYPE ^ "ZOS"
  93. string FILE_NAME += "."
  94. string FILE_NAME += FILE_ARCHIVE_NUM
  95. string FILE_NAME += ".zosft"
  96. log FILE_NAME 0 FILE_SZ MEMORY_FILE4
  97. endif
  98. endif
  99. endif
  100. endif
  101. next i
RAW Paste Data