mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
wsd for Phantom Brave (WII) added
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@612 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
094b5f1976
commit
272f4ffa70
@ -190,7 +190,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/ps2_mcg.o \
|
||||
meta/redspark.o \
|
||||
meta/ps2_vgs.o \
|
||||
meta/ivaud.o
|
||||
meta/ivaud.o \
|
||||
meta/wii_wsd.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -746,6 +746,10 @@
|
||||
RelativePath=".\meta\wii_sts.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\wii_wsd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ws_aud.c"
|
||||
>
|
||||
|
@ -150,5 +150,6 @@ libmeta_la_SOURCES += ps2_mcg.c
|
||||
libmeta_la_SOURCES += redspark.c
|
||||
libmeta_la_SOURCES += ivaud.c
|
||||
libmeta_la_SOURCES += ps2_vgs.c
|
||||
libmeta_la_SOURCES += wii_wsd.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -365,4 +365,6 @@ VGMSTREAM * init_vgmstream_RedSpark(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_wii_wsd(STREAMFILE *streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -12,7 +12,8 @@ VGMSTREAM * init_vgmstream_ngc_adpdtk(STREAMFILE *streamFile) {
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("adp",filename_extension(filename))) goto fail;
|
||||
if (strcasecmp("adp",filename_extension(filename)) &&
|
||||
strcasecmp("dtk",filename_extension(filename))) goto fail;
|
||||
|
||||
/* file size is the only way to determine sample count */
|
||||
file_size = get_streamfile_size(streamFile);
|
||||
|
94
src/meta/wii_wsd.c
Normal file
94
src/meta/wii_wsd.c
Normal file
@ -0,0 +1,94 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* WSD - Phantom Brave (WII) */
|
||||
VGMSTREAM * init_vgmstream_wii_wsd(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
int coef1_start;
|
||||
int coef2_start;
|
||||
int second_channel_start;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("wsd",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header, first file should alwas start at 0x20 */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x00000020) /* 0x20 */
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_32bitBE(0x2C,streamFile) != 0x0);
|
||||
channel_count = read_32bitBE(0x38,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x80;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x28,streamFile);
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = read_32bitBE(0x24,streamFile)/channel_count/8*14;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x30,streamFile)/channel_count/8*14;
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x34,streamFile)/channel_count/8*14;
|
||||
}
|
||||
|
||||
/* dealing with no interleave, 'cause the interleave
|
||||
for 2 channels is larger than the sample count/2 */
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_WII_WSD;
|
||||
|
||||
coef1_start = 0x3C;
|
||||
coef2_start = read_32bitBE(0x4,streamFile)+0x1C;
|
||||
second_channel_start = read_32bitBE(0x4,streamFile)+0x60;
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<16;i++)
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(coef1_start+i*2,streamFile);
|
||||
if (channel_count == 2) {
|
||||
for (i=0;i<16;i++)
|
||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(coef2_start+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
/* The first channel */
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[0].offset=start_offset;
|
||||
|
||||
/* The second channel */
|
||||
if (channel_count == 2) {
|
||||
vgmstream->ch[1].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[1].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[1].channel_start_offset=
|
||||
vgmstream->ch[1].offset=second_channel_start;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -202,6 +202,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_vgs,
|
||||
init_vgmstream_RedSpark,
|
||||
init_vgmstream_ivaud,
|
||||
init_vgmstream_wii_wsd,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2124,6 +2125,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_PC_IVAUD:
|
||||
snprintf(temp,TEMPSIZE,"assumed GTA IV Audio file by .ivaud extension");
|
||||
break;
|
||||
case meta_WII_WSD:
|
||||
snprintf(temp,TEMPSIZE,"Phantom Brave WSD Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
break;
|
||||
|
@ -381,6 +381,7 @@ typedef enum {
|
||||
meta_ZSD, /* Dragon Booster ZSD */
|
||||
meta_RedSpark, /* "RedSpark" RSD (MadWorld) */
|
||||
meta_PC_IVAUD, /* .ivaud GTA IV */
|
||||
meta_WII_WSD, /* Phantom Brave (WII) */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -82,6 +82,7 @@ char * extension_list[] = {
|
||||
"hps\0HALPST Audio File (*.HPS)\0",
|
||||
"strm\0STRM Audio File (*.STRM)\0",
|
||||
"adp\0ADP Audio File (*.ADP)\0",
|
||||
"dtk\0DTK Audio File (*.DTK)\0",
|
||||
"rsf\0RSF Audio File (*.RSF)\0",
|
||||
"dsp\0DSP Audio File (*.DSP)\0",
|
||||
"gcw\0GCW Audio File (*.GCW)\0",
|
||||
@ -232,6 +233,7 @@ char * extension_list[] = {
|
||||
"mcg\0MCG Audio File (*.MCG)\0",
|
||||
"zsd\0ZSD Audio File (*.ZSD)\0",
|
||||
"ivaud\0IVAUD Audio File (*.IVAUD)\0",
|
||||
"wsd\0WSD Audio File (*.WSD)\0",
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
Reference in New Issue
Block a user