mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-15 02:57:38 +01:00
Add NWAV [Fuurai no Shiren Gaiden: Onnakenshi Asuka Kenzan! (PC)]
This commit is contained in:
parent
c2ecafa3cf
commit
b56f9e9acd
@ -262,6 +262,7 @@ static const char* extension_list[] = {
|
||||
"npsf", //fake extension/header id for .nps (in bigfiles)
|
||||
"nus3bank",
|
||||
"nwa",
|
||||
"nwav",
|
||||
"nxa",
|
||||
|
||||
//"ogg", //common
|
||||
@ -1107,6 +1108,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_VA3, "Konami VA3 header" },
|
||||
{meta_XOPUS, "Exient XOPUS header"},
|
||||
{meta_VS_FFX, "Square VS header"},
|
||||
{meta_NWAV, "Chunsoft NWAV header"},
|
||||
|
||||
};
|
||||
|
||||
|
@ -850,6 +850,10 @@
|
||||
RelativePath=".\meta\nwa.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\nwav.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\nxa.c"
|
||||
>
|
||||
|
@ -319,6 +319,7 @@
|
||||
<ClCompile Include="meta\nub_xma.c" />
|
||||
<ClCompile Include="meta\nus3bank.c" />
|
||||
<ClCompile Include="meta\nwa.c" />
|
||||
<ClCompile Include="meta\nwav.c" />
|
||||
<ClCompile Include="meta\nxa.c" />
|
||||
<ClCompile Include="meta\nxap.c" />
|
||||
<ClCompile Include="meta\ogg_vorbis.c" />
|
||||
|
@ -523,6 +523,9 @@
|
||||
<ClCompile Include="meta\nwa.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\nwav.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\nxa.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -804,4 +804,6 @@ VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_msf_banpresto_wmsf(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_msf_banpresto_2msf(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_nwav(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
57
src/meta/nwav.c
Normal file
57
src/meta/nwav.c
Normal file
@ -0,0 +1,57 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* NWAV - from Chunsoft games [Fuurai no Shiren Gaiden: Onnakenshi Asuka Kenzan! (PC)] */
|
||||
VGMSTREAM * init_vgmstream_nwav(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
|
||||
|
||||
/* checks */
|
||||
/* .nwav: header id (no filenames in bigfiles) */
|
||||
if ( !check_extensions(streamFile,"nwav") )
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) != 0x4E574156) /* "NWAV" */
|
||||
goto fail;
|
||||
|
||||
|
||||
#ifdef VGM_USE_VORBIS
|
||||
{
|
||||
ogg_vorbis_meta_info_t ovmi = {0};
|
||||
int channels;
|
||||
|
||||
/* 0x04: version? */
|
||||
/* 0x08: crc? */
|
||||
ovmi.stream_size = read_32bitLE(0x0c, streamFile);
|
||||
ovmi.loop_end = read_32bitLE(0x10, streamFile); /* num_samples, actually */
|
||||
/* 0x14: sample rate */
|
||||
/* 0x18: bps? (16) */
|
||||
channels = read_8bit(0x19, streamFile);
|
||||
start_offset = read_16bitLE(0x1a, streamFile);
|
||||
|
||||
ovmi.loop_flag = read_16bitLE(0x1c, streamFile) != 0; /* loop count? -1 = loops */
|
||||
/* 0x1e: always 2? */
|
||||
/* 0x20: always 1? */
|
||||
ovmi.loop_start = read_32bitLE(0x24, streamFile);
|
||||
/* 0x28: always 1? */
|
||||
/* 0x2a: always 1? */
|
||||
/* 0x2c: always null? */
|
||||
|
||||
ovmi.meta_type = meta_NWAV;
|
||||
|
||||
/* values are in resulting bytes */
|
||||
ovmi.loop_start = ovmi.loop_start / sizeof(int16_t) / channels;
|
||||
ovmi.loop_end = ovmi.loop_end / sizeof(int16_t) / channels;
|
||||
|
||||
vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -447,6 +447,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_vs_ffx,
|
||||
init_vgmstream_msf_banpresto_wmsf,
|
||||
init_vgmstream_msf_banpresto_2msf,
|
||||
init_vgmstream_nwav,
|
||||
|
||||
/* 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 */
|
||||
|
@ -702,6 +702,7 @@ typedef enum {
|
||||
meta_VA3, /* DDR Supernova 2 AC */
|
||||
meta_XOPUS,
|
||||
meta_VS_FFX,
|
||||
meta_NWAV,
|
||||
|
||||
} meta_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user