2008-11-02 17:43:12 +01:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../util.h"
|
|
|
|
|
2018-03-24 19:27:24 +01:00
|
|
|
/* SPSD - Naomi GD-ROM streams [Guilty Gear X (Naomi), Crazy Taxi (Naomi), Virtua Tennis 2 (Naomi)] */
|
2008-11-02 17:43:12 +01:00
|
|
|
VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset;
|
2018-03-24 19:27:24 +01:00
|
|
|
size_t data_size;
|
|
|
|
int loop_flag, channel_count;
|
2008-11-02 17:43:12 +01:00
|
|
|
|
|
|
|
|
2018-03-24 19:27:24 +01:00
|
|
|
/* checks */
|
|
|
|
if (!check_extensions(streamFile, "spsd"))
|
|
|
|
goto fail;
|
2008-11-02 17:43:12 +01:00
|
|
|
if (read_32bitBE(0x00,streamFile) != 0x53505344) /* "SPSD" */
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
loop_flag = 0;
|
|
|
|
channel_count = 2;
|
2018-03-24 19:27:24 +01:00
|
|
|
|
|
|
|
start_offset = 0x40;
|
|
|
|
data_size = get_streamfile_size(streamFile) - start_offset;
|
|
|
|
|
2010-05-10 10:02:22 +02:00
|
|
|
/* build the VGMSTREAM */
|
2008-11-02 17:43:12 +01:00
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
2008-11-06 23:03:35 +01:00
|
|
|
vgmstream->sample_rate = (uint16_t)read_16bitLE(0x2A,streamFile);
|
2008-11-02 17:43:12 +01:00
|
|
|
vgmstream->num_samples = read_32bitLE(0x0C,streamFile);
|
2010-05-10 10:02:22 +02:00
|
|
|
|
2018-03-24 19:27:24 +01:00
|
|
|
vgmstream->meta_type = meta_NAOMI_SPSD;
|
|
|
|
switch (read_8bit(0x08,streamFile)) {
|
|
|
|
case 0x01: /* [Virtua Tennis 2 (Naomi)] */
|
|
|
|
vgmstream->coding_type = coding_PCM8;
|
|
|
|
break;
|
|
|
|
case 0x03:
|
2018-03-27 23:32:01 +02:00
|
|
|
vgmstream->coding_type = coding_AICA_int;
|
2018-03-24 19:27:24 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto fail;
|
2008-11-02 17:43:12 +01:00
|
|
|
}
|
2018-03-24 19:27:24 +01:00
|
|
|
vgmstream->layout_type = layout_interleave;
|
2008-11-02 17:43:12 +01:00
|
|
|
vgmstream->interleave_block_size = 0x2000;
|
2018-03-24 19:27:24 +01:00
|
|
|
if (vgmstream->interleave_block_size)
|
|
|
|
vgmstream->interleave_last_block_size = (data_size % (vgmstream->interleave_block_size*vgmstream->channels)) / vgmstream->channels;
|
2008-11-02 17:43:12 +01:00
|
|
|
|
|
|
|
|
2018-03-24 19:27:24 +01:00
|
|
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
|
|
|
goto fail;
|
2008-11-02 17:43:12 +01:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-03-24 19:27:24 +01:00
|
|
|
close_vgmstream(vgmstream);
|
2008-11-02 17:43:12 +01:00
|
|
|
return NULL;
|
|
|
|
}
|