DSPHLE/Zelda: Add bounds check for m_sync_voice_skip_flags in RenderAudio()

This commit is contained in:
Admiral H. Curtiss
2026-09-10 19:07:23 +02:00
parent a2efdf1197
commit b84323e108

View File

@@ -628,7 +628,11 @@ void ZeldaUCode::RenderAudio()
if (m_rendering_curr_voice == 0)
m_renderer.PrepareFrame();
while (m_rendering_curr_voice < m_rendering_voices_per_frame)
// TODO: Find out the actual hardware behavior for the case where
// (m_rendering_voices_per_frame >> 4) >= m_sync_voice_skip_flags.size()
const u16 number_of_voices = std::min(m_rendering_voices_per_frame,
static_cast<u16>(m_sync_voice_skip_flags.size() << 4));
while (m_rendering_curr_voice < number_of_voices)
{
// If we are not meant to render this voice yet, go back to message
// processing.