AnonBaiter

square_sqex_ps2_vag_formats.bms

Jun 15th, 2019
54
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. get file_size asize
  2. math vs_offset = 0
  3. math vlt = 1
  4. math clt = 2
  5. math channels = 0
  6. math str = 0
  7. math vs = 0
  8. math svs = 0
  9. math vsf = 0
  10. for i = 0 < vlt
  11. for j = 0 < clt
  12. goto vs_offset
  13. for k = 0 < 4
  14. get id_byte byte
  15. putarray 1 k id_byte
  16. next k
  17. getarray char_01 1 0
  18. getarray char_02 1 1
  19. getarray char_03 1 2
  20. getarray char_04 1 3
  21. if char_01 == 0x53
  22. if char_02 == 0x54
  23. if char_03 == 0x52
  24. print " blocked(a header is provided every 2048 bytes that contains relevant info regarding that byte) STREAM format "
  25. if i = 0
  26. if char_04 == 0x4c
  27. print " left-channel block "
  28. math channels + 1
  29. endif
  30. if char_04 == 0x4d
  31. print " mono-channel block "
  32. math channels + 1
  33. endif
  34. if char_04 == 0x52
  35. print " right-channel block "
  36. math channels + 1
  37. endif
  38. endif
  39. math str = 1
  40. endif
  41. endif
  42. endif
  43. if char_01 == 0x56
  44. if char_02 == 0x53
  45. if char_03 == 0x00
  46. if char_04 == 0x00
  47. print " blocked(a header is provided every 2048 bytes that contains relevant info regarding that byte) VAG-STREAM format "
  48. math vs = 1
  49. endif
  50. endif
  51. endif
  52. endif
  53. if char_01 == 0x53
  54. if char_02 == 0x56
  55. if char_03 == 0x53
  56. if char_04 == 0x00
  57. print " normal(as in, only the header is available from the first byte not every 2048 bytes) SEQ-VAG-STREAM format "
  58. math svs = 1
  59. endif
  60. endif
  61. endif
  62. endif
  63. if char_01 == 0x56
  64. if char_02 == 0x53
  65. if char_03 == 0x46
  66. if char_04 == 0x00
  67. print " normal(as in, only the header is available from the first byte not every 2048 bytes) VAG-STREAM format "
  68. math vsf = 1
  69. endif
  70. endif
  71. endif
  72. endif
  73. if str = 1
  74. get interleave_per_block long
  75. get remaining_block_numbers long
  76. get str_03 long
  77. get block_config long
  78. get str_05 long
  79. get str_06 long
  80. get str_07 long
  81. if i = 0
  82. xmath vlt "remaining_block_numbers + 1"
  83. if char_04 == 0x4d
  84. math clt = channels
  85. else
  86. if j = 1
  87. math clt = channels
  88. endif
  89. endif
  90. endif
  91. endif
  92. if vs = 1
  93. get block_config long
  94. # ^ 0-1 is mono/stereo flag, and not much is known beyond that
  95. get current_block_number long
  96. get remaining_block_numbers long
  97. get sample_rate_frequency long
  98. get volume_number long
  99. get vs_06 long
  100. get vs_07 long
  101. if i = 0
  102. if j = 0
  103. xmath channels "(block_config & 1) + 1"
  104. math vlt = remaining_block_numbers
  105. math clt = channels
  106. endif
  107. endif
  108. endif
  109. if svs = 1
  110. get stream_config long
  111. # ^ 0-1 is mono/stereo flag, 2 is loop flag, again, nothing known beyond that
  112. get minimum_loop_sample_within_stream long
  113. get maximum_samples_within_stream long
  114. get sample_rate_frequency long
  115. get svs_05 long
  116. get svs_file_number long
  117. get volume_number long
  118. if i = 0
  119. if j = 0
  120. math vlt = 1
  121. math clt = 1
  122. endif
  123. endif
  124. endif
  125. if vsf = 1
  126. get vsf_size long
  127. get vsf_file_number long
  128. get vsf_03 long
  129. get maximum_samples_within_stream long
  130. get vsf_05 long
  131. get minimum_loop_sample_within_stream long
  132. get stream_config long
  133. # ^ 0-1 is mono/stereo flag, 2 is loop flag,
  134. # although 0x10 exists as an additional flag as well
  135. get sample_rate_frequency long
  136. get volume_number long
  137. get vsf_10 long
  138. if i = 0
  139. if j = 0
  140. math vlt = 1
  141. math clt = 1
  142. endif
  143. endif
  144. endif
  145. math vs_offset >> 11
  146. math vs_offset + 1
  147. math vs_offset << 11
  148. next j
  149. if i = 0
  150. if svs != 1 && vsf != 1
  151. xmath vs_size "(vlt << 11) * channels"
  152. if file_size == vs_size
  153. print " overall stream size(with blocked layout) is correct "
  154. endif
  155. endif
  156. endif
  157. next i
RAW Paste Data