2008-09-23 07:13:53 +02:00
|
|
|
#include "meta.h"
|
2023-06-24 17:56:09 +02:00
|
|
|
#include "../coding/coding.h"
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* YMF - from Yuke's games [WWE WrestleMania X8 (GC)] */
|
|
|
|
VGMSTREAM* init_vgmstream_ymf(STREAMFILE* sf) {
|
|
|
|
VGMSTREAM* vgmstream = NULL;
|
|
|
|
uint32_t start_offset;
|
|
|
|
int channels, loop_flag;
|
2008-09-23 07:13:53 +02:00
|
|
|
|
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* checks */
|
|
|
|
if (read_u32be(0x00,sf) != 0x00000180 ||
|
|
|
|
read_u32be(0x08,sf) != 0x00000003 ||
|
|
|
|
read_u32be(0x0c,sf) != 0xCCCCCCCC)
|
|
|
|
return NULL;
|
|
|
|
/* 0x04: used data size? */
|
|
|
|
|
|
|
|
/* .ymf: actual extension */
|
|
|
|
if (!check_extensions(sf, "ymf"))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* .ymf can contain audio or video, but not both (videos start with 0x100 and change minor values),
|
2023-06-25 00:59:10 +02:00
|
|
|
* though it's are found in ./movie/... and probably are considered so */
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2008-09-23 08:05:37 +02:00
|
|
|
loop_flag = 0;
|
2023-06-24 17:56:09 +02:00
|
|
|
channels = 2;
|
|
|
|
start_offset = read_u32be(0x00,sf);
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
2008-09-23 07:13:53 +02:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
vgmstream->meta_type = meta_YMF;
|
|
|
|
vgmstream->sample_rate = read_32bitBE(0xA8,sf);
|
|
|
|
vgmstream->num_samples = read_32bitBE(0xDC,sf);
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
vgmstream->coding_type = coding_NGC_DSP;
|
2008-09-23 07:13:53 +02:00
|
|
|
vgmstream->layout_type = layout_interleave;
|
2008-12-16 16:48:21 +01:00
|
|
|
vgmstream->interleave_block_size = 0x20000;
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
dsp_read_coefs_be(vgmstream, sf, 0xAE, 0x60);
|
|
|
|
//dsp_read_hist_be(vgmstream, sf, 0xAE + 0x20, 0x60);
|
2008-09-23 07:13:53 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
|
|
|
goto fail;
|
2008-09-23 07:13:53 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2023-06-24 17:56:09 +02:00
|
|
|
close_vgmstream(vgmstream);
|
2008-09-23 07:13:53 +02:00
|
|
|
return NULL;
|
|
|
|
}
|