Byvar

eso_mnf_with_filenumber.bms

Oct 13th, 2013
260
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. goto 0x0A 0 SEEK_CUR #unknown part
  10. endian big
  11. comtype ZLIB
  12. get FILECOUNT long 0
  13. goto 0x4 0 SEEK_CUR #2nd file count
  14.  
  15. get BLOCK_SZ long 0 #block 1 size
  16. get BLOCK_ZSZ long 0 #block 1 compressed size
  17. savepos OFFSET 0
  18. clog MEMORY_FILE OFFSET BLOCK_ZSZ BLOCK_SZ 0
  19. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  20.  
  21. get BLOCK_SZ long 0 #block 2 size
  22. get BLOCK_ZSZ long 0 #block 2 compressed size
  23. savepos OFFSET 0
  24. clog MEMORY_FILE2 OFFSET BLOCK_ZSZ BLOCK_SZ 0
  25. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  26.  
  27. get BLOCK_SZ long 0 #block 3 size
  28. get BLOCK_ZSZ long 0 #block 3 compressed size
  29. savepos OFFSET 0
  30. clog MEMORY_FILE3 OFFSET BLOCK_ZSZ BLOCK_SZ 0
  31. goto BLOCK_ZSZ 0 SEEK_CUR #skip zlib block
  32.  
  33. savepos OFFSET 0
  34.  
  35. ###################################### EXTRACTION ######################################
  36. endian little
  37. for i = 0 < FILECOUNT
  38. get FILE_NUMBER long MEMORY_FILE2
  39. get UNKNOWN long MEMORY_FILE2 # unknown
  40. get FILE_SZ long MEMORY_FILE3
  41. get FILE_ZSZ long MEMORY_FILE3
  42. get FILE_NAME_HASH long MEMORY_FILE3
  43. get FILE_OFFSET long MEMORY_FILE3
  44. get FILE_COMTYPE byte MEMORY_FILE3 # 0 = no compression, 1 = zlib, 2 = snappy
  45. get FILE_ARCHIVE_NUM byte MEMORY_FILE3
  46. get DUMMY short MEMORY_FILE3 # unknown
  47. string ARCHIVE_NAME p= "%s%04d.dat" NAME FILE_ARCHIVE_NUM
  48. open FDSE ARCHIVE_NAME 1
  49. for
  50. get FILE_ID long MEMORY_FILE
  51. if FILE_ID != 0
  52. break
  53. endif
  54. next
  55. string FILE_NAME = "__"
  56. string FILE_NAME += FILE_NUMBER # unique identification
  57. if FILE_COMTYPE == 0
  58. log MEMORY_FILE4 FILE_OFFSET FILE_SZ 1
  59. elif FILE_COMTYPE == 1
  60. comtype ZLIB
  61. clog MEMORY_FILE4 FILE_OFFSET FILE_ZSZ FILE_SZ 1
  62. elif FILE_COMTYPE == 2
  63. comtype SNAPPY
  64. clog MEMORY_FILE4 FILE_OFFSET FILE_ZSZ FILE_SZ 1
  65. endif
  66. getdstring FILETYPE 3 MEMORY_FILE4
  67. # print %FILETYPE%
  68. if FILETYPE ^ "RIF"
  69. string FILE_NAME += ".wav"
  70. elif FILETYPE ^ "DDS"
  71. string FILE_NAME += ".dds"
  72. elif FILETYPE ^ "ZOS"
  73. string FILE_NAME += ".zosft"
  74. else
  75. string FILE_NAME += ".eso"
  76. endif
  77. log FILE_NAME 0 FILE_SZ MEMORY_FILE4
  78. next i
RAW Paste Data