Add Namco AAC (.naac) [Ace Combat: Assault Horizon Legacy (3DS)]

This commit is contained in:
bnnm 2017-11-23 22:32:31 +01:00
parent bf41d53690
commit 17da12f324
8 changed files with 85 additions and 5 deletions

View File

@ -192,6 +192,7 @@ static const char* extension_list[] = {
"mxst",
"myspd",
"naac",
"ndp",
"ngca",
"nps",
@ -265,7 +266,7 @@ static const char* extension_list[] = {
"sl3",
"sli",
"smp",
"smpl",
"smpl", //fake extension (to be removed)
"snd",
"snds",
"sng",
@ -681,7 +682,7 @@ static const meta_info meta_info_list[] = {
{meta_XBOX_WVS, "Metal Arms WVS Header (XBOX)"},
{meta_NGC_WVS, "Metal Arms WVS Header (GameCube)"},
{meta_XBOX_MATX, "assumed Matrix file by .matx extension"},
{meta_DE2, "gurumin .de2 with embedded funky RIFF"},
{meta_DE2, "Falcom DEC/DE2 RIFF header"},
{meta_VS, "Men in Black VS Header"},
{meta_DC_STR, "Sega Stream Asset Builder header"},
{meta_DC_STR_V2, "variant of Sega Stream Asset Builder header"},
@ -796,12 +797,12 @@ static const meta_info meta_info_list[] = {
{meta_S14, "Namco .S14 raw header"},
{meta_SSS, "Namco .SSS raw header"},
{meta_PS2_GCM, "GCM 'MCG' Header"},
{meta_PS2_SMPL, "Homura 'SMPL' Header"},
{meta_PS2_SMPL, "Homura SMPL header"},
{meta_PS2_MSA, "Psyvariar -Complete Edition- MSA header"},
{meta_PC_SMP, "Ghostbusters .smp Header"},
{meta_NGC_PDT, "PDT DSP header"},
{meta_NGC_BO2, "Blood Omen 2 DSP header"},
{meta_P3D, "Radical P3D Header"},
{meta_P3D, "Radical P3D header"},
{meta_PS2_TK1, "Tekken TK5STRM1 Header"},
{meta_PS2_ADSC, "ADSC Header"},
{meta_NGC_DSP_MPDS, "MPDS DSP header"},
@ -900,6 +901,7 @@ static const meta_info meta_info_list[] = {
{meta_PC_AL2, "Illwinter Game Design AL2 raw header"},
{meta_PC_AST, "Capcom AST (PC) header"},
{meta_UBI_SB, "Ubisoft SBx header"},
{meta_NAAC, "Namco NAAC header"},
#ifdef VGM_USE_VORBIS
{meta_OGG_VORBIS, "Ogg Vorbis"},

View File

@ -514,6 +514,10 @@
RelativePath=".\meta\myspd.c"
>
</File>
<File
RelativePath=".\meta\naac.c"
>
</File>
<File
RelativePath=".\meta\naomi_adpcm.c"
>

View File

@ -259,6 +259,7 @@
<ClCompile Include="meta\musc.c" />
<ClCompile Include="meta\musx.c" />
<ClCompile Include="meta\myspd.c" />
<ClCompile Include="meta\naac.c" />
<ClCompile Include="meta\naomi_adpcm.c" />
<ClCompile Include="meta\naomi_spsd.c" />
<ClCompile Include="meta\nds_hwas.c" />

View File

@ -295,6 +295,9 @@
<ClCompile Include="meta\myspd.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\naac.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\naomi_adpcm.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -687,6 +687,8 @@ VGMSTREAM * init_vgmstream_pc_al2(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_pc_ast(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_naac(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ubi_sb(STREAMFILE * streamFile);
#endif /*_META_H*/

66
src/meta/naac.c Normal file
View File

@ -0,0 +1,66 @@
#include "meta.h"
#include "../coding/coding.h"
/* .NAAC - from Namco 3DS games (Ace Combat - Assault Horizon Legacy, Taiko no Tatsujin Don to Katsu no Jikuu Daibouken) */
VGMSTREAM * init_vgmstream_naac(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
size_t data_size;
/* check extension */
if ( !check_extensions(streamFile,"naac") )
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x41414320) /* "AAC " */
goto fail;
if (read_32bitLE(0x04,streamFile) != 0x01) /* version? */
goto fail;
start_offset = 0x1000;
loop_flag = (read_32bitLE(0x18,streamFile) != 0);
channel_count = read_32bitLE(0x08,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
vgmstream->num_samples = read_32bitLE(0x10,streamFile); /* without skip_samples */
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile); /* with skip_samples */
vgmstream->loop_end_sample = read_32bitLE(0x18,streamFile);
/* 0x1c: loop start offset, 0x20: loop end offset (within data) */
data_size = read_32bitLE(0x24,streamFile);
/* 0x28: unknown; 0x2c: table start offset?; 0x30: seek table (always 0xFD0, padded) */
vgmstream->meta_type = meta_NAAC;
#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;
/* observed default, some files start without silence though seems correct when loop_start=0 */
if (!ffmpeg_data->skipSamples) /* FFmpeg doesn't seem to use not report it */
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;
}

View File

@ -368,6 +368,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_nsw_opus,
init_vgmstream_pc_al2,
init_vgmstream_pc_ast,
init_vgmstream_naac,
init_vgmstream_ubi_sb,
init_vgmstream_txth, /* should go at the end (lower priority) */

View File

@ -239,7 +239,7 @@ typedef enum {
layout_hwas_blocked,
layout_ea_sns_blocked, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
layout_blocked_awc, /* Rockstar AWC */
layout_blocked_vgs, /* Guitar Hero II */
layout_blocked_vgs, /* Guitar Hero II (PS2) */
/* otherwise odd */
layout_acm, /* libacm layout */
@ -627,6 +627,7 @@ typedef enum {
meta_NSW_OPUS, /* Lego City Undercover (Switch) */
meta_PC_AL2, /* Conquest of Elysium 3 (PC) */
meta_PC_AST, /* Dead Rising (PC) */
meta_NAAC, /* Namco AAC (3DS) */
meta_UBI_SB, /* Ubisoft banks */
#ifdef VGM_USE_VORBIS