From 36fa0fe343fb4e5114c1c9d1d2bf9b1da10fd847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 2 Mar 2025 11:24:42 +0100 Subject: [PATCH] Update logging in sceKernelResumeThread --- Core/HLE/sceKernelThread.cpp | 35 +++++++++++++---------------------- Core/MIPS/MIPSInt.cpp | 1 + 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 2465a350c6..8c3f565cbb 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -2636,11 +2636,12 @@ int sceKernelCancelWakeupThread(SceUID uid) { } } +// Logs like a HLE func static int __KernelSleepThread(bool doCallbacks) { PSPThread *thread = __GetCurrentThread(); if (!thread) { ERROR_LOG_REPORT(Log::sceKernel, "sceKernelSleepThread*(): bad current thread"); - return -1; + return hleNoLog(-1); } if (thread->nt.wakeupCount > 0) { @@ -2650,7 +2651,7 @@ static int __KernelSleepThread(bool doCallbacks) { __KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept"); return hleLogVerbose(Log::sceKernel, 0, "sleeping"); } - return 0; + return hleNoLog(0); } int sceKernelSleepThread() { @@ -2804,24 +2805,21 @@ int sceKernelSuspendThread(SceUID threadID) } } -int sceKernelResumeThread(SceUID threadID) -{ +int sceKernelResumeThread(SceUID threadID) { // TODO: What about interrupts/callbacks? - if (threadID == 0 || threadID == currentThread) - { - ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): cannot suspend current thread", threadID); - return SCE_KERNEL_ERROR_ILLEGAL_THID; + if (threadID == 0 || threadID == currentThread) { + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_THID, "cannot suspend current thread"); } u32 error; PSPThread *t = kernelObjects.Get(threadID, error); - if (t) - { - if (!t->isSuspended()) - { - ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): thread not suspended", threadID); - return SCE_KERNEL_ERROR_NOT_SUSPEND; + if (!t) { + return hleLogError(Log::sceKernel, error, "bad thread"); + } else { + if (!t->isSuspended()) { + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NOT_SUSPEND, "sceKernelResumeThread(%d): thread not suspended", threadID); } + DEBUG_LOG(Log::sceKernel, "sceKernelResumeThread(%d)", threadID); t->nt.status &= ~THREADSTATUS_SUSPEND; @@ -2829,17 +2827,10 @@ int sceKernelResumeThread(SceUID threadID) if (t->nt.status == 0) __KernelChangeReadyState(t, threadID, true); hleReSchedule("resume thread from suspend"); - return 0; - } - else - { - ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): bad thread", threadID); - return error; + return hleNoLog(0); } } - - ////////////////////////////////////////////////////////////////////////// // CALLBACKS ////////////////////////////////////////////////////////////////////////// diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index 370a080e32..0896a169ab 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -831,6 +831,7 @@ namespace MIPSInt // move from interrupt controller, not implemented // See related report https://report.ppsspp.org/logs/kind/316 for possible locations. // Also see https://forums.ps2dev.org/viewtopic.php?p=32700#p32700 . + // TODO: Should we actually implement this? if (!reported) { WARN_LOG(Log::CPU, "MFIC Disable/Enable Interrupt CPU instruction"); reported = 1;