mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-30 11:57:27 +01:00
Support for Turok: Evolution (NGC)
Support for Teenage Mutant Ninja Turtles 2 (NGC) renamed ps2_rkv.c to rkv.c fixes in tec.c git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@749 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
28c6dc5d5a
commit
130f1f4dff
@ -122,7 +122,7 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/sfl.o \
|
||||
meta/pcm.o \
|
||||
meta/ps2_psw.o \
|
||||
meta/ps2_rkv.o \
|
||||
meta/rkv.o \
|
||||
meta/ps2_vas.o \
|
||||
meta/ps2_tec.o \
|
||||
meta/ps2_enth.o \
|
||||
@ -220,7 +220,9 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/myspd.o \
|
||||
meta/his.o \
|
||||
meta/ps2_ast.o \
|
||||
meta/dmsg_segh.o
|
||||
meta/dmsg_segh.o \
|
||||
meta/ngc_aaap.o \
|
||||
meta/ngc_dsp_tmnt2.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -426,6 +426,10 @@
|
||||
RelativePath=".\meta\nds_swav.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_aaap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_adpdtk.c"
|
||||
>
|
||||
@ -442,6 +446,10 @@
|
||||
RelativePath=".\meta\ngc_dsp_std.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_dsp_tmnt2.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ngc_dsp_ygo.c"
|
||||
>
|
||||
@ -622,10 +630,6 @@
|
||||
RelativePath=".\meta\ps2_psw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_rkv.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_rnd.c"
|
||||
>
|
||||
@ -734,6 +738,10 @@
|
||||
RelativePath=".\meta\riff.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\rkv.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\rs03.c"
|
||||
>
|
||||
|
@ -80,7 +80,7 @@ libmeta_la_SOURCES += sli.c
|
||||
libmeta_la_SOURCES += sfl.c
|
||||
libmeta_la_SOURCES += pcm.c
|
||||
libmeta_la_SOURCES += ps2_psw.c
|
||||
libmeta_la_SOURCES += ps2_rkv.c
|
||||
libmeta_la_SOURCES += rkv.c
|
||||
libmeta_la_SOURCES += ps2_vas.c
|
||||
libmeta_la_SOURCES += ps2_tec.c
|
||||
libmeta_la_SOURCES += ps2_enth.c
|
||||
@ -178,5 +178,7 @@ libmeta_la_SOURCES += myspd.c
|
||||
libmeta_la_SOURCES += his.c
|
||||
libmeta_la_SOURCES += ps2_ast.c
|
||||
libmeta_la_SOURCES += dmsg_segh.c
|
||||
libmeta_la_SOURCES += ngc_aaap.c
|
||||
libmeta_la_SOURCES += ngc_dsp_tmnt2.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -110,13 +110,14 @@ VGMSTREAM * init_vgmstream_dc_str_v2(STREAMFILE *streamFile) {
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("str",filename_extension(filename))) goto fail;
|
||||
#if 0
|
||||
|
||||
/* check header */
|
||||
if ((read_32bitBE(0x00,streamFile) != 0x00000002) &&
|
||||
(read_32bitBE(0x10,streamFile) != 0x00000100) &&
|
||||
(read_32bitBE(0x1C,streamFile) != 0x1F000000))
|
||||
if ((read_32bitLE(0x00,streamFile) != 0x2))
|
||||
goto fail;
|
||||
if ((read_32bitLE(0x10,streamFile) != 0x10000))
|
||||
goto fail;
|
||||
if ((read_32bitLE(0x1C,streamFile) != 0x1F))
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
channel_count = 2;
|
||||
|
||||
|
@ -119,6 +119,7 @@ VGMSTREAM * init_vgmstream_fsb4(STREAMFILE *streamFile) {
|
||||
loop_flag = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (read_32bitBE(0x60,streamFile) != 0x20000882 &&
|
||||
read_32bitBE(0x60,streamFile) != 0x20100002 &&
|
||||
read_32bitBE(0x60,streamFile) != 0x20100882 &&
|
||||
@ -129,6 +130,9 @@ VGMSTREAM * init_vgmstream_fsb4(STREAMFILE *streamFile) {
|
||||
} else {
|
||||
channel_count = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
channel_count = (uint16_t)read_16bitLE(0x6E,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
|
@ -441,4 +441,8 @@ VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_dmsg(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_aaap(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_tmnt2(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
83
src/meta/ngc_aaap.c
Normal file
83
src/meta/ngc_aaap.c
Normal file
@ -0,0 +1,83 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* AAAP
|
||||
found in: Turok Evoluttion (NGC)
|
||||
*/
|
||||
VGMSTREAM * init_vgmstream_ngc_aaap(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int i, j;
|
||||
off_t start_offset;
|
||||
off_t coef_table[8] = {0x24,0x84,0xE4,0x144,0x1A4,0x204,0x264,0x2C4};
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("aaap",filename_extension(filename)))
|
||||
goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x41414170) /* "AAAp" */
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = (uint16_t)read_16bitBE(0x06,streamFile);
|
||||
|
||||
if ((read_32bitBE(0x0C,streamFile)+0x8+(channel_count*0x60)) != (get_streamfile_size(streamFile)))
|
||||
goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x8 + (channel_count * 0x60);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = read_32bitBE(0x8,streamFile);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x8,streamFile);
|
||||
}
|
||||
|
||||
if (channel_count == 1) {
|
||||
vgmstream->layout_type = layout_none;
|
||||
} else if (channel_count > 1) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = (uint16_t)read_16bitBE(0x04,streamFile);
|
||||
}
|
||||
|
||||
vgmstream->meta_type = meta_NGC_AAAP;
|
||||
|
||||
{
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+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;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
75
src/meta/ngc_dsp_tmnt2.c
Normal file
75
src/meta/ngc_dsp_tmnt2.c
Normal file
@ -0,0 +1,75 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* DSP
|
||||
Teenage Mutant Ninja Turtles 2 (NGC)
|
||||
*/
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_tmnt2(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int i, j;
|
||||
off_t start_offset;
|
||||
off_t coef_table[8] = {0x90,0xD0,0x110,0x150,0x190,0x1D0,0x210,0x250};
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("dsp",filename_extension(filename)))
|
||||
goto fail;
|
||||
|
||||
/* check header */
|
||||
if ((read_32bitBE(0x00,streamFile)+0x800) != (get_streamfile_size(streamFile)))
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_32bitBE(0x10,streamFile) != 0x0);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = (read_32bitBE(0x00,streamFile)/channel_count/8*14);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (read_32bitBE(0x14,streamFile)/channel_count/8*14);
|
||||
vgmstream->loop_end_sample = (read_32bitBE(0x00,streamFile)/channel_count/8*14);
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x100;
|
||||
vgmstream->meta_type = meta_NGC_DSP_TMNT2;
|
||||
|
||||
{
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+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;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -6,9 +6,12 @@
|
||||
VGMSTREAM * init_vgmstream_ps2_tec(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
int current_chunk;
|
||||
off_t start_offset;
|
||||
int dataBuffer = 0;
|
||||
int Founddata = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
@ -32,8 +35,37 @@ VGMSTREAM * init_vgmstream_ps2_tec(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = get_streamfile_size(streamFile)*28/16/channel_count;
|
||||
}
|
||||
|
||||
// Check the first frame header (should be always zero)
|
||||
if ((uint8_t)(read_8bit(0x00,streamFile) != 0x0))
|
||||
goto fail;
|
||||
|
||||
// Scan for Interleave
|
||||
{
|
||||
current_chunk = 16;
|
||||
while (!Founddata && current_chunk < 65536) {
|
||||
dataBuffer = (uint8_t)(read_8bit(current_chunk,streamFile));
|
||||
if (dataBuffer == 0x0) { /* "0x0" */
|
||||
Founddata = 1;
|
||||
break;
|
||||
}
|
||||
current_chunk = current_chunk + 16;
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel if we can't find an interleave
|
||||
if (Founddata == 0) {
|
||||
goto fail;
|
||||
} else if (Founddata == 1) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x4000;
|
||||
vgmstream->interleave_block_size = current_chunk;
|
||||
}
|
||||
|
||||
// Cancel if the first flag isn't invalid/bad
|
||||
if ((uint8_t)(read_8bit(0x01,streamFile) == 0x0))
|
||||
goto fail;
|
||||
if ((uint8_t)(read_8bit(0x01+current_chunk,streamFile) == 0x0))
|
||||
goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_PS2_TEC;
|
||||
|
||||
/* open the file for reading */
|
||||
|
@ -73,3 +73,5 @@ fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -241,6 +241,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_his,
|
||||
init_vgmstream_ps2_ast,
|
||||
init_vgmstream_dmsg,
|
||||
init_vgmstream_ngc_aaap,
|
||||
init_vgmstream_ngc_dsp_tmnt2,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2392,6 +2394,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_PONA_PSX:
|
||||
snprintf(temp,TEMPSIZE,"Policenauts BGM header");
|
||||
break;
|
||||
case meta_NGC_AAAP:
|
||||
snprintf(temp,TEMPSIZE,"Turok: Evolution 'AAAp' dsp header");
|
||||
break;
|
||||
case meta_NGC_DSP_TMNT2:
|
||||
snprintf(temp,TEMPSIZE,"TMNT2 dsp header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -342,6 +342,7 @@ typedef enum {
|
||||
meta_PS2_SPS, /* Ape Escape 2 */
|
||||
meta_PS2_XA2_RRP, /* RC Revenge Pro */
|
||||
meta_PS2_STM, /* Red Dead Revolver .stm, renamed .ps2stm */
|
||||
meta_NGC_DSP_TMNT2, /* Teenage Mutant Ninja Turtles 2 */
|
||||
|
||||
meta_XBOX_WAVM, /* XBOX WAVM File */
|
||||
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
|
||||
@ -429,6 +430,7 @@ typedef enum {
|
||||
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
|
||||
meta_PS2_AST, /* Some KOEI game (PS2) */
|
||||
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
|
||||
meta_NGC_AAAP, /* Turok: Evolution (NGC) */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -82,6 +82,7 @@ char * extension_list[] = {
|
||||
|
||||
"2dx\0""2DX Audio File (*.2DX)\0",
|
||||
|
||||
"aaap\0AAAP Audio File (*.AAAP)\0",
|
||||
"aax\0AAX Audio File (*.AAX)\0",
|
||||
"acm\0ACM Audio File (*.ACM)\0",
|
||||
"adpcm\0ADPCM Audio File (*.ADPCM)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user