Fixed effects area wrapping calculation, which was always buggy but this

wasn't evident until additional addresses were precalculated.
Not expected to improve compatibility.
This commit is contained in:
Pseudonym 2016-11-01 11:09:08 +00:00
parent d1ae298211
commit 233f66db5e
1 changed files with 4 additions and 8 deletions

View File

@ -229,17 +229,13 @@ s32 V_Core::EffectsBufferIndexer(s32 offset) const
// already x4'd. It doesn't really make sense that we should x4 them again, and this // already x4'd. It doesn't really make sense that we should x4 them again, and this
// seems to work. (feedback-free in bios and DDS) --air // seems to work. (feedback-free in bios and DDS) --air
u32 pos = EffectsStartA + offset;
// Need to use modulus here, because games can and will drop the buffer size // Need to use modulus here, because games can and will drop the buffer size
// without notice, and it leads to offsets several times past the end of the buffer. // without notice, and it leads to offsets several times past the end of the buffer.
if (pos > EffectsEndA) { if ((u32)offset >= (u32)EffectsBufferSize)
pos = EffectsStartA + (offset % EffectsBufferSize); return EffectsStartA + (offset % EffectsBufferSize) + (offset < 0 ? EffectsBufferSize : 0);
} else if (pos < EffectsStartA) { else
pos = EffectsEndA + 1 - (offset % EffectsBufferSize); return EffectsStartA + offset;
}
return pos;
} }
void V_Core::UpdateEffectsBufferSize() void V_Core::UpdateEffectsBufferSize()