diff --git a/src/formats.c b/src/formats.c index eac58b18..0baa8965 100644 --- a/src/formats.c +++ b/src/formats.c @@ -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", diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 1de32156..d17b0c44 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1706,6 +1706,10 @@ RelativePath=".\meta\sqex_sead.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 32355de0..5773a53b 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -250,6 +250,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index e32b1700..2c3bc382 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1636,6 +1636,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index ce0f21c5..c41216ae 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -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*/ diff --git a/src/meta/sspr.c b/src/meta/sspr.c new file mode 100644 index 00000000..f24e1623 --- /dev/null +++ b/src/meta/sspr.c @@ -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; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 530856d0..bd5f3209 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -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 */