mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Add delays in some timing funcs that games tightloop.
Greatly improves performance in Legend of Heroes 1.
This commit is contained in:
parent
a7bf56e2ae
commit
75c5afa147
@ -345,10 +345,15 @@ u64 hleDelayResult(u64 result, const char *reason, int usec)
|
||||
return result;
|
||||
}
|
||||
|
||||
void hleEatMicro(int usec)
|
||||
void hleEatCycles(int cycles)
|
||||
{
|
||||
// Maybe this should Idle, at least for larger delays? Could that cause issues?
|
||||
currentMIPS->downcount -= (int) usToCycles(usec);
|
||||
currentMIPS->downcount -= cycles;
|
||||
}
|
||||
|
||||
void hleEatMicro(int usec)
|
||||
{
|
||||
hleEatCycles((int) usToCycles(usec));
|
||||
}
|
||||
|
||||
inline void hleFinishSyscall(int modulenum, int funcnum)
|
||||
|
@ -90,6 +90,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);
|
||||
u64 hleDelayResult(u64 result, const char *reason, int usec);
|
||||
void hleEatCycles(int cycles);
|
||||
void hleEatMicro(int usec);
|
||||
|
||||
inline int hleDelayResult(int result, const char *reason, int usec)
|
||||
|
@ -543,7 +543,7 @@ u32 sceDisplayWaitVblank() {
|
||||
return 0;
|
||||
} else {
|
||||
DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank");
|
||||
hleEatMicro(5);
|
||||
hleEatCycles(5 * 222);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -563,7 +563,7 @@ u32 sceDisplayWaitVblankCB() {
|
||||
return 0;
|
||||
} else {
|
||||
DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank");
|
||||
hleEatMicro(5);
|
||||
hleEatCycles(5 * 222);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -585,7 +585,7 @@ u32 sceDisplayWaitVblankStartMultiCB(int vblanks) {
|
||||
u32 sceDisplayGetVcount() {
|
||||
VERBOSE_LOG(HLE,"%i=sceDisplayGetVcount()", vCount);
|
||||
|
||||
hleEatMicro(2);
|
||||
hleEatCycles(2 * 222);
|
||||
return vCount;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ int sceKernelGetSystemTime(u32 sysclockPtr)
|
||||
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
|
||||
Memory::Write_U64(t, sysclockPtr);
|
||||
DEBUG_LOG(HLE, "sceKernelGetSystemTime(out:%16llx)", t);
|
||||
hleEatCycles(2 * 222);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -107,6 +108,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
|
||||
Memory::Write_U32(highResult, highPtr);
|
||||
if (Memory::IsValidAddress(lowPtr))
|
||||
Memory::Write_U32(lowResult, lowPtr);
|
||||
hleEatCycles(2 * 222);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user