mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
Merge pull request #1516 from EdnessP/master
RAGE AUD: Better BE support
This commit is contained in:
commit
63a12e108b
@ -281,7 +281,7 @@ int render_layout(sample_t* buf, int32_t sample_count, VGMSTREAM* vgmstream) {
|
||||
case layout_blocked_xvas:
|
||||
case layout_blocked_thp:
|
||||
case layout_blocked_filp:
|
||||
case layout_blocked_ivaud:
|
||||
case layout_blocked_rage_aud:
|
||||
case layout_blocked_ea_swvr:
|
||||
case layout_blocked_adm:
|
||||
case layout_blocked_ps2_iab:
|
||||
|
@ -954,7 +954,7 @@ static const layout_info layout_info_list[] = {
|
||||
{layout_blocked_filp, "blocked (FILP)"},
|
||||
{layout_blocked_ea_swvr, "blocked (EA SWVR)"},
|
||||
{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_vs_str, "blocked (STR VS)"},
|
||||
{layout_blocked_rws, "blocked (RWS)"},
|
||||
@ -1149,7 +1149,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_PS2_MCG, "Gunvari MCG Header"},
|
||||
{meta_ZSD, "Konami ZSD header"},
|
||||
{meta_REDSPARK, "RedSpark header"},
|
||||
{meta_IVAUD, "Rockstar .ivaud header"},
|
||||
{meta_RAGE_AUD, "Rockstar AUD header"},
|
||||
{meta_DSP_WII_WSD, ".WSD header"},
|
||||
{meta_WII_NDP, "Icon Games NDP 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:
|
||||
block_update_filp(block_offset,vgmstream);
|
||||
break;
|
||||
case layout_blocked_ivaud:
|
||||
block_update_ivaud(block_offset,vgmstream);
|
||||
case layout_blocked_rage_aud:
|
||||
block_update_rage_aud(block_offset,vgmstream);
|
||||
break;
|
||||
case layout_blocked_ea_swvr:
|
||||
block_update_ea_swvr(block_offset,vgmstream);
|
||||
|
@ -1,53 +0,0 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* GTA IV blocks */
|
||||
void block_update_ivaud(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
STREAMFILE *streamFile = vgmstream->ch[0].streamfile;
|
||||
size_t header_size, block_samples;
|
||||
int i;
|
||||
off_t seek_info_offset;
|
||||
|
||||
/* base header */
|
||||
seek_info_offset = read_32bitLE(block_offset+0x00,streamFile); /*64b */
|
||||
/* 0x08(8): seek table offset */
|
||||
/* 0x10(8): seek table offset again? */
|
||||
|
||||
/* seek info (per channel) */
|
||||
/* 0x00: start entry */
|
||||
/* 0x04: number of entries */
|
||||
/* 0x08: unknown */
|
||||
/* 0x0c: data size */
|
||||
|
||||
/* seek table (per all entries) */
|
||||
/* 0x00: start? */
|
||||
/* 0x04: end? */
|
||||
|
||||
|
||||
/* find header size */
|
||||
/* 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) */
|
||||
if (vgmstream->channels > 3)
|
||||
header_size = 0x1000;
|
||||
else
|
||||
header_size = 0x800;
|
||||
|
||||
/* get max data_size as channels may vary slightly (data is padded, hopefully won't create pops) */
|
||||
block_samples = 0;
|
||||
for(i = 0;i < vgmstream->channels; i++) {
|
||||
size_t channel_samples = read_32bitLE(block_offset + seek_info_offset+0x0c + 0x10*i,streamFile);
|
||||
if (block_samples < channel_samples)
|
||||
block_samples = channel_samples;
|
||||
}
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + vgmstream->full_block_size;
|
||||
vgmstream->current_block_samples = block_samples;
|
||||
vgmstream->current_block_size = 0;
|
||||
|
||||
for(i = 0; i < vgmstream->channels; i++) {
|
||||
/* 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;
|
||||
vgmstream->ch[i].offset = block_offset + header_size + interleave_size;
|
||||
}
|
||||
}
|
75
src/layout/blocked_rage_aud.c
Normal file
75
src/layout/blocked_rage_aud.c
Normal file
@ -0,0 +1,75 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
#include "../util/endianness.h"
|
||||
|
||||
/* RAGE AUD (MC:LA, GTA IV) blocks */
|
||||
void block_update_rage_aud(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
||||
size_t header_size, block_samples, seek_info_size, seek_info_entry_size;
|
||||
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 */
|
||||
seek_info_offset = read_u64(block_offset + 0x00, sf); /* 0x18 */
|
||||
seek_info_size = read_u64(block_offset + 0x08, sf);
|
||||
/* 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) */
|
||||
/* 0x00: start entry */
|
||||
/* 0x04: number of entries */
|
||||
/* 0x08: unknown */
|
||||
/* 0x0c: data size */
|
||||
|
||||
/* seek table (per all entries) */
|
||||
/* 0x00: start? */
|
||||
/* 0x04: end? */
|
||||
|
||||
|
||||
/* find header size */
|
||||
/* 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) */
|
||||
|
||||
/* 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)
|
||||
header_size = 0x1000;
|
||||
else
|
||||
header_size = 0x800;
|
||||
|
||||
/* get max data_size as channels may vary slightly (data is padded, hopefully won't create pops) */
|
||||
block_samples = 0;
|
||||
seek_info_offset += block_offset;
|
||||
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)
|
||||
block_samples = channel_samples;
|
||||
}
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + vgmstream->full_block_size;
|
||||
vgmstream->current_block_samples = block_samples;
|
||||
vgmstream->current_block_size = 0;
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
/* use seek table's start entry to find channel offset */
|
||||
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;
|
||||
}
|
||||
}
|
@ -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_thp(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_adm(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_ps2_iab(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
|
@ -311,10 +311,10 @@
|
||||
<ClCompile Include="layout\blocked_h4m.c" />
|
||||
<ClCompile Include="layout\blocked_halpst.c" />
|
||||
<ClCompile Include="layout\blocked_hwas.c" />
|
||||
<ClCompile Include="layout\blocked_ivaud.c" />
|
||||
<ClCompile Include="layout\blocked_mul.c" />
|
||||
<ClCompile Include="layout\blocked_mxch.c" />
|
||||
<ClCompile Include="layout\blocked_ps2_iab.c" />
|
||||
<ClCompile Include="layout\blocked_rage_aud.c" />
|
||||
<ClCompile Include="layout\blocked_rws.c" />
|
||||
<ClCompile Include="layout\blocked_sthd.c" />
|
||||
<ClCompile Include="layout\blocked_str_snds.c" />
|
||||
@ -482,7 +482,6 @@
|
||||
<ClCompile Include="meta\isb.c" />
|
||||
<ClCompile Include="meta\ish_isd.c" />
|
||||
<ClCompile Include="meta\ivag.c" />
|
||||
<ClCompile Include="meta\ivaud.c" />
|
||||
<ClCompile Include="meta\ivb.c" />
|
||||
<ClCompile Include="meta\jstm.c" />
|
||||
<ClCompile Include="meta\kat.c" />
|
||||
@ -603,6 +602,7 @@
|
||||
<ClCompile Include="meta\ps_headerless.c" />
|
||||
<ClCompile Include="meta\pwb.c" />
|
||||
<ClCompile Include="meta\rad.c" />
|
||||
<ClCompile Include="meta\rage_aud.c" />
|
||||
<ClCompile Include="meta\raw_int.c" />
|
||||
<ClCompile Include="meta\raw_pcm.c" />
|
||||
<ClCompile Include="meta\raw_rsf.c" />
|
||||
|
@ -754,9 +754,6 @@
|
||||
<ClCompile Include="layout\blocked_hwas.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_ivaud.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_mul.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -766,6 +763,9 @@
|
||||
<ClCompile Include="layout\blocked_ps2_iab.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_rage_aud.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_rws.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1267,9 +1267,6 @@
|
||||
<ClCompile Include="meta\ivag.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ivaud.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ivb.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1630,6 +1627,9 @@
|
||||
<ClCompile Include="meta\rad.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rage_aud.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\raw_int.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -374,7 +374,7 @@ VGMSTREAM * init_vgmstream_vgs_ps(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);
|
||||
|
||||
|
@ -20,24 +20,24 @@ typedef struct {
|
||||
size_t stream_size;
|
||||
|
||||
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) */
|
||||
VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
||||
/* RAGE AUD - MC:LA, GTA IV (PC/PS3/X360) */
|
||||
VGMSTREAM* init_vgmstream_rage_aud(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
ivaud_header ivaud = {0};
|
||||
aud_header aud = {0};
|
||||
int loop_flag;
|
||||
|
||||
/* checks */
|
||||
/* (hashed filenames are likely extensionless, .ivaud is added by tools) */
|
||||
/* extensionless (.ivaud is fake/added by tools) */
|
||||
if (!check_extensions(sf, "ivaud,"))
|
||||
return NULL;
|
||||
|
||||
/* check header */
|
||||
if (!parse_ivaud_header(sf, &ivaud))
|
||||
if (!parse_aud_header(sf, &aud))
|
||||
return NULL;
|
||||
|
||||
|
||||
@ -45,35 +45,36 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(ivaud.channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(aud.channel_count, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = ivaud.sample_rate;
|
||||
vgmstream->num_samples = ivaud.num_samples;
|
||||
vgmstream->num_streams = ivaud.total_subsongs;
|
||||
vgmstream->stream_size = ivaud.stream_size;
|
||||
vgmstream->meta_type = meta_IVAUD;
|
||||
vgmstream->sample_rate = aud.sample_rate;
|
||||
vgmstream->num_samples = aud.num_samples;
|
||||
vgmstream->num_streams = aud.total_subsongs;
|
||||
vgmstream->stream_size = aud.stream_size;
|
||||
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) */
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = ivaud.is_music ? layout_blocked_ivaud : layout_none;
|
||||
vgmstream->full_block_size = ivaud.block_size;
|
||||
vgmstream->coding_type = aud.big_endian ? coding_PCM16BE : coding_PCM16LE;
|
||||
vgmstream->layout_type = aud.is_music ? layout_blocked_rage_aud : layout_none;
|
||||
vgmstream->full_block_size = aud.block_size;
|
||||
break;
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case 0x0000: { /* XMA2 (X360) */
|
||||
if (ivaud.is_music) {
|
||||
if (aud.is_music) {
|
||||
goto fail;
|
||||
}
|
||||
else {
|
||||
/* 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;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
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;
|
||||
}
|
||||
@ -83,14 +84,14 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
||||
case 0x0100: { /* MPEG (PS3) */
|
||||
mpeg_custom_config cfg = {0};
|
||||
|
||||
if (ivaud.is_music) {
|
||||
if (aud.is_music) {
|
||||
goto fail;
|
||||
}
|
||||
else {
|
||||
cfg.chunk_size = ivaud.block_size;
|
||||
cfg.big_endian = ivaud.big_endian;
|
||||
cfg.chunk_size = aud.block_size;
|
||||
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;
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
@ -100,17 +101,17 @@ VGMSTREAM* init_vgmstream_ivaud(STREAMFILE* sf) {
|
||||
|
||||
case 0x0400: /* PC */
|
||||
vgmstream->coding_type = coding_IMA_int;
|
||||
vgmstream->layout_type = ivaud.is_music ? layout_blocked_ivaud : layout_none;
|
||||
vgmstream->full_block_size = ivaud.block_size;
|
||||
vgmstream->layout_type = aud.is_music ? layout_blocked_rage_aud : layout_none;
|
||||
vgmstream->full_block_size = aud.block_size;
|
||||
break;
|
||||
|
||||
default:
|
||||
VGM_LOG("IVAUD: unknown codec 0x%x\n", ivaud.codec);
|
||||
VGM_LOG("RAGE AUD: unknown codec 0x%x\n", aud.codec);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,sf,ivaud.stream_offset))
|
||||
if (!vgmstream_open_stream(vgmstream, sf, aud.stream_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
@ -119,43 +120,43 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse Rockstar's .ivaud header (much info from SparkIV). */
|
||||
static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud) {
|
||||
/* Parse Rockstar's AUD header (much info from SparkIV). */
|
||||
static int parse_aud_header(STREAMFILE* sf, aud_header* aud) {
|
||||
int target_subsong = sf->stream_index;
|
||||
read_u64_t read_u64;
|
||||
read_u32_t read_u32;
|
||||
read_u16_t read_u16;
|
||||
|
||||
|
||||
ivaud->big_endian = read_u32be(0x00, sf) == 0; /* table offset at 0x04 > BE (64b) */
|
||||
read_u64 = ivaud->big_endian ? read_u64be : read_u64le;
|
||||
read_u32 = ivaud->big_endian ? read_u32be : read_u32le;
|
||||
read_u16 = ivaud->big_endian ? read_u16be : read_u16le;
|
||||
aud->big_endian = read_u32be(0x00, sf) == 0; /* table offset at 0x04 > BE (64b) */
|
||||
read_u64 = aud->big_endian ? read_u64be : read_u64le;
|
||||
read_u32 = aud->big_endian ? read_u32be : read_u32le;
|
||||
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 */
|
||||
return 0;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* music header */
|
||||
block_table_offset = table_offset;
|
||||
ivaud->block_count = read_u32(0x08,sf);
|
||||
ivaud->block_size = read_u32(0x0c,sf); /* uses padded blocks */
|
||||
aud->block_count = read_u32(0x08, sf);
|
||||
aud->block_size = read_u32(0x0c, sf); /* uses padded blocks */
|
||||
/* 0x10(4): stream count */
|
||||
channel_table_offset = read_u64(0x14,sf);
|
||||
channel_table_offset = read_u64(0x14, sf);
|
||||
/* 0x1c(8): block_table_offset again? */
|
||||
ivaud->channel_count = read_u32(0x24,sf);
|
||||
aud->channel_count = read_u32(0x24, sf);
|
||||
/* 0x28(4): unknown entries? */
|
||||
ivaud->stream_offset = read_u32(0x2c,sf);
|
||||
channel_info_offset = channel_table_offset + ivaud->channel_count * 0x10;
|
||||
aud->stream_offset = read_u32(0x2c, sf);
|
||||
channel_info_offset = channel_table_offset + aud->channel_count * 0x10;
|
||||
|
||||
if ((ivaud->block_count * ivaud->block_size) + ivaud->stream_offset != get_streamfile_size(sf)) {
|
||||
VGM_LOG("IVAUD: bad file size\n");
|
||||
if ((aud->block_count * aud->block_size) + aud->stream_offset != get_streamfile_size(sf)) {
|
||||
VGM_LOG("RAGE AUD: bad file size\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -168,23 +169,23 @@ static int parse_ivaud_header(STREAMFILE* sf, ivaud_header* ivaud) {
|
||||
/* 0x00(8): offset within data (should be 0) */
|
||||
/* 0x08(4): hash */
|
||||
/* 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) */
|
||||
/* 0x18(2): sample rate */
|
||||
/* 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) */
|
||||
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
||||
/* rest: unknown data */
|
||||
|
||||
/* block table (one entry per block) */
|
||||
/* 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 */
|
||||
|
||||
|
||||
ivaud->total_subsongs = 1;
|
||||
ivaud->stream_size = get_streamfile_size(sf);
|
||||
aud->total_subsongs = 1;
|
||||
aud->stream_size = get_streamfile_size(sf);
|
||||
}
|
||||
else {
|
||||
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 */
|
||||
stream_table_offset = table_offset;
|
||||
/* 0x08(8): header size? start offset? */
|
||||
ivaud->total_subsongs = read_u32(0x10,sf);
|
||||
aud->total_subsongs = read_u32(0x10, sf);
|
||||
/* 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 > 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)
|
||||
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_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 */
|
||||
/* 0x08(4): hash */
|
||||
/* 0x0c(4): some offset/size */
|
||||
|
||||
/* stream info (one entry per stream) */
|
||||
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 */
|
||||
ivaud->stream_size = read_u32(offset+0x0c,sf);
|
||||
ivaud->num_samples = read_u32(offset+0x10,sf);
|
||||
aud->stream_size = read_u32(offset + 0x0c, sf);
|
||||
aud->num_samples = read_u32(offset + 0x10, sf);
|
||||
/* 0x14(4): unknown (-1) */
|
||||
ivaud->sample_rate = read_u16(offset+0x18,sf);
|
||||
aud->sample_rate = read_u16(offset + 0x18, sf);
|
||||
/* 0x1a(2): unknown */
|
||||
ivaud->codec = read_u32(offset+0x1c,sf);
|
||||
aud->codec = read_u32(offset + 0x1c, sf);
|
||||
/* (when codec is IMA) */
|
||||
/* 0x20(8): adpcm states offset, 0x38: num states? (reference for seeks?) */
|
||||
/* rest: unknown data */
|
||||
|
||||
ivaud->channel_count = 1;
|
||||
aud->channel_count = 1;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
return 0;
|
||||
}
|
@ -535,7 +535,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_mic_koei,
|
||||
init_vgmstream_seb,
|
||||
init_vgmstream_tgc,
|
||||
init_vgmstream_ivaud,
|
||||
init_vgmstream_rage_aud,
|
||||
init_vgmstream_asd_naxat,
|
||||
/* need companion files */
|
||||
init_vgmstream_pos,
|
||||
|
@ -215,21 +215,21 @@ typedef enum {
|
||||
layout_blocked_ea_swvr,
|
||||
layout_blocked_adm,
|
||||
layout_blocked_mxch,
|
||||
layout_blocked_ivaud, /* GTA IV .ivaud blocks */
|
||||
layout_blocked_rage_aud, /* Rockstar AUD blocks */
|
||||
layout_blocked_ps2_iab,
|
||||
layout_blocked_vs_str,
|
||||
layout_blocked_rws,
|
||||
layout_blocked_hwas,
|
||||
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
|
||||
layout_blocked_awc, /* Rockstar AWC */
|
||||
layout_blocked_vgs, /* Guitar Hero II (PS2) */
|
||||
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
|
||||
layout_blocked_awc, /* Rockstar AWC */
|
||||
layout_blocked_vgs, /* Guitar Hero II (PS2) */
|
||||
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_ad10, /* EA WVE Ad10 blocks */
|
||||
layout_blocked_sthd, /* Dream Factory STHD */
|
||||
layout_blocked_h4m, /* H4M video */
|
||||
layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */
|
||||
layout_blocked_sthd, /* Dream Factory STHD */
|
||||
layout_blocked_h4m, /* H4M video */
|
||||
layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */
|
||||
layout_blocked_vs_square,
|
||||
layout_blocked_vid1,
|
||||
layout_blocked_ubi_sce,
|
||||
@ -436,7 +436,7 @@ typedef enum {
|
||||
meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */
|
||||
meta_ZSD, /* Dragon Booster ZSD */
|
||||
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_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
|
||||
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
|
||||
|
Loading…
Reference in New Issue
Block a user