mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Fix interleave bug in mono
This commit is contained in:
parent
9a1b37d2af
commit
894df45850
@ -435,7 +435,6 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE* sf) {
|
||||
case DSP: { /* Wii/3DS/WiiU */
|
||||
off_t wiih_offset;
|
||||
size_t wiih_size;
|
||||
int i;
|
||||
|
||||
//if (ww.fmt_size != 0x28 && ww.fmt_size != ?) goto fail; /* old, new */
|
||||
if (ww.bits_per_sample != 4) goto fail;
|
||||
@ -711,10 +710,16 @@ static int is_dsp_full_interleave(STREAMFILE* sf, wwise_header* ww, off_t coef_o
|
||||
if (ww->truncated)
|
||||
return 0;
|
||||
|
||||
if (ww->channels == 1)
|
||||
return 0;
|
||||
|
||||
if (check_extensions(sf,"bnk"))
|
||||
return 1;
|
||||
|
||||
if (ww->channels == 2 && ww->data_size <= 0x30000) {
|
||||
if (ww->data_size > 0x30000)
|
||||
return 0;
|
||||
|
||||
{
|
||||
uint16_t head_ps2 = read_u16be(coef_offset + 1 * 0x2e + 0x22, sf); /* ch2's initial predictor */
|
||||
uint16_t init_ps2 = read_u8(ww->data_offset + 0x08, sf); /* at normal interleave */
|
||||
uint16_t half_ps2 = read_u8(ww->data_offset + ww->data_size / 2, sf); /* at full interleave */
|
||||
|
@ -2890,6 +2890,25 @@ int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t s
|
||||
vgmstream->frame_size = vgmstream->interleave_block_size;
|
||||
}
|
||||
|
||||
/* big interleaved values for non-interleaved data may result in incorrect behavior,
|
||||
* quick fix for now since layouts are finicky, with 'interleave' left for meta info
|
||||
* (certain layouts+codecs combos results in funny output too, should rework the whole thing) */
|
||||
if (vgmstream->layout_type == layout_interleave
|
||||
&& vgmstream->channels == 1
|
||||
&& vgmstream->interleave_block_size > 0) {
|
||||
/* main codecs that use arbitrary interleaves but could happen for others too */
|
||||
switch(vgmstream->coding_type) {
|
||||
case coding_NGC_DSP:
|
||||
case coding_NGC_DSP_subint:
|
||||
case coding_PSX:
|
||||
case coding_PSX_badflags:
|
||||
vgmstream->interleave_block_size = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if interleave is big enough keep a buffer per channel */
|
||||
if (vgmstream->interleave_block_size * vgmstream->channels >= STREAMFILE_DEFAULT_BUFFER_SIZE) {
|
||||
use_streamfile_per_channel = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user