Fix some .MSA [Konohana Pack: 3tsu no Jikenbo (PS2)]

This commit is contained in:
bnnm 2018-09-06 18:09:56 +02:00
parent f519b1ad70
commit 5e2283f51a
2 changed files with 20 additions and 8 deletions

View File

@ -908,7 +908,7 @@ static const meta_info meta_info_list[] = {
{meta_SSS, "Namco .SSS raw header"},
{meta_PS2_GCM, "GCM 'MCG' Header"},
{meta_PS2_SMPL, "Homura SMPL header"},
{meta_PS2_MSA, "Psyvariar -Complete Edition- MSA header"},
{meta_PS2_MSA, "Success .MSA header"},
{meta_PC_SMP, "Ghostbusters .smp Header"},
{meta_NGC_PDT, "Hudson .PDT header"},
{meta_NGC_RKV, "Legacy of Kain - Blood Omen 2 RKV GC header"},

View File

@ -1,37 +1,49 @@
#include "meta.h"
#include "../coding/coding.h"
/* MSA - from Psyvariar -Complete Edition- (PS2) */
/* MSA - from Sucess games [Psyvariar -Complete Edition- (PS2), Konohana Pack: 3tsu no Jikenbo (PS2)]*/
VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset, data_size, file_size;
off_t start_offset;
int loop_flag, channel_count;
size_t data_size, channel_size, file_size;
/* checks */
if (!check_extensions(streamFile, "msa"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x00000000)
goto fail;
if (read_32bitBE(0x08,streamFile) != 0x00000000)
goto fail;
loop_flag = 0;
channel_count = 2;
start_offset = 0x14;
data_size = read_32bitLE(0x4,streamFile);
file_size = get_streamfile_size(streamFile);
data_size = read_32bitLE(0x04,streamFile); /* wrong, see below */
channel_size = read_32bitLE(0x0c,streamFile); /* also wrong like data_size */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_PS2_MSA;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
if (vgmstream->sample_rate == 0) /* ex. AME.MSA */
if (vgmstream->sample_rate == 0) /* ex. Psyvariar's AME.MSA */
vgmstream->sample_rate = 44100;
vgmstream->num_samples = ps_bytes_to_samples(data_size, channel_count);
vgmstream->num_samples = ps_bytes_to_samples(data_size, channel_count);//data_size*28/(0x10*channel_count);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4000;
vgmstream->meta_type = meta_PS2_MSA;
if (channel_size) /* Konohana Pack */
vgmstream->interleave_block_size = 0x6000;
else /* Psyvariar */
vgmstream->interleave_block_size = 0x4000;
/* (could also test first frame in various interleaves, as it's always 0'ed) */
/* MSAs are strangely truncated, so manually calculate samples.
* Data after last usable block is always silence or garbage. */