hrydgard/ppsspp — pull request #3587 by unknownbrackets (2013-09-03 07:28:07+00:00)
Title: Calculate Hcount more accurately, support adjusting

This is an oldie but a goodie. 90b324a4b0bff215e5f2571dd8b9acc90208abb1 is from March, but I never bothered myself to test it. Since Star Ocean was calling the one function I thought it'd be worth it finally.

Notes:
* I think someone once said a game got slower when this was moved, which is why I never worried about it. But it always seemed right for the timing to start there.
* I think the test in hrydgard/pspautotests#99 shows that the behavior is correct, since it starts at 1 at the beginning of the vblank.
* The wrap around is probably important. Test should show this behavior too. **I think it fixed Star Ocean.**
* Also implements sceDisplayGetAccumulatedHcount() which reporting shows some games calling.
* We still don't match exactly. On my device, hcount goes up to 14 while inside vblank, but PPSSPP only 13. Probably not major. Our average is also 285.

I spent a little too long forgetting that floats don't wrap around when you add to them, so I don't have a lot of time to test. However, I just did ~20 battles or so and can no longer reproduce the issue (where I could every other or so before.)

Have not tested too many other games unfortunately, but I checked for perf regressions in a couple that call these funcs.

-[Unknown]