mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 18:53:58 +01:00
SignalSema: throw an error on overflow.
This is what the PSP does.
This commit is contained in:
1 parent
dd14450424
commit
71e57043e8
1 file changed
+7
-5
@@ -191,12 +191,14 @@ void sceKernelSignalSema(SceUID id, int signal)
|
||||
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
|
||||
if (s)
|
||||
{
|
||||
int oldval = s->ns.currentCount;
|
||||
|
||||
if (s->ns.currentCount + signal > s->ns.maxCount)
|
||||
s->ns.currentCount += s->ns.maxCount;
|
||||
else
|
||||
s->ns.currentCount += signal;
|
||||
{
|
||||
RETURN(SCE_KERNEL_ERROR_SEMA_OVF);
|
||||
return;
|
||||
}
|
||||
|
||||
int oldval = s->ns.currentCount;
|
||||
s->ns.currentCount += signal;
|
||||
DEBUG_LOG(HLE,"sceKernelSignalSema(%i, %i) (old: %i, new: %i)", id, signal, oldval, s->ns.currentCount);
|
||||
|
||||
// We need to set the return value BEFORE processing other threads.
|
||||
|
||||
Reference in new issue
Block a user