Spend a lot less time calculating the hcount.

Tiny loss in precision, can't even notice.  Cuts time significantly in
Valkyrie Profile.
This commit is contained in:
Unknown W. Brackets 2013-09-03 00:12:48 -07:00
parent 994e2b3e5c
commit 6e5426a528

View File

@ -686,9 +686,10 @@ u32 sceDisplayGetVcount() {
}
u32 __DisplayGetCurrentHcount() {
const u64 ticksIntoFrame = CoreTiming::GetTicks() - frameStartTicks;
const static int ticksPerVblank333 = 333 * 1000000 / 60 / hCountPerVblank;
const int ticksIntoFrame = CoreTiming::GetTicks() - frameStartTicks;
// Can't seem to produce a 0 on real hardware, offsetting by 1 makes things look right.
return 1 + (ticksIntoFrame / ((u64)CoreTiming::GetClockFrequencyMHz() * 1000000 / 60 / hCountPerVblank));
return 1 + (ticksIntoFrame / (CoreTiming::GetClockFrequencyMHz() * ticksPerVblank333 / 333));
}
u32 __DisplayGetAccumulatedHcount() {