bnnm

EA .MUS (SNR+SNS) extract

Mar 29th, 2018
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # EA .MUS (SNR+SNS) extract
  2.  
  3. endian big
  4.  
  5. idstring "\x3D\xFC\xC4\x2C"
  6.  
  7. get FILENAME basename
  8.  
  9. set OFFSET long 0x0c
  10. set I long 0
  11.  
  12. goto OFFSET
  13. get MAX long
  14.  
  15.  
  16. do
  17. goto OFFSET
  18.  
  19. get SNR_OFFSET long
  20. get SNS_OFFSET long
  21. get NUMBER short
  22. get DUMMY short
  23.  
  24. # no more files
  25. if SNS_OFFSET == 0
  26. exit
  27. endif
  28.  
  29. callfunction DUMP_SNR_SNS 1
  30.  
  31. math I += 1
  32. math OFFSET += 0x0c
  33. while OFFSET < MAX
  34.  
  35.  
  36. ##############
  37.  
  38. startfunction DUMP_SNR_SNS
  39. string SNR_NAME p= "%s__%03i.snr" FILENAME I
  40. string SNS_NAME p= "%s__%03i.sns" FILENAME I
  41.  
  42.  
  43. set SNR_SIZE long 0x10
  44. set SNS_SIZE long 0
  45.  
  46. # get SNS SIZE
  47. get SNS_MAX asize
  48. math SNS_CURRENT = SNS_OFFSET
  49. do
  50. goto SNS_CURRENT
  51. get BLOCK_FLAG byte
  52. get BLOCK_SIZE threebyte
  53.  
  54. math SNS_CURRENT += BLOCK_SIZE
  55. math SNS_SIZE += BLOCK_SIZE
  56.  
  57. if BLOCK_FLAG == 0x80
  58. break #sns done
  59. endif
  60.  
  61. while SNS_CURRENT < SNS_MAX
  62.  
  63.  
  64. log SNR_NAME SNR_OFFSET SNR_SIZE
  65. log SNS_NAME SNS_OFFSET SNS_SIZE
  66.  
  67. endfunction
RAW Paste Data