-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgust_ps2.bms
More file actions
280 lines (274 loc) · 7.46 KB
/
gust_ps2.bms
File metadata and controls
280 lines (274 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# Gust - PS2 titles
get ps2_elf_name filename
math is_taikenban = 0
if ps2_elf_name == "SLPM_601.12" # Hresvelgr (Trial Version)
# this particular version has its PCM files stored on a separate header
# instead of a singular appended .BIN file for the game exe to latch onto
open FDSE "RPK.BIN" 1
open FDSE "\SD\SD0FP.FP" 2
open FDSE "\SD\SD1FP.FP" 3
open FDSE "\SD\SD2FP.FP" 4
open FDSE "\SD\SD3FP.FP" 5
open FDSE "\PCM\FV.PCM" 6
math is_taikenban = 1
for file_number = 1 <= 6
callfunction handle_hresvelgr_info 1
next file_number
elif ps2_elf_name == "SLPS_200.24" # Hresvelgr
open FDSE "RPK.BIN" 1
open FDSE "SD.BIN" 2
for file_number = 1 <= 2
callfunction handle_hresvelgr_info 1
next file_number
elif ps2_elf_name == "SLPS_200.59" # Hresvelgr: International Edition
open FDSE "RPK.BIN" 1
open FDSE "SDJ.BIN" 2
for file_number = 1 <= 2
callfunction handle_hresvelgr_info 1
next file_number
elif ps2_elf_name == "SLES_505.44" # Jet Ion GP
open FDSE "RPKPAL.BIN" 1
open FDSE "SDOS.BIN" 2
for file_number = 1 <= 2
callfunction handle_hresvelgr_info 1
next file_number
endif
startfunction handle_hresvelgr_info
/*
up until Hresvelgr: International Edition, \PCM\FV.PCM file table could be approached like this in the game exe
SLPM_601.12 - 0x2e4460
SLPS_200.24 - 0x365d70
the game demo (SLPM_601.12) had said file stored individually. the original game release (SLPS_200.24) had said file stored in SD.BIN with a file table designed specifically for both SD.BIN and \PCM\FV.PCM, with the table for the latter file stored *before* the SD.BIN file table.
later releases (SLPS_200.59) avoid this entirely and has everything stored into SDJ.BIN with a singularly dedicated file table for it in the game exe.
*/
/*
by contrast all .FP files used by the game contain a special file table for each (all within the game exe)
SD0FP.FP - 0x2e40c0(SLPM_601.12)
SD1FP.FP - 0x2e4140(SLPM_601.12)
SD2FP.FP - 0x2e4158(SLPM_601.12)
SD3FP.FP - 0x2e4170(SLPM_601.12)
*/
putarray 0 0 ""
putarray 1 0 ""
putarray 0 1 ""
putarray 2 0 ""
putarray 0 2 ""
putarray 3 0 ""
putarray 0 3 ""
if file_number = 1
if ps2_elf_name == "SLPM_601.12"
goto 0x17cd80
math rpk_files = 7
elif ps2_elf_name == "SLPS_200.24"
goto 0x200980
math rpk_files = 0x10
elif ps2_elf_name == "SLPS_200.59"
goto 0x21fd00
math rpk_files = 0x30
elif ps2_elf_name == "SLES_505.44"
goto 0x22ed00
math rpk_files = 0x2e
endif
for i = 0 < rpk_files
get file_name_string_offset long
callfunction calc_string_value 1
putarray 1 i file_name_string_offset
get file_offset long
math file_offset << 11
putarray 2 i file_offset
get file_size long
putarray 3 i file_size
next i
for i = 0 < rpk_files
getarray file_name_string_offset 1 i
goto file_name_string_offset
get file_name string
getarray file_offset 2 i
getarray file_size 3 i
callfunction extract_file 1
next i
endif
if is_taikenban != 1
if file_number = 2
if ps2_elf_name == "SLPS_200.24"
goto 0x3660b8
elif ps2_elf_name == "SLPS_200.59"
goto 0x37ab10
elif ps2_elf_name == "SLES_505.44"
goto 0x389b58
endif
get pcm_files long
for i = 0 < pcm_files
get file_offset long
math file_offset << 11
putarray i 1 file_offset
get file_size long
putarray i 2 file_Size
next i
if ps2_elf_name == "SLPS_200.24"
goto 0x365950
math i3 = 4
for i2 = 0 < 11
get file_name_string_offset long
get file_02 long
callfunction calc_string_value 1
if i2 == 10
putarray 0 3 file_name_string_offset
else
putarray i3 3 file_name_string_offset
math i3 + 1
endif
next i2
math i3 = 1
for i2 = 0 < 3
get file_01 long
get file_name_string_offset long
get file_03 long
callfunction calc_string_value 1
putarray i3 3 file_name_string_offset
math i3 + 1
next i2
elif ps2_elf_name == "SLPS_200.59"
goto 0x37a724
math i3 = 0
for i2 = 0 < 4
get file_01 long
get file_name_string_offset long
get file_03 long
callfunction calc_string_value 1
putarray i3 3 file_name_string_offset
math i3 + 1
next i2
for i2 = 0 < 55
putarray i3 3 0
math i3 + 1
next i2
elif ps2_elf_name == "SLES_505.44"
goto 0x38976c
math i3 = 0
for i2 = 0 < 4
get file_01 long
get file_name_string_offset long
get file_03 long
callfunction calc_string_value 1
putarray i3 3 file_name_string_offset
math i3 + 1
next i2
for i2 = 0 < 12
putarray i3 3 0
math i3 + 1
next i2
endif
math i2s = 1
for i = 0 < pcm_files
getarray file_offset i 1
getarray file_size i 2
getarray file_name_string_offset i 3
if file_name_string_offset != 0
goto file_name_string_offset
get file_name string
string file_name > ";1"
else
string file_name p "\PCM\%02d.PCM" i2s
math i2s + 1
endif
callfunction extract_file 1
next i
endif
else
if file_number == 2
goto 0x2e40c0
endif
if file_number == 3
goto 0x2e4140
endif
if file_number == 4
goto 0x2e4158
endif
if file_number == 5
goto 0x2e4170
endif
if file_number == 6
goto 0x2e4460
endif
get files long
for i = 0 < files
xmath i2 "i + 1"
set file_name string ""
get file_offset long
math file_offset << 11
get file_size long
if file_number == 2
set file_extension string ""
set pre_name string ""
goto file_offset file_number
get file_sign long file_number
goto -4 file_number SEEK_CUR
if file_sign == 0x53434549
callfunction handle_scei_file 1
elif file_sign == 0x56414270
set file_extension string "VH"
endif
if i < 9
if i = 0
math i3 = 1
endif
set pre_name string "M"
endif
if i > 8
if i = 9
math i3 = 1
endif
set pre_name string "BANK_"
endif
string file_name p "\FP\%s%02d.%s" pre_name i3 file_extension
math i3 + 1
endif
if file_number >= 3 && file_number <= 5
if file_number = 3 && i = 0
math i3 = 1
endif
set pre_name string "\FP\BANK_"
set file_extension string "VB"
if file_number == 5 && i == 1
set file_extension string "BD"
endif
string file_name p "%s%02d.%s" pre_name i3 file_extension
math i3 + 1
endif
if file_number == 6
string file_name p "\FV\%03d.PCM" i2
endif
log file_name file_offset file_size file_number
next i
endif
endfunction
startfunction calc_string_value
math file_name_string_offset - 0x1ff000
endfunction
startfunction extract_file
log file_name file_offset file_size file_number
endfunction
startfunction handle_scei_file
set file_extension string ""
savepos pos_01 file_number
for sc = 0 < 1
goto pos_01 file_number
get is_scei_chunk long file_number
if is_scei_chunk != 0x53434549
break
endif
get scei_chunk_type long file_number
get scei_chunk_size long file_number
if scei_chunk_type = 0x56657273
get scei_bank_info long file_number
xmath is_sound_bank_header "(scei_bank_info >> 24) & 0xff"
if is_sound_bank_header == 0
set file_extension string "SEQ"
elif is_sound_bank_header == 1
set file_extension string "HD"
endif
endif
math pos_01 + scei_chunk_size
next sc
endfunction