Add Capcom .sspr [Sengoku Basara 4 (PS3/PS4)]

This commit is contained in:
bnnm 2021-07-09 00:06:27 +02:00
parent d7b277a671
commit b299aae547
7 changed files with 68 additions and 1 deletions

View File

@ -438,6 +438,7 @@ static const char* extension_list[] = {
"sb6",
"sb7",
"sbk",
"sbin",
"sbr",
"sbv",
"sm0",
@ -448,7 +449,6 @@ static const char* extension_list[] = {
"sm5",
"sm6",
"sm7",
"sbin",
"sc",
"scd",
"sch",
@ -491,6 +491,7 @@ static const char* extension_list[] = {
"ss2",
"ssd", //txth/reserved [Zack & Wiki (Wii)]
"ssm",
"sspr",
"sss",
"ster",
"sth",

View File

@ -1706,6 +1706,10 @@
RelativePath=".\meta\sqex_sead.c"
>
</File>
<File
RelativePath=".\meta\sspr.c"
>
</File>
<File
RelativePath=".\meta\sthd.c"
>

View File

@ -250,6 +250,7 @@
<ClCompile Include="meta\sqex_scd.c" />
<ClCompile Include="meta\sqex_scd_sscf.c" />
<ClCompile Include="meta\sqex_sead.c" />
<ClCompile Include="meta\sspr.c" />
<ClCompile Include="meta\sthd.c" />
<ClCompile Include="meta\tun.c" />
<ClCompile Include="meta\txth.c" />

View File

@ -1636,6 +1636,9 @@
<ClCompile Include="meta\sqex_sead.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\sspr.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\sthd.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -949,4 +949,6 @@ VGMSTREAM* init_vgmstream_tac(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_ogv_3rdeye(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_sspr(STREAMFILE* sf);
#endif /*_META_H*/

55
src/meta/sspr.c Normal file
View File

@ -0,0 +1,55 @@
#include "meta.h"
#include "../coding/coding.h"
/* SSPR - Capcom container [Sengoku Basara 4 (PS3/PS4), Mega Man Zero ZX Legacy Collection (PS4)] */
VGMSTREAM* init_vgmstream_sspr(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
STREAMFILE* temp_sf = NULL;
uint32_t name_offset, subfile_offset, subfile_size, name_size;
int big_endian;
int total_subsongs, target_subsong = sf->stream_index;
char* extension;
uint32_t (*read_u32)(off_t,STREAMFILE*) = NULL;
/* checks */
if (!check_extensions(sf,"sspr"))
goto fail;
if (!is_id32be(0x00,sf,"SSPR"))
goto fail;
/* Simple (audio only) container used some Capcom games (common engine?).
* Some files come with a .stqr with unknown data (cues?). */
big_endian = guess_endianness32bit(0x04, sf); /* 0x01 (version?) */
read_u32 = big_endian ? read_u32be : read_u32le;
total_subsongs = read_u32(0x08,sf);
if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
/* 0x0c: null */
name_offset = read_u32(0x10 + (target_subsong-1) * 0x10 + 0x00,sf);
subfile_offset = read_u32(0x10 + (target_subsong-1) * 0x10 + 0x04,sf);
name_size = read_u32(0x10 + (target_subsong-1) * 0x10 + 0x08,sf);
subfile_size = read_u32(0x10 + (target_subsong-1) * 0x10 + 0x0c,sf);
extension = big_endian ? "at3" : "at9";
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, extension);
if (!temp_sf) goto fail;
vgmstream = init_vgmstream_riff(temp_sf);
if (!vgmstream) goto fail;
vgmstream->num_streams = total_subsongs;
read_string(vgmstream->stream_name,name_size+1, name_offset,sf);
close_streamfile(temp_sf);
return vgmstream;
fail:
close_streamfile(temp_sf);
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -524,6 +524,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_idsp_tose,
init_vgmstream_dsp_kwa,
init_vgmstream_ogv_3rdeye,
init_vgmstream_sspr,
/* 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 */