diff --git a/fb2k/in_vgmstream.cpp b/fb2k/in_vgmstream.cpp index c9630aa9..371116ab 100644 --- a/fb2k/in_vgmstream.cpp +++ b/fb2k/in_vgmstream.cpp @@ -407,6 +407,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension if(!stricmp_utf8(p_extension,"nwa")) return 1; if(!stricmp_utf8(p_extension,"omu")) return 1; + if(!stricmp_utf8(p_extension,"otm")) return 1; if(!stricmp_utf8(p_extension,"p2bt")) return 1; if(!stricmp_utf8(p_extension,"p3d")) return 1; @@ -728,6 +729,7 @@ DECLARE_MULTIPLE_FILE_TYPE("PS2 NPSF Audio File (*.NPSF)", npsf); DECLARE_MULTIPLE_FILE_TYPE("NWA Audio File (*.NWA)", nwa); DECLARE_MULTIPLE_FILE_TYPE("OMU Audio File (*.OMU)", omu); +DECLARE_MULTIPLE_FILE_TYPE("OTM Audio File (*.OTM)", otm); DECLARE_MULTIPLE_FILE_TYPE("P2BT Audio File (*.P2BT)", p2bt); DECLARE_MULTIPLE_FILE_TYPE("P3D Audio File (*.P3D)", p3d); diff --git a/src/Makefile b/src/Makefile index 03fa2ead..deeddabb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -290,7 +290,8 @@ META_OBJS=meta/adx_header.o \ meta/ps3_ivag.o \ meta/ps2_2pfs.o \ meta/ubi_ckd.o \ - meta/ps2_vbk.o + meta/ps2_vbk.o \ + meta/otm.o OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index cef681cd..956669eb 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1,4 +1,4 @@ - + + + + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 05351276..d247b9ba 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -313,6 +313,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index 62ea5733..3d6eef10 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -235,5 +235,6 @@ libmeta_la_SOURCES += ps2_hsf.c libmeta_la_SOURCES += ps3_ivag.c libmeta_la_SOURCES += ps2_2pfs.c libmeta_la_SOURCES += ubi_ckd.c +libmeta_la_SOURCES += otm.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index 10c34558..7a05c972 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -626,4 +626,6 @@ VGMSTREAM * init_vgmstream_ubi_ckd(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ps2_vbk(STREAMFILE* streamFile); +VGMSTREAM * init_vgmstream_otm(STREAMFILE* streamFile); + #endif diff --git a/src/meta/otm.c b/src/meta/otm.c new file mode 100644 index 00000000..500771c0 --- /dev/null +++ b/src/meta/otm.c @@ -0,0 +1,73 @@ +#include "meta.h" +#include "../coding/coding.h" +#include "../layout/layout.h" +#include "../util.h" + +/* Otomedius OTM (Arcade) */ +VGMSTREAM * init_vgmstream_otm(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + char filename[PATH_LIMIT]; + off_t start_offset; + + int loop_flag; + int channel_count; + + /* check extension, case insensitive */ + streamFile->get_name(streamFile,filename,sizeof(filename)); + if (strcasecmp("otm",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x20,streamFile) != 0x10B10200) + goto fail; + if (read_32bitBE(0x24,streamFile) != 0x04001000) + goto fail; + + if (read_32bitBE(0x14,streamFile) != 0x00000000) + loop_flag = 1; + else + loop_flag = 0; + channel_count = read_16bitLE(0x1A,streamFile); + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x2C; + vgmstream->num_samples = (get_streamfile_size(streamFile)- start_offset)/channel_count/2; + vgmstream->channels = channel_count; + vgmstream->sample_rate = read_32bitLE(0x1C,streamFile); + if (loop_flag) { + vgmstream->loop_start_sample = (read_32bitLE(0x10,streamFile))/channel_count/2; + vgmstream->loop_end_sample = (read_32bitLE(0xC,streamFile) - start_offset)/channel_count/2; + } + vgmstream->coding_type = coding_PCM16LE; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 2; + vgmstream->meta_type = meta_OTM; + + /* 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;ich[i].streamfile = file; + + vgmstream->ch[i].channel_start_offset= + vgmstream->ch[i].offset=start_offset+ + vgmstream->interleave_block_size*i; + + } + + } + + return vgmstream; + +fail: + /* clean up anything we may have opened */ + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} + diff --git a/src/vgmstream.c b/src/vgmstream.c index 8b2e9e74..ad3f9caa 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -328,6 +328,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_rsd6oogv, init_vgmstream_ubi_ckd, init_vgmstream_ps2_vbk, + init_vgmstream_otm, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) @@ -3053,6 +3054,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { break; case meta_PS2_VBK: snprintf(temp,TEMPSIZE,"PS2 VBK Header"); + break; + case meta_OTM: + snprintf(temp,TEMPSIZE,"Otomedius OTM Header"); break; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); diff --git a/src/vgmstream.h b/src/vgmstream.h index ccedd838..30c3a873 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -563,6 +563,7 @@ typedef enum { meta_PS3_IVAG, // Interleaved VAG files (PS3) meta_PS2_2PFS, // Mahoromatic: Moetto - KiraKira Maid-San (PS2) meta_PS2_VBK, + meta_OTM, // Otomedius (Arcade) #ifdef VGM_USE_MP4V2 meta_MP4, #endif diff --git a/unix/data.c b/unix/data.c index 5d829dcc..a2ce15ed 100644 --- a/unix/data.c +++ b/unix/data.c @@ -152,6 +152,7 @@ gchar *vgmstream_exts [] = { "nwa", "omu", + "otm", "p2bt", "p3d", diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 824d5388..a85f2193 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -221,6 +221,7 @@ char * extension_list[] = { "nwa\0NWA Audio File (*.NWA)\0", "omu\0OMU Audio File (*.OMU)\0", + "otm\0OTM Audio File (*.OTM)\0", "p2bt\0P2BT Audio File (*.P2BT)\0", "p3d\0P3D Audio File (*.P3D)\0",