vgmstream/src/layout/blocked_wsi.c

30 lines
1.0 KiB
C
Raw Normal View History

#include "layout.h"
#include "../vgmstream.h"
2018-03-23 18:34:37 +01:00
/* .wsi - headered blocks with a single channel */
void block_update_wsi(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i;
2018-03-23 18:34:37 +01:00
off_t channel_block_size;
/* assume that all channels have the same size for this block */
2018-03-23 18:34:37 +01:00
channel_block_size = read_32bitBE(block_offset, streamFile);
vgmstream->current_block_offset = block_offset;
2018-03-23 18:34:37 +01:00
vgmstream->current_block_size = channel_block_size - 0x10; /* remove header */
vgmstream->next_block_offset = block_offset + channel_block_size*vgmstream->channels;
2018-03-23 18:34:37 +01:00
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + channel_block_size*i + 0x10;
}
/* first block has DSP header, remove */
if (block_offset == vgmstream->ch[0].channel_start_offset) {
vgmstream->current_block_size -= 0x60;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset += 0x60;
}
}
}