mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Added .SD9 support for beatmaniaIIDX16 - EMPRESS (Arcade)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@653 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
6d4242e9bb
commit
4f79513ce3
@ -196,7 +196,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/nds_hwas.o \
|
||||
meta/ngc_lps.o \
|
||||
meta/ps2_snd.o \
|
||||
meta/naomi_adpcm.o
|
||||
meta/naomi_adpcm.o \
|
||||
meta/sd9.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="libvgmstream"
|
||||
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
||||
RootNamespace="libvgmstream"
|
||||
@ -698,6 +698,10 @@
|
||||
RelativePath=".\meta\sat_sap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sd9.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sdt.c"
|
||||
>
|
||||
|
@ -156,5 +156,6 @@ libmeta_la_SOURCES += nds_hwas.c
|
||||
libmeta_la_SOURCES += ngc_lps.c
|
||||
libmeta_la_SOURCES += ps2_snd.c
|
||||
libmeta_la_SOURCES += naomi_adpcm.c
|
||||
libmeta_la_SOURCES += sd9.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -387,4 +387,6 @@ VGMSTREAM * init_vgmstream_rsd3pcmb(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_rsd3gadp(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_sd9(STREAMFILE * streamFile);
|
||||
|
||||
#endif
|
||||
|
73
src/meta/sd9.c
Normal file
73
src/meta/sd9.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* SD9 (found in beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||
VGMSTREAM * init_vgmstream_sd9(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("sd9",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x0,streamFile) != 0x53443900) /* SD9 */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x20,streamFile) != 0x52494646) /* RIFF */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x28,streamFile) != 0x57415645) /* WAVE */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x2c,streamFile) != 0x666D7420) /* fmt */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x72,streamFile) != 0x64617461) /* data */
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_16bitLE(0xe,streamFile)==0x1);
|
||||
channel_count = read_16bitLE(0x34,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x7a;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x38,streamFile);
|
||||
vgmstream->coding_type = coding_MSADPCM;
|
||||
vgmstream->num_samples = read_32bitLE(0x6e,streamFile);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (read_32bitLE(0x4,streamFile))*28/16/channel_count;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->interleave_block_size = read_16bitLE(0x40,streamFile);
|
||||
vgmstream->meta_type = meta_SD9;
|
||||
|
||||
/* 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;
|
||||
}
|
@ -213,6 +213,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ngc_lps,
|
||||
init_vgmstream_ps2_snd,
|
||||
init_vgmstream_naomi_adpcm,
|
||||
init_vgmstream_sd9,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2180,6 +2181,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_NAOMI_ADPCM:
|
||||
snprintf(temp,TEMPSIZE,"NAOMI/NAOMI2 Arcade games ADPCM header");
|
||||
break;
|
||||
case meta_SD9:
|
||||
snprintf(temp,TEMPSIZE,"beatmaniaIIDX SD9 header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -393,6 +393,7 @@ typedef enum {
|
||||
meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
|
||||
meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
|
||||
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
|
||||
meta_SD9 /* beatmaniaIIDX16 - EMPRESS (Arcade) */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -175,6 +175,7 @@ gchar *vgmstream_exts [] = {
|
||||
"snd",
|
||||
"mcg",
|
||||
"wii",
|
||||
"sd9",
|
||||
/* terminator */
|
||||
NULL
|
||||
};
|
||||
|
@ -202,6 +202,7 @@ char * extension_list[] = {
|
||||
|
||||
"sad\0SAD Audio File (*.SAD)\0",
|
||||
"sap\0SAP Audio File (*.SAP)\0",
|
||||
"sd9\0SD9 Audio File (*.SD9)\0",
|
||||
"sdt\0SDT Audio File (*.SDT)\0",
|
||||
"seg\0SEG Audio File (*.SEG)\0",
|
||||
"sfl\0SFL Audio File (*.SFL)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user