mirror of https://github.com/PCSX2/pcsx2.git
Counters: Process overflow before Target in case of Target = 0
This commit is contained in:
parent
36c9b68b6c
commit
b327033333
|
@ -156,7 +156,9 @@ static __fi void cpuRcntSet()
|
||||||
_rcntSet( i );
|
_rcntSet( i );
|
||||||
|
|
||||||
// sanity check!
|
// sanity check!
|
||||||
if( nextCounter < 0 ) nextCounter = 0;
|
if (nextCounter < 0)
|
||||||
|
nextCounter = 0;
|
||||||
|
|
||||||
cpuSetNextEvent(nextsCounter, nextCounter); // Need to update on counter resets/target changes
|
cpuSetNextEvent(nextsCounter, nextCounter); // Need to update on counter resets/target changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,8 +813,9 @@ static __fi void _cpuTestOverflow( int i )
|
||||||
// well forceinline it!
|
// well forceinline it!
|
||||||
__fi void rcntUpdate()
|
__fi void rcntUpdate()
|
||||||
{
|
{
|
||||||
rcntUpdate_hScanline();
|
|
||||||
rcntUpdate_vSync();
|
rcntUpdate_vSync();
|
||||||
|
// HBlank after as VSync can do error compensation
|
||||||
|
rcntUpdate_hScanline();
|
||||||
|
|
||||||
// Update counters so that we can perform overflow and target tests.
|
// Update counters so that we can perform overflow and target tests.
|
||||||
|
|
||||||
|
@ -835,8 +838,9 @@ __fi void rcntUpdate()
|
||||||
counters[i].sCycleT = cpuRegs.cycle - change;
|
counters[i].sCycleT = cpuRegs.cycle - change;
|
||||||
|
|
||||||
// Check Counter Targets and Overflows:
|
// Check Counter Targets and Overflows:
|
||||||
_cpuTestTarget( i );
|
// Check Overflow first, in case the target is 0
|
||||||
_cpuTestOverflow( i );
|
_cpuTestOverflow( i );
|
||||||
|
_cpuTestTarget(i);
|
||||||
}
|
}
|
||||||
else counters[i].sCycleT = cpuRegs.cycle;
|
else counters[i].sCycleT = cpuRegs.cycle;
|
||||||
}
|
}
|
||||||
|
@ -886,8 +890,8 @@ static __fi void rcntStartGate(bool isVblank, u32 sCycle)
|
||||||
// currectly by rcntUpdate (since it's not being scheduled for these counters)
|
// currectly by rcntUpdate (since it's not being scheduled for these counters)
|
||||||
|
|
||||||
counters[i].count += HBLANK_COUNTER_SPEED;
|
counters[i].count += HBLANK_COUNTER_SPEED;
|
||||||
|
_cpuTestOverflow(i);
|
||||||
_cpuTestTarget( i );
|
_cpuTestTarget( i );
|
||||||
_cpuTestOverflow( i );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(gates & (1<<i))) continue;
|
if (!(gates & (1<<i))) continue;
|
||||||
|
|
|
@ -379,16 +379,16 @@ void psxCheckStartGate16(int i)
|
||||||
(psxCounters[1].mode & stoppedGateCheck) == altSourceCheck)
|
(psxCounters[1].mode & stoppedGateCheck) == altSourceCheck)
|
||||||
{
|
{
|
||||||
psxCounters[1].count++;
|
psxCounters[1].count++;
|
||||||
_rcntTestTarget(1);
|
|
||||||
_rcntTestOverflow(1);
|
_rcntTestOverflow(1);
|
||||||
|
_rcntTestTarget(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((psxCounters[3].mode & altSourceCheck) == IOPCNT_ALT_SOURCE ||
|
if ((psxCounters[3].mode & altSourceCheck) == IOPCNT_ALT_SOURCE ||
|
||||||
(psxCounters[3].mode & stoppedGateCheck) == altSourceCheck)
|
(psxCounters[3].mode & stoppedGateCheck) == altSourceCheck)
|
||||||
{
|
{
|
||||||
psxCounters[3].count++;
|
psxCounters[3].count++;
|
||||||
_rcntTestTarget(3);
|
|
||||||
_rcntTestOverflow(3);
|
_rcntTestOverflow(3);
|
||||||
|
_rcntTestTarget(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,8 +488,8 @@ void psxRcntUpdate()
|
||||||
if (psxCounters[i].mode & IOPCNT_STOPPED)
|
if (psxCounters[i].mode & IOPCNT_STOPPED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_rcntTestTarget(i);
|
|
||||||
_rcntTestOverflow(i);
|
_rcntTestOverflow(i);
|
||||||
|
_rcntTestTarget(i);
|
||||||
|
|
||||||
// perform second target test because if we overflowed above it's possible we
|
// perform second target test because if we overflowed above it's possible we
|
||||||
// already shot past our target if it was very near zero.
|
// already shot past our target if it was very near zero.
|
||||||
|
|
Loading…
Reference in New Issue