mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-20 20:41:08 +01:00
fsb updated (fsb4)
nds strm fixed genh dsp interleave types added git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@489 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
e7ca2efac2
commit
a41c341a18
102
src/meta/fsb.c
102
src/meta/fsb.c
@ -58,15 +58,20 @@ VGMSTREAM * init_vgmstream_fsb1(STREAMFILE *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;
|
||||
|
||||
@ -219,3 +224,94 @@ fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FSB4 */
|
||||
VGMSTREAM * init_vgmstream_fsb4(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
/* int fsb1_included_files; */
|
||||
int fsb4_format;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("fsb",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x46534234) /* "FSB4" */
|
||||
goto fail;
|
||||
|
||||
/* "Check if the FSB is used as
|
||||
conatiner or as single file" */
|
||||
if (read_32bitBE(0x04,streamFile) != 0x01000000)
|
||||
goto fail;
|
||||
|
||||
|
||||
if (read_32bitBE(0x60,streamFile) == 0x40008800) {
|
||||
loop_flag = 1;
|
||||
} else {
|
||||
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 = 0x80;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x64,streamFile);
|
||||
fsb4_format = read_32bitBE(0x60,streamFile);
|
||||
switch (fsb4_format) {
|
||||
/* PS2 (Spider Man - Web of Shadows), Speed Racer */
|
||||
case 0x40008800:
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->num_samples = (read_32bitLE(0x54,streamFile))*28/16/channel_count;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x50,streamFile);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
|
||||
}
|
||||
|
||||
vgmstream->meta_type = meta_FSB4;
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,8 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
int32_t start_offset;
|
||||
int32_t header_size;
|
||||
int32_t coef[2];
|
||||
|
||||
int32_t dsp_interleave_type;
|
||||
|
||||
char filename[260];
|
||||
int coding;
|
||||
#ifdef VGM_USE_MPEG
|
||||
@ -52,6 +53,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
/* 10 = AICA ADPCM */
|
||||
/* 11 = MS ADPCM */
|
||||
/* 12 = NGC DSP */
|
||||
/* 13 = 8bit unsingned PCM */
|
||||
/* ... others to come */
|
||||
switch (read_32bitLE(0x18,streamFile)) {
|
||||
case 0:
|
||||
@ -97,6 +99,9 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
case 12:
|
||||
coding = coding_NGC_DSP;
|
||||
break;
|
||||
case 13:
|
||||
coding = coding_PCM8_U_int;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
@ -120,7 +125,8 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
|
||||
coef[0] = read_32bitLE(0x24,streamFile);
|
||||
coef[1] = read_32bitLE(0x28,streamFile);
|
||||
|
||||
dsp_interleave_type = read_32bitLE(0x2C,streamFile);
|
||||
|
||||
//if (coding == coding_XBOX && channel_count != 2) goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
@ -137,7 +143,10 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_flag = (loop_start != -1);
|
||||
|
||||
switch (coding) {
|
||||
case coding_PCM16LE:
|
||||
case coding_PCM8_U_int:
|
||||
vgmstream->layout_type=layout_none;
|
||||
break;
|
||||
case coding_PCM16LE:
|
||||
case coding_PCM16BE:
|
||||
case coding_PCM8:
|
||||
case coding_SDX2:
|
||||
@ -172,22 +181,19 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
break;
|
||||
case coding_XBOX:
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
break;
|
||||
case coding_NGC_DTK:
|
||||
vgmstream->layout_type = layout_dtk_interleave;
|
||||
break;
|
||||
case coding_NGC_DSP:
|
||||
if (channel_count > 1) {
|
||||
if (interleave < 9) {
|
||||
vgmstream->layout_type = layout_interleave_byte;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
} else if (interleave > 8) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
} else {
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
if (dsp_interleave_type == 0) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
} else if (dsp_interleave_type == 1) {
|
||||
vgmstream->layout_type = layout_interleave_byte;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
} else if (dsp_interleave_type == 2) {
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -220,6 +226,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
case coding_DVI_IMA:
|
||||
case coding_IMA:
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_U_int:
|
||||
case coding_AICA:
|
||||
case coding_INT_DVI_IMA:
|
||||
case coding_INT_IMA:
|
||||
|
@ -135,6 +135,8 @@ VGMSTREAM * init_vgmstream_fsb1(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_fsb3(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_fsb4(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_rwx(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_xwb(STREAMFILE * streamFile);
|
||||
|
@ -20,15 +20,14 @@ VGMSTREAM * init_vgmstream_nds_strm(STREAMFILE *streamFile) {
|
||||
/* check header */
|
||||
if ((uint32_t)read_32bitBE(0x00,streamFile)!=0x5354524D) /* STRM */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x04,streamFile)!=0xFFFE0001) { /* Old Header Check */
|
||||
if ((uint32_t)read_32bitBE(0x04,streamFile)!=0xFFFE0001 && /* Old Header Check */
|
||||
((uint32_t)read_32bitBE(0x04,streamFile)!=0xFEFF0001)) /* Some newer games have a new flag */
|
||||
goto fail;
|
||||
} else if (read_32bitBE(0x04,streamFile)!=0xFEFF0001) { /* Some newer games have a new flag */
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check for HEAD section */
|
||||
if ((uint32_t)read_32bitBE(0x10,streamFile)!=0x48454144 || /* "HEAD" */
|
||||
if ((uint32_t)read_32bitBE(0x10,streamFile)!=0x48454144 && /* "HEAD" */
|
||||
(uint32_t)read_32bitLE(0x14,streamFile)!=0x50) /* 0x50-sized head is all I've seen */
|
||||
goto fail;
|
||||
|
||||
|
@ -82,6 +82,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_rws,
|
||||
init_vgmstream_fsb1,
|
||||
init_vgmstream_fsb3,
|
||||
init_vgmstream_fsb4,
|
||||
init_vgmstream_rwx,
|
||||
init_vgmstream_xwb,
|
||||
init_vgmstream_xa30,
|
||||
@ -1645,6 +1646,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_FSB3:
|
||||
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB3) Header");
|
||||
break;
|
||||
case meta_FSB4:
|
||||
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB4) Header");
|
||||
break;
|
||||
case meta_RWX:
|
||||
snprintf(temp,TEMPSIZE,"RWX Header");
|
||||
|
@ -207,6 +207,7 @@ typedef enum {
|
||||
meta_RWS, /* Variuos Konami Games */
|
||||
meta_FSB1, /* FMOD Sample Bank, version 1 */
|
||||
meta_FSB3, /* FMOD Sample Bank, version 3 */
|
||||
meta_FSB4, /* FMOD Sample Bank, version 4 */
|
||||
meta_RWX, /* Air Force Delta Storm (XBOX) */
|
||||
meta_XWB, /* King of Fighters (XBOX) */
|
||||
meta_XA30, /* Driver - Parallel Lines (PS2) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user