2008-07-12 17:20:39 +02:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../util.h"
|
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
/* AUS - Atomic Planet games [Jackie Chan Adventures (PS2), Mega Man Anniversary Collection (PS2/Xbox)] */
|
|
|
|
VGMSTREAM* init_vgmstream_aus(STREAMFILE* sf) {
|
|
|
|
VGMSTREAM* vgmstream = NULL;
|
2008-07-12 17:20:39 +02:00
|
|
|
off_t start_offset;
|
2023-01-20 17:30:17 +01:00
|
|
|
int loop_flag, channels, codec;
|
2008-07-12 17:20:39 +02:00
|
|
|
|
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
/* checks */
|
|
|
|
if (!is_id32be(0x00, sf, "AUS "))
|
|
|
|
goto fail;
|
|
|
|
if (!check_extensions(sf, "aus"))
|
2008-07-12 17:20:39 +02:00
|
|
|
goto fail;
|
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
channels = read_u32le(0x0c,sf);
|
2008-07-12 17:20:39 +02:00
|
|
|
start_offset = 0x800;
|
2023-01-20 17:30:17 +01:00
|
|
|
codec = read_u16le(0x06,sf);
|
|
|
|
loop_flag = (read_u32le(0x1c,sf) == 1); /* games seem to just do full loops, even when makes no sense (jingles/megaman stages) */
|
2008-07-12 17:20:39 +02:00
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
2008-07-12 17:20:39 +02:00
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
vgmstream->meta_type = meta_AUS;
|
|
|
|
vgmstream->sample_rate = read_s32le(0x10,sf); /* uses pretty odd values */
|
|
|
|
vgmstream->num_samples = read_s32le(0x08,sf);
|
|
|
|
vgmstream->loop_start_sample = read_s32le(0x14,sf); /* always 0? */
|
|
|
|
vgmstream->loop_end_sample = read_s32le(0x18,sf); /* always samples? */
|
2008-07-12 17:20:39 +02:00
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
if (codec == 0x02) {
|
|
|
|
vgmstream->coding_type = coding_XBOX_IMA;
|
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
vgmstream->coding_type = coding_PSX;
|
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->interleave_block_size = 0x800;
|
2008-07-12 17:20:39 +02:00
|
|
|
}
|
|
|
|
|
2023-01-20 17:30:17 +01:00
|
|
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
|
|
|
goto fail;
|
2008-07-12 17:20:39 +02:00
|
|
|
return vgmstream;
|
|
|
|
fail:
|
2023-01-20 17:30:17 +01:00
|
|
|
close_vgmstream(vgmstream);
|
2008-07-12 17:20:39 +02:00
|
|
|
return NULL;
|
|
|
|
}
|