Merge branch 'master' of https://github.com/kode54/vgmstream into test

This commit is contained in:
bnnm 2018-03-30 11:02:28 +02:00
commit 99888d6517
5 changed files with 28 additions and 50 deletions

View File

@ -238,7 +238,7 @@ static const char* extension_list[] = {
"pona", "pona",
"pos", "pos",
"ps2stm", //fake extension for .stm (to be removed) "ps2stm", //fake extension for .stm (to be removed)
"psh", "psh", // fake extension for VSV(?) Dawn of Mana needs to be checked again
"psnd", "psnd",
"psw", "psw",
@ -356,6 +356,7 @@ static const char* extension_list[] = {
"vpk", "vpk",
"vs", "vs",
"vsf", "vsf",
"vsv", // official extension for PSH? TODO: recheck Dawn of Mana
"vxn", "vxn",
"waa", "waa",
@ -707,7 +708,7 @@ static const meta_info meta_info_list[] = {
{meta_MUS_ACM, "InterPlay MUS ACM header"}, {meta_MUS_ACM, "InterPlay MUS ACM header"},
{meta_PS2_KCES, "Konami KCES Header"}, {meta_PS2_KCES, "Konami KCES Header"},
{meta_PS2_DXH, "Tokobot Plus DXH Header"}, {meta_PS2_DXH, "Tokobot Plus DXH Header"},
{meta_PS2_PSH, "Dawn of Mana - Seiken Densetsu 4 PSH Header"}, {meta_PS2_PSH, "Square Enix PSH/VSV Header"},
{meta_RIFF_WAVE_labl, "RIFF WAVE header with loop markers"}, {meta_RIFF_WAVE_labl, "RIFF WAVE header with loop markers"},
{meta_RIFF_WAVE_smpl, "RIFF WAVE header with sample looping info"}, {meta_RIFF_WAVE_smpl, "RIFF WAVE header with sample looping info"},
{meta_RIFF_WAVE_wsmp, "RIFF WAVE header with wsmp looping info"}, {meta_RIFF_WAVE_wsmp, "RIFF WAVE header with wsmp looping info"},

View File

@ -386,7 +386,8 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callb
strstr(user_comment,"LOOPSTART=")==user_comment || strstr(user_comment,"LOOPSTART=")==user_comment ||
strstr(user_comment,"um3.stream.looppoint.start=")==user_comment || strstr(user_comment,"um3.stream.looppoint.start=")==user_comment ||
strstr(user_comment,"LOOP_BEGIN=")==user_comment || /* Hatsune Miku: Project Diva F (PS3) */ strstr(user_comment,"LOOP_BEGIN=")==user_comment || /* Hatsune Miku: Project Diva F (PS3) */
strstr(user_comment,"LoopStart=")==user_comment) { /* Devil May Cry 4 (PC) */ strstr(user_comment,"LoopStart=")==user_comment || /* Devil May Cry 4 (PC) */
strstr(user_comment,"XIPH_CUE_LOOPSTART=")==user_comment) { /* Super Mario Run (Android) */
loop_start = atol(strrchr(user_comment,'=')+1); loop_start = atol(strrchr(user_comment,'=')+1);
loop_flag = (loop_start >= 0); loop_flag = (loop_start >= 0);
} }
@ -430,6 +431,12 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callb
loop_flag = 1; loop_flag = 1;
loop_end_found = 1; loop_end_found = 1;
} }
else if (strstr(user_comment, "XIPH_CUE_LOOPEND=") == user_comment) { /* XIPH_CUE_LOOPSTART pair */
if (loop_flag) {
loop_length = atol(strrchr(user_comment, '=') + 1) - loop_start;
loop_length_found = 1;
}
}
} }
} }

View File

@ -1,11 +1,10 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../util.h"
/* PSH (from Dawn of Mana - Seiken Densetsu 4) */ /* PSH (from Dawn of Mana - Seiken Densetsu 4, Kingdom Hearts Re:Chain of Memories) */
/* probably Square Vag Stream */ /* probably Square Vag Stream */
VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset; off_t start_offset;
uint8_t testBuffer[0x10]; uint8_t testBuffer[0x10];
off_t loopEnd = 0; off_t loopEnd = 0;
@ -16,8 +15,8 @@ VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) {
int channel_count; int channel_count;
/* check extension, case insensitive */ /* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename)); if (!check_extensions(streamFile, "psh,vsv")) // vsv seems to be official extension
if (strcasecmp("psh",filename_extension(filename))) goto fail; goto fail;
/* check header */ /* check header */
if (read_16bitBE(0x02,streamFile) != 0x6400) if (read_16bitBE(0x02,streamFile) != 0x6400)
@ -65,25 +64,12 @@ VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) {
vgmstream->meta_type = meta_PS2_PSH; vgmstream->meta_type = meta_PS2_PSH;
/* open the file for reading */ /* open the file for reading */
{ if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
int i; goto fail;
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;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream; return vgmstream;
/* clean up anything we may have opened */ /* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -4,25 +4,22 @@
/* VSF (from Musashi: Samurai Legend) */ /* VSF (from Musashi: Samurai Legend) */
VGMSTREAM * init_vgmstream_ps2_vsf(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_ps2_vsf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset; off_t start_offset;
int loop_flag, channel_count;
int loop_flag;
int channel_count;
/* check extension, case insensitive */ /* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename)); if (!check_extensions(streamFile, "vsf"))
if (strcasecmp("vsf",filename_extension(filename))) goto fail; goto fail;
/* check header */ /* check header */
if (read_32bitBE(0x00,streamFile) != 0x56534600) /* "VSF" */ if (read_32bitBE(0x00,streamFile) != 0x56534600) /* "VSF" */
goto fail; goto fail;
loop_flag = (read_32bitLE(0x1c,streamFile)==0x13); loop_flag = (read_32bitLE(0x1c,streamFile)==0x13);
if(read_32bitLE(0x8,streamFile)==0x0) if(read_8bit(0x1C,streamFile)==0x0)
channel_count = 1; channel_count = 1;
else else
channel_count = 2; channel_count = 2;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
@ -44,25 +41,12 @@ VGMSTREAM * init_vgmstream_ps2_vsf(STREAMFILE *streamFile) {
vgmstream->meta_type = meta_PS2_VSF; vgmstream->meta_type = meta_PS2_VSF;
/* open the file for reading */ /* open the file for reading */
{ if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
int i; goto fail;
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;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream; return vgmstream;
/* clean up anything we may have opened */ /* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -369,7 +369,7 @@ typedef enum {
meta_PS2_RSTM, /* Midnight Club 3 */ meta_PS2_RSTM, /* Midnight Club 3 */
meta_PS2_KCES, /* Dance Dance Revolution */ meta_PS2_KCES, /* Dance Dance Revolution */
meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */ meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */
meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */ meta_PS2_PSH, /* Square Enix PSH/VSV (Dawn of Mana/KH Re:CoM) */
meta_SCD_PCM, /* Lunar - Eternal Blue */ meta_SCD_PCM, /* Lunar - Eternal Blue */
meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */ meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */ meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */