Add a function for HLE to consume cycles.

Needed sometimes to make timing match better for tight loops.
Also removes the Puyo Puyo Fever hack.
This commit is contained in:
Unknown W. Brackets 2013-03-09 13:41:42 -08:00
parent 806ee13b61
commit dba04a7e22
4 changed files with 11 additions and 7 deletions

View File

@ -335,6 +335,12 @@ u32 hleDelayResult(u32 result, const char *reason, int usec)
return result;
}
void hleEatMicro(int usec)
{
// Maybe this should Idle, at least for larger delays? Could that cause issues?
currentMIPS->downcount -= (int) usToCycles(usec);
}
inline void hleFinishSyscall(int modulenum, int funcnum)
{
if ((hleAfterSyscall & HLE_AFTER_CURRENT_CALLBACKS) != 0)

View File

@ -89,6 +89,7 @@ void hleDebugBreak();
// Delays the result for usec microseconds, allowing other threads to run during this time.
u32 hleDelayResult(u32 result, const char *reason, int usec);
void hleEatMicro(int usec);
void HLEInit();
void HLEDoState(PointerWrap &p);

View File

@ -543,6 +543,7 @@ u32 sceDisplayWaitVblank() {
return 0;
} else {
DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank");
hleEatMicro(5);
return 1;
}
}
@ -562,6 +563,7 @@ u32 sceDisplayWaitVblankCB() {
return 0;
} else {
DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank");
hleEatMicro(5);
return 1;
}
}
@ -584,12 +586,7 @@ u32 sceDisplayGetVcount() {
// Too spammy
// DEBUG_LOG(HLE,"%i=sceDisplayGetVcount()", vCount);
// Puyo Puyo Fever polls this as a substitute for waiting for vblank.
// As a result, the game never gets to reschedule so it doesn't mix audio and things break.
// Need to find a better hack as this breaks games like Project Diva.
// hleReSchedule("sceDisplayGetVcount hack"); // Puyo puyo hack?
CoreTiming::Idle(1000000);
hleEatMicro(2);
return vCount;
}

View File

@ -53,6 +53,7 @@ tests_good = [
"ctrl/sampling/sampling",
"ctrl/sampling2/sampling2",
"display/display",
"display/vblankmulti",
"dmac/dmactest",
"loader/bss/bss",
"intr/intr",
@ -134,7 +135,6 @@ tests_next = [
"audio/atrac/atractest",
"audio/mp3/mp3test",
"audio/sascore/sascore",
"display/vblankmulti",
"malloc/malloc",
"threads/fpl/fpl",
"threads/k0/k0",