VAS: Manhunt 2 [PSP]

This commit is contained in:
EdnessP 2024-04-05 01:41:54 +03:00
parent 3116445e58
commit f41808a5dd
5 changed files with 63 additions and 0 deletions

View File

@ -1430,6 +1430,7 @@ static const meta_info meta_info_list[] = {
{meta_NXOF, "Nihon Falcom FDK header"}, {meta_NXOF, "Nihon Falcom FDK header"},
{meta_GWB_GWD, "Ubisoft GWB+GWD header"}, {meta_GWB_GWD, "Ubisoft GWB+GWD header"},
{meta_CBX, "Traveller's Tales CBX header"}, {meta_CBX, "Traveller's Tales CBX header"},
{meta_VAS, "Manhunt 2 .VAS header"},
}; };
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) { void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {

View File

@ -692,6 +692,7 @@
<ClCompile Include="meta\vab.c" /> <ClCompile Include="meta\vab.c" />
<ClCompile Include="meta\vag.c" /> <ClCompile Include="meta\vag.c" />
<ClCompile Include="meta\vai.c" /> <ClCompile Include="meta\vai.c" />
<ClCompile Include="meta\vas.c" />
<ClCompile Include="meta\vgs.c" /> <ClCompile Include="meta\vgs.c" />
<ClCompile Include="meta\vgs_ps.c" /> <ClCompile Include="meta\vgs_ps.c" />
<ClCompile Include="meta\vid1.c" /> <ClCompile Include="meta\vid1.c" />

View File

@ -1897,6 +1897,9 @@
<ClCompile Include="meta\vai.c"> <ClCompile Include="meta\vai.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\vas.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\vgs.c"> <ClCompile Include="meta\vgs.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>

57
src/meta/vas.c Normal file
View File

@ -0,0 +1,57 @@
#include "meta.h"
#include "../coding/coding.h"
/* VAS - Manhunt 2 [PSP] */
VGMSTREAM* init_vgmstream_rstm_rockstar(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t stream_offset;
size_t stream_size;
int sample_rate, channels, loop_flag = 0;
/* checks */
/* VAGs: v1, used in prerelease builds
* 2AGs: v2, used in the final release */
if (!is_id32be(0x00, sf, "VAGs") && !is_id32be(0x00, sf, "2AGs"))
goto fail;
if (!check_extensions(sf, "vas"))
goto fail;
stream_size = read_u32le(0x04, sf);
sample_rate = read_u16le(0x08, sf);
/* read_u8(0x0C, sf); // interleave size * 0x10? never used, always mono */
channels = read_u8(0x0B, sf);
if (channels != 1) goto fail;
stream_offset = 0x0C;
/* offset by 32 bytes for v2, stream name field? always empty in Manhunt 2 */
if (is_id32be(0x00, sf, "2AGs"))
stream_offset += 0x20;
/* might conflict with the standard VAG otherwise */
if (stream_size + stream_offset != get_streamfile_size(sf))
goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_VAS;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_none;
vgmstream->sample_rate = sample_rate;
vgmstream->stream_size = stream_size;
vgmstream->interleave_block_size = 0;
vgmstream->num_samples = ps_bytes_to_samples(stream_size, channels);
if (!vgmstream_open_stream(vgmstream, sf, stream_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -704,6 +704,7 @@ typedef enum {
meta_NXOF, meta_NXOF,
meta_GWB_GWD, meta_GWB_GWD,
meta_CBX, meta_CBX,
meta_VAS,
} meta_t; } meta_t;