Updated VGMStream to r1745-58-g828c6b09

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-07-07 16:44:01 -07:00
parent 3a16a53bd1
commit 7d8c2c53a0
5 changed files with 74 additions and 51 deletions

View File

@ -1157,7 +1157,7 @@ static const meta_info meta_info_list[] = {
{meta_PS2_WB, "Shooting Love. ~TRIZEAL~ WB header"},
{meta_S14, "Namco .S14 raw header"},
{meta_SSS, "Namco .SSS raw header"},
{meta_PS2_GCM, "GCM 'MCG' Header"},
{meta_PS2_GCM, "Namco GCM header"},
{meta_PS2_SMPL, "Homura SMPL header"},
{meta_PS2_MSA, "Success .MSA header"},
{meta_NGC_PDT, "Hudson .PDT header"},

View File

@ -15,6 +15,10 @@ VGMSTREAM* init_vgmstream_acb(STREAMFILE* sf) {
/* checks */
if (!is_id32be(0x00,sf, "@UTF"))
goto fail;
/* mainly for bigger files (utf lib checks smaller) */
if (read_u32be(0x04,sf) + 0x08 != get_streamfile_size(sf))
goto fail;
if (!check_extensions(sf, "acb"))
goto fail;

View File

@ -99,18 +99,19 @@ VGMSTREAM* init_vgmstream_hca_subkey(STREAMFILE* sf, uint16_t subkey) {
vgmstream->layout_type = layout_none;
vgmstream->codec_data = hca_data;
/* assumed mappings */
/* Assumed mappings; seems correct vs Atom Viewer, that lists L/R/C/LFE/LS/RS and downmixes HCAs like that.
* USM HCA's seem to be L/R/SL/SR/C/LFE though (probably reordered at USM level, no detection done in Atom Viewer). */
{
static const uint32_t hca_mappings[] = {
0,
mapping_MONO,
mapping_STEREO,
mapping_2POINT1,
mapping_QUAD,
mapping_QUAD_side,
mapping_5POINT0,
mapping_5POINT1,
mapping_5POINT1_surround,
mapping_7POINT0,
mapping_7POINT1,
mapping_7POINT1_surround,
};
vgmstream->channel_layout = hca_mappings[vgmstream->channels];

View File

@ -347,10 +347,12 @@ VGMSTREAM* init_vgmstream_opus_sps_n1(STREAMFILE* sf) {
/* checks */
if (read_u32be(0x00, sf) != 0x09000000) /* file type (see other N1 SPS) */
goto fail;
/* .sps: Labyrinth of Refrain: Coven of Dusk (Switch)
* .nlsd: Disgaea Refine (Switch), Ys VIII (Switch)
* .at9: void tRrLM(); //Void Terrarium (Switch) */
if (!check_extensions(sf, "sps,nlsd,at9"))
* .at9: void tRrLM(); //Void Terrarium (Switch)
* .opus: Asatsugutori (Switch) */
if (!check_extensions(sf, "sps,nlsd,at9,opus,lopus"))
goto fail;
num_samples = read_32bitLE(0x0C, sf);

View File

@ -1,62 +1,78 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* GCM (from NamCollection) */
VGMSTREAM * init_vgmstream_ps2_gcm(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
/* .GCM - from PS2 Namco games [Gunvari Collection + Time Crisis (PS2), NamCollection (PS2)] */
VGMSTREAM* init_vgmstream_ps2_gcm(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
uint32_t start_offset, name_offset;
uint32_t vagp_l_offset, vagp_r_offset, track_size, data_size, channel_size;
int channels, sample_rate, interleave;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("gcm",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D434700) /* "MCG" */
goto fail;
if (read_32bitBE(0x20,streamFile) != 0x56414770) /* "VAGp" */
/* checks */
if (!is_id32be(0x00,sf, "MCG\0"))
goto fail;
loop_flag = 0;
channel_count= 2;
/* .gcm: actual extension */
if (!check_extensions(sf, "gcm"))
goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x80;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x30,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x10,streamFile)*28/32;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
vgmstream->meta_type = meta_PS2_GCM;
/* format is two v4 "VAGp" headers then interleaved data (even for 6ch files) */
vagp_l_offset = read_u32le(0x04, sf);
if (!is_id32be(vagp_l_offset,sf, "VAGp"))
goto fail;
vagp_r_offset = read_u32le(0x08, sf);
if (!is_id32be(vagp_r_offset,sf, "VAGp"))
goto fail;
/* open the file for reading */
{
int i;
STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
start_offset = read_u32le(0x0c, sf);
track_size = read_u32le(0x10, sf); /* stereo size */
interleave = read_s32le(0x14, sf);
/* 0x18/1c: null */
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
/* nothing in the header indicates multi-channel files (*M.GCM), check expected sizes of stereo pairs */
data_size = get_streamfile_size(sf) - start_offset;
if (data_size == (track_size * 3)) {
channels = 6;
}
else if (data_size == track_size) {
channels = 2;
}
else {
goto fail; /* unknown setup (could also check start frames are null) */
}
/* get some values from the VAGp */
channel_size = read_u32be(vagp_l_offset + 0x0c, sf); /* without padding */
sample_rate = read_s32be(vagp_l_offset + 0x10, sf);
name_offset = vagp_l_offset + 0x20; /* both VAGp use the same name (sometimes with an L/R letter) */
if (channel_size != read_u32be(vagp_r_offset + 0x0c, sf)) /* unlikely... */
goto fail;
if (sample_rate != read_u32be(vagp_r_offset + 0x10, sf)) /* unlikely.. */
goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, 0);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_PS2_GCM;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = ps_bytes_to_samples(channel_size, 1);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = interleave;
read_string(vgmstream->stream_name,0x10+1, name_offset,sf);
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
close_vgmstream(vgmstream);
return NULL;
}