mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-07 15:01:24 +01:00
Add .wav/lwav extension for .gcub [Sega Soccer Slam (GC)]
This commit is contained in:
parent
f20310c02c
commit
6de8142826
@ -1095,7 +1095,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_2DX9, "beatmania IIDX 2DX9 header"},
|
{meta_2DX9, "beatmania IIDX 2DX9 header"},
|
||||||
{meta_DSP_YGO, "Konami custom DSP Header"},
|
{meta_DSP_YGO, "Konami custom DSP Header"},
|
||||||
{meta_PS2_VGV, "Rune: Viking Warlord VGV Header"},
|
{meta_PS2_VGV, "Rune: Viking Warlord VGV Header"},
|
||||||
{meta_NGC_GCUB, "GCub Header"},
|
{meta_GCUB, "Sega GCub header"},
|
||||||
{meta_NGC_SCK_DSP, "The Scorpion King SCK Header"},
|
{meta_NGC_SCK_DSP, "The Scorpion King SCK Header"},
|
||||||
{meta_CAFF, "Apple Core Audio Format File header"},
|
{meta_CAFF, "Apple Core Audio Format File header"},
|
||||||
{meta_PC_MXST, "Lego Island MxSt Header"},
|
{meta_PC_MXST, "Lego Island MxSt Header"},
|
||||||
|
122
src/meta/gcub.c
122
src/meta/gcub.c
@ -1,103 +1,53 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* GCUB - found in 'Sega Soccer Slam' */
|
/* GCub - found in Sega Soccer Slam (GC) */
|
||||||
VGMSTREAM * init_vgmstream_ngc_gcub(STREAMFILE *streamFile) {
|
VGMSTREAM* init_vgmstream_gcub(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
off_t start_offset;
|
||||||
off_t start_offset;
|
int channels, loop_flag, sample_rate;
|
||||||
int loop_flag;
|
size_t data_size;
|
||||||
int channel_count;
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("gcub",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
/* checks */
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x47437562) /* "GCub" */
|
/* .wav: extension found in bigfile
|
||||||
goto fail;
|
* .gcub: header id */
|
||||||
|
if (!check_extensions(sf, "wav,lwav,gcub"))
|
||||||
|
goto fail;
|
||||||
|
if (!is_id32be(0x00,sf, "GCub"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
channel_count = read_32bitBE(0x04,streamFile);
|
channels = read_u32be(0x04,sf);
|
||||||
|
sample_rate = read_u32be(0x08,sf);
|
||||||
|
data_size = read_u32be(0x0c,sf);
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
if (is_id32be(0x60,sf, "GCxx")) /* seen in sfx */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
start_offset = 0x88;
|
||||||
|
else
|
||||||
|
start_offset = 0x60;
|
||||||
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
vgmstream->meta_type = meta_GCUB;
|
||||||
if (read_32bitBE(0x60,streamFile) == 0x47437878) /* "GCxx" */
|
vgmstream->sample_rate = sample_rate;
|
||||||
{
|
vgmstream->num_samples = dsp_bytes_to_samples(data_size, channels);
|
||||||
start_offset = 0x88;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
start_offset = 0x60;
|
|
||||||
}
|
|
||||||
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
|
|
||||||
vgmstream->coding_type = coding_NGC_DSP;
|
vgmstream->coding_type = coding_NGC_DSP;
|
||||||
vgmstream->num_samples = (read_32bitBE(0x0C,streamFile)-start_offset)/8/channel_count*14;
|
vgmstream->layout_type = layout_interleave;
|
||||||
if (loop_flag) {
|
vgmstream->interleave_block_size = 0x8000;
|
||||||
vgmstream->loop_start_sample = 0;
|
|
||||||
vgmstream->loop_end_sample = (read_32bitBE(0x0C,streamFile)-start_offset)/8/channel_count*14;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
dsp_read_coefs_be(vgmstream, sf, 0x10, 0x20);
|
||||||
|
/* 0x50: initial ps for ch1/2 (16b) */
|
||||||
|
/* 0x54: hist? (always blank) */
|
||||||
|
|
||||||
if (channel_count == 1)
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||||
{
|
goto fail;
|
||||||
vgmstream->layout_type = layout_none;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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 == 2) {
|
|
||||||
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;
|
|
||||||
|
|
||||||
/* 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=start_offset+vgmstream->interleave_block_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE * streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_vgv(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_ps2_vgv(STREAMFILE * streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ngc_gcub(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_gcub(STREAMFILE * streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_maxis_xa(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_maxis_xa(STREAMFILE * streamFile);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
|||||||
init_vgmstream_2dx9,
|
init_vgmstream_2dx9,
|
||||||
init_vgmstream_dsp_ygo,
|
init_vgmstream_dsp_ygo,
|
||||||
init_vgmstream_ps2_vgv,
|
init_vgmstream_ps2_vgv,
|
||||||
init_vgmstream_ngc_gcub,
|
init_vgmstream_gcub,
|
||||||
init_vgmstream_maxis_xa,
|
init_vgmstream_maxis_xa,
|
||||||
init_vgmstream_ngc_sck_dsp,
|
init_vgmstream_ngc_sck_dsp,
|
||||||
init_vgmstream_apple_caff,
|
init_vgmstream_apple_caff,
|
||||||
|
@ -515,7 +515,7 @@ typedef enum {
|
|||||||
meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||||
meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||||
meta_PS2_VGV, /* Rune: Viking Warlord */
|
meta_PS2_VGV, /* Rune: Viking Warlord */
|
||||||
meta_NGC_GCUB, /* Sega Soccer Slam */
|
meta_GCUB,
|
||||||
meta_MAXIS_XA, /* Sim City 3000 (PC) */
|
meta_MAXIS_XA, /* Sim City 3000 (PC) */
|
||||||
meta_NGC_SCK_DSP, /* Scorpion King (NGC) */
|
meta_NGC_SCK_DSP, /* Scorpion King (NGC) */
|
||||||
meta_CAFF, /* iPhone .caf */
|
meta_CAFF, /* iPhone .caf */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user