From aa322dbd5348b7dbc4920b0f1bbfd5979a12bb4f Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 18 Oct 2020 19:32:18 +0100 Subject: [PATCH] Fixed loading a save-state where both Phasor 6522's Timer1s are active (eg. DIGIDREAM demo) --- source/Mockingboard.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 8dfc65f7..5ed14ff2 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -2597,14 +2597,14 @@ bool Phasor_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version if (pMB->bTimer1Active) { - const UINT id = nDeviceNum*kNumTimersPer6522+0; // TIMER1 + const UINT id = (nDeviceNum/2)*kNumTimersPer6522+0; // TIMER1 SyncEvent* pSyncEvent = g_syncEvent[id]; pSyncEvent->SetCycles(pMB->sy6522.TIMER1_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH g_SynchronousEventMgr.Insert(pSyncEvent); } if (pMB->bTimer2Active) { - const UINT id = nDeviceNum*kNumTimersPer6522+1; // TIMER2 + const UINT id = (nDeviceNum/2)*kNumTimersPer6522+1; // TIMER2 SyncEvent* pSyncEvent = g_syncEvent[id]; pSyncEvent->SetCycles(pMB->sy6522.TIMER2_COUNTER.w + kExtraTimerCycles); // NB. use COUNTER, not LATCH g_SynchronousEventMgr.Insert(pSyncEvent); @@ -2613,7 +2613,7 @@ bool Phasor_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version // FIXME: currently only support a single speech chip if (pMB->SpeechChip.DurationPhoneme || g_bVotraxPhoneme) { - g_nSSI263Device = nDeviceNum; + g_nSSI263Device = nDeviceNum+1; // +1 as speech is always 2nd device of the pair g_bPhasorEnable = true; SetSpeechIRQ(pMB); }