2008-07-06 20:05:04 +02:00
|
|
|
#include "meta.h"
|
|
|
|
|
|
|
|
|
2018-07-21 20:12:09 +02:00
|
|
|
/* .pos - loop points for .wav [Ys I Complete (PC); reused for manual looping] */
|
2008-07-06 20:05:04 +02:00
|
|
|
VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
|
2018-07-21 20:12:09 +02:00
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
STREAMFILE * streamData = NULL;
|
|
|
|
int32_t loop_start, loop_end;
|
2008-07-06 20:05:04 +02:00
|
|
|
|
|
|
|
|
2018-07-21 20:12:09 +02:00
|
|
|
/* checks */
|
|
|
|
if (!check_extensions(streamFile,"pos"))
|
|
|
|
goto fail;
|
|
|
|
if (get_streamfile_size(streamFile) != 0x08)
|
|
|
|
goto fail;
|
2008-07-06 20:18:25 +02:00
|
|
|
|
2018-07-21 20:12:09 +02:00
|
|
|
streamData = open_streamfile_by_ext(streamFile, "wav");
|
|
|
|
if (!streamData) goto fail;
|
2008-07-06 20:05:04 +02:00
|
|
|
|
|
|
|
/* let the real initer do the parsing */
|
2018-07-21 20:12:09 +02:00
|
|
|
vgmstream = init_vgmstream_riff(streamData);
|
2008-07-06 20:05:04 +02:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
2018-07-21 20:12:09 +02:00
|
|
|
close_streamfile(streamData);
|
|
|
|
streamData = NULL;
|
2008-07-06 21:44:18 +02:00
|
|
|
|
2018-07-21 20:12:09 +02:00
|
|
|
/* install loops (wrong values are validated later) */
|
|
|
|
loop_start = read_32bitLE(0x00,streamFile);
|
|
|
|
loop_end = read_32bitLE(0x04,streamFile);
|
|
|
|
vgmstream_force_loop(vgmstream, 1, loop_start, loop_end);
|
2008-07-06 20:05:04 +02:00
|
|
|
|
|
|
|
vgmstream->meta_type = meta_RIFF_WAVE_POS;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-07-21 20:12:09 +02:00
|
|
|
close_streamfile(streamData);
|
|
|
|
close_vgmstream(vgmstream);
|
2008-07-06 20:05:04 +02:00
|
|
|
return NULL;
|
|
|
|
}
|