mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 16:30:54 +01:00
Add AAC .strm [Cursed Castilla (3DS)]
This commit is contained in:
parent
650c3847d2
commit
b4fff010dd
@ -1173,6 +1173,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_208, "Ocean .208 header"},
|
||||
{meta_DSP_DS2, "LucasArts .DS2 header"},
|
||||
{meta_MUS_VC, "Vicious Cycle .MUS header"},
|
||||
{meta_STRM_ABYLIGHT, "Abylight STRM header"},
|
||||
|
||||
};
|
||||
|
||||
|
@ -1457,6 +1457,10 @@
|
||||
<File
|
||||
RelativePath=".\meta\str_wav.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\strm_abylight.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\stx.c"
|
||||
|
@ -447,6 +447,7 @@
|
||||
<ClCompile Include="meta\str_asr.c" />
|
||||
<ClCompile Include="meta\str_snds.c" />
|
||||
<ClCompile Include="meta\str_wav.c" />
|
||||
<ClCompile Include="meta\strm_abylight.c" />
|
||||
<ClCompile Include="meta\stx.c" />
|
||||
<ClCompile Include="meta\svs.c" />
|
||||
<ClCompile Include="meta\sxd.c" />
|
||||
|
@ -898,6 +898,9 @@
|
||||
<ClCompile Include="meta\str_wav.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\strm_abylight.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\stx.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -835,4 +835,6 @@ VGMSTREAM * init_vgmstream_ffdl(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_mus_vc(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_strm_abylight(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
71
src/meta/strm_abylight.c
Normal file
71
src/meta/strm_abylight.c
Normal file
@ -0,0 +1,71 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
|
||||
/* .STRM - from Abylight 3DS games [Cursed Castilla (3DS)] */
|
||||
VGMSTREAM * init_vgmstream_strm_abylight(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count, sample_rate;
|
||||
size_t data_size;
|
||||
|
||||
|
||||
/* check extension */
|
||||
if ( !check_extensions(streamFile,"strm") )
|
||||
goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x5354524D) /* "STRM" */
|
||||
goto fail;
|
||||
if (read_32bitLE(0x04,streamFile) != 0x03E8) /* version 1000? */
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = 2; /* there are various possible fields but all files are stereo */
|
||||
sample_rate = read_32bitLE(0x08,streamFile);
|
||||
|
||||
start_offset = 0x1e;
|
||||
data_size = read_32bitLE(0x10,streamFile);
|
||||
if (data_size != get_streamfile_size(streamFile) - start_offset)
|
||||
goto fail;
|
||||
if (data_size != read_32bitLE(0x18,streamFile))
|
||||
goto fail;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = aac_get_samples(streamFile, start_offset, data_size);
|
||||
|
||||
vgmstream->meta_type = meta_STRM_ABYLIGHT;
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
{
|
||||
ffmpeg_codec_data *ffmpeg_data = NULL;
|
||||
|
||||
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,data_size);
|
||||
if (!ffmpeg_data) goto fail;
|
||||
vgmstream->codec_data = ffmpeg_data;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
/* apparently none, or maybe ~600 */
|
||||
//if (!ffmpeg_data->skipSamples)
|
||||
// ffmpeg_set_skip_samples(ffmpeg_data, 1024);
|
||||
//vgmstream->num_samples -= 1024;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
/* open the file for reading */
|
||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -471,6 +471,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_dsp_ds2,
|
||||
init_vgmstream_ffdl,
|
||||
init_vgmstream_mus_vc,
|
||||
init_vgmstream_strm_abylight,
|
||||
|
||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||
@ -569,7 +570,7 @@ static VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile) {
|
||||
}
|
||||
|
||||
/* files can have thousands subsongs, but let's put a limit */
|
||||
if (vgmstream->num_streams < 0 || vgmstream->num_streams > 65535) {
|
||||
if (vgmstream->num_streams < 0 || vgmstream->num_streams > VGMSTREAM_MAX_SUBSONGS) {
|
||||
VGM_LOG("VGMSTREAM: wrong num_streams (ns=%i)\n", vgmstream->num_streams);
|
||||
close_vgmstream(vgmstream);
|
||||
continue;
|
||||
|
@ -11,6 +11,7 @@ enum { STREAM_NAME_SIZE = 255 };
|
||||
enum { VGMSTREAM_MAX_CHANNELS = 64 };
|
||||
enum { VGMSTREAM_MIN_SAMPLE_RATE = 300 }; /* 300 is Wwise min */
|
||||
enum { VGMSTREAM_MAX_SAMPLE_RATE = 96000 };
|
||||
enum { VGMSTREAM_MAX_SUBSONGS = 65535 };
|
||||
|
||||
#include "streamfile.h"
|
||||
|
||||
@ -725,6 +726,7 @@ typedef enum {
|
||||
meta_208,
|
||||
meta_DSP_DS2,
|
||||
meta_MUS_VC,
|
||||
meta_STRM_ABYLIGHT,
|
||||
|
||||
} meta_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user