Minor comments

This commit is contained in:
bnnm 2018-03-04 00:16:49 +01:00
parent 4ddecd424f
commit 710e5e11cd

View File

@ -4,12 +4,12 @@
static VGMSTREAM * init_vgmstream_kt_wiibgm_offset(STREAMFILE *streamFile, off_t offset);
/* Koei Tecmo G1L - pack format, sometimes containing a single stream
*
/* Koei Tecmo G1L - container format, sometimes containing a single stream.
* It probably makes more sense to extract it externally, it's here mainly for Hyrule Warriors */
VGMSTREAM * init_vgmstream_kt_g1l(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int type, num_streams, target_stream = streamFile->stream_index;
int type;
int total_streams, target_stream = streamFile->stream_index;
off_t stream_offset;
int32_t (*read_32bit)(off_t,STREAMFILE*) = NULL;
@ -22,30 +22,30 @@ VGMSTREAM * init_vgmstream_kt_g1l(STREAMFILE *streamFile) {
&& read_32bitBE(0x4, streamFile) != 0x30303030) /* "0000" (version?) */
goto fail;
if (read_32bitBE(0x0, streamFile) == 0x47314C5F ) {
if (read_32bitBE(0x0, streamFile) == 0x47314C5F) {
read_32bit = read_32bitBE;
} else {
read_32bit = read_32bitLE;
}
/* 0x08 filesize */
/* 0x0c first file offset (same as 0x18) */
/* 0x08: filesize, 0x0c: header size */
type = read_32bit(0x10,streamFile);
num_streams = read_32bit(0x14,streamFile);
total_streams = read_32bit(0x14,streamFile);
if (target_stream==0) target_stream = 1;
if (target_stream < 0 || target_stream > num_streams || num_streams < 1) goto fail;
if (target_stream < 0 || target_stream > total_streams || total_streams < 1) goto fail;
stream_offset = read_32bit(0x18 + 0x4*(target_stream-1),streamFile);
/* filesize = stream_offset - stream_next_offset*/
//stream_size = stream_offset - stream_next_offset;//not ok, sometimes entries are unordered/repeats */
switch(type) { /* type may not be correct */
case 0x09: /* DSP (WiiBGM) from Hyrule Warriors (Wii U) */
vgmstream = init_vgmstream_kt_wiibgm_offset(streamFile, stream_offset);
break;
case 0x06: /* ATRAC9 (RIFF) from One Piece Pirate Warriors 3 (Vita) */
case 0x01: /* ATRAC3plus (RIFF) from One Piece Pirate Warriors 2 (PS3) */
case 0x00: /* OGG (KOVS) from Romance Three Kindgoms 13 (PC)*/
case 0x0A: /* OGG (KOVS) from Dragon Quest Heroes (PC)*/
case 0x0A: /* OGG (KOVS) from Dragon Quest Heroes (PC), Bladestorm (PC) w/ single files */
default:
goto fail;
}