mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
Add PS2 IAB blocked type. Can't seem to get exactly right, but it's very close.
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@891 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
56f31b8f4a
commit
649e987aca
@ -335,6 +335,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
if(!stricmp_utf8(p_extension,"hps")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"hwas")) return 1;
|
||||
|
||||
if(!stricmp_utf8(p_extension,"iab")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"idsp")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"idvi")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"ikm")) return 1;
|
||||
|
@ -266,7 +266,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/wii_ras.o \
|
||||
meta/ps2_spm.o \
|
||||
meta/ps2_mtaf.o \
|
||||
meta/x360_tra.o
|
||||
meta/x360_tra.o \
|
||||
meta/ps2_iab.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -127,6 +127,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
|
||||
case layout_mtaf_blocked:
|
||||
mtaf_block_update(vgmstream->next_block_offset,vgmstream);
|
||||
break;
|
||||
case layout_ps2_iab_blocked:
|
||||
ps2_iab_block_update(vgmstream->next_block_offset,vgmstream);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -68,4 +68,6 @@ void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
void mtaf_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream);
|
||||
|
||||
#endif
|
||||
|
16
src/layout/ps2_iab_blocked.c
Normal file
16
src/layout/ps2_iab_blocked.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* set up for the block at the given offset */
|
||||
void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = 0x4010;
|
||||
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size;
|
||||
|
||||
for (i=0;i<vgmstream->channels;i++)
|
||||
{
|
||||
vgmstream->ch[i].offset = vgmstream->current_block_offset + (0x2000 * i) + 0x10;
|
||||
}
|
||||
}
|
@ -634,6 +634,10 @@
|
||||
RelativePath=".\meta\ps2_hgc1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_iab.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_ikm.c"
|
||||
>
|
||||
@ -1282,6 +1286,10 @@
|
||||
RelativePath=".\layout\ps2_adm_blocked.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\ps2_iab_blocked.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\psx_mgav_blocked.c"
|
||||
>
|
||||
|
@ -217,5 +217,6 @@ libmeta_la_SOURCES += wii_ras.c
|
||||
libmeta_la_SOURCES += ps2_spm.c
|
||||
libmeta_la_SOURCES += ps2_mtaf.c
|
||||
libmeta_la_SOURCES += x360_tra.c
|
||||
libmeta_la_SOURCES += ps2_iab.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -547,4 +547,6 @@ VGMSTREAM * init_vgmstream_ps2_spm(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_x360_tra(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_iab(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
70
src/meta/ps2_iab.c
Normal file
70
src/meta/ps2_iab.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* IAB: Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */
|
||||
VGMSTREAM * init_vgmstream_ps2_iab(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("iab",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x10000000)
|
||||
goto fail;
|
||||
|
||||
/* check file size */
|
||||
if (read_32bitLE(0x1C,streamFile) != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
|
||||
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 = 0x40;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x4,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
|
||||
vgmstream->layout_type = layout_ps2_iab_blocked;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0xC, streamFile);
|
||||
vgmstream->meta_type = meta_PS2_IAB;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++)
|
||||
{
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename, vgmstream->interleave_block_size);
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calc num_samples */
|
||||
ps2_iab_block_update(start_offset, vgmstream);
|
||||
vgmstream->num_samples=0;
|
||||
|
||||
do
|
||||
{
|
||||
vgmstream->num_samples += 0x4000 * 14 / 16;
|
||||
ps2_iab_block_update(vgmstream->next_block_offset, vgmstream);
|
||||
} while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
|
||||
|
||||
ps2_iab_block_update(start_offset, vgmstream);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -295,6 +295,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_wii_ras,
|
||||
init_vgmstream_ps2_spm,
|
||||
init_vgmstream_x360_tra,
|
||||
init_vgmstream_ps2_iab,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -738,6 +739,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
|
||||
case layout_dsp_bdsp_blocked:
|
||||
case layout_tra_blocked:
|
||||
case layout_mtaf_blocked:
|
||||
case layout_ps2_iab_blocked:
|
||||
render_vgmstream_blocked(buffer,sample_count,vgmstream);
|
||||
break;
|
||||
case layout_interleave_byte:
|
||||
@ -1865,6 +1867,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case layout_mtaf_blocked:
|
||||
snprintf(temp,TEMPSIZE,"MTAF blocked");
|
||||
break;
|
||||
case layout_ps2_iab_blocked:
|
||||
snprintf(temp,TEMPSIZE,"IAB blocked");
|
||||
break;
|
||||
case layout_tra_blocked:
|
||||
snprintf(temp,TEMPSIZE,"TRA blocked");
|
||||
@ -2738,6 +2743,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS2_VGS:
|
||||
snprintf(temp,TEMPSIZE,"Princess Soft VGS header");
|
||||
break;
|
||||
case meta_PS2_IAB:
|
||||
snprintf(temp,TEMPSIZE,"IAB header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -177,6 +177,7 @@ typedef enum {
|
||||
layout_ivaud_blocked, /* GTA IV .ivaud blocks */
|
||||
layout_tra_blocked, /* DefJam Rapstar .tra blocks */
|
||||
layout_mtaf_blocked,
|
||||
layout_ps2_iab_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. */
|
||||
@ -502,6 +503,7 @@ typedef enum {
|
||||
meta_PS2_SPM, /* Lethal Skies Elite Pilot: Team SW */
|
||||
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_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -93,6 +93,7 @@ gchar *vgmstream_exts [] = {
|
||||
"hps",
|
||||
"hwas",
|
||||
|
||||
"iab",
|
||||
"idsp",
|
||||
"idvi",
|
||||
"ikm",
|
||||
|
@ -157,7 +157,8 @@ char * extension_list[] = {
|
||||
"hps\0HALPST Audio File (*.HPS)\0",
|
||||
"hwas\0HWAS Audio File (*.HWAS)\0",
|
||||
|
||||
"iadp\0IADP Audio File (*.IADP)\0",
|
||||
"iab\0IAB Audio File (*.IAB)\0",
|
||||
"iadp\0IADP Audio File (*.IADP)\0",
|
||||
"idsp\0IDSP Audio File (*.IDSP)\0",
|
||||
"idvi\0IDVI Audio File (*.IDVI)\0",
|
||||
"ikm\0IKM Audio File (*.IKM)\0",
|
||||
|
Loading…
Reference in New Issue
Block a user