Added initial support for .TUN (LEGO Racers (PC)), broken though (for now)

Added .WPD support for Shuffle! (PC)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@951 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2011-05-18 20:33:00 +00:00
parent cd8908869f
commit d4e2f18106
11 changed files with 153 additions and 1 deletions

View File

@ -478,6 +478,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"tk1")) return 1; if(!stricmp_utf8(p_extension,"tk1")) return 1;
if(!stricmp_utf8(p_extension,"tk5")) return 1; if(!stricmp_utf8(p_extension,"tk5")) return 1;
if(!stricmp_utf8(p_extension,"tra")) return 1; if(!stricmp_utf8(p_extension,"tra")) return 1;
if(!stricmp_utf8(p_extension,"tun")) return 1;
if(!stricmp_utf8(p_extension,"tydsp")) return 1; if(!stricmp_utf8(p_extension,"tydsp")) return 1;
if(!stricmp_utf8(p_extension,"um3")) return 1; if(!stricmp_utf8(p_extension,"um3")) return 1;
@ -504,6 +505,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"wii")) return 1; if(!stricmp_utf8(p_extension,"wii")) return 1;
if(!stricmp_utf8(p_extension,"wmus")) return 1; if(!stricmp_utf8(p_extension,"wmus")) return 1;
if(!stricmp_utf8(p_extension,"wp2")) return 1; if(!stricmp_utf8(p_extension,"wp2")) return 1;
if(!stricmp_utf8(p_extension,"wpd")) return 1;
if(!stricmp_utf8(p_extension,"wsd")) return 1; if(!stricmp_utf8(p_extension,"wsd")) return 1;
if(!stricmp_utf8(p_extension,"wsi")) return 1; if(!stricmp_utf8(p_extension,"wsi")) return 1;
if(!stricmp_utf8(p_extension,"wvs")) return 1; if(!stricmp_utf8(p_extension,"wvs")) return 1;
@ -784,6 +786,7 @@ DECLARE_MULTIPLE_FILE_TYPE("TEC Audio File (*.TEC)", tec);
DECLARE_MULTIPLE_FILE_TYPE("THP Audio File (*.THP)", thp); DECLARE_MULTIPLE_FILE_TYPE("THP Audio File (*.THP)", thp);
DECLARE_MULTIPLE_FILE_TYPE("TK1 Audio File (*.TK1)", tk1); DECLARE_MULTIPLE_FILE_TYPE("TK1 Audio File (*.TK1)", tk1);
DECLARE_MULTIPLE_FILE_TYPE("TK5 Audio File (*.TK5)", tk5); DECLARE_MULTIPLE_FILE_TYPE("TK5 Audio File (*.TK5)", tk5);
DECLARE_MULTIPLE_FILE_TYPE("TUN Audio File (*.TUN)", tun);
DECLARE_MULTIPLE_FILE_TYPE("TYDSP Audio File (*.TYDSP)", tydsp); DECLARE_MULTIPLE_FILE_TYPE("TYDSP Audio File (*.TYDSP)", tydsp);
DECLARE_MULTIPLE_FILE_TYPE("UM3 Audio File (*.UM3)", um3); DECLARE_MULTIPLE_FILE_TYPE("UM3 Audio File (*.UM3)", um3);
@ -809,6 +812,7 @@ DECLARE_MULTIPLE_FILE_TYPE("WAS Audio File (*.WAS)", was);
DECLARE_MULTIPLE_FILE_TYPE("WII Audio File (*.WII)", wii); DECLARE_MULTIPLE_FILE_TYPE("WII Audio File (*.WII)", wii);
DECLARE_MULTIPLE_FILE_TYPE("WMUS Audio File (*.WMUS)", wmus); DECLARE_MULTIPLE_FILE_TYPE("WMUS Audio File (*.WMUS)", wmus);
DECLARE_MULTIPLE_FILE_TYPE("WP2 Audio File (*.WP2)", wp2); DECLARE_MULTIPLE_FILE_TYPE("WP2 Audio File (*.WP2)", wp2);
DECLARE_MULTIPLE_FILE_TYPE("WPD Audio File (*.WPD)", wpd);
DECLARE_MULTIPLE_FILE_TYPE("WSD Audio File (*.WSD)", wsd); DECLARE_MULTIPLE_FILE_TYPE("WSD Audio File (*.WSD)", wsd);
DECLARE_MULTIPLE_FILE_TYPE("WSI Audio File (*.WSI)", wsi); DECLARE_MULTIPLE_FILE_TYPE("WSI Audio File (*.WSI)", wsi);
DECLARE_MULTIPLE_FILE_TYPE("WVS Audio File (*.WVS)", wvs); DECLARE_MULTIPLE_FILE_TYPE("WVS Audio File (*.WVS)", wvs);

View File

@ -280,7 +280,9 @@ META_OBJS=meta/adx_header.o \
meta/pc_adp.o \ meta/pc_adp.o \
meta/excitebots.o \ meta/excitebots.o \
meta/ps3_klbs.o \ meta/ps3_klbs.o \
meta/ps2_mtaf.o meta/ps2_mtaf.o \
meta/tun.o \
meta/wpd.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -1006,6 +1006,10 @@
RelativePath=".\meta\thp.c" RelativePath=".\meta\thp.c"
> >
</File> </File>
<File
RelativePath=".\meta\tun.c"
>
</File>
<File <File
RelativePath=".\meta\vgs.c" RelativePath=".\meta\vgs.c"
> >
@ -1046,6 +1050,10 @@
RelativePath=".\meta\wii_sts.c" RelativePath=".\meta\wii_sts.c"
> >
</File> </File>
<File
RelativePath=".\meta\wpd.c"
>
</File>
<File <File
RelativePath=".\meta\ws_aud.c" RelativePath=".\meta\ws_aud.c"
> >

View File

@ -227,5 +227,7 @@ libmeta_la_SOURCES += pc_adp.c
libmeta_la_SOURCES += excitebots.c libmeta_la_SOURCES += excitebots.c
libmeta_la_SOURCES += ps2_mtaf.c libmeta_la_SOURCES += ps2_mtaf.c
libmeta_la_SOURCES += ps3_klbs.c libmeta_la_SOURCES += ps3_klbs.c
libmeta_la_SOURCES += tun.c
libmeta_la_SOURCES += wpd.c
EXTRA_DIST = meta.h EXTRA_DIST = meta.h

View File

@ -577,4 +577,8 @@ VGMSTREAM * init_vgmstream_ps3_sgx(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_tun(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_wpd(STREAMFILE* streamFile);
#endif #endif

59
src/meta/tun.c Normal file
View File

@ -0,0 +1,59 @@
#include "meta.h"
#include "../util.h"
/* TUN (from LEGO Racers (PC)) */
VGMSTREAM * init_vgmstream_tun(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int channel_count;
int loop_flag;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("tun",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x414C5020) /* "ALP " */
goto fail;
channel_count = 2;
loop_flag = 0;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x10;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 22050;
vgmstream->coding_type = coding_DVI_IMA;
vgmstream->num_samples = (get_streamfile_size(streamFile)) - 0x10;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 1;
vgmstream->meta_type = meta_TUN;
/* 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;
}

59
src/meta/wpd.c Normal file
View File

@ -0,0 +1,59 @@
#include "meta.h"
#include "../util.h"
/* WPD (from Shuffle! (PC)) */
VGMSTREAM * init_vgmstream_wpd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int channel_count;
int loop_flag;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("wpd",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x20445057) /* " DPW" */
goto fail;
channel_count = read_32bitLE(0x4,streamFile);
loop_flag = 0;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x30;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = (read_32bitLE(0x14,streamFile))/2/channel_count;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 2;
vgmstream->meta_type = meta_WPD;
/* 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;
}

View File

@ -310,6 +310,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps3_klbs, init_vgmstream_ps3_klbs,
init_vgmstream_ps3_sgx, init_vgmstream_ps3_sgx,
init_vgmstream_ps2_mtaf, init_vgmstream_ps2_mtaf,
init_vgmstream_tun,
init_vgmstream_wpd,
}; };
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2854,6 +2856,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case meta_PS2_VAG2: case meta_PS2_VAG2:
snprintf(temp,TEMPSIZE,"Konami VAG Stereo header (VAG2)"); snprintf(temp,TEMPSIZE,"Konami VAG Stereo header (VAG2)");
break;
case meta_TUN:
snprintf(temp,TEMPSIZE,"TUN 'ALP' header");
break;
case meta_WPD:
snprintf(temp,TEMPSIZE,"WPD 'DPW' header");
break; break;
default: default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -524,6 +524,8 @@ typedef enum {
meta_PS2_MTAF, // Metal Gear Solid 3 MTAF meta_PS2_MTAF, // Metal Gear Solid 3 MTAF
meta_PS2_VAG1, // Metal Gear Solid 3 VAG1 meta_PS2_VAG1, // Metal Gear Solid 3 VAG1
meta_PS2_VAG2, // Metal Gear Solid 3 VAG2 meta_PS2_VAG2, // Metal Gear Solid 3 VAG2
meta_TUN, // LEGO Racers (PC)
meta_WPD, // Shuffle! (PC)
} meta_t; } meta_t;
typedef struct { typedef struct {

View File

@ -225,6 +225,7 @@ gchar *vgmstream_exts [] = {
"tk1", "tk1",
"tk5", "tk5",
"tra", "tra",
"tun",
"tydsp", "tydsp",
"um3", "um3",
@ -251,6 +252,7 @@ gchar *vgmstream_exts [] = {
"wii", "wii",
"wmus", "wmus",
"wp2", "wp2",
"wpd",
"wsd", "wsd",
"wsi", "wsi",
"wvs", "wvs",

View File

@ -295,6 +295,7 @@ char * extension_list[] = {
"tk1\0TK1 Audio File (*.TK1)\0", "tk1\0TK1 Audio File (*.TK1)\0",
"tk5\0TK5 Audio File (*.TK5)\0", "tk5\0TK5 Audio File (*.TK5)\0",
"tra\0TRA Audio File (*.TRA)\0", "tra\0TRA Audio File (*.TRA)\0",
"tun\0TUN Audio File (*.TUN)\0",
"tydsp\0TYDSP Audio File (*.TYDSP)\0", "tydsp\0TYDSP Audio File (*.TYDSP)\0",
"um3\0UM3 Audio File (*.UM3)\0", "um3\0UM3 Audio File (*.UM3)\0",
@ -322,6 +323,7 @@ char * extension_list[] = {
"wii\0WII Audio File (*.WII)\0", "wii\0WII Audio File (*.WII)\0",
"wmus\0WMUS Audio File (*.WMUS)\0", "wmus\0WMUS Audio File (*.WMUS)\0",
"wp2\0WP2 Audio File (*.WP2)\0", "wp2\0WP2 Audio File (*.WP2)\0",
"wpd\0WPD Audio File (*.WPD)\0",
"wsd\0WSD Audio File (*.WSD)\0", "wsd\0WSD Audio File (*.WSD)\0",
"wsi\0WSI Audio File (*.WSI)\0", "wsi\0WSI Audio File (*.WSI)\0",
"wvs\0WVS Audio File (*.WVS)\0", "wvs\0WVS Audio File (*.WVS)\0",