Core: Add argmask for threadhacks to prevent crash.

Every HLEFunction should have an argmask.  Some asserts for shutdown
crashes someone was seeing when calling HLE funcs from a shutdown
function.
This commit is contained in:
Unknown W. Brackets 2020-03-22 23:25:22 -07:00
parent 56a1b6d03a
commit 9cb74691b6
3 changed files with 10 additions and 8 deletions

View file

@ -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.)

View file

@ -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[] =

View file

@ -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)));