Fixed bug in IOP counters.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@299 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2008-11-05 12:25:13 +00:00 committed by Gregory Hainaut
parent a892ff1964
commit 3108024a30
1 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ __forceinline static void _rcntSet( int i, int bitwise )
assert( i < 3 ); assert( i < 3 );
#endif #endif
// psxNextCounter is relative to the cpuRegs.cycle when rcntUpdate() was last called. // psxNextCounter is relative to the psxRegs.cycle when rcntUpdate() was last called.
// However, the current _rcntSet could be called at any cycle count, so we need to take // However, the current _rcntSet could be called at any cycle count, so we need to take
// that into account. Adding the difference from that cycle count to the current one // that into account. Adding the difference from that cycle count to the current one
// will do the trick! // will do the trick!
@ -71,13 +71,13 @@ __forceinline static void _rcntSet( int i, int bitwise )
if(psxCounters[i].rate == PSXHBLANK) return; if(psxCounters[i].rate == PSXHBLANK) return;
c = (u64)((overflowCap - psxCounters[i].count) * psxCounters[i].rate) - (psxRegs.cycle - psxCounters[i].sCycleT); c = (u64)((overflowCap - psxCounters[i].count) * psxCounters[i].rate) - (psxRegs.cycle - psxCounters[i].sCycleT);
c += cpuRegs.cycle - psxNextsCounter; // adjust for time passed since last rcntUpdate(); c += psxRegs.cycle - psxNextsCounter; // adjust for time passed since last rcntUpdate();
if (c < psxNextCounter) psxNextCounter = (u32)c; if (c < psxNextCounter) psxNextCounter = (u32)c;
//if((psxCounters[i].mode & 0x10) == 0 || psxCounters[i].target > 0xffff) continue; //if((psxCounters[i].mode & 0x10) == 0 || psxCounters[i].target > 0xffff) continue;
c = (u64)((psxCounters[i].target - psxCounters[i].count) * psxCounters[i].rate) - (psxRegs.cycle - psxCounters[i].sCycleT); c = (u64)((psxCounters[i].target - psxCounters[i].count) * psxCounters[i].rate) - (psxRegs.cycle - psxCounters[i].sCycleT);
c += cpuRegs.cycle - psxNextsCounter; // adjust for time passed since last rcntUpdate(); c += psxRegs.cycle - psxNextsCounter; // adjust for time passed since last rcntUpdate();
if (c < psxNextCounter) psxNextCounter = (u32)c; if (c < psxNextCounter) psxNextCounter = (u32)c;
} }