2008-06-29 03:30:13 +02:00
|
|
|
#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;
|
2008-06-29 03:30:13 +02:00
|
|
|
int i;
|
2018-03-23 18:34:37 +01:00
|
|
|
off_t channel_block_size;
|
|
|
|
|
2008-06-29 03:30:13 +02:00
|
|
|
|
|
|
|
/* 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);
|
2008-06-29 03:30:13 +02:00
|
|
|
|
|
|
|
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;
|
2008-06-29 03:30:13 +02:00
|
|
|
|
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;
|
2008-06-29 03:30:13 +02:00
|
|
|
}
|
2018-08-26 17:40:40 +02:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
}
|
2008-06-29 03:30:13 +02:00
|
|
|
}
|