mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
Add FSB5 .bank [Shantae: Half-Genie Hero (Switch)]
This commit is contained in:
parent
ab719d08de
commit
272a23490d
@ -73,6 +73,7 @@ static const char* extension_list[] = {
|
||||
"b1s",
|
||||
"baf",
|
||||
"baka",
|
||||
"bank",
|
||||
"bar",
|
||||
"bcstm",
|
||||
"bcwav",
|
||||
|
@ -608,10 +608,14 @@
|
||||
RelativePath=".\meta\fsb.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\fsb5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\fsb5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\fsb5_fev.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\fsb_encrypted.c"
|
||||
>
|
||||
|
@ -275,6 +275,7 @@
|
||||
<ClCompile Include="meta\flx.c" />
|
||||
<ClCompile Include="meta\fsb.c" />
|
||||
<ClCompile Include="meta\fsb5.c" />
|
||||
<ClCompile Include="meta\fsb5_fev.c" />
|
||||
<ClCompile Include="meta\fsb_encrypted.c" />
|
||||
<ClCompile Include="meta\gca.c" />
|
||||
<ClCompile Include="meta\gcsw.c" />
|
||||
|
@ -391,6 +391,9 @@
|
||||
<ClCompile Include="meta\fsb5.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\fsb5_fev.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\fsb_encrypted.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
54
src/meta/fsb5_fev.c
Normal file
54
src/meta/fsb5_fev.c
Normal file
@ -0,0 +1,54 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* FEV+FSB5 container [Shantae: Half-Genie Hero (Switch)] */
|
||||
VGMSTREAM * init_vgmstream_fsb5_fev_bank(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE *temp_streamFile = NULL;
|
||||
off_t subfile_offset, chunk_offset, first_offset = 0x0c;
|
||||
size_t subfile_size, chunk_size;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "bank"))
|
||||
goto fail;
|
||||
|
||||
if (read_32bitBE(0x00,streamFile) != 0x52494646) /* "RIFF" */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x08,streamFile) != 0x46455620) /* "FEV " */
|
||||
goto fail;
|
||||
|
||||
/* .fev is an event format referencing various external .fsb, but FMOD can bake .fev and .fsb to
|
||||
* form a .bank, which is the format we support here (regular .fev is complex and not very interesting).
|
||||
* Format is RIFF with FMT (main), LIST (config) and SND (FSB5 data), we want the FSB5 offset inside LIST */
|
||||
if (!find_chunk_le(streamFile, 0x4C495354,first_offset,0, &chunk_offset,NULL)) /* "LIST" */
|
||||
goto fail;
|
||||
|
||||
if (read_32bitBE(chunk_offset+0x00,streamFile) != 0x50524F4A || /* "PROJ" */
|
||||
read_32bitBE(chunk_offset+0x04,streamFile) != 0x424E4B49) /* "BNKI" */
|
||||
goto fail; /* event .fev has "OBCT" instead of "BNKI" */
|
||||
|
||||
/* inside BNKI is a bunch of LIST each with event subchunks and finally the fsb offset */
|
||||
first_offset = chunk_offset + 0x04;
|
||||
if (!find_chunk_le(streamFile, 0x534E4448,first_offset,0, &chunk_offset,&chunk_size)) /* "SNDH" */
|
||||
goto fail;
|
||||
|
||||
if (chunk_size != 0x0c)
|
||||
goto fail; /* assuming only one FSB5 is possible */
|
||||
subfile_offset = read_32bitLE(chunk_offset+0x04,streamFile);
|
||||
subfile_size = read_32bitLE(chunk_offset+0x08,streamFile);
|
||||
|
||||
|
||||
temp_streamFile = setup_subfile_streamfile(streamFile, subfile_offset,subfile_size, "fsb");
|
||||
if (!temp_streamFile) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_fsb5(temp_streamFile);
|
||||
close_streamfile(temp_streamFile);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -852,4 +852,6 @@ VGMSTREAM * init_vgmstream_xwma_konami(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_9tav(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_fsb5_fev_bank(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
@ -479,6 +479,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_msf_konami,
|
||||
init_vgmstream_xwma_konami,
|
||||
init_vgmstream_9tav,
|
||||
init_vgmstream_fsb5_fev_bank,
|
||||
|
||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||
|
Loading…
Reference in New Issue
Block a user