bnnm

FEAR 2 .snd extractor

Apr 8th, 2018
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # FEAR 2 .snd extractor
  2. # names may be in Game\database_sound\SoundDB.gamedb
  3.  
  4. get BASE_NAME basename
  5. get FILE_SIZE asize
  6.  
  7. get DUMMY long
  8. get ENTRIES long
  9. get ENTRIES_OFFSET long
  10. get HEADERS_OFFSET long
  11. get DATA_OFFSET long
  12.  
  13. set I long 0
  14.  
  15. #extract data directly, ignoring headers
  16.  
  17. for OFFSET = DATA_OFFSET < FILE_SIZE
  18. goto OFFSET
  19.  
  20. get SIZE long
  21. math SIZE += 0x08
  22.  
  23. string NAME p= "%s__%04i.snd" BASE_NAME I
  24.  
  25. log NAME OFFSET SIZE
  26.  
  27. math OFFSET += SIZE
  28. math I += 1
  29.  
  30. next
  31.  
  32.  
  33.  
  34. # failed attempt to extract in header order
  35. # some files don't seem to have proper pointers
  36.  
  37. #goto ENTRIES_OFFSET
  38. #
  39. #for I = 0 < ENTRIES
  40. # get ID long
  41. # get ENTRY_OFFSET long
  42. # savepos CURRENT
  43. #
  44. # goto ENTRY_OFFSET
  45. # get SUBFILES long
  46. # math ENTRY_OFFSET += 0x10
  47. #
  48. # for J = 0 < SUBFILES
  49. # #there is a mini header but is also in the extracted file
  50. # math ENTRY_OFFSET += 0x18
  51. # goto ENTRY_OFFSET
  52. # get OFFSET long
  53. # math ENTRY_OFFSET += 0x08
  54. #
  55. # math OFFSET += DATA_OFFSET
  56. # goto OFFSET
  57. # get SIZE long
  58. # math SIZE += 0x08
  59. #
  60. # string NAME p= "%s__%03i_%02i.snd" BASE_NAME I J
  61. # print "EN=%ENTRY_OFFSET|h%, OFF=%OFFSET|h% SZ=%SIZE|h%"
  62. # log NAME OFFSET SIZE
  63. # next J
  64. #
  65. # goto CURRENT
  66. #next I
RAW Paste Data