Wait until IRQ2 is acknowledged before starting IRQ40 sequence. Fixes Ski Champ hanging at FBI screen when region set to USA

This commit is contained in:
gm-matthew 2022-11-22 01:43:38 +00:00 committed by trzy
parent 79a2414f3f
commit 2063303a4d

View file

@ -2041,9 +2041,8 @@ void CModel3::RunMainBoardFrame(void)
// Compute display and VBlank timings // Compute display and VBlank timings
unsigned ppcCycles = m_config["PowerPCFrequency"].ValueAs<unsigned>() * 1000000; unsigned ppcCycles = m_config["PowerPCFrequency"].ValueAs<unsigned>() * 1000000;
unsigned frameCycles = (unsigned)((float)ppcCycles / 57.524160f); unsigned frameCycles = (unsigned)((float)ppcCycles / 57.524160f);
unsigned gapCycles = (unsigned)((float)frameCycles * 2.5f / 100.0f); // we need a gap between asserting irq2 & irq 0x40
unsigned offsetCycles = (unsigned)((float)frameCycles * 33.f / 100.0f); unsigned offsetCycles = (unsigned)((float)frameCycles * 33.f / 100.0f);
unsigned dispCycles = frameCycles - gapCycles - offsetCycles; unsigned dispCycles = frameCycles - offsetCycles;
unsigned statusCycles = (unsigned)((float)frameCycles * (0.005f)); unsigned statusCycles = (unsigned)((float)frameCycles * (0.005f));
// we think a frame looks like this on the model 2 // we think a frame looks like this on the model 2
@ -2069,7 +2068,13 @@ void CModel3::RunMainBoardFrame(void)
ppc_execute(offsetCycles); ppc_execute(offsetCycles);
IRQ.Assert(0x02); // start at 33% of the frame IRQ.Assert(0x02); // start at 33% of the frame
ppc_execute(gapCycles); // need a gap between asserting irqs
// keep running cycles until IRQ2 is acknowledged
while (IRQ.ReadIRQEnable() & 0x2 && IRQ.ReadIRQState() & 0x2 && dispCycles > 1000)
{
ppc_execute(1000);
dispCycles -= 1000;
}
/* /*
* Sound: * Sound: