mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
.gcub added for "Sega Soccer Slam"
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@669 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
6c74404c37
commit
d003418862
@ -200,7 +200,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/sd9.o \
|
||||
meta/2dx.o \
|
||||
meta/ngc_dsp_ygo.o \
|
||||
meta/ps2_vgv.o
|
||||
meta/ps2_vgv.o \
|
||||
meta/ngc_gcub.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -422,6 +422,10 @@
|
||||
RelativePath=".\meta\ngc_ffcc_str.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_gcub.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_lps.c"
|
||||
>
|
||||
|
@ -160,5 +160,6 @@ libmeta_la_SOURCES += sd9.c
|
||||
libmeta_la_SOURCES += 2dx.c
|
||||
libmeta_la_SOURCES += ngc_dsp_ygo.c
|
||||
libmeta_la_SOURCES += ps2_vgv.c
|
||||
libmeta_la_SOURCES += ngc_gcub.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -397,4 +397,6 @@ VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_vgv(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_gcub(STREAMFILE * streamFile);
|
||||
|
||||
#endif
|
||||
|
76
src/meta/ngc_gcub.c
Normal file
76
src/meta/ngc_gcub.c
Normal file
@ -0,0 +1,76 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* GCUB - found in 'Sega Soccer Slam' */
|
||||
VGMSTREAM * init_vgmstream_ngc_gcub(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("gcub",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x47437562) /* "GCub" */
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitBE(0x04,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x60;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = (read_32bitBE(0x0C,streamFile)-start_offset)/8/channel_count*14;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitBE(0x0C,streamFile)-start_offset)/8/channel_count*14;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x8000; // read_32bitBE(0x04,streamFile);
|
||||
vgmstream->meta_type = meta_NGC_GCUB;
|
||||
|
||||
if (vgmstream->coding_type == coding_NGC_DSP) {
|
||||
int i;
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x10+i*2,streamFile);
|
||||
}
|
||||
if (vgmstream->channels) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x30+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;
|
||||
|
||||
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;
|
||||
}
|
@ -218,6 +218,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_2dx,
|
||||
init_vgmstream_dsp_ygo,
|
||||
init_vgmstream_ps2_vgv,
|
||||
init_vgmstream_ngc_gcub,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2218,6 +2219,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_PS2_VGV:
|
||||
snprintf(temp,TEMPSIZE,"Rune: Viking Warlord VGV Header");
|
||||
break;
|
||||
case meta_NGC_GCUB:
|
||||
snprintf(temp,TEMPSIZE,"Sega Soccer Slam GCub Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -400,6 +400,7 @@ typedef enum {
|
||||
meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||
meta_2DX, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||
meta_PS2_VGV, /* Rune: Viking Warlord */
|
||||
meta_NGC_GCUB, /* Rune: Viking Warlord */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -132,6 +132,7 @@ char * extension_list[] = {
|
||||
"gbts\0GBTS Audio File (*.GBTS)\0",
|
||||
"gca\0GCA Audio File (*.GCA)\0",
|
||||
"gcm\0GCM Audio File (*.GCM)\0",
|
||||
"gcub\0GCUB Audio File (*.GCUB)\0",
|
||||
"gcw\0GCW Audio File (*.GCW)\0",
|
||||
"genh\0GENH Audio File (*.GENH)\0",
|
||||
"gms\0GMS Audio File (*.GMS)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user