From 79c7ed503939a348cb47b1540fa6f8bfba8e366c Mon Sep 17 00:00:00 2001 From: AliceLR Date: Mon, 5 Jan 2026 19:53:05 -0700 Subject: [PATCH] Fix mLoopCount global setting. The module repeat count is supposed to be configured via mLoopCount in the Modplug global settings. Setting this to a negative value is supposed to enable looping forever (what game engines are most likely to expect), but for some reason, this feature was *deliberately broken* despite the default being 0. There's no reason for this to be commented out. Fixes #51. See also: https://github.com/icculus/SDL_sound/issues/123 https://github.com/AliceLR/megazeux/blob/f83d897dc7df808ed4ad3eb31b5abb6a7b479d08/contrib/patches/libmodplug/01-libmodplug-0.8.9.0-fix-looping.diff --- src/sndmix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sndmix.cpp b/src/sndmix.cpp index 2f8377c7..5285fbc0 100644 --- a/src/sndmix.cpp +++ b/src/sndmix.cpp @@ -363,7 +363,7 @@ BOOL CSoundFile::ProcessRow() // End of song ? if ((m_nPattern == 0xFF) || (m_nCurrentPattern >= MAX_ORDERS)) { - //if (!m_nRepeatCount) + if (!m_nRepeatCount) return FALSE; //never repeat entire song if (!m_nRestartPos) { @@ -396,7 +396,7 @@ BOOL CSoundFile::ProcessRow() } } } -// if (m_nRepeatCount > 0) m_nRepeatCount--; + if (m_nRepeatCount > 0) m_nRepeatCount--; m_nCurrentPattern = m_nRestartPos; m_nRow = 0; if ((Order[m_nCurrentPattern] >= MAX_PATTERNS) || (!Patterns[Order[m_nCurrentPattern]])) return FALSE;