mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
RAGE AUD: Better BE support
This commit is contained in:
parent
f4843db739
commit
2dd03f1ff5
@ -281,7 +281,7 @@ int render_layout(sample_t* buf, int32_t sample_count, VGMSTREAM* vgmstream) {
|
|||||||
case layout_blocked_xvas:
|
case layout_blocked_xvas:
|
||||||
case layout_blocked_thp:
|
case layout_blocked_thp:
|
||||||
case layout_blocked_filp:
|
case layout_blocked_filp:
|
||||||
case layout_blocked_ivaud:
|
case layout_blocked_rage_aud:
|
||||||
case layout_blocked_ea_swvr:
|
case layout_blocked_ea_swvr:
|
||||||
case layout_blocked_adm:
|
case layout_blocked_adm:
|
||||||
case layout_blocked_ps2_iab:
|
case layout_blocked_ps2_iab:
|
||||||
|
@ -954,7 +954,7 @@ static const layout_info layout_info_list[] = {
|
|||||||
{layout_blocked_filp, "blocked (FILP)"},
|
{layout_blocked_filp, "blocked (FILP)"},
|
||||||
{layout_blocked_ea_swvr, "blocked (EA SWVR)"},
|
{layout_blocked_ea_swvr, "blocked (EA SWVR)"},
|
||||||
{layout_blocked_adm, "blocked (ADM)"},
|
{layout_blocked_adm, "blocked (ADM)"},
|
||||||
{layout_blocked_ivaud, "blocked (IVAUD)"},
|
{layout_blocked_rage_aud, "blocked (Rockstar AUD)"},
|
||||||
{layout_blocked_ps2_iab, "blocked (IAB)"},
|
{layout_blocked_ps2_iab, "blocked (IAB)"},
|
||||||
{layout_blocked_vs_str, "blocked (STR VS)"},
|
{layout_blocked_vs_str, "blocked (STR VS)"},
|
||||||
{layout_blocked_rws, "blocked (RWS)"},
|
{layout_blocked_rws, "blocked (RWS)"},
|
||||||
@ -1149,7 +1149,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_PS2_MCG, "Gunvari MCG Header"},
|
{meta_PS2_MCG, "Gunvari MCG Header"},
|
||||||
{meta_ZSD, "Konami ZSD header"},
|
{meta_ZSD, "Konami ZSD header"},
|
||||||
{meta_REDSPARK, "RedSpark header"},
|
{meta_REDSPARK, "RedSpark header"},
|
||||||
{meta_IVAUD, "Rockstar .ivaud header"},
|
{meta_RAGE_AUD, "Rockstar AUD header"},
|
||||||
{meta_DSP_WII_WSD, ".WSD header"},
|
{meta_DSP_WII_WSD, ".WSD header"},
|
||||||
{meta_WII_NDP, "Icon Games NDP header"},
|
{meta_WII_NDP, "Icon Games NDP header"},
|
||||||
{meta_PS2_SPS, "Ape Escape 2 SPS Header"},
|
{meta_PS2_SPS, "Ape Escape 2 SPS Header"},
|
||||||
|
@ -144,8 +144,8 @@ void block_update(off_t block_offset, VGMSTREAM* vgmstream) {
|
|||||||
case layout_blocked_filp:
|
case layout_blocked_filp:
|
||||||
block_update_filp(block_offset,vgmstream);
|
block_update_filp(block_offset,vgmstream);
|
||||||
break;
|
break;
|
||||||
case layout_blocked_ivaud:
|
case layout_blocked_rage_aud:
|
||||||
block_update_ivaud(block_offset,vgmstream);
|
block_update_rage_aud(block_offset,vgmstream);
|
||||||
break;
|
break;
|
||||||
case layout_blocked_ea_swvr:
|
case layout_blocked_ea_swvr:
|
||||||
block_update_ea_swvr(block_offset,vgmstream);
|
block_update_ea_swvr(block_offset,vgmstream);
|
||||||
|
@ -1,18 +1,26 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
|
#include "../util/endianness.h"
|
||||||
|
|
||||||
/* GTA IV blocks */
|
/* RAGE AUD (MC:LA, GTA IV) blocks */
|
||||||
void block_update_ivaud(off_t block_offset, VGMSTREAM * vgmstream) {
|
void block_update_rage_aud(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||||
STREAMFILE *streamFile = vgmstream->ch[0].streamfile;
|
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
||||||
size_t header_size, block_samples;
|
size_t header_size, block_samples, seek_info_size, seek_info_entry_size;
|
||||||
int i;
|
|
||||||
off_t seek_info_offset;
|
off_t seek_info_offset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
//big_endian = read_u32le(0x00, sf) == 0; /* 64-bit number */
|
||||||
|
read_u64_t read_u64 = vgmstream->codec_endian ? read_u64be : read_u64le;
|
||||||
|
read_u32_t read_u32 = vgmstream->codec_endian ? read_u32be : read_u32le;
|
||||||
|
|
||||||
|
|
||||||
/* base header */
|
/* base header */
|
||||||
seek_info_offset = read_32bitLE(block_offset+0x00,streamFile); /*64b */
|
seek_info_offset = read_u64(block_offset + 0x00, sf); /* 0x18 */
|
||||||
/* 0x08(8): seek table offset */
|
seek_info_size = read_u64(block_offset + 0x08, sf);
|
||||||
/* 0x10(8): seek table offset again? */
|
/* 0x10(8): seek table offset; should be identical to seek_info_size */
|
||||||
|
|
||||||
|
/* entries are 0x10 long on PC & X360, and 0x18 on PS3 */
|
||||||
|
seek_info_entry_size = (seek_info_size - seek_info_offset) / vgmstream->channels;
|
||||||
/* seek info (per channel) */
|
/* seek info (per channel) */
|
||||||
/* 0x00: start entry */
|
/* 0x00: start entry */
|
||||||
/* 0x04: number of entries */
|
/* 0x04: number of entries */
|
||||||
@ -27,6 +35,19 @@ void block_update_ivaud(off_t block_offset, VGMSTREAM * vgmstream) {
|
|||||||
/* find header size */
|
/* find header size */
|
||||||
/* can't see a better way to calc, as there may be dummy entries after usable ones
|
/* can't see a better way to calc, as there may be dummy entries after usable ones
|
||||||
* (table is max 0x7b8 + seek table offset + 0x800-padded) */
|
* (table is max 0x7b8 + seek table offset + 0x800-padded) */
|
||||||
|
|
||||||
|
/* TODO: This isn't really reliable, there are several very short 4-7ch streams in
|
||||||
|
* both MCLA and GTA4 whose seek tables are short enough to fit in 0x800 alignment
|
||||||
|
*
|
||||||
|
* The best option might be to search for the highest start_entry offset across all the
|
||||||
|
* seek info entries (offsets 0x00 and 0x04, can be along with the block_samples loop),
|
||||||
|
* and do seek_info_size + furthest_offset * 0x08 + num_entries * 0x08, since sometimes
|
||||||
|
* the number of seek entries are off by one, so just adding them all up won't match.
|
||||||
|
*
|
||||||
|
* However this should always be done from the 1st stream block, or at the very least
|
||||||
|
* not the final block, since it can have less data left over due to it being the end
|
||||||
|
* of the stream, where the calculation would result in it being smaller than it is.
|
||||||
|
*/
|
||||||
if (vgmstream->channels > 3)
|
if (vgmstream->channels > 3)
|
||||||
header_size = 0x1000;
|
header_size = 0x1000;
|
||||||
else
|
else
|
||||||
@ -34,8 +55,9 @@ void block_update_ivaud(off_t block_offset, VGMSTREAM * vgmstream) {
|
|||||||
|
|
||||||
/* get max data_size as channels may vary slightly (data is padded, hopefully won't create pops) */
|
/* get max data_size as channels may vary slightly (data is padded, hopefully won't create pops) */
|
||||||
block_samples = 0;
|
block_samples = 0;
|
||||||
for(i = 0;i < vgmstream->channels; i++) {
|
seek_info_offset += block_offset;
|
||||||
size_t channel_samples = read_32bitLE(block_offset + seek_info_offset+0x0c + 0x10*i,streamFile);
|
for (i = 0; i < vgmstream->channels; i++) {
|
||||||
|
size_t channel_samples = read_u32(seek_info_offset + 0x0c + seek_info_entry_size * i, sf);
|
||||||
if (block_samples < channel_samples)
|
if (block_samples < channel_samples)
|
||||||
block_samples = channel_samples;
|
block_samples = channel_samples;
|
||||||
}
|
}
|
||||||
@ -45,9 +67,9 @@ void block_update_ivaud(off_t block_offset, VGMSTREAM * vgmstream) {
|
|||||||
vgmstream->current_block_samples = block_samples;
|
vgmstream->current_block_samples = block_samples;
|
||||||
vgmstream->current_block_size = 0;
|
vgmstream->current_block_size = 0;
|
||||||
|
|
||||||
for(i = 0; i < vgmstream->channels; i++) {
|
for (i = 0; i < vgmstream->channels; i++) {
|
||||||
/* use seek table's start entry to find channel offset */
|
/* use seek table's start entry to find channel offset */
|
||||||
size_t interleave_size = read_32bitLE(block_offset + seek_info_offset+0x00 + 0x10*i,streamFile) * 0x800;
|
size_t interleave_size = read_u32(seek_info_offset + 0x00 + seek_info_entry_size * i, sf) * 0x800;
|
||||||
vgmstream->ch[i].offset = block_offset + header_size + interleave_size;
|
vgmstream->ch[i].offset = block_offset + header_size + interleave_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ void block_update_gsb(off_t block_offset, VGMSTREAM* vgmstream);
|
|||||||
void block_update_xvas(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_xvas(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_thp(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_thp(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_filp(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_filp(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_ivaud(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_rage_aud(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_ea_swvr(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_ea_swvr(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_adm(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_adm(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
void block_update_ps2_iab(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update_ps2_iab(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
|
125
src/meta/ivaud.c
125
src/meta/ivaud.c
@ -20,24 +20,24 @@ typedef struct {
|
|||||||
size_t stream_size;
|
size_t stream_size;
|
||||||
|
|
||||||
int big_endian;
|
int big_endian;
|
||||||
} ivaud_header;
|
} aud_header;
|
||||||
|
|
||||||
static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud);
|
static int parse_aud_header(STREAMFILE* sf, aud_header* aud);
|
||||||
|
|
||||||
|
|
||||||
/* .ivaud - from GTA IV (PC/PS3/X360) */
|
/* RAGE AUD - MC:LA, GTA IV (PC/PS3/X360) */
|
||||||
VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
VGMSTREAM* init_vgmstream_rage_aud(STREAMFILE* sf) {
|
||||||
VGMSTREAM* vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
ivaud_header ivaud = {0};
|
aud_header aud = {0};
|
||||||
int loop_flag;
|
int loop_flag;
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
/* (hashed filenames are likely extensionless, .ivaud is added by tools) */
|
/* extensionless (.ivaud is fake/added by tools) */
|
||||||
if (!check_extensions(sf, "ivaud,"))
|
if (!check_extensions(sf, "ivaud,"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* check header */
|
/* check header */
|
||||||
if (!parse_ivaud_header(sf, &ivaud))
|
if (!parse_aud_header(sf, &aud))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -45,35 +45,36 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
|||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(ivaud.channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(aud.channel_count, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->sample_rate = ivaud.sample_rate;
|
vgmstream->sample_rate = aud.sample_rate;
|
||||||
vgmstream->num_samples = ivaud.num_samples;
|
vgmstream->num_samples = aud.num_samples;
|
||||||
vgmstream->num_streams = ivaud.total_subsongs;
|
vgmstream->num_streams = aud.total_subsongs;
|
||||||
vgmstream->stream_size = ivaud.stream_size;
|
vgmstream->stream_size = aud.stream_size;
|
||||||
vgmstream->meta_type = meta_IVAUD;
|
vgmstream->codec_endian = aud.big_endian;
|
||||||
|
vgmstream->meta_type = meta_RAGE_AUD;
|
||||||
|
|
||||||
switch(ivaud.codec) {
|
switch (aud.codec) {
|
||||||
case 0x0001: /* common in sfx, uncommon in music (ex. EP2_SFX/MENU_MUSIC) */
|
case 0x0001: /* common in sfx, uncommon in music (ex. EP2_SFX/MENU_MUSIC) */
|
||||||
vgmstream->coding_type = coding_PCM16LE;
|
vgmstream->coding_type = aud.big_endian ? coding_PCM16BE : coding_PCM16LE;
|
||||||
vgmstream->layout_type = ivaud.is_music ? layout_blocked_ivaud : layout_none;
|
vgmstream->layout_type = aud.is_music ? layout_blocked_rage_aud : layout_none;
|
||||||
vgmstream->full_block_size = ivaud.block_size;
|
vgmstream->full_block_size = aud.block_size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
case 0x0000: { /* XMA2 (X360) */
|
case 0x0000: { /* XMA2 (X360) */
|
||||||
if (ivaud.is_music) {
|
if (aud.is_music) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* regular XMA for sfx */
|
/* regular XMA for sfx */
|
||||||
vgmstream->codec_data = init_ffmpeg_xma1_raw(sf, ivaud.stream_offset, ivaud.stream_size, ivaud.channel_count, ivaud.sample_rate, 0);
|
vgmstream->codec_data = init_ffmpeg_xma1_raw(sf, aud.stream_offset, aud.stream_size, aud.channel_count, aud.sample_rate, 0);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
vgmstream->coding_type = coding_FFmpeg;
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
xma_fix_raw_samples(vgmstream, sf, ivaud.stream_offset, ivaud.stream_size, 0, 0,0); /* samples are ok? */
|
xma_fix_raw_samples(vgmstream, sf, aud.stream_offset, aud.stream_size, 0, 0, 0); /* samples are ok? */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -83,14 +84,14 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
|||||||
case 0x0100: { /* MPEG (PS3) */
|
case 0x0100: { /* MPEG (PS3) */
|
||||||
mpeg_custom_config cfg = {0};
|
mpeg_custom_config cfg = {0};
|
||||||
|
|
||||||
if (ivaud.is_music) {
|
if (aud.is_music) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cfg.chunk_size = ivaud.block_size;
|
cfg.chunk_size = aud.block_size;
|
||||||
cfg.big_endian = ivaud.big_endian;
|
cfg.big_endian = aud.big_endian;
|
||||||
|
|
||||||
vgmstream->codec_data = init_mpeg_custom(sf, ivaud.stream_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_STANDARD, &cfg);
|
vgmstream->codec_data = init_mpeg_custom(sf, aud.stream_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_STANDARD, &cfg);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
}
|
}
|
||||||
@ -100,17 +101,17 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
|||||||
|
|
||||||
case 0x0400: /* PC */
|
case 0x0400: /* PC */
|
||||||
vgmstream->coding_type = coding_IMA_int;
|
vgmstream->coding_type = coding_IMA_int;
|
||||||
vgmstream->layout_type = ivaud.is_music ? layout_blocked_ivaud : layout_none;
|
vgmstream->layout_type = aud.is_music ? layout_blocked_rage_aud : layout_none;
|
||||||
vgmstream->full_block_size = ivaud.block_size;
|
vgmstream->full_block_size = aud.block_size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VGM_LOG("IVAUD: unknown codec 0x%x\n", ivaud.codec);
|
VGM_LOG("RAGE AUD: unknown codec 0x%x\n", aud.codec);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!vgmstream_open_stream(vgmstream,sf,ivaud.stream_offset))
|
if (!vgmstream_open_stream(vgmstream, sf, aud.stream_offset))
|
||||||
goto fail;
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
@ -119,43 +120,43 @@ fail:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse Rockstar's .ivaud header (much info from SparkIV). */
|
/* Parse Rockstar's AUD header (much info from SparkIV). */
|
||||||
static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud) {
|
static int parse_aud_header(STREAMFILE* sf, aud_header* aud) {
|
||||||
int target_subsong = sf->stream_index;
|
int target_subsong = sf->stream_index;
|
||||||
read_u64_t read_u64;
|
read_u64_t read_u64;
|
||||||
read_u32_t read_u32;
|
read_u32_t read_u32;
|
||||||
read_u16_t read_u16;
|
read_u16_t read_u16;
|
||||||
|
|
||||||
|
|
||||||
ivaud->big_endian = read_u32be(0x00, sf) == 0; /* table offset at 0x04 > BE (64b) */
|
aud->big_endian = read_u32be(0x00, sf) == 0; /* table offset at 0x04 > BE (64b) */
|
||||||
read_u64 = ivaud->big_endian ? read_u64be : read_u64le;
|
read_u64 = aud->big_endian ? read_u64be : read_u64le;
|
||||||
read_u32 = ivaud->big_endian ? read_u32be : read_u32le;
|
read_u32 = aud->big_endian ? read_u32be : read_u32le;
|
||||||
read_u16 = ivaud->big_endian ? read_u16be : read_u16le;
|
read_u16 = aud->big_endian ? read_u16be : read_u16le;
|
||||||
|
|
||||||
uint64_t table_offset = read_u64(0x00,sf);
|
uint64_t table_offset = read_u64(0x00, sf);
|
||||||
if (table_offset > 0x10000) /* arbitrary max, typically 0x1c~0x1000 */
|
if (table_offset > 0x10000) /* arbitrary max, typically 0x1c~0x1000 */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* use bank's stream count to detect */
|
/* use bank's stream count to detect */
|
||||||
ivaud->is_music = (read_u32(0x10,sf) == 0);
|
aud->is_music = (read_u32(0x10, sf) == 0);
|
||||||
|
|
||||||
if (ivaud->is_music) {
|
if (aud->is_music) {
|
||||||
off_t block_table_offset, channel_table_offset, channel_info_offset;
|
off_t block_table_offset, channel_table_offset, channel_info_offset;
|
||||||
|
|
||||||
/* music header */
|
/* music header */
|
||||||
block_table_offset = table_offset;
|
block_table_offset = table_offset;
|
||||||
ivaud->block_count = read_u32(0x08,sf);
|
aud->block_count = read_u32(0x08, sf);
|
||||||
ivaud->block_size = read_u32(0x0c,sf); /* uses padded blocks */
|
aud->block_size = read_u32(0x0c, sf); /* uses padded blocks */
|
||||||
/* 0x10(4): stream count */
|
/* 0x10(4): stream count */
|
||||||
channel_table_offset = read_u64(0x14,sf);
|
channel_table_offset = read_u64(0x14, sf);
|
||||||
/* 0x1c(8): block_table_offset again? */
|
/* 0x1c(8): block_table_offset again? */
|
||||||
ivaud->channel_count = read_u32(0x24,sf);
|
aud->channel_count = read_u32(0x24, sf);
|
||||||
/* 0x28(4): unknown entries? */
|
/* 0x28(4): unknown entries? */
|
||||||
ivaud->stream_offset = read_u32(0x2c,sf);
|
aud->stream_offset = read_u32(0x2c, sf);
|
||||||
channel_info_offset = channel_table_offset + ivaud->channel_count * 0x10;
|
channel_info_offset = channel_table_offset + aud->channel_count * 0x10;
|
||||||
|
|
||||||
if ((ivaud->block_count * ivaud->block_size) + ivaud->stream_offset != get_streamfile_size(sf)) {
|
if ((aud->block_count * aud->block_size) + aud->stream_offset != get_streamfile_size(sf)) {
|
||||||
VGM_LOG("IVAUD: bad file size\n");
|
VGM_LOG("RAGE AUD: bad file size\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,23 +169,23 @@ static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud) {
|
|||||||
/* 0x00(8): offset within data (should be 0) */
|
/* 0x00(8): offset within data (should be 0) */
|
||||||
/* 0x08(4): hash */
|
/* 0x08(4): hash */
|
||||||
/* 0x0c(4): half num_samples? */
|
/* 0x0c(4): half num_samples? */
|
||||||
ivaud->num_samples = read_u32(channel_info_offset+0x10,sf);
|
aud->num_samples = read_u32(channel_info_offset + 0x10, sf);
|
||||||
/* 0x14(4): unknown (-1) */
|
/* 0x14(4): unknown (-1) */
|
||||||
/* 0x18(2): sample rate */
|
/* 0x18(2): sample rate */
|
||||||
/* 0x1a(2): unknown */
|
/* 0x1a(2): unknown */
|
||||||
ivaud->codec = read_u32(channel_info_offset+0x1c,sf);
|
aud->codec = read_u32(channel_info_offset + 0x1c, sf);
|
||||||
/* (when codec is IMA) */
|
/* (when codec is IMA) */
|
||||||
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
||||||
/* rest: unknown data */
|
/* rest: unknown data */
|
||||||
|
|
||||||
/* block table (one entry per block) */
|
/* block table (one entry per block) */
|
||||||
/* 0x00: data size processed up to this block (doesn't count block padding) */
|
/* 0x00: data size processed up to this block (doesn't count block padding) */
|
||||||
ivaud->sample_rate = read_u32(block_table_offset + 0x04,sf);
|
aud->sample_rate = read_u32(block_table_offset + 0x04, sf);
|
||||||
/* sample_rate should agree with each channel in the channel table */
|
/* sample_rate should agree with each channel in the channel table */
|
||||||
|
|
||||||
|
|
||||||
ivaud->total_subsongs = 1;
|
aud->total_subsongs = 1;
|
||||||
ivaud->stream_size = get_streamfile_size(sf);
|
aud->stream_size = get_streamfile_size(sf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
off_t stream_table_offset, stream_info_offset, stream_entry_offset, offset;
|
off_t stream_table_offset, stream_info_offset, stream_entry_offset, offset;
|
||||||
@ -192,42 +193,42 @@ static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud) {
|
|||||||
/* bank header */
|
/* bank header */
|
||||||
stream_table_offset = table_offset;
|
stream_table_offset = table_offset;
|
||||||
/* 0x08(8): header size? start offset? */
|
/* 0x08(8): header size? start offset? */
|
||||||
ivaud->total_subsongs = read_u32(0x10,sf);
|
aud->total_subsongs = read_u32(0x10, sf);
|
||||||
/* 0x14(4): unknown */
|
/* 0x14(4): unknown */
|
||||||
ivaud->stream_offset = read_u32(0x18,sf); /* base start_offset */
|
aud->stream_offset = read_u32(0x18, sf); /* base start_offset */
|
||||||
|
|
||||||
if (target_subsong == 0) target_subsong = 1;
|
if (target_subsong == 0) target_subsong = 1;
|
||||||
if (target_subsong < 0 || target_subsong > ivaud->total_subsongs || ivaud->total_subsongs < 1) goto fail;
|
if (target_subsong < 0 || target_subsong > aud->total_subsongs || aud->total_subsongs < 1) goto fail;
|
||||||
|
|
||||||
if (stream_table_offset != 0x1c)
|
if (stream_table_offset != 0x1c)
|
||||||
goto fail;
|
goto fail;
|
||||||
stream_info_offset = stream_table_offset + 0x10*ivaud->total_subsongs;
|
stream_info_offset = stream_table_offset + 0x10 * aud->total_subsongs;
|
||||||
|
|
||||||
/* stream table (one entry per stream, points to stream info) */
|
/* stream table (one entry per stream, points to stream info) */
|
||||||
stream_entry_offset = read_u64(stream_table_offset + 0x10*(target_subsong-1) + 0x00,sf); /* within stream info */
|
stream_entry_offset = read_u64(stream_table_offset + 0x10 * (target_subsong - 1) + 0x00, sf); /* within stream info */
|
||||||
/* 0x00(8): offset within stream_info_offset */
|
/* 0x00(8): offset within stream_info_offset */
|
||||||
/* 0x08(4): hash */
|
/* 0x08(4): hash */
|
||||||
/* 0x0c(4): some offset/size */
|
/* 0x0c(4): some offset/size */
|
||||||
|
|
||||||
/* stream info (one entry per stream) */
|
/* stream info (one entry per stream) */
|
||||||
offset = stream_info_offset + stream_entry_offset;
|
offset = stream_info_offset + stream_entry_offset;
|
||||||
ivaud->stream_offset += read_u64(offset+0x00,sf); /* within data */
|
aud->stream_offset += read_u64(offset + 0x00, sf); /* within data */
|
||||||
/* 0x08(4): hash */
|
/* 0x08(4): hash */
|
||||||
ivaud->stream_size = read_u32(offset+0x0c,sf);
|
aud->stream_size = read_u32(offset + 0x0c, sf);
|
||||||
ivaud->num_samples = read_u32(offset+0x10,sf);
|
aud->num_samples = read_u32(offset + 0x10, sf);
|
||||||
/* 0x14(4): unknown (-1) */
|
/* 0x14(4): unknown (-1) */
|
||||||
ivaud->sample_rate = read_u16(offset+0x18,sf);
|
aud->sample_rate = read_u16(offset + 0x18, sf);
|
||||||
/* 0x1a(2): unknown */
|
/* 0x1a(2): unknown */
|
||||||
ivaud->codec = read_u32(offset+0x1c,sf);
|
aud->codec = read_u32(offset + 0x1c, sf);
|
||||||
/* (when codec is IMA) */
|
/* (when codec is IMA) */
|
||||||
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
||||||
/* rest: unknown data */
|
/* rest: unknown data */
|
||||||
|
|
||||||
ivaud->channel_count = 1;
|
aud->channel_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ VGMSTREAM * init_vgmstream_vgs_ps(STREAMFILE *streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_redspark(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_redspark(STREAMFILE *streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_rage_aud(STREAMFILE *streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_sps(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_ps2_sps(STREAMFILE *streamFile);
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
|||||||
init_vgmstream_mic_koei,
|
init_vgmstream_mic_koei,
|
||||||
init_vgmstream_seb,
|
init_vgmstream_seb,
|
||||||
init_vgmstream_tgc,
|
init_vgmstream_tgc,
|
||||||
init_vgmstream_ivaud,
|
init_vgmstream_rage_aud,
|
||||||
init_vgmstream_asd_naxat,
|
init_vgmstream_asd_naxat,
|
||||||
/* need companion files */
|
/* need companion files */
|
||||||
init_vgmstream_pos,
|
init_vgmstream_pos,
|
||||||
|
@ -215,7 +215,7 @@ typedef enum {
|
|||||||
layout_blocked_ea_swvr,
|
layout_blocked_ea_swvr,
|
||||||
layout_blocked_adm,
|
layout_blocked_adm,
|
||||||
layout_blocked_mxch,
|
layout_blocked_mxch,
|
||||||
layout_blocked_ivaud, /* GTA IV .ivaud blocks */
|
layout_blocked_rage_aud, /* Rockstar AUD blocks */
|
||||||
layout_blocked_ps2_iab,
|
layout_blocked_ps2_iab,
|
||||||
layout_blocked_vs_str,
|
layout_blocked_vs_str,
|
||||||
layout_blocked_rws,
|
layout_blocked_rws,
|
||||||
@ -224,7 +224,7 @@ typedef enum {
|
|||||||
layout_blocked_awc, /* Rockstar AWC */
|
layout_blocked_awc, /* Rockstar AWC */
|
||||||
layout_blocked_vgs, /* Guitar Hero II (PS2) */
|
layout_blocked_vgs, /* Guitar Hero II (PS2) */
|
||||||
layout_blocked_xwav,
|
layout_blocked_xwav,
|
||||||
layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */
|
layout_blocked_xvag_subsong,/* XVAG subsongs [God of War III (PS4)] */
|
||||||
layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */
|
layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */
|
||||||
layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */
|
layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */
|
||||||
layout_blocked_sthd, /* Dream Factory STHD */
|
layout_blocked_sthd, /* Dream Factory STHD */
|
||||||
@ -436,7 +436,7 @@ typedef enum {
|
|||||||
meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */
|
meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */
|
||||||
meta_ZSD, /* Dragon Booster ZSD */
|
meta_ZSD, /* Dragon Booster ZSD */
|
||||||
meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */
|
meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */
|
||||||
meta_IVAUD, /* .ivaud GTA IV */
|
meta_RAGE_AUD, /* Rockstar AUD - MC:LA, GTA IV */
|
||||||
meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
|
meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
|
||||||
meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
|
meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
|
||||||
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
|
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
|
||||||
|
Loading…
Reference in New Issue
Block a user