.psh added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@352 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-07-20 20:41:11 +00:00
parent 1fd66dd519
commit a1642a84fa
8 changed files with 81 additions and 1 deletions

View File

@ -97,7 +97,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_rstm.o \ meta/ps2_rstm.o \
meta/acm.o \ meta/acm.o \
meta/ps2_kces.o \ meta/ps2_kces.o \
meta/ps2_dxh.o meta/ps2_dxh.o \
meta/ps2_psh.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -366,6 +366,10 @@
RelativePath=".\meta\ps2_pnb.c" RelativePath=".\meta\ps2_pnb.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_psh.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_rstm.c" RelativePath=".\meta\ps2_rstm.c"
> >

View File

@ -74,5 +74,6 @@ libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c libmeta_la_SOURCES += ps2_dxh.c
libmeta_la_SOURCES += ps2_psh.c
EXTRA_DIST = meta.h EXTRA_DIST = meta.h

View File

@ -161,4 +161,6 @@ VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_dxh(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ps2_dxh(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE * streamFile);
#endif #endif

66
src/meta/ps2_psh.c Normal file
View File

@ -0,0 +1,66 @@
#include "meta.h"
#include "../util.h"
/* PSH (from Dawn of Mana - Seiken Densetsu 4) */
/* probably Square Vag Stream */
VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("psh",filename_extension(filename))) goto fail;
/* check header */
if (read_16bitBE(0x02,streamFile) != 0x6400)
goto fail;
loop_flag = (read_16bitLE(0x04,streamFile)!=0);
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = (uint16_t)read_16bitLE(0x08,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (uint32_t)(read_16bitLE(0x0C,streamFile)*0x800)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = (uint16_t)read_16bitLE(0x04,streamFile)*128;
vgmstream->loop_end_sample = (uint16_t)read_16bitLE(0x06,streamFile)*128;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x800;
vgmstream->meta_type = meta_PS2_PSH;
/* 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;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -96,6 +96,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_acm, init_vgmstream_acm,
init_vgmstream_ps2_kces, init_vgmstream_ps2_kces,
init_vgmstream_ps2_dxh, init_vgmstream_ps2_dxh,
init_vgmstream_ps2_psh,
}; };
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -1374,6 +1375,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_PS2_DXH: case meta_PS2_DXH:
snprintf(temp,TEMPSIZE,"Tokobot Plus DXH Header"); snprintf(temp,TEMPSIZE,"Tokobot Plus DXH Header");
break; break;
case meta_PS2_PSH:
snprintf(temp,TEMPSIZE,"Dawn of Mana - Seiken Densetsu 4 PSH Header");
break;
default: default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
} }

View File

@ -195,6 +195,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_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -152,6 +152,7 @@ char * extension_list[] = {
"acm\0ACM Audio File (*.ACM)\0", "acm\0ACM Audio File (*.ACM)\0",
"kces\0KCES Audio File (*.KCES)\0", "kces\0KCES Audio File (*.KCES)\0",
"dxh\0DXH Audio File (*.DXH)\0", "dxh\0DXH Audio File (*.DXH)\0",
"psh\0PSH Audio File (*.PSH)\0",
}; };
void about(HWND hwndParent) { void about(HWND hwndParent) {