Initial .RAS support (incomplete but working) added for Donkey Kong Country Returns (Wii). Loop and other code will need to be added once other files are found. Other incomplete/unused code that breaks vgmstream commented out for now.

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@881 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-11-22 01:45:39 +00:00
parent 2f61f9c58a
commit 9c7283eda0
13 changed files with 134 additions and 43 deletions

View File

@ -397,6 +397,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"psh")) return 1;
if(!stricmp_utf8(p_extension,"psw")) return 1;
if(!stricmp_utf8(p_extension,"ras")) return 1;
if(!stricmp_utf8(p_extension,"raw")) return 1;
if(!stricmp_utf8(p_extension,"rkv")) return 1;
if(!stricmp_utf8(p_extension,"rnd")) return 1;
@ -690,6 +691,7 @@ DECLARE_MULTIPLE_FILE_TYPE("PS2STM Audio File (*.PS2STM)", ps2stm);
DECLARE_MULTIPLE_FILE_TYPE("PSH Audio File (*.PSH)", psh);
DECLARE_MULTIPLE_FILE_TYPE("PSW Audio File (*.PSW)", psw);
DECLARE_MULTIPLE_FILE_TYPE("RAS Audio File (*.RAS)", ras);
DECLARE_MULTIPLE_FILE_TYPE("RAW Audio File (*.RAW)", raw);
DECLARE_MULTIPLE_FILE_TYPE("RKV Audio File (*.RKV)", rkv);
DECLARE_MULTIPLE_FILE_TYPE("RND Audio File (*.RND)", rnd);

View File

@ -260,7 +260,8 @@ META_OBJS=meta/adx_header.o \
meta/nub.o \
meta/ps3_past.o \
meta/ps3_sgh_sgb.o \
meta/ngca.o
meta/ngca.o \
meta/wii_ras.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -121,10 +121,10 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_dsp_bdsp_blocked:
dsp_bdsp_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_mtaf_blocked:
/*case layout_mtaf_blocked:
mtaf_block_update(vgmstream->next_block_offset,vgmstream);
case layout_tra_blocked:
tra_block_update(vgmstream->next_block_offset,vgmstream);
tra_block_update(vgmstream->next_block_offset,vgmstream);*/
default:
break;
}

View File

@ -978,6 +978,10 @@
RelativePath=".\meta\wii_mus.c"
>
</File>
<File
RelativePath=".\meta\wii_ras.c"
>
</File>
<File
RelativePath=".\meta\wii_smp.c"
>

View File

@ -213,5 +213,6 @@ libmeta_la_SOURCES += nub.c
libmeta_la_SOURCES += ps3_past.c
libmeta_la_SOURCES += ps3_sgh_sgb.c
libmeta_la_SOURCES += ngca.c
libmeta_la_SOURCES += wii_ras.c
EXTRA_DIST = meta.h

View File

@ -543,12 +543,12 @@ VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sghb(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_xbox_tra(STREAMFILE* streamFile);
//VGMSTREAM * init_vgmstream_xbox_tra(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngca(STREAMFILE* streamFile);
//VGMSTREAM * init_vgmstream_ngca(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_wii_ras(STREAMFILE* streamFile);
#endif

View File

@ -4,28 +4,28 @@
/* SGH+SGB (from Folklore) */
VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset = 0;
STREAMFILE * streamFileSGH = NULL;
char filename[260];
char filenameSGH[260];
int channel_count;
off_t start_offset = 0;
STREAMFILE * streamFileSGH = NULL;
char filename[260];
char filenameSGH[260];
int channel_count;
int loop_flag;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("sgb",filename_extension(filename))) goto fail;
strcpy(filenameSGH,filename);
strcpy(filenameSGH,filename);
strcpy(filenameSGH+strlen(filenameSGH)-3,"sgh");
streamFileSGH = streamFile->open(streamFile,filenameSGH,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!streamFileSGH) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFileSGH) != 0x53475844) /* "SGXD" */
streamFileSGH = streamFile->open(streamFile,filenameSGH,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!streamFileSGH) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFileSGH) != 0x53475844) /* "SGXD" */
goto fail;
channel_count = read_32bitLE(0x6C,streamFileSGH);
channel_count = read_32bitLE(0x6C,streamFileSGH);
if (read_32bitBE(0x44,streamFileSGH)==0xFFFFFFFF)
loop_flag = 0;
else
@ -36,14 +36,14 @@ VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE *streamFile) {
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x2C,streamFileSGH);
vgmstream->num_samples = read_32bitLE(0xC,streamFileSGH)*28/32;
vgmstream->coding_type = coding_PSX;
if(loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x44,streamFileSGH);
vgmstream->loop_end_sample = read_32bitLE(0x48,streamFileSGH);
}
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x2C,streamFileSGH);
vgmstream->num_samples = read_32bitLE(0xC,streamFileSGH)*28/32;
vgmstream->coding_type = coding_PSX;
if(loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x44,streamFileSGH);
vgmstream->loop_end_sample = read_32bitLE(0x48,streamFileSGH);
}
vgmstream->layout_type = layout_interleave;

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

@ -0,0 +1,74 @@
#include "meta.h"
#include "../util.h"
/* RAS (from Donkey Kong Country Returns) */
VGMSTREAM * init_vgmstream_wii_ras(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("ras",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x5241535F) /* "RAS_" */
goto fail;
loop_flag = 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 = read_32bitBE(0x18,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x14,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0xc,streamFile);
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x20,streamFile);
vgmstream->meta_type = meta_WII_RAS;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x40+i*2,streamFile);
}
if (channel_count == 2) {
for (i=0;i<16;i++)
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x70+i*2,streamFile);
}
}
/* open the file for reading */
{
int i;
for (i=0;i<channel_count;i++) {
if (vgmstream->layout_type==layout_interleave_shortblock)
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
vgmstream->interleave_block_size);
else
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
0x1000);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
start_offset + i*vgmstream->interleave_block_size;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -60,6 +60,7 @@ fail:
return NULL;
}
#ifdef x360_tra
VGMSTREAM * init_vgmstream_xbox_tra(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
@ -110,3 +111,4 @@ fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
#endif

View File

@ -282,7 +282,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_dsp_dspw,
init_vgmstream_ps2_jstm,
init_vgmstream_ps3_xvag,
init_vgmstream_ps2_mtaf,
//init_vgmstream_ps2_mtaf,
init_vgmstream_ps3_cps,
init_vgmstream_se_scd,
init_vgmstream_ngc_nst_dsp,
@ -291,9 +291,10 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_fsb_mpeg,
init_vgmstream_nub_vag,
init_vgmstream_ps3_past,
// init_vgmstream_ps3_sgh_sgb,
init_vgmstream_xbox_tra,
//init_vgmstream_ngca,
init_vgmstream_ps3_sgh_sgb,
//init_vgmstream_xbox_tra,
init_vgmstream_ngca,
init_vgmstream_wii_ras,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -735,10 +736,10 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_psx_mgav_blocked:
case layout_ps2_adm_blocked:
case layout_dsp_bdsp_blocked:
case layout_mtaf_blocked:
case layout_tra_blocked:
//case layout_mtaf_blocked:
/*case layout_tra_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
break;*/
case layout_interleave_byte:
render_vgmstream_interleave_byte(buffer,sample_count,vgmstream);
break;
@ -1771,9 +1772,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case layout_mxch_blocked:
snprintf(temp,TEMPSIZE,"MxCh blocked");
break;
case layout_mtaf_blocked:
/*case layout_mtaf_blocked:
snprintf(temp,TEMPSIZE,"MTAF blocked");
break;
break; */
case layout_ast_blocked:
snprintf(temp,TEMPSIZE,"AST blocked");
break;
@ -2723,8 +2724,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_NGCA:
snprintf(temp,TEMPSIZE,"NGCA header");
break;
case meta_X360_TRA:
snprintf(temp,TEMPSIZE,"Assume Def Jam Rapstar Track by .tra extension");
/*case meta_X360_TRA:
snprintf(temp,TEMPSIZE,"Assume Def Jam Rapstar Track by .tra extension"); */
case meta_WII_RAS:
snprintf(temp,TEMPSIZE,"RAS header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -158,8 +158,8 @@ typedef enum {
layout_ps2_adm_blocked,
layout_dsp_bdsp_blocked,
layout_mxch_blocked,
layout_mtaf_blocked,
layout_tra_blocked,
//layout_mtaf_blocked,
//layout_tra_blocked,
#if 0
layout_strm_blocked, /* */
@ -492,14 +492,15 @@ typedef enum {
meta_NGC_NST_DSP, /* Animaniacs [NGC] */
meta_BAF, /* .baf (Blur) */
meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_PS2_MTAF, /* Metal Gear 3 MTAF */
//meta_PS2_MTAF, /* Metal Gear 3 MTAF */
meta_PS3_CPS, /* Eternal Sonata (PS3) */
meta_PS3_MSF, /* MSF header */
meta_NUB_VAG, /* VAG from Nub archives */
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
meta_PS3_SGH_SGB, /* Folklore (PS3) */
meta_NGCA, /* GoldenEye 007 (Wii) */
meta_X360_TRA, /* Def Jam Rapstar */
//meta_X360_TRA, /* Def Jam Rapstar */
meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */
} meta_t;
typedef struct {

View File

@ -153,6 +153,7 @@ gchar *vgmstream_exts [] = {
"psh",
"psw",
"ras",
"raw",
"rkv",
"rnd",

View File

@ -220,7 +220,8 @@ char * extension_list[] = {
"psh\0PSH Audio File (*.PSH)\0",
"psw\0PSW Audio File (*.PSW)\0",
"raw\0RAW Audio File (*.RAW)\0",
"ras\0RAS Audio File (*.RAS)\0",
"raw\0RAW Audio File (*.RAW)\0",
"rkv\0RKV Audio File (*.RKV)\0",
"rnd\0RND Audio File (*.RND)\0",
"rrds\0RRDS Audio File (*.RRDS)\0",