Fixed loading a save-state where both Phasor 6522's Timer1s are active (eg. DIGIDREAM demo)

This commit is contained in:
tomcw 2020-10-18 19:32:18 +01:00
parent 37009e287d
commit aa322dbd53

View File

@ -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);
}