From 0918ec85980a61a901ad62b19b5c8a704c074578 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 5 Apr 2013 20:42:20 -0700 Subject: [PATCH] Return negative for UnscheduleEvent(). It usually won't be, but it could be negative. Also some other minor warnings. --- Core/CoreTiming.cpp | 4 ++-- Core/CoreTiming.h | 2 +- Core/HLE/sceKernelEventFlag.cpp | 2 +- Core/HLE/sceKernelMbx.cpp | 2 +- Core/HLE/sceKernelMemory.cpp | 2 +- Core/HLE/sceKernelMutex.cpp | 8 ++++---- Core/HLE/sceKernelSemaphore.cpp | 4 ++-- Core/HLE/sceKernelTime.cpp | 2 +- Core/HLE/sceKernelVTimer.cpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index ea33031d7..d442f0bcc 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -271,9 +271,9 @@ void ScheduleEvent(s64 cyclesIntoFuture, int event_type, u64 userdata) } // Returns cycles left in timer. -u64 UnscheduleEvent(int event_type, u64 userdata) +s64 UnscheduleEvent(int event_type, u64 userdata) { - u64 result = 0; + s64 result = 0; if (!first) return result; while(first) diff --git a/Core/CoreTiming.h b/Core/CoreTiming.h index e61928145..5f608df5a 100644 --- a/Core/CoreTiming.h +++ b/Core/CoreTiming.h @@ -93,7 +93,7 @@ namespace CoreTiming void ScheduleEvent(s64 cyclesIntoFuture, int event_type, u64 userdata=0); void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata=0); void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata=0); - u64 UnscheduleEvent(int event_type, u64 userdata); + s64 UnscheduleEvent(int event_type, u64 userdata); void RemoveEvent(int event_type); void RemoveThreadsafeEvent(int event_type); diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index fc532d10c..4d28a4c05 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -165,7 +165,7 @@ bool __KernelUnlockEventFlagForThread(EventFlag *e, EventFlagTh &th, u32 &error, if (timeoutPtr != 0 && eventFlagWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(eventFlagWaitTimer, th.tid); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(eventFlagWaitTimer, th.tid); Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); } diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index 98560a321..bd01e096e 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -205,7 +205,7 @@ bool __KernelUnlockMbxForThread(Mbx *m, MbxWaitingThread &th, u32 &error, int re if (timeoutPtr != 0 && mbxWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(mbxWaitTimer, th.first); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(mbxWaitTimer, th.first); Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); } diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index b35a280b5..6f271928f 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -804,7 +804,7 @@ bool __KernelUnlockVplForThread(VPL *vpl, VplWaitingThread &threadInfo, u32 &err if (timeoutPtr != 0 && vplWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(vplWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(vplWaitTimer, threadID); Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); } diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 961a1e626..d2a155722 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -264,7 +264,7 @@ bool __KernelUnlockMutexForThread(Mutex *mutex, SceUID threadID, u32 &error, int if (timeoutPtr != 0 && mutexWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID); Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); } @@ -289,7 +289,7 @@ void __KernelMutexBeginCallback(SceUID threadID, SceUID prevCallbackId) if (timeoutPtr != 0 && mutexWaitTimer != -1) { - u64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID); mutex->pausedWaitTimeouts[pauseKey] = CoreTiming::GetTicks() + cyclesLeft; } else @@ -759,7 +759,7 @@ bool __KernelUnlockLwMutexForThread(LwMutex *mutex, T workarea, SceUID threadID, if (timeoutPtr != 0 && lwMutexWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID); Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); } @@ -931,7 +931,7 @@ void __KernelLwMutexBeginCallback(SceUID threadID, SceUID prevCallbackId) if (timeoutPtr != 0 && lwMutexWaitTimer != -1) { - u64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID); mutex->pausedWaitTimeouts[pauseKey] = CoreTiming::GetTicks() + cyclesLeft; } else diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index a4aba4b6f..2842fab34 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -121,7 +121,7 @@ bool __KernelUnlockSemaForThread(Semaphore *s, SceUID threadID, u32 &error, int if (timeoutPtr != 0 && semaWaitTimer != -1) { // Remove any event for this thread. - u64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID); if (cyclesLeft < 0) cyclesLeft = 0; Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr); @@ -149,7 +149,7 @@ void __KernelSemaBeginCallback(SceUID threadID, SceUID prevCallbackId) if (timeoutPtr != 0 && semaWaitTimer != -1) { - u64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID); + s64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID); s->pausedWaitTimeouts[pauseKey] = CoreTiming::GetTicks() + cyclesLeft; } else diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 072d7ede7..93577c235 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -116,7 +116,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr) int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr) { u64 sysClock = lowClock | ((u64)highClock << 32); - DEBUG_LOG(HLE, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", clock, lowPtr, highPtr); + DEBUG_LOG(HLE, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", sysClock, lowPtr, highPtr); if (Memory::IsValidAddress(lowPtr)) { Memory::Write_U32((u32)(sysClock / 1000000), lowPtr); if (Memory::IsValidAddress(highPtr)) diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index b7f8b7840..bfe2be293 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -92,7 +92,7 @@ void __KernelScheduleVTimer(VTimer *vt, u64 schedule) { CoreTiming::ScheduleEvent(usToCycles(vt->nvt.schedule + 372), vtimerTimer, vt->GetUID()); } -void __rescheduleVTimer(SceUID id, u32 delay) { +void __rescheduleVTimer(SceUID id, int delay) { u32 error; VTimer *vt = kernelObjects.Get(id, error);