Skip to content
Permalink
Browse files

Merge pull request #12751 from unknownbrackets/kernel-minor

Core: Add argmask for threadhacks to prevent crash
  • Loading branch information
hrydgard committed Mar 23, 2020
2 parents 79ea010 + 9cb7469 commit c6948561fd93d0027a03bf17e2e9c6ebf46fa97a
Showing with 10 additions and 8 deletions.
  1. +1 −0 Core/HLE/HLE.cpp
  2. +8 −8 Core/HLE/HLETables.cpp
  3. +1 −0 Core/HLE/sceKernelThread.cpp
@@ -842,6 +842,7 @@ void hleDoLogInternal(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u64 res,
const char *funcName = "?";
u32 funcFlags = 0;
if (latestSyscall) {
_dbg_assert_(HLE, latestSyscall->argmask != nullptr);
hleFormatLogArgs(formatted_args, sizeof(formatted_args), latestSyscall->argmask);

// This acts as an override (for error returns which are usually hex.)
@@ -89,14 +89,14 @@
//sound
//zlibdec
const HLEFunction FakeSysCalls[] = {
{NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread"},
{NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall"},
{NID_INTERRUPTRETURN, __KernelReturnFromInterrupt, "__KernelReturnFromInterrupt"},
{NID_EXTENDRETURN, __KernelReturnFromExtendStack, "__KernelReturnFromExtendStack"},
{NID_MODULERETURN, __KernelReturnFromModuleFunc, "__KernelReturnFromModuleFunc"},
{NID_IDLE, __KernelIdle, "_sceKernelIdle"},
{NID_GPUREPLAY, __KernelGPUReplay, "__KernelGPUReplay"},
{NID_HLECALLRETURN, HLEReturnFromMipsCall, "HLEReturnFromMipsCall"},
{NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread", 'x', ""},
{NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall", 'x', ""},
{NID_INTERRUPTRETURN, __KernelReturnFromInterrupt, "__KernelReturnFromInterrupt", 'x', ""},
{NID_EXTENDRETURN, __KernelReturnFromExtendStack, "__KernelReturnFromExtendStack", 'x', ""},
{NID_MODULERETURN, __KernelReturnFromModuleFunc, "__KernelReturnFromModuleFunc", 'x', ""},
{NID_IDLE, __KernelIdle, "_sceKernelIdle", 'x', ""},
{NID_GPUREPLAY, __KernelGPUReplay, "__KernelGPUReplay", 'x', ""},
{NID_HLECALLRETURN, HLEReturnFromMipsCall, "HLEReturnFromMipsCall", 'x', ""},
};

const HLEFunction UtilsForUser[] =
@@ -1514,6 +1514,7 @@ void __KernelWaitCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 time
}

PSPThread *thread = __GetCurrentThread();
assert(thread != nullptr);
thread->nt.waitID = waitID;
thread->nt.waitType = type;
__KernelChangeThreadState(thread, ThreadStatus(THREADSTATUS_WAIT | (thread->nt.status & THREADSTATUS_SUSPEND)));

0 comments on commit c694856

Please sign in to comment.
You can’t perform that action at this time.