diff --git a/src/meta/omu.c b/src/meta/omu.c new file mode 100644 index 00000000..c45a0020 --- /dev/null +++ b/src/meta/omu.c @@ -0,0 +1,45 @@ +#include "meta.h" + +/* IMU - found in Alter Echo (PS2) */ +VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + off_t start_offset; + int loop_flag, channel_count; + + + /* check extension */ + if ( !check_extensions(streamFile,"omu") ) + goto fail; + + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x4F4D5520 && /* "OMU " */ + read_32bitBE(0x08,streamFile) != 0x46524D54) /* "FRMT" */ + goto fail; + + loop_flag = 1; + channel_count = (int)read_8bit(0x14,streamFile); + start_offset = 0x40; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + vgmstream->sample_rate = read_32bitLE(0x10,streamFile); + vgmstream->num_samples = (int32_t)(read_32bitLE(0x3C,streamFile)/(vgmstream->channels*2)); + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample = vgmstream->num_samples; + + vgmstream->coding_type = coding_PCM16LE; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x200; + vgmstream->meta_type = meta_PS2_OMU; + + /* open the file for reading */ + if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) ) + goto fail; + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/ps2_int.c b/src/meta/ps2_int.c index e7aa1a84..06d52816 100644 --- a/src/meta/ps2_int.c +++ b/src/meta/ps2_int.c @@ -59,57 +59,3 @@ fail: if (vgmstream) close_vgmstream(vgmstream); return NULL; } - - -// OMU is a PS2 .INT file with header ... -// found in Alter Echo -VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile) { - VGMSTREAM * vgmstream = NULL; - char filename[PATH_LIMIT]; - int i,channel_count; - - /* check extension, case insensitive */ - streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("omu",filename_extension(filename))) goto fail; - - /* check header */ - if((read_32bitBE(0,streamFile)!=0x4F4D5520) && (read_32bitBE(0x08,streamFile)!=0x46524D54)) - goto fail; - - channel_count = (int)read_8bit(0x14,streamFile); - - /* build the VGMSTREAM */ - vgmstream = allocate_vgmstream(channel_count,1); - if (!vgmstream) goto fail; - - /* fill in the vital statistics */ - vgmstream->channels=channel_count; - vgmstream->sample_rate = read_32bitLE(0x10,streamFile); - vgmstream->coding_type = coding_PCM16LE; - vgmstream->num_samples = (int32_t)(read_32bitLE(0x3C,streamFile)/(vgmstream->channels*2)); - vgmstream->interleave_block_size = 0x200; - vgmstream->layout_type = layout_interleave; - vgmstream->meta_type = meta_PS2_OMU; - - vgmstream->loop_start_sample=0; - vgmstream->loop_end_sample=vgmstream->num_samples; - - /* open the file for reading by each channel */ - { - for (i=0;ichannels;i++) { - vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000); - - if (!vgmstream->ch[i].streamfile) goto fail; - - vgmstream->ch[i].channel_start_offset= - vgmstream->ch[i].offset=0x40+(i*vgmstream->interleave_block_size); - } - } - - return vgmstream; - - /* clean up anything we may have opened */ -fail: - if (vgmstream) close_vgmstream(vgmstream); - return NULL; -}