From 270382b958c454f4c555d72b229002bcb12e272f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 8 Jul 2023 11:05:39 +0200 Subject: [PATCH 1/2] Remove delays in sceKernelReferThreadProfiler/ReferGlobalProfiler. This fixes timing in the MLB games, but is inconsistent with testing :( See issue #17623 --- Core/HLE/sceKernel.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 5b1addafe332..2860bf5f62bd 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -683,19 +683,16 @@ static u32 sceKernelReferThreadProfiler() { // This seems to simply has no parameter: // https://pspdev.github.io/pspsdk/group__ThreadMan.html#ga8fd30da51b9dc0507ac4dae04a7e4a17 , // And in testing it just returns null in 55 usec (which is surprisingly long). - - // So, we log only if debug logging is enabled, and sleep for a bit. + // However, this breaks MLB 2k11. See issue #17623. So I've removed the sleeps for now. DEBUG_LOG(SCEKERNEL, "0=sceKernelReferThreadProfiler()"); - - // The delay has been measured, 53-56 us. - hleEatMicro(55); + // hleEatMicro(55); return 0; } static int sceKernelReferGlobalProfiler() { DEBUG_LOG(SCEKERNEL, "0=sceKernelReferGlobalProfiler()"); - // The delay has been measured, 53-56 us. - hleEatMicro(55); + // See sceKernelReferThreadProfiler(), similar. + // hleEatMicro(55); return 0; } From 725f1059d6ae9c1d468cb476fa369893410c8f7a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 8 Jul 2023 06:20:17 -0700 Subject: [PATCH 2/2] Kernel: Use lower profiler func timing. --- Core/HLE/sceKernel.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 2860bf5f62bd..5ff26c046187 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -681,18 +681,17 @@ struct DebugProfilerRegs { static u32 sceKernelReferThreadProfiler() { // This seems to simply has no parameter: - // https://pspdev.github.io/pspsdk/group__ThreadMan.html#ga8fd30da51b9dc0507ac4dae04a7e4a17 , - // And in testing it just returns null in 55 usec (which is surprisingly long). - // However, this breaks MLB 2k11. See issue #17623. So I've removed the sleeps for now. + // https://pspdev.github.io/pspsdk/group__ThreadMan.html#ga8fd30da51b9dc0507ac4dae04a7e4a17 + // In testing it just returns null in around 140-150 cycles. See issue #17623. DEBUG_LOG(SCEKERNEL, "0=sceKernelReferThreadProfiler()"); - // hleEatMicro(55); + hleEatCycles(140); return 0; } static int sceKernelReferGlobalProfiler() { DEBUG_LOG(SCEKERNEL, "0=sceKernelReferGlobalProfiler()"); // See sceKernelReferThreadProfiler(), similar. - // hleEatMicro(55); + hleEatCycles(140); return 0; }