2008-07-12 17:20:39 +02:00
|
|
|
#include "meta.h"
|
2018-04-07 12:35:18 +02:00
|
|
|
#include "../coding/coding.h"
|
2008-07-12 17:20:39 +02:00
|
|
|
|
2018-04-07 12:35:18 +02:00
|
|
|
/* SL3 - Atari Melbourne House games [ Test Drive Unlimited (PS2), Transformers (PS2)] */
|
2008-07-12 17:20:39 +02:00
|
|
|
VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset;
|
2018-04-07 12:35:18 +02:00
|
|
|
int loop_flag = 0, channel_count;
|
2008-07-12 17:20:39 +02:00
|
|
|
|
2018-04-07 12:35:18 +02:00
|
|
|
/* checks */
|
|
|
|
/* .ms: actual extension, sl3: header id */
|
|
|
|
if (!check_extensions(streamFile, "ms,sl3"))
|
|
|
|
goto fail;
|
2008-07-12 17:20:39 +02:00
|
|
|
if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */
|
|
|
|
goto fail;
|
|
|
|
|
2008-12-16 16:48:21 +01:00
|
|
|
loop_flag = 0;
|
2008-07-12 17:20:39 +02:00
|
|
|
channel_count = read_32bitLE(0x14,streamFile);
|
2018-04-07 12:35:18 +02:00
|
|
|
start_offset = 0x8000; /* also at 0x24? */
|
|
|
|
|
|
|
|
|
2008-07-12 17:20:39 +02:00
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
|
2018-04-07 12:35:18 +02:00
|
|
|
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(streamFile)-start_offset,channel_count);
|
2008-07-12 17:20:39 +02:00
|
|
|
if (loop_flag) {
|
2008-12-16 16:48:21 +01:00
|
|
|
vgmstream->loop_start_sample = 0;
|
2008-07-12 17:20:39 +02:00
|
|
|
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
|
|
|
|
}
|
|
|
|
|
2018-04-07 12:35:18 +02:00
|
|
|
vgmstream->coding_type = coding_PSX;
|
2008-07-12 17:20:39 +02:00
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->interleave_block_size = read_32bitLE(0x20,streamFile);
|
|
|
|
vgmstream->meta_type = meta_SL3;
|
|
|
|
|
2018-04-07 12:35:18 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
|
|
|
goto fail;
|
2008-07-12 17:20:39 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-04-07 12:35:18 +02:00
|
|
|
close_vgmstream(vgmstream);
|
2008-07-12 17:20:39 +02:00
|
|
|
return NULL;
|
|
|
|
}
|