2018-03-29 15:39:33 +02:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../coding/coding.h"
|
|
|
|
#include "../layout/layout.h"
|
|
|
|
|
|
|
|
/* EA WVE (VLC0/au00) - from Electronic Arts PS movies [Future Cop - L.A.P.D. (PS), Supercross 2000 (PS)] */
|
|
|
|
VGMSTREAM * init_vgmstream_ea_wve_au00(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset;
|
|
|
|
int loop_flag, channel_count;
|
|
|
|
|
|
|
|
|
|
|
|
/* checks */
|
2018-04-13 19:49:45 +02:00
|
|
|
/* .wve: common, .fsv: Future Cop LAPD (PS1) */
|
|
|
|
if (!check_extensions(streamFile, "wve,fsv"))
|
2018-03-29 15:39:33 +02:00
|
|
|
goto fail;
|
|
|
|
if (read_32bitBE(0x00,streamFile) != 0x564C4330) /* "VLC0" */
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
start_offset = read_32bitBE(0x04,streamFile);
|
|
|
|
if (read_32bitBE(start_offset, streamFile) != 0x61753030 && /* "au00" */
|
|
|
|
read_32bitBE(start_offset, streamFile) != 0x61753031) /* "au01" (last block, but could be first) */
|
|
|
|
goto fail;
|
|
|
|
loop_flag = 0;
|
|
|
|
channel_count = 2;
|
|
|
|
|
|
|
|
|
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->meta_type = meta_EA_WVE_AU00;
|
2018-08-26 13:47:48 +02:00
|
|
|
vgmstream->sample_rate = 22050;
|
2018-03-29 15:39:33 +02:00
|
|
|
|
|
|
|
/* You'd think they'd use coding_EA_XA_int but instead it's PS-ADPCM without flags and 0x0f frame size
|
|
|
|
* (equivalent to configurable PS-ADPCM), surely to shoehorn EA-XA sizes into the PS1 hardware decoder */
|
|
|
|
vgmstream->coding_type = coding_PSX_cfg;
|
|
|
|
vgmstream->interleave_block_size = 0x0f;
|
|
|
|
vgmstream->layout_type = layout_blocked_ea_wve_au00;
|
|
|
|
|
|
|
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* calc num_samples manually */
|
|
|
|
{
|
2018-04-13 16:47:33 +02:00
|
|
|
vgmstream->next_block_offset = start_offset;
|
2018-03-29 15:39:33 +02:00
|
|
|
do {
|
2018-08-26 13:47:48 +02:00
|
|
|
block_update(vgmstream->next_block_offset,vgmstream);
|
2018-04-13 16:47:33 +02:00
|
|
|
vgmstream->num_samples += ps_cfg_bytes_to_samples(vgmstream->current_block_size, vgmstream->interleave_block_size, 1);
|
2018-03-29 15:39:33 +02:00
|
|
|
}
|
|
|
|
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
|
2018-08-26 13:47:48 +02:00
|
|
|
block_update(start_offset, vgmstream);
|
2018-03-29 15:39:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|