Fix some .tun [NBA Inside Drive 2000 (PC)]

This commit is contained in:
bnnm 2022-05-15 12:23:01 +02:00
parent 0dc64cdd8b
commit b61e94ed3c
5 changed files with 25 additions and 13 deletions

View File

@ -1205,7 +1205,7 @@ static const meta_info meta_info_list[] = {
{meta_MTAF, "Konami MTAF header"},
{meta_PS2_VAG1, "Konami VAG1 header"},
{meta_PS2_VAG2, "Konami VAG2 header"},
{meta_TUN, "Lego Racers ALP header"},
{meta_ALP, "High Voltage ALP header"},
{meta_WPD, "WPD 'DPW' header"},
{meta_MN_STR, "Mini Ninjas 'STR' header"},
{meta_MSS, "Guerilla MCSS header"},

View File

@ -541,7 +541,7 @@ VGMSTREAM * init_vgmstream_eb_sf0(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_mtaf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_tun(STREAMFILE* streamFile);
VGMSTREAM* init_vgmstream_alp(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_wpd(STREAMFILE* streamFile);

View File

@ -1,31 +1,43 @@
#include "meta.h"
#include "../coding/coding.h"
/* ALP - from LEGO Racers (PC) */
VGMSTREAM* init_vgmstream_tun(STREAMFILE* sf) {
/* ALP - from High Voltage games [LEGO Racers (PC), NBA Inside Drive 2000 (PC)] */
VGMSTREAM* init_vgmstream_alp(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int loop_flag, channels;
int loop_flag, channels, sample_rate;
/* checks */
if (!is_id32be(0x00,sf, "ALP "))
goto fail;
if (!check_extensions(sf,"tun"))
goto fail;
/* also "ADPCM" at 0x08 */
channels = 2; /* probably at 0x0F */
start_offset = read_u32le(0x04, sf) + 0x08;
if (!is_id32be(0x08,sf, "ADPC")) /* codec, probably */
goto fail;
/* 0x0c: "M\0\0" */
channels = read_u8(0x0f, sf);
if (channels != 2) /* not seen though mono should work (raw IMA_HV in NBA Hangtime uses it) */
goto fail;
/* NBA Inside Drive (PC) */
if (start_offset >= 0x14)
sample_rate = read_s32le(0x10, sf); /* still 22050 thogh */
else
sample_rate = 22050;
loop_flag = 0;
start_offset = 0x10;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_TUN;
vgmstream->meta_type = meta_ALP;
vgmstream->channels = channels;
vgmstream->sample_rate = 22050;
vgmstream->num_samples = ima_bytes_to_samples(get_streamfile_size(sf) - 0x10, channels);
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = ima_bytes_to_samples(get_streamfile_size(sf) - start_offset, channels);
vgmstream->coding_type = coding_HV_IMA;
vgmstream->layout_type = layout_interleave;

View File

@ -257,7 +257,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_eb_sfx,
init_vgmstream_eb_sf0,
init_vgmstream_mtaf,
init_vgmstream_tun,
init_vgmstream_alp,
init_vgmstream_wpd,
init_vgmstream_mn_str,
init_vgmstream_mss,

View File

@ -568,7 +568,7 @@ typedef enum {
meta_MTAF,
meta_PS2_VAG1, /* Metal Gear Solid 3 VAG1 */
meta_PS2_VAG2, /* Metal Gear Solid 3 VAG2 */
meta_TUN, /* LEGO Racers (PC) */
meta_ALP,
meta_WPD, /* Shuffle! (PC) */
meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */
meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */