mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Fix Homura (PS2) stereo and add .v0
This commit is contained in:
parent
17da12f324
commit
6d80168879
@ -100,6 +100,7 @@ VGMSTREAM_DECLARE_FILE_TYPE("DBM", dbm);
|
|||||||
VGMSTREAM_DECLARE_FILE_TYPE("DCS", dcs);
|
VGMSTREAM_DECLARE_FILE_TYPE("DCS", dcs);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("DDSP", ddsp);
|
VGMSTREAM_DECLARE_FILE_TYPE("DDSP", ddsp);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("DE2", de2);
|
VGMSTREAM_DECLARE_FILE_TYPE("DE2", de2);
|
||||||
|
VGMSTREAM_DECLARE_FILE_TYPE("DEC", dec);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("DMSG", dmsg);
|
VGMSTREAM_DECLARE_FILE_TYPE("DMSG", dmsg);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("DSP", dsp);
|
VGMSTREAM_DECLARE_FILE_TYPE("DSP", dsp);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("DSPW", dspw);
|
VGMSTREAM_DECLARE_FILE_TYPE("DSPW", dspw);
|
||||||
@ -199,6 +200,7 @@ VGMSTREAM_DECLARE_FILE_TYPE("MWV", mwv);
|
|||||||
VGMSTREAM_DECLARE_FILE_TYPE("MxSt", mxst);
|
VGMSTREAM_DECLARE_FILE_TYPE("MxSt", mxst);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("MYSPD", myspd);
|
VGMSTREAM_DECLARE_FILE_TYPE("MYSPD", myspd);
|
||||||
|
|
||||||
|
VGMSTREAM_DECLARE_FILE_TYPE("NAAC", naac);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("NDP", ndp);
|
VGMSTREAM_DECLARE_FILE_TYPE("NDP", ndp);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("NGCA", ngca);
|
VGMSTREAM_DECLARE_FILE_TYPE("NGCA", ngca);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("NPS", nps);
|
VGMSTREAM_DECLARE_FILE_TYPE("NPS", nps);
|
||||||
@ -363,6 +365,7 @@ VGMSTREAM_DECLARE_FILE_TYPE("XWMA", xwma);
|
|||||||
VGMSTREAM_DECLARE_FILE_TYPE("XWS", xws);
|
VGMSTREAM_DECLARE_FILE_TYPE("XWS", xws);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("XWV", xwv);
|
VGMSTREAM_DECLARE_FILE_TYPE("XWV", xwv);
|
||||||
|
|
||||||
|
VGMSTREAM_DECLARE_FILE_TYPE("V0", v0);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("YDSP", ydsp);
|
VGMSTREAM_DECLARE_FILE_TYPE("YDSP", ydsp);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("YMF", ymf);
|
VGMSTREAM_DECLARE_FILE_TYPE("YMF", ymf);
|
||||||
|
|
||||||
|
@ -308,6 +308,7 @@ static const char* extension_list[] = {
|
|||||||
"ulw",
|
"ulw",
|
||||||
"um3",
|
"um3",
|
||||||
|
|
||||||
|
"v0",
|
||||||
"vag",
|
"vag",
|
||||||
"vas",
|
"vas",
|
||||||
"vawx",
|
"vawx",
|
||||||
|
@ -1,63 +1,71 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* SMPL (from Homura) */
|
/* SMPL - from Homura */
|
||||||
VGMSTREAM * init_vgmstream_ps2_smpl(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ps2_smpl(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
STREAMFILE * streamRch = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
|
int loop_flag, channel_count;
|
||||||
|
size_t channel_size;
|
||||||
|
|
||||||
int loop_flag;
|
/* check extension (.v0: left channel, .v1: right channel, .smpl: header id) */
|
||||||
int channel_count;
|
if ( !check_extensions(streamFile,"v0,smpl") )
|
||||||
|
goto fail;
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("smpl",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
/* check header */
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x534D504C) /* "SMPL" */
|
if (read_32bitBE(0x00,streamFile) != 0x534D504C) /* "SMPL" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
loop_flag = 1;
|
/* right channel is in .V1 and doesn't have loop points; manually parse as dual_stereo would fail */
|
||||||
channel_count = 1;
|
streamRch = open_stream_ext(streamFile, "V1");
|
||||||
|
channel_count = streamRch != NULL ? 2 : 1;
|
||||||
|
loop_flag = (read_32bitLE(0x30,streamFile) != 0);
|
||||||
|
start_offset = 0x40;
|
||||||
|
channel_size = read_32bitBE(0x0c,streamFile) - 0x10;
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
start_offset = 0x40;
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
||||||
vgmstream->coding_type = coding_PSX_badflags;
|
vgmstream->num_samples = ps_bytes_to_samples(channel_size*channel_count, channel_count);
|
||||||
vgmstream->num_samples = read_32bitBE(0xc,streamFile)*56/32;
|
vgmstream->loop_start_sample = read_32bitLE(0x30,streamFile);
|
||||||
if (loop_flag) {
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x30,streamFile);
|
|
||||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
|
||||||
}
|
|
||||||
vgmstream->layout_type = layout_none;
|
|
||||||
vgmstream->meta_type = meta_PS2_SMPL;
|
vgmstream->meta_type = meta_PS2_SMPL;
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
|
/* always, but can be null or used as special string */
|
||||||
|
read_string(vgmstream->stream_name,0x10+1, 0x20,streamFile);
|
||||||
|
|
||||||
/* open the file for reading */
|
/* open the file for reading */
|
||||||
|
//if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||||
|
// goto fail;
|
||||||
|
|
||||||
|
/* custom dual channel */ // todo improve dual_stereo
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
STREAMFILE * file;
|
char filename[PATH_LIMIT];
|
||||||
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;
|
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
vgmstream->ch[i].offset=start_offset+
|
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
vgmstream->interleave_block_size*i;
|
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||||
|
|
||||||
|
if (channel_count == 2)
|
||||||
|
vgmstream->ch[1].streamfile = streamRch;
|
||||||
|
|
||||||
|
for (i = 0; i < channel_count; i++) {
|
||||||
|
vgmstream->ch[i].channel_start_offset =
|
||||||
|
vgmstream->ch[i].offset = start_offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
if (streamRch) close_streamfile(streamRch);
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user