mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
SSND/.snd ps2 meta
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@641 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
e27b380369
commit
3b008b9ea2
@ -194,7 +194,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/wii_ndp.o \
|
||||
meta/ps2_sps.o \
|
||||
meta/nds_hwas.o \
|
||||
meta/ngc_lps.o
|
||||
meta/ngc_lps.o \
|
||||
meta/ps2_snd.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -578,6 +578,10 @@
|
||||
RelativePath=".\meta\ps2_rxw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_snd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_seg.c"
|
||||
>
|
||||
|
@ -154,5 +154,6 @@ libmeta_la_SOURCES += wii_ndp.c
|
||||
libmeta_la_SOURCES += ps2_sps.c
|
||||
libmeta_la_SOURCES += nds_hwas.c
|
||||
libmeta_la_SOURCES += ngc_lps.c
|
||||
libmeta_la_SOURCES += ps2_snd.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -379,4 +379,6 @@ VGMSTREAM * init_vgmstream_rsd3vag(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE * streamFile);
|
||||
|
||||
#endif
|
||||
|
59
src/meta/ps2_snd.c
Normal file
59
src/meta/ps2_snd.c
Normal file
@ -0,0 +1,59 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* SND (Warriors of Might and Magic Heroes of M&M:Dragonbone Staff) */
|
||||
VGMSTREAM * init_vgmstream_ps2_snd(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("snd",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x0,streamFile) !=0x53534e44) goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_16bitLE(0x0a,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitLE(0x04,streamFile)+8;
|
||||
vgmstream->sample_rate = (uint16_t)read_16bitLE(0xe,streamFile);
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/2/channel_count;
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = (uint16_t)read_16bitLE(0x12,streamFile);
|
||||
vgmstream->meta_type = meta_PS2_SND;
|
||||
|
||||
/* 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;
|
||||
}
|
@ -209,6 +209,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_xa2_rrp,
|
||||
init_vgmstream_nds_hwas,
|
||||
init_vgmstream_ngc_lps,
|
||||
init_vgmstream_ps2_snd,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2126,6 +2127,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_PS2_TK5:
|
||||
snprintf(temp,TEMPSIZE,"Tekken 5 Stream Header");
|
||||
break;
|
||||
case meta_PS2_SND:
|
||||
snprintf(temp,TEMPSIZE,"Might and Magic SSND Header");
|
||||
break;
|
||||
case meta_PS2_VSF_TTA:
|
||||
snprintf(temp,TEMPSIZE,"VSF with SMSS Header");
|
||||
break;
|
||||
|
@ -223,6 +223,7 @@ typedef enum {
|
||||
meta_PS2_VPK, /* VPK Audio File */
|
||||
meta_PS2_BMDX, /* Beatmania thing */
|
||||
meta_PS2_IVB, /* Langrisser 3 IVB */
|
||||
meta_PS2_SND, /* some Might & Magics SSND header */
|
||||
meta_PS2_SVS, /* Square SVS */
|
||||
meta_XSS, /* Dino Crisis 3 */
|
||||
meta_SL3, /* Test Drive Unlimited */
|
||||
|
@ -172,6 +172,7 @@ gchar *vgmstream_exts [] = {
|
||||
"ndp",
|
||||
"sps",
|
||||
"lps",
|
||||
"snd",
|
||||
/* terminator */
|
||||
NULL
|
||||
};
|
||||
|
@ -208,6 +208,7 @@ char * extension_list[] = {
|
||||
"sl3\0SL3 Audio File (*.SL3)\0",
|
||||
"sli\0SLI Audio File (*.SLI)\0",
|
||||
"smp\0SMP Audio File (*.SMP)\0",
|
||||
"snd\0SND Audio File (*.SND)\0",
|
||||
"sng\0SNG Audio File (*.SNG)\0",
|
||||
"spd\0SPD Audio File (*.SPD)\0",
|
||||
"sps\0SPS Audio File (*.SPS)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user