mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
Added OTM support for Otomedius (Arcade)
This commit is contained in:
parent
a095da3965
commit
9fc46bd877
@ -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);
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
@ -553,6 +553,10 @@
|
||||
<File
|
||||
RelativePath=".\meta\ogg_vorbis_file.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\otm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\p3d.c"
|
||||
|
@ -217,6 +217,7 @@
|
||||
<ClCompile Include="meta\ngc_ymf.c" />
|
||||
<ClCompile Include="meta\nwa.c" />
|
||||
<ClCompile Include="meta\ogg_vorbis_file.c" />
|
||||
<ClCompile Include="meta\otm.c" />
|
||||
<ClCompile Include="meta\p3d.c" />
|
||||
<ClCompile Include="meta\pc_mxst.c" />
|
||||
<ClCompile Include="meta\pc_smp.c" />
|
||||
|
@ -313,6 +313,9 @@
|
||||
<ClCompile Include="meta\ogg_vorbis_file.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\otm.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\p3d.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
73
src/meta/otm.c
Normal file
73
src/meta/otm.c
Normal file
@ -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;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;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -152,6 +152,7 @@ gchar *vgmstream_exts [] = {
|
||||
"nwa",
|
||||
|
||||
"omu",
|
||||
"otm",
|
||||
|
||||
"p2bt",
|
||||
"p3d",
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user