mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
.MIHB added -> Merged MIH+MIB
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@441 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
da5f3a7376
commit
96c3b5cc43
@ -137,7 +137,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/ngc_ymf.o \
|
||||
meta/nds_sad.o \
|
||||
meta/ps2_ccc.o \
|
||||
meta/psx_fag.o
|
||||
meta/psx_fag.o \
|
||||
meta/ps2_mihb.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -437,6 +437,10 @@
|
||||
RelativePath=".\meta\ps2_mic.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_mihb.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_npsf.c"
|
||||
>
|
||||
|
@ -106,4 +106,5 @@ libmeta_la_SOURCES += ngc_ymf.c
|
||||
libmeta_la_SOURCES += nds_sad.c
|
||||
libmeta_la_SOURCES += ps2_ccc.c
|
||||
libmeta_la_SOURCES += psx_fag.c
|
||||
libmeta_la_SOURCES += ps2_mihb.c
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -233,4 +233,6 @@ VGMSTREAM * init_vgmstream_ps2_ccc(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_psx_fag(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE * streamFile);
|
||||
|
||||
#endif
|
||||
|
67
src/meta/ps2_mihb.c
Normal file
67
src/meta/ps2_mihb.c
Normal file
@ -0,0 +1,67 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* MIHB (Merged MIH+MIB) */
|
||||
VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
int mib_blocks;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("mihb",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x40000000)
|
||||
goto fail;
|
||||
|
||||
mib_blocks = read_32bitLE(0x14,streamFile);
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x08,streamFile);
|
||||
|
||||
/* 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(0x0C,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = (read_32bitLE(0x10,streamFile))*mib_blocks*channel_count/32*28;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitLE(0x10,streamFile))*mib_blocks*channel_count/32*28;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x10,streamFile);
|
||||
vgmstream->meta_type = meta_PS2_MIHB;
|
||||
|
||||
/* 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;
|
||||
}
|
@ -132,6 +132,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_sadl,
|
||||
init_vgmstream_ps2_ccc,
|
||||
init_vgmstream_psx_fag,
|
||||
init_vgmstream_ps2_mihb,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -1703,6 +1704,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PSX_FAG:
|
||||
snprintf(temp,TEMPSIZE,"FAG Header");
|
||||
break;
|
||||
case meta_PS2_MIHB:
|
||||
snprintf(temp,TEMPSIZE,"Merged MIH+MIB");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -239,6 +239,7 @@ typedef enum {
|
||||
meta_SADL, /* .sad */
|
||||
meta_PS2_CCC, /* Tokyo Xtreme Racer DRIFT 2 */
|
||||
meta_PSX_FAG, /* Jackie Chan - Stuntmaster */
|
||||
meta_PS2_MIHB, /* Merged MIH+MIB */
|
||||
|
||||
meta_XBOX_WAVM, /* XBOX WAVM File */
|
||||
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
|
||||
|
@ -188,6 +188,7 @@ char * extension_list[] = {
|
||||
"ymf\0YMF Audio File (*.YMF)\0",
|
||||
"ccc\0CCC Audio File (*.CCC)\0",
|
||||
"fag\0FAG Audio File (*.FAG)\0",
|
||||
"mihb\0MIHB Audio File (*.MIHB)\0",
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
Reference in New Issue
Block a user