MB: Refactor IsActive() to IsActiveToPreventFullSpeed() (#1340)

This commit is contained in:
tomcw 2024-11-20 21:00:38 +00:00
parent d896e1cec2
commit b5544142e0
5 changed files with 7 additions and 20 deletions

View File

@ -998,26 +998,13 @@ int MockingboardCard::MB_SyncEventCallbackInternal(int id, int /*cycles*/, ULONG
//-----------------------------------------------------------------------------
bool MockingboardCard::IsActive(const bool isFullSpeedCheck)
bool MockingboardCard::IsActiveToPreventFullSpeed(void)
{
// Full-speed check ignores SSI263::IsPhonemeActive(), because:
// Full-speed check ignores SSI263::IsPhonemeActive(), because: (GH#1340)
// . Once an SSI263 has started playing a phoneme (and the chip isn't powered-down) then it'll repeat it indefinitely.
// . Typically a SSI263 is "disabled" by disabling ints & setting phoneme=PAUSE(0x00) and leaving the chip powered-up.
// . So if we also checked SSI263::IsPhonemeActive(), then it'd always report the SSI263 as active, and so prohibit full-speed.
if (isFullSpeedCheck)
return m_isActive;
// Currently this codepath isn't taken - ie. isFullSpeedCheck==false (so remove this codepath for now)
#if 1
_ASSERT(0);
return m_isActive;
#else
bool isSSI263Active = false;
for (UINT i = 0; i < NUM_SSI263; i++)
isSSI263Active |= m_MBSubUnit[i].ssi263.IsPhonemeActive();
return m_isActive || isSSI263Active;
#endif
}
//-----------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@ public:
void ReinitializeClock(void);
void MuteControl(bool mute);
void UpdateCycles(ULONG executedCycles);
bool IsActive(const bool isFullSpeedCheck);
bool IsActiveToPreventFullSpeed(void);
void SetVolume(DWORD dwVolume, DWORD dwVolumeMax);
void SetCumulativeCycles(void);
UINT MB_Update(void);

View File

@ -130,7 +130,7 @@ void MockingboardCardManager::UpdateIRQ(void)
CpuIrqDeassert(IS_6522);
}
bool MockingboardCardManager::IsActive(const bool isFullSpeedCheck)
bool MockingboardCardManager::IsActiveToPreventFullSpeed(void)
{
if (!m_mockingboardVoice.bActive)
return false;
@ -138,7 +138,7 @@ bool MockingboardCardManager::IsActive(const bool isFullSpeedCheck)
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
{
if (IsMockingboard(i))
if (dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(i)).IsActive(isFullSpeedCheck))
if (dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(i)).IsActiveToPreventFullSpeed())
return true; // if any card is true then the condition for active is true
}

View File

@ -29,7 +29,7 @@ public:
void SetCumulativeCycles(void);
void UpdateCycles(ULONG executedCycles);
void UpdateIRQ(void);
bool IsActive(const bool isFullSpeedCheck);
bool IsActiveToPreventFullSpeed(void);
DWORD GetVolume(void);
void SetVolume(DWORD volume, DWORD volumeMax);
void OutputToRiff(void) { m_outputToRiff = true; }

View File

@ -179,7 +179,7 @@ static void ContinueExecution(void)
const bool bWasFullSpeed = g_bFullSpeed;
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
bScrollLock_FullSpeed ||
(GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !GetCardMgr().GetMockingboardCardMgr().IsActive(true)) ||
(GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !GetCardMgr().GetMockingboardCardMgr().IsActiveToPreventFullSpeed()) ||
IsDebugSteppingAtFullSpeed();
if (g_bFullSpeed)