fixed offset detection on SS2

add AUS Xbox support
add RND PS2 support


git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@424 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-08-21 20:09:06 +00:00
parent b6e2c1249c
commit ded69c17d7
7 changed files with 84 additions and 22 deletions

View File

@ -436,6 +436,10 @@
RelativePath=".\meta\ps2_rkv.c"
>
</File>
<File
RelativePath=".\meta\ps2_rnd.c"
>
</File>
<File
RelativePath=".\meta\ps2_rstm.c"
>

View File

@ -213,4 +213,6 @@ VGMSTREAM * init_vgmstream_sat_sap(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dc_idvi(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_rnd(STREAMFILE *streamFile);
#endif

View File

@ -10,7 +10,6 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
int loop_flag=0;
int channel_count;
off_t start_offset,test_offset;
int ads_type_2=0;
int i;
/* check extension, case insensitive */
@ -45,7 +44,7 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
/* Check for Compression Scheme */
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x24,streamFile)/16*28/vgmstream->channels;
vgmstream->num_samples = (read_32bitLE(0x24,streamFile)-0x40)/16*28/vgmstream->channels;
/* SS2 container with RAW Interleaved PCM */
if (read_32bitLE(0x08,streamFile)!=0x10) {
@ -61,7 +60,7 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
if(vgmstream->loop_flag) {
if(vgmstream->interleave_block_size==0x10) {
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
vgmstream->loop_end_sample = vgmstream->num_samples;
} else {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*0x10)/16*28;
vgmstream->loop_end_sample = (read_32bitLE(0x1C,streamFile)*0x10)/16*28;
@ -75,16 +74,8 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
start_offset=0x28;
// Hack for files with start_offset = 0x800
ads_type_2=1;
for(test_offset=start_offset;test_offset<0x800;test_offset+=4) {
if (read_32bitLE(test_offset,streamFile)!=0)
ads_type_2=0;
}
if((ads_type_2==1)){
if(get_streamfile_size(streamFile)-read_32bitLE(0x24,streamFile)>=0x800)
start_offset=0x800;
}
/* open the file for reading by each channel */
{

View File

@ -18,7 +18,7 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) {
if (read_32bitBE(0x00,streamFile) != 0x41555320) /* "AUS " */
goto fail;
loop_flag = (read_32bitLE(0x4,streamFile)!=0);
loop_flag = (read_32bitLE(0x0c,streamFile)!=0);
channel_count = read_32bitLE(0xC,streamFile);
/* build the VGMSTREAM */
@ -29,16 +29,23 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) {
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x08,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x4,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile);
}
vgmstream->num_samples = read_32bitLE(0x08,streamFile);
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x800;
vgmstream->meta_type = meta_AUS;
if(read_16bitLE(0x06,streamFile)==0x02) {
vgmstream->coding_type = coding_XBOX;
vgmstream->layout_type=layout_none;
} else {
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x800;
}
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile);
}
vgmstream->meta_type = meta_AUS;
/* open the file for reading */
{

56
src/meta/ps2_rnd.c Normal file
View File

@ -0,0 +1,56 @@
#include "meta.h"
#include "../util.h"
/* rnd (from Karaoke Revolution) */
VGMSTREAM * init_vgmstream_ps2_rnd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("rnd",filename_extension(filename))) goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x00,streamFile);
/* 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 = read_32bitLE(0x04,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x10)/16*28/vgmstream->channels;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2000;
vgmstream->meta_type = meta_HGC1;
/* 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

@ -122,6 +122,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_bh2pcm,
init_vgmstream_sat_sap,
init_vgmstream_dc_idvi,
init_vgmstream_ps2_rnd,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))

View File

@ -179,6 +179,7 @@ char * extension_list[] = {
"bh2pcm\0BH2PCM Audio File (*.BH2PCM)\0",
"sap\0SAP Audio File (*.SAP)\0",
"idvi\0IDVI Audio File (*.IDVI)\0",
"rnd\0RND Audio File (*.RND)\0",
};
void about(HWND hwndParent) {