git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@211 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2008-06-09 00:20:08 +00:00
parent db42da3850
commit 013464482e
8 changed files with 144 additions and 56 deletions

View File

@ -52,7 +52,8 @@ META_OBJS=meta/adx_header.o \
meta/xbox_xwav.o \
meta/ea_header.o \
meta/ngc_caf.o \
meta/ps2_vpk.o
meta/ps2_vpk.o \
meta/psx_genh.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -306,6 +306,10 @@
RelativePath=".\meta\psx_cdxa.c"
>
</File>
<File
RelativePath=".\meta\psx_genh.c"
>
</File>
<File
RelativePath=".\meta\psx_gms.c"
>

View File

@ -4,6 +4,6 @@ AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libmeta_la_LDFLAGS =
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c psx_genh.c
EXTRA_DIST = meta.h

View File

@ -79,4 +79,6 @@ VGMSTREAM * init_vgmstream_caf(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_vpk(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_psx_genh(STREAMFILE *streamFile);
#endif

74
src/meta/psx_genh.c Normal file
View File

@ -0,0 +1,74 @@
#include "meta.h"
#include "../util.h"
/* GENH is an artificial "generic" header for headerless streams */
VGMSTREAM * init_vgmstream_psx_genh(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int32_t channel_count;
int32_t interleave;
int32_t sample_rate;
int32_t loop_start;
int32_t loop_end;
char filename[260];
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("genh",filename_extension(filename))) goto fail;
/* check header magic */
if (read_32bitBE(0x0,streamFile) != 0x47454e48) goto fail;
/* check format (reserved for now) */
if (read_32bitLE(0x18,streamFile) != 0) goto fail;
channel_count = read_32bitLE(0x4,streamFile);
interleave = read_32bitLE(0x8,streamFile);
sample_rate = read_32bitLE(0xc,streamFile);
loop_start = read_32bitLE(0x10,streamFile);
loop_end = read_32bitLE(0x14,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,(loop_start!=-1));
if (!vgmstream) goto fail;
/* fill in the vital information */
vgmstream->channels = channel_count;
vgmstream->sample_rate = sample_rate;
vgmstream->interleave_block_size = interleave;
vgmstream->num_samples = loop_end;
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
vgmstream->loop_flag = (loop_start != -1);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PSX_GENH;
/* open the file for reading by each channel */
{
int i;
for (i=0;i<channel_count;i++) {
if (channel_count > 1)
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,interleave);
else
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=0x800;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -15,48 +15,50 @@
* List of functions that will recognize files. These should correspond pretty
* directly to the metadata types
*/
#define INIT_VGMSTREAM_FCNS 38
VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(STREAMFILE *streamFile) = {
init_vgmstream_adx, /* 0 */
init_vgmstream_brstm, /* 1 */
init_vgmstream_nds_strm, /* 2 */
init_vgmstream_agsc, /* 3 */
init_vgmstream_ngc_adpdtk, /* 4 */
init_vgmstream_rsf, /* 5 */
init_vgmstream_afc, /* 6 */
init_vgmstream_ast, /* 7 */
init_vgmstream_halpst, /* 8 */
init_vgmstream_rs03, /* 9 */
init_vgmstream_ngc_dsp_std, /* 10 */
init_vgmstream_Cstr, /* 11 */
init_vgmstream_gcsw, /* 12 */
init_vgmstream_ps2_ads, /* 13 */
init_vgmstream_ps2_npsf, /* 14 */
init_vgmstream_rwsd, /* 15 */
init_vgmstream_cdxa, /* 16 */
init_vgmstream_ps2_rxw, /* 17 */
init_vgmstream_ps2_int, /* 18 */
init_vgmstream_ngc_dsp_stm, /* 19 */
init_vgmstream_ps2_exst, /* 20 */
init_vgmstream_ps2_svag, /* 21 */
init_vgmstream_ps2_mib, /* 22 */
init_vgmstream_ngc_mpdsp, /* 23 */
init_vgmstream_ps2_mic, /* 24 */
init_vgmstream_ngc_dsp_std_int, /* 25 */
init_vgmstream_raw, /* 26 */
init_vgmstream_ps2_vag, /* 27 */
init_vgmstream_psx_gms, /* 28 */
init_vgmstream_ps2_str, /* 29 */
init_vgmstream_ps2_ild, /* 30 */
init_vgmstream_ps2_pnb, /* 31 */
init_vgmstream_xbox_wavm, /* 32 */
init_vgmstream_xbox_xwav, /* 33 */
init_vgmstream_ngc_str, /* 34 */
init_vgmstream_ea, /* 35 */
init_vgmstream_caf, /* 36 */
init_vgmstream_ps2_vpk /* 37 */
VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_adx,
init_vgmstream_brstm,
init_vgmstream_nds_strm,
init_vgmstream_agsc,
init_vgmstream_ngc_adpdtk,
init_vgmstream_rsf,
init_vgmstream_afc,
init_vgmstream_ast,
init_vgmstream_halpst,
init_vgmstream_rs03,
init_vgmstream_ngc_dsp_std,
init_vgmstream_Cstr,
init_vgmstream_gcsw,
init_vgmstream_ps2_ads,
init_vgmstream_ps2_npsf,
init_vgmstream_rwsd,
init_vgmstream_cdxa,
init_vgmstream_ps2_rxw,
init_vgmstream_ps2_int,
init_vgmstream_ngc_dsp_stm,
init_vgmstream_ps2_exst,
init_vgmstream_ps2_svag,
init_vgmstream_ps2_mib,
init_vgmstream_ngc_mpdsp,
init_vgmstream_ps2_mic,
init_vgmstream_ngc_dsp_std_int,
init_vgmstream_raw,
init_vgmstream_ps2_vag,
init_vgmstream_psx_gms,
init_vgmstream_ps2_str,
init_vgmstream_ps2_ild,
init_vgmstream_ps2_pnb,
init_vgmstream_xbox_wavm,
init_vgmstream_xbox_xwav,
init_vgmstream_ngc_str,
init_vgmstream_ea,
init_vgmstream_caf,
init_vgmstream_ps2_vpk,
init_vgmstream_psx_genh,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
/* internal version with all parameters */
VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
int i;
@ -793,6 +795,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_PS2_VPK:
snprintf(temp,TEMPSIZE,"VPK Header");
break;
case meta_PSX_GENH:
snprintf(temp,TEMPSIZE,"GENH Generic PSX ADPCM Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -107,6 +107,7 @@ typedef enum {
meta_PSX_XA, /* CD-XA with RIFF header */
meta_PS2_VAGs, /* VAG Stereo from Kingdom Hearts */
meta_PS2_VPK, /* VPK Audio File */
meta_PSX_GENH, /* generic header for PSX ADPCM */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -100,20 +100,21 @@ char * extension_list[] = {
"mic\0PS2 MIC Audio File (*.MIC)\0",
"gcm\0GCM Audio File (*.GCM)\0",
"mss\0MSS Audio File (*.MSS)\0",
"raw\0RAW Audio File (*.RAW)\0",
"vag\0VAG Audio File (*.VAG)\0",
"gms\0GMS Audio File (*.GMS)\0",
"str\0STR Audio File (*.STR)\0",
"ild\0ILD Audio File (*.ILD)\0",
"pnb\0PNB Audio File (*.PNB)\0",
"wavm\0WAVM Audio File (*.WAVM)\0",
"xwav\0XWAV Audio File (*.XWAV)\0",
"wp2\0WP2 Audio File (*.WP2)\0",
"sng\0SNG Audio File (*.SNG)\0",
"asf\0ASF Audio File (*.ASF)\0",
"eam\0EAM Audio File (*.EAM)\0",
"cfn\0CFN Audio File (*.CFN)\0",
"vpk\0VPK Audio File (*.VPK)\0"
"raw\0RAW Audio File (*.RAW)\0",
"vag\0VAG Audio File (*.VAG)\0",
"gms\0GMS Audio File (*.GMS)\0",
"str\0STR Audio File (*.STR)\0",
"ild\0ILD Audio File (*.ILD)\0",
"pnb\0PNB Audio File (*.PNB)\0",
"wavm\0WAVM Audio File (*.WAVM)\0",
"xwav\0XWAV Audio File (*.XWAV)\0",
"wp2\0WP2 Audio File (*.WP2)\0",
"sng\0SNG Audio File (*.SNG)\0",
"asf\0ASF Audio File (*.ASF)\0",
"eam\0EAM Audio File (*.EAM)\0",
"cfn\0CFN Audio File (*.CFN)\0",
"vpk\0VPK Audio File (*.VPK)\0",
"genh\0GENH Audio File (*.GENH)\0",
};
void about(HWND hwndParent) {