mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-26 06:48:46 +01:00
Add .ikm PC/PSP and fix PS2 samples [Chaos Legion (PC), TLOH IV (PSP)]
This commit is contained in:
parent
a64fabe831
commit
50f8f53385
@ -844,7 +844,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_MUSX_V201, "MUSX / Version 201 Header"},
|
{meta_MUSX_V201, "MUSX / Version 201 Header"},
|
||||||
{meta_LEG, "Legaia 2 - Duel Saga LEG Header"},
|
{meta_LEG, "Legaia 2 - Duel Saga LEG Header"},
|
||||||
{meta_FILP, "Bio Hazard - Gun Survivor FILp Header"},
|
{meta_FILP, "Bio Hazard - Gun Survivor FILp Header"},
|
||||||
{meta_IKM, "Zwei!! IKM Header"},
|
{meta_IKM, "MiCROViSiON IKM header"},
|
||||||
{meta_SFS, "Baroque SFS Header"},
|
{meta_SFS, "Baroque SFS Header"},
|
||||||
{meta_SAT_DVI, "Konami KCEN DVI. header"},
|
{meta_SAT_DVI, "Konami KCEN DVI. header"},
|
||||||
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
|
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
|
||||||
|
146
src/meta/ikm.c
146
src/meta/ikm.c
@ -1,63 +1,125 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* IKM (found in Zwei!) */
|
|
||||||
VGMSTREAM * init_vgmstream_ikm(STREAMFILE *streamFile) {
|
/* IKM - MiCROViSiON PS2 container [Zwei (PS2)] */
|
||||||
|
VGMSTREAM * init_vgmstream_ikm_ps2(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag = 0;
|
int loop_flag, channel_count;
|
||||||
int channel_count;
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("ikm",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
/* checks */
|
||||||
if ((read_32bitBE(0x00,streamFile) != 0x494B4D00) && /* "IKM\0" */
|
if ( !check_extensions(streamFile,"ikm") )
|
||||||
(read_32bitBE(0x40,streamFile) != 0x41535400)) /* "AST\0" */
|
goto fail;
|
||||||
goto fail;
|
if (read_32bitBE(0x00,streamFile) != 0x494B4D00) /* "IKM\0" */
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (read_32bitBE(0x40,streamFile) != 0x41535400) /* "AST\0" */
|
||||||
|
goto fail;
|
||||||
|
/* 0x20: type 03? */
|
||||||
|
|
||||||
|
loop_flag = (read_32bitLE(0x14, streamFile) > 0);
|
||||||
|
channel_count = read_32bitLE(0x50, streamFile);
|
||||||
|
start_offset = 0x800;
|
||||||
|
|
||||||
loop_flag = (read_32bitLE(0x14,streamFile)!=0); /* Not sure */
|
|
||||||
channel_count = read_32bitLE(0x50,streamFile);
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
start_offset = 0x800;
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = read_32bitLE(0x44,streamFile);
|
|
||||||
vgmstream->coding_type = coding_PSX;
|
|
||||||
vgmstream->num_samples = (read_32bitLE(0x4C,streamFile)-start_offset)/16/channel_count*28;
|
|
||||||
if (loop_flag) {
|
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
|
|
||||||
vgmstream->loop_end_sample = read_32bitLE(0x18,streamFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
vgmstream->layout_type = layout_interleave;
|
|
||||||
vgmstream->interleave_block_size = 0x10;
|
|
||||||
vgmstream->meta_type = meta_IKM;
|
vgmstream->meta_type = meta_IKM;
|
||||||
|
vgmstream->sample_rate = read_32bitLE(0x44, streamFile);
|
||||||
|
vgmstream->num_samples = ps_bytes_to_samples(read_32bitLE(0x4c, streamFile), channel_count);
|
||||||
|
vgmstream->loop_start_sample = read_32bitLE(0x14, streamFile);
|
||||||
|
vgmstream->loop_end_sample = read_32bitLE(0x18, streamFile);
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = 0x10; /* @0x40 / channels */
|
||||||
|
|
||||||
/* open the file for reading */
|
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
|
||||||
|
goto fail;
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IKM - MiCROViSiON PC container [Chaos Legion (PC)] */
|
||||||
|
VGMSTREAM * init_vgmstream_ikm_pc(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
off_t start_offset;
|
||||||
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if ( !check_extensions(streamFile,"ikm") )
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitBE(0x00,streamFile) != 0x494B4D00) /* "IKM\0" */
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitBE(0x30,streamFile) != 0x4F676753) /* "OggS" */
|
||||||
|
goto fail;
|
||||||
|
/* 0x20: type 01? */
|
||||||
|
|
||||||
|
start_offset = 0x30;
|
||||||
|
#ifdef VGM_USE_VORBIS
|
||||||
{
|
{
|
||||||
int i;
|
ogg_vorbis_meta_info_t ovmi = {0};
|
||||||
STREAMFILE * file;
|
|
||||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
ovmi.meta_type = meta_IKM;
|
||||||
if (!file) goto fail;
|
ovmi.loop_start = read_32bitLE(0x14, streamFile);
|
||||||
for (i=0;i<channel_count;i++) {
|
ovmi.loop_end = read_32bitLE(0x18, streamFile);
|
||||||
vgmstream->ch[i].streamfile = file;
|
ovmi.loop_end_found = ovmi.loop_end;
|
||||||
vgmstream->ch[i].channel_start_offset=
|
ovmi.loop_flag = ovmi.loop_end > 0;
|
||||||
vgmstream->ch[i].offset=start_offset+
|
ovmi.stream_size = read_32bitLE(0x24, streamFile);
|
||||||
vgmstream->interleave_block_size*i;
|
|
||||||
}
|
vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
goto fail;
|
||||||
|
#endif
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IKM - MiCROViSiON PSP container [The Legend of Heroes: A Tear of Vermillion (PSP)] */
|
||||||
|
VGMSTREAM * init_vgmstream_ikm_psp(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM *vgmstream = NULL;
|
||||||
|
STREAMFILE *temp_streamFile = NULL;
|
||||||
|
off_t start_offset;
|
||||||
|
size_t data_size;
|
||||||
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if ( !check_extensions(streamFile,"ikm") )
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitBE(0x00,streamFile) != 0x494B4D00) /* "IKM\0" */
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitBE(0x800,streamFile) != 0x52494646) /* "RIFF" */
|
||||||
|
goto fail;
|
||||||
|
/* 0x20: type 00? */
|
||||||
|
|
||||||
|
/* loop values (pre-adjusted without encoder delay) at 0x14/18 are found in the RIFF too */
|
||||||
|
data_size = read_32bitLE(0x24, streamFile);
|
||||||
|
start_offset = 0x800;
|
||||||
|
|
||||||
|
temp_streamFile = setup_subfile_streamfile(streamFile, start_offset, data_size, "at3");
|
||||||
|
if (!temp_streamFile) goto fail;
|
||||||
|
|
||||||
|
vgmstream = init_vgmstream_riff(temp_streamFile);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->meta_type = meta_IKM;
|
||||||
|
|
||||||
|
close_streamfile(temp_streamFile);
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_streamfile(temp_streamFile);
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,9 @@ VGMSTREAM * init_vgmstream_leg(STREAMFILE * streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_filp(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_filp(STREAMFILE * streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ikm(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_ikm_ps2(STREAMFILE * streamFile);
|
||||||
|
VGMSTREAM * init_vgmstream_ikm_pc(STREAMFILE * streamFile);
|
||||||
|
VGMSTREAM * init_vgmstream_ikm_psp(STREAMFILE * streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_sfs(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_sfs(STREAMFILE * streamFile);
|
||||||
|
|
||||||
|
@ -107,7 +107,9 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
|||||||
init_vgmstream_musx_v201,
|
init_vgmstream_musx_v201,
|
||||||
init_vgmstream_leg,
|
init_vgmstream_leg,
|
||||||
init_vgmstream_filp,
|
init_vgmstream_filp,
|
||||||
init_vgmstream_ikm,
|
init_vgmstream_ikm_ps2,
|
||||||
|
init_vgmstream_ikm_pc,
|
||||||
|
init_vgmstream_ikm_psp,
|
||||||
init_vgmstream_sfs,
|
init_vgmstream_sfs,
|
||||||
init_vgmstream_bg00,
|
init_vgmstream_bg00,
|
||||||
init_vgmstream_sat_dvi,
|
init_vgmstream_sat_dvi,
|
||||||
|
@ -378,7 +378,7 @@ typedef enum {
|
|||||||
meta_MUSX_V201, /* Sphinx and the cursed Mummy */
|
meta_MUSX_V201, /* Sphinx and the cursed Mummy */
|
||||||
meta_LEG, /* Legaia 2 [no header_id] */
|
meta_LEG, /* Legaia 2 [no header_id] */
|
||||||
meta_FILP, /* Resident Evil - Dead Aim */
|
meta_FILP, /* Resident Evil - Dead Aim */
|
||||||
meta_IKM, /* Zwei! */
|
meta_IKM,
|
||||||
meta_SFS, /* Baroque */
|
meta_SFS, /* Baroque */
|
||||||
meta_BG00, /* Ibara, Mushihimesama */
|
meta_BG00, /* Ibara, Mushihimesama */
|
||||||
meta_PS2_RSTM, /* Midnight Club 3 */
|
meta_PS2_RSTM, /* Midnight Club 3 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user