Cleanup sceKernelRegisterExitCallback() per tests.

This commit is contained in:
Unknown W. Brackets 2013-09-29 01:10:07 -07:00
parent a7ec139b5a
commit b928f50353
3 changed files with 24 additions and 12 deletions

View File

@ -280,13 +280,6 @@ void sceKernelExitGameWithStatus()
Core_Stop();
}
u32 sceKernelRegisterExitCallback(u32 cbId)
{
DEBUG_LOG(SCEKERNEL,"sceKernelRegisterExitCallback(%i)", cbId);
registeredExitCbId = cbId;
return 0;
}
u32 sceKernelDevkitVersion()
{
int firmwareVersion = 150;
@ -886,7 +879,7 @@ void Register_ThreadManForUser()
const HLEFunction LoadExecForUser[] =
{
{0x05572A5F,&WrapV_V<sceKernelExitGame>, "sceKernelExitGame"}, //()
{0x4AC57943,&WrapU_U<sceKernelRegisterExitCallback>,"sceKernelRegisterExitCallback"},
{0x4AC57943,&WrapI_I<sceKernelRegisterExitCallback>,"sceKernelRegisterExitCallback"},
{0xBD2F1094,&WrapI_CU<sceKernelLoadExec>,"sceKernelLoadExec"},
{0x2AC9954B,&WrapV_V<sceKernelExitGameWithStatus>,"sceKernelExitGameWithStatus"},
{0x362A956B,&WrapI_V<LoadExecForUser_362A956B>, "LoadExecForUser_362A956B"},

View File

@ -3662,6 +3662,23 @@ void __KernelChangeThreadState(SceUID threadId, ThreadStatus newStatus)
__KernelChangeThreadState(t, newStatus);
}
int sceKernelRegisterExitCallback(SceUID cbId)
{
u32 error;
Callback *cb = kernelObjects.Get<Callback>(cbId, error);
if (!cb)
{
WARN_LOG(SCEKERNEL, "sceKernelRegisterExitCallback(%i): invalid callback id", cbId);
if (sceKernelGetCompiledSdkVersion() >= 0x3090500)
return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT;
return 0;
}
DEBUG_LOG(SCEKERNEL, "sceKernelRegisterExitCallback(%i)", cbId);
registeredExitCbId = cbId;
return 0;
}
int LoadExecForUser_362A956B()
{
WARN_LOG_REPORT(SCEKERNEL, "LoadExecForUser_362A956B()");
@ -3676,18 +3693,18 @@ int LoadExecForUser_362A956B()
WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid address for cbArg (0x%08X)", cbArg);
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
}
int unknown1 = Memory::Read_U32(cbArg - 8);
if (unknown1 < 0 || unknown1 >= 4) {
u32 unknown1 = Memory::Read_U32(cbArg - 8);
if (unknown1 >= 4) {
WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid value unknown1 (0x%08X)", unknown1);
return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT;
}
int parameterArea = Memory::Read_U32(cbArg - 4);
u32 parameterArea = Memory::Read_U32(cbArg - 4);
if (!Memory::IsValidAddress(parameterArea)) {
WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid address for parameterArea on userMemory (0x%08X)", parameterArea);
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
}
int size = Memory::Read_U32(parameterArea);
u32 size = Memory::Read_U32(parameterArea);
if (size < 12) {
WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid parameterArea size %d", size);
return SCE_KERNEL_ERROR_ILLEGAL_SIZE;

View File

@ -304,4 +304,6 @@ struct DebugThreadInfo
std::vector<DebugThreadInfo> GetThreadsInfo();
void __KernelChangeThreadState(SceUID threadId, ThreadStatus newStatus);
int LoadExecForUser_362A956B();
int sceKernelRegisterExitCallback(SceUID cbId);