Unmerged changes

This commit is contained in:
Chris Moeller 2012-09-04 20:33:13 -07:00
commit 71d7cb07b4
14 changed files with 114 additions and 4 deletions

Binary file not shown.

Binary file not shown.

BIN
ext_libs/libmpg123-0.exp Normal file

Binary file not shown.

BIN
ext_libs/libmpg123-0.lib Normal file

Binary file not shown.

BIN
ext_libs/libvorbis.exp Normal file

Binary file not shown.

BIN
ext_libs/libvorbis.lib Normal file

Binary file not shown.

View File

@ -618,4 +618,6 @@ VGMSTREAM * init_vgmstream_ps3_ivag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_2pfs(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE* streamFile);
#endif

View File

@ -106,6 +106,29 @@ static size_t read_func_scd(void *ptr, size_t size, size_t nmemb, void * datasou
return items_read;
}
static size_t read_func_psych(void *ptr, size_t size, size_t nmemb, void * datasource)
{
ogg_vorbis_streamfile * const ov_streamfile = datasource;
size_t items_read;
size_t bytes_read;
size_t i;
bytes_read = read_streamfile(ptr, ov_streamfile->offset + ov_streamfile->other_header_bytes, size * nmemb,
ov_streamfile->streamfile);
/* add 0x23 ('#') */
for (i=0;i<bytes_read;i++)
((uint8_t*)ptr)[i] += 0x23;
items_read = bytes_read / size;
ov_streamfile->offset += items_read * size;
return items_read;
}
static int seek_func(void *datasource, ogg_int64_t offset, int whence) {
ogg_vorbis_streamfile * const ov_streamfile = datasource;
ogg_int64_t base_offset;
@ -155,6 +178,7 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
off_t other_header_bytes = 0;
int um3_ogg = 0;
int kovs_ogg = 0;
int psych_ogg = 0;
vgm_vorbis_info_t inf;
memset(&inf, 0, sizeof(inf));
@ -195,10 +219,17 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
other_header_bytes = 0x20;
}
/* detect Psychic Software obfuscation (as seen in "Darkwind") */
if (read_32bitBE(0x0,streamFile)==0x2c444430) {
psych_ogg = 1;
}
if (um3_ogg) {
callbacks.read_func = read_func_um3;
} else if (kovs_ogg) {
callbacks.read_func = read_func_kovs;
} else if (psych_ogg) {
callbacks.read_func = read_func_psych;
} else {
callbacks.read_func = read_func;
}
@ -210,6 +241,8 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
inf.meta_type = meta_um3_ogg;
} else if (kovs_ogg) {
inf.meta_type = meta_KOVS_ogg;
} else if (psych_ogg) {
inf.meta_type = meta_psych_ogg;
} else {
inf.meta_type = meta_ogg_vorbis;
}

View File

@ -960,6 +960,72 @@ fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
/* RSD6OGG */
VGMSTREAM * init_vgmstream_rsd6oogv(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("rsd",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x52534436) /* RSD6 */
goto fail;
if (read_32bitBE(0x4,streamFile) != 0x4F4F4756) /* OOGV */
goto fail;
#ifdef VGM_USE_VORBIS
{
vgm_vorbis_info_t inf;
VGMSTREAM * result = NULL;
memset(&inf, 0, sizeof(inf));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_RSD6OOGV;
start_offset = 0x800;
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
if (result != NULL) {
return result;
}
}
#endif
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = read_32bitLE(0x8,streamFile);
vgmstream->sample_rate = read_32bitLE(0x10,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;
}
}
return vgmstream;
fail:
/* clean up anything we may have opened */
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
/* RSD6XADP */
VGMSTREAM * init_vgmstream_rsd6xadp(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;

View File

@ -323,6 +323,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps3_ivag,
init_vgmstream_ps2_2pfs,
init_vgmstream_xnbm,
init_vgmstream_rsd6oogv,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2246,6 +2247,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_KOVS_ogg:
snprintf(temp,TEMPSIZE,"Ogg Vorbis, KOVS header");
break;
case meta_psych_ogg:
snprintf(temp,TEMPSIZE,"Ogg Vorbis, Psychic Software obfuscation");
break;
#endif
case meta_DSP_SADB:
snprintf(temp,TEMPSIZE,"sadb header");
@ -2970,6 +2974,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_PS2_2PFS:
snprintf(temp,TEMPSIZE,"PS2 '2PFS' Header");
break;
case meta_RSD6OOGV:
snprintf(temp,TEMPSIZE,"RSD6/OOGV Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -362,6 +362,7 @@ typedef enum {
meta_RSD6WADP, /* RSD6WADP */
meta_RSD6XADP, /* RSD6XADP */
meta_RSD6RADP, /* RSD6RADP */
meta_RSD6OOGV, /* RSD6OOGV */
meta_PS2_ASS, /* ASS */
meta_PS2_SEG, /* Eragon */
@ -414,6 +415,7 @@ typedef enum {
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
meta_um3_ogg, /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */
meta_KOVS_ogg, /* Ogg Vorbis with exta header and 0x100 bytes XOR */
meta_psych_ogg, /* Ogg Vorbis with all bytes -0x23*/
#endif
meta_AIFC, /* Audio Interchange File Format AIFF-C */

View File

@ -1,6 +1,6 @@
export SHELL = /bin/sh
export CFLAGS=-Wall -ggdb
export LDFLAGS=-lm -L../src -lvgmstream -lvorbisfile -lmpg123
export LDFLAGS= -L../src -lvgmstream -lvorbisfile -lmpg123 -lm
export STRIP=strip
.PHONY: libvgmstream.a

View File

@ -1,6 +1,6 @@
export SHELL = /bin/sh
export CFLAGS=-Wall -O3 -DVGM_USE_G7221 -I../ext_includes
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode
export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode -lm
export CC=i586-mingw32msvc-gcc
export AR=i586-mingw32msvc-ar
export STRIP=i586-mingw32msvc-strip

View File

@ -1,6 +1,6 @@
export SHELL = /bin/sh
export CFLAGS=-Wall -O3 "-DVGM_USE_G7221" -I../ext_includes
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode
export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode -lm
export CC=i586-mingw32msvc-gcc
export AR=i586-mingw32msvc-ar
export STRIP=i586-mingw32msvc-strip