mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
WIP support for "The Bouncer" .str files
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@900 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
863012e3ec
commit
7bcbc6f6be
@ -130,6 +130,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
|
||||
case layout_ps2_iab_blocked:
|
||||
ps2_iab_block_update(vgmstream->next_block_offset,vgmstream);
|
||||
break;
|
||||
case layout_ps2_strlr_blocked:
|
||||
ps2_strlr_block_update(vgmstream->next_block_offset,vgmstream);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -70,4 +70,6 @@ void mtaf_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
#endif
|
||||
|
19
src/layout/ps2_strlr_blocked.c
Normal file
19
src/layout/ps2_strlr_blocked.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* set up for the block at the given offset */
|
||||
void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = read_32bitLE(
|
||||
vgmstream->current_block_offset+0x4,
|
||||
vgmstream->ch[0].streamfile)*2;
|
||||
vgmstream->next_block_offset = vgmstream->current_block_offset+vgmstream->current_block_size+0x40;
|
||||
//vgmstream->current_block_size/=vgmstream->channels;
|
||||
|
||||
for (i=0;i<vgmstream->channels;i++) {
|
||||
vgmstream->ch[i].offset = vgmstream->current_block_offset+0x20+(0x800*i);
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="libvgmstream"
|
||||
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
||||
RootNamespace="libvgmstream"
|
||||
@ -774,6 +774,10 @@
|
||||
RelativePath=".\meta\ps2_str.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_strlr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_svag.c"
|
||||
>
|
||||
@ -1290,6 +1294,10 @@
|
||||
RelativePath=".\layout\ps2_iab_blocked.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\ps2_strlr_blocked.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\psx_mgav_blocked.c"
|
||||
>
|
||||
|
@ -549,4 +549,6 @@ VGMSTREAM * init_vgmstream_x360_tra(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_iab(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
70
src/meta/ps2_strlr.c
Normal file
70
src/meta/ps2_strlr.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* STR: The Bouncer (PS2) */
|
||||
VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int i;
|
||||
off_t start_offset;
|
||||
|
||||
/* 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) != 0x5354524C) /* "STRL" */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) != 0x53545252) /* "STRR" */
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
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 = 0x0;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 48000;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
|
||||
vgmstream->layout_type = layout_ps2_strlr_blocked;
|
||||
//vgmstream->interleave_block_size = read_32bitLE(0xC, streamFile);
|
||||
vgmstream->meta_type = meta_PS2_STRLR;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++)
|
||||
{
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename, 0x8000);
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calc num_samples */
|
||||
ps2_strlr_block_update(start_offset, vgmstream);
|
||||
vgmstream->num_samples=0;
|
||||
|
||||
do
|
||||
{
|
||||
vgmstream->num_samples += vgmstream->current_block_size * 14 / 16;
|
||||
ps2_strlr_block_update(vgmstream->next_block_offset, vgmstream);
|
||||
} while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
|
||||
|
||||
ps2_strlr_block_update(start_offset, vgmstream);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -296,6 +296,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_spm,
|
||||
init_vgmstream_x360_tra,
|
||||
init_vgmstream_ps2_iab,
|
||||
init_vgmstream_ps2_strlr,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -740,6 +741,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
|
||||
case layout_tra_blocked:
|
||||
case layout_mtaf_blocked:
|
||||
case layout_ps2_iab_blocked:
|
||||
case layout_ps2_strlr_blocked:
|
||||
render_vgmstream_blocked(buffer,sample_count,vgmstream);
|
||||
break;
|
||||
case layout_interleave_byte:
|
||||
@ -1870,6 +1872,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case layout_ps2_iab_blocked:
|
||||
snprintf(temp,TEMPSIZE,"IAB blocked");
|
||||
break;
|
||||
case layout_ps2_strlr_blocked:
|
||||
snprintf(temp,TEMPSIZE,"The Bouncer STR blocked");
|
||||
break;
|
||||
case layout_tra_blocked:
|
||||
snprintf(temp,TEMPSIZE,"TRA blocked");
|
||||
@ -2749,6 +2754,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS2_IAB:
|
||||
snprintf(temp,TEMPSIZE,"IAB header");
|
||||
break;
|
||||
case meta_PS2_STRLR:
|
||||
snprintf(temp,TEMPSIZE,"STR L/R header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -178,6 +178,7 @@ typedef enum {
|
||||
layout_tra_blocked, /* DefJam Rapstar .tra blocks */
|
||||
layout_mtaf_blocked,
|
||||
layout_ps2_iab_blocked,
|
||||
layout_ps2_strlr_blocked,
|
||||
} layout_t;
|
||||
|
||||
/* The meta type specifies how we know what we know about the file. We may know because of a header we read, some of it may have been guessed from filenames, etc. */
|
||||
@ -505,6 +506,7 @@ typedef enum {
|
||||
meta_X360_TRA, /* Def Jam Rapstar */
|
||||
meta_PS2_VGS, // Princess Soft PS2 games
|
||||
meta_PS2_IAB, // Ueki no Housoku - Taosu ze Robert Juudan!! (PS2)
|
||||
meta_PS2_STRLR,
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -283,7 +283,7 @@ char * extension_list[] = {
|
||||
"swav\0SWAV Audio File (*.SWAV)\0",
|
||||
"swd\0SWD Audio File (*.SWD)\0",
|
||||
|
||||
"tec\0TEC Audio File (*.TEC)\0",
|
||||
"tec\0TEC Audio File (*.TEC)\0",
|
||||
"thp\0THP Audio File (*.THP)\0",
|
||||
"tk1\0TK1 Audio File (*.TK1)\0",
|
||||
"tk5\0TK5 Audio File (*.TK5)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user