Correct sceKernelReferMsgPipeStatus().

This commit is contained in:
Unknown W. Brackets 2013-08-18 17:31:17 -07:00
parent a53c5d291c
commit 4f7f963274
3 changed files with 20 additions and 10 deletions

View File

@ -766,7 +766,7 @@ const HLEFunction ThreadManForUser[] =
{0xFBFA697D,WrapI_IUUUUU<sceKernelReceiveMsgPipeCB>, "sceKernelReceiveMsgPipeCB"},
{0xDF52098F,WrapI_IUUUU<sceKernelTryReceiveMsgPipe>, "sceKernelTryReceiveMsgPipe"},
{0x349B864D,WrapI_IUU<sceKernelCancelMsgPipe>, "sceKernelCancelMsgPipe"},
{0x33BE4024,sceKernelReferMsgPipeStatus,"sceKernelReferMsgPipeStatus"},
{0x33BE4024,WrapI_IU<sceKernelReferMsgPipeStatus>, "sceKernelReferMsgPipeStatus"},
{0x56C039B5,WrapI_CIUUU<sceKernelCreateVpl>,"sceKernelCreateVpl"},
{0x89B3D48C,WrapI_I<sceKernelDeleteVpl>,"sceKernelDeleteVpl"},

View File

@ -776,23 +776,33 @@ int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThr
return 0;
}
void sceKernelReferMsgPipeStatus()
int sceKernelReferMsgPipeStatus(SceUID uid, u32 statusPtr)
{
SceUID uid = PARAM(0);
u32 msgPipeStatusAddr = PARAM(1);
DEBUG_LOG(HLE,"sceKernelReferMsgPipeStatus(%i, %08x)", uid, msgPipeStatusAddr);
u32 error;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (m)
{
if (!Memory::IsValidAddress(statusPtr))
{
ERROR_LOG(HLE, "sceKernelReferMsgPipeStatus(%i, %08x): invalid address", uid, statusPtr);
return -1;
}
DEBUG_LOG(HLE, "sceKernelReferMsgPipeStatus(%i, %08x)", uid, statusPtr);
// Clean up any that have timed out.
m->SortReceiveThreads();
m->SortSendThreads();
m->nmp.numSendWaitThreads = (int) m->sendWaitingThreads.size();
m->nmp.numReceiveWaitThreads = (int) m->receiveWaitingThreads.size();
Memory::WriteStruct(msgPipeStatusAddr, &m->nmp);
RETURN(0);
if (Memory::Read_U32(statusPtr) != 0)
Memory::WriteStruct(statusPtr, &m->nmp);
return 0;
}
else
{
RETURN(error);
DEBUG_LOG(HLE, "sceKernelReferMsgPipeStatus(%i, %08x): bad message pipe", uid, statusPtr);
return error;
}
}

View File

@ -28,7 +28,7 @@ int sceKernelReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u32
int sceKernelReceiveMsgPipeCB(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u32 waitMode, u32 resultAddr, u32 timeoutPtr);
int sceKernelTryReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u32 waitMode, u32 resultAddr);
int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThreadsAddr);
void sceKernelReferMsgPipeStatus();
int sceKernelReferMsgPipeStatus(SceUID uid, u32 statusPtr);
void __KernelMsgPipeInit();
void __KernelMsgPipeDoState(PointerWrap &p);