From 4065fae262f473b61e867dda93e4073cb2d8a378 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 20 Oct 2019 10:25:57 -0700 Subject: [PATCH] Io: Destroy async threads on reset. Oops, this left us in a different state on exit. --- Core/HLE/sceIo.cpp | 9 +++++++++ Core/HLE/sceKernelThread.cpp | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index f933d88b04..da898f8d91 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -737,6 +737,15 @@ void __IoShutdown() { ioManager.Shutdown(); } + for (int i = 0; i < PSP_COUNT_FDS; ++i) { + asyncParams[i].op = IoAsyncOp::NONE; + asyncParams[i].priority = -1; + if (asyncThreads[i]) + asyncThreads[i]->Forget(); + delete asyncThreads[i]; + asyncThreads[i] = nullptr; + } + pspFileSystem.Unmount("ms0:", memstickSystem); pspFileSystem.Unmount("fatms0:", memstickSystem); pspFileSystem.Unmount("fatms:", memstickSystem); diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index a56f7fa67e..6bcccaf92e 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1641,9 +1641,9 @@ void __KernelStopThread(SceUID threadID, int exitStatus, const char *reason) // Stopped threads are never waiting. t->nt.waitType = WAITTYPE_NONE; t->nt.waitID = 0; - } - else + } else { ERROR_LOG_REPORT(SCEKERNEL, "__KernelStopThread: thread %d does not exist", threadID); + } } u32 __KernelDeleteThread(SceUID threadID, int exitStatus, const char *reason)