Implement Traveller's Tales' RAD

This commit is contained in:
Simon Aarons 2019-07-12 20:14:39 +10:00
parent e118414287
commit 5734a84a23
7 changed files with 45 additions and 0 deletions

View File

@ -333,6 +333,7 @@ static const char* extension_list[] = {
"r",
"rac", //txth/reserved [Manhunt (Xbox)]
"rad",
"rak",
"ras",
"raw",
@ -1195,6 +1196,7 @@ static const meta_info meta_info_list[] = {
{meta_XWMA_KONAMI, "Konami XWMA header"},
{meta_9TAV, "Konami 9TAV header"},
{meta_BWAV, "Nintendo BWAV header"},
{meta_RAD, "Traveller's Tales RAD header"},
};

View File

@ -186,6 +186,7 @@
<ClCompile Include="meta\mss.c" />
<ClCompile Include="meta\mtaf.c" />
<ClCompile Include="meta\ps2_spm.c" />
<ClCompile Include="meta\rad.c" />
<ClCompile Include="meta\vs_str.c" />
<ClCompile Include="meta\ps2_wmus.c" />
<ClCompile Include="meta\ps3_ivag.c" />

View File

@ -1591,5 +1591,8 @@
<ClCompile Include="meta\bwav.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\rad.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -861,4 +861,6 @@ VGMSTREAM * init_vgmstream_opus_prototype(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_awb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rad(STREAMFILE * streamFile);
#endif /*_META_H*/

35
src/meta/rad.c Normal file
View File

@ -0,0 +1,35 @@
#include "meta.h"
#include "../coding/coding.h"
/* RAD - from Traveller's Tales' Bionicle Heroes */
VGMSTREAM * init_vgmstream_rad(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int channel_count, loop_flag = 0;
/* checks */
if (!check_extensions(streamFile, "rad"))
goto fail;
start_offset = read_32bitLE(0x00, streamFile);
channel_count = read_8bit(0x0D, streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x04, streamFile);
vgmstream->num_samples = read_32bitLE(0x08, streamFile);
vgmstream->meta_type = meta_RAD;
vgmstream->layout_type = layout_none;
vgmstream->coding_type = coding_PCM16LE;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -483,6 +483,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_bwav,
init_vgmstream_opus_prototype,
init_vgmstream_awb,
init_vgmstream_rad,
/* 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 */

View File

@ -731,6 +731,7 @@ typedef enum {
meta_XWMA_KONAMI,
meta_9TAV,
meta_BWAV,
meta_RAD,
} meta_t;