Fix sema and event flag refer to check size.
If it's zero, write nothing, just like the others.
This commit is contained in:
parent
f649364b2d
commit
ac9e936ba8
2 changed files with 14 additions and 3 deletions
|
@ -661,16 +661,22 @@ int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti
|
|||
//int sceKernelReferEventFlagStatus(SceUID event, SceKernelEventFlagInfo *status);
|
||||
u32 sceKernelReferEventFlagStatus(SceUID id, u32 statusPtr)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceKernelReferEventFlagStatus(%i, %08x)", id, statusPtr);
|
||||
u32 error;
|
||||
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
|
||||
if (e)
|
||||
{
|
||||
Memory::WriteStruct(statusPtr, &e->nef);
|
||||
DEBUG_LOG(HLE, "sceKernelReferEventFlagStatus(%i, %08x)", id, statusPtr);
|
||||
|
||||
if (!Memory::IsValidAddress(statusPtr))
|
||||
return -1;
|
||||
|
||||
if (Memory::Read_U32(statusPtr) != 0)
|
||||
Memory::WriteStruct(statusPtr, &e->nef);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelReferEventFlagStatus(%i, %08x): invalid event flag", id, statusPtr);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,7 +328,12 @@ int sceKernelReferSemaStatus(SceUID id, u32 infoPtr)
|
|||
if (s)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceKernelReferSemaStatus(%i, %08x)", id, infoPtr);
|
||||
Memory::WriteStruct(infoPtr, &s->ns);
|
||||
|
||||
if (!Memory::IsValidAddress(infoPtr))
|
||||
return -1;
|
||||
|
||||
if (Memory::Read_U32(infoPtr) != 0)
|
||||
Memory::WriteStruct(infoPtr, &s->ns);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue