Oops, 0 is a valid timer id.

This commit is contained in:
Unknown W. Brackets 2013-01-17 22:04:52 -08:00
parent 0db19f8c8e
commit 43c8726554
7 changed files with 21 additions and 21 deletions

View File

@ -106,7 +106,7 @@ public:
SceUID alarmID;
};
static int alarmTimer = 0;
static int alarmTimer = -1;
void __KernelTriggerAlarm(u64 userdata, int cyclesLate)
{

View File

@ -98,7 +98,7 @@ enum PspEventFlagWaitTypes
PSP_EVENT_WAITKNOWN = PSP_EVENT_WAITCLEAR | PSP_EVENT_WAITCLEARALL | PSP_EVENT_WAITOR,
};
int eventFlagWaitTimer = 0;
int eventFlagWaitTimer = -1;
void __KernelEventFlagInit()
{
@ -160,7 +160,7 @@ bool __KernelUnlockEventFlagForThread(EventFlag *e, EventFlagTh &th, u32 &error,
Memory::Write_U32(e->nef.currentPattern, th.outAddr);
}
if (timeoutPtr != 0 && eventFlagWaitTimer != 0)
if (timeoutPtr != 0 && eventFlagWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(eventFlagWaitTimer, th.tid);
@ -347,7 +347,7 @@ void __KernelEventFlagTimeout(u64 userdata, int cycleslate)
void __KernelSetEventFlagTimeout(EventFlag *e, u32 timeoutPtr)
{
if (timeoutPtr == 0 || eventFlagWaitTimer == 0)
if (timeoutPtr == 0 || eventFlagWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);

View File

@ -30,7 +30,7 @@ const int PSP_MBX_ERROR_DUPLICATE_MSG = 0x800201C9;
typedef std::pair<SceUID, u32> MbxWaitingThread;
void __KernelMbxTimeout(u64 userdata, int cyclesLate);
static int mbxWaitTimer = 0;
static int mbxWaitTimer = -1;
struct NativeMbx
{
@ -192,7 +192,7 @@ bool __KernelUnlockMbxForThread(Mbx *m, MbxWaitingThread &th, u32 &error, int re
if (waitID != m->GetUID())
return true;
if (timeoutPtr != 0 && mbxWaitTimer != 0)
if (timeoutPtr != 0 && mbxWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(mbxWaitTimer, th.first);
@ -230,7 +230,7 @@ void __KernelMbxTimeout(u64 userdata, int cyclesLate)
void __KernelWaitMbx(Mbx *m, u32 timeoutPtr)
{
if (timeoutPtr == 0 || mbxWaitTimer == 0)
if (timeoutPtr == 0 || mbxWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);

View File

@ -32,7 +32,7 @@
BlockAllocator userMemory(256);
BlockAllocator kernelMemory(256);
static int vplWaitTimer = 0;
static int vplWaitTimer = -1;
// STATE END
//////////////////////////////////////////////////////////////////////////
@ -754,7 +754,7 @@ bool __KernelUnlockVplForThread(VPL *vpl, VplWaitingThread &threadInfo, u32 &err
vpl->nv.numWaitThreads--;
}
if (timeoutPtr != 0 && vplWaitTimer != 0)
if (timeoutPtr != 0 && vplWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(vplWaitTimer, threadID);
@ -929,7 +929,7 @@ void __KernelVplTimeout(u64 userdata, int cyclesLate)
void __KernelSetVplTimeout(u32 timeoutPtr)
{
if (timeoutPtr == 0 || vplWaitTimer == 0)
if (timeoutPtr == 0 || vplWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);

View File

@ -125,8 +125,8 @@ struct LwMutex : public KernelObject
std::vector<SceUID> waitingThreads;
};
static int mutexWaitTimer = 0;
static int lwMutexWaitTimer = 0;
static int mutexWaitTimer = -1;
static int lwMutexWaitTimer = -1;
// Thread -> Mutex locks for thread end.
typedef std::multimap<SceUID, SceUID> MutexMap;
static MutexMap mutexHeldLocks;
@ -280,7 +280,7 @@ bool __KernelUnlockMutexForThread(Mutex *mutex, SceUID threadID, u32 &error, int
__KernelMutexAcquireLock(mutex, wVal, threadID);
}
if (timeoutPtr != 0 && mutexWaitTimer != 0)
if (timeoutPtr != 0 && mutexWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(mutexWaitTimer, threadID);
@ -428,7 +428,7 @@ void __KernelMutexThreadEnd(SceUID threadID)
void __KernelWaitMutex(Mutex *mutex, u32 timeoutPtr)
{
if (timeoutPtr == 0 || mutexWaitTimer == 0)
if (timeoutPtr == 0 || mutexWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);
@ -604,7 +604,7 @@ bool __KernelUnlockLwMutexForThread(LwMutex *mutex, NativeLwMutexWorkarea &worka
workarea.lockThread = threadID;
}
if (timeoutPtr != 0 && lwMutexWaitTimer != 0)
if (timeoutPtr != 0 && lwMutexWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(lwMutexWaitTimer, threadID);
@ -745,7 +745,7 @@ void __KernelLwMutexTimeout(u64 userdata, int cyclesLate)
void __KernelWaitLwMutex(LwMutex *mutex, u32 timeoutPtr)
{
if (timeoutPtr == 0 || lwMutexWaitTimer == 0)
if (timeoutPtr == 0 || lwMutexWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);

View File

@ -69,7 +69,7 @@ struct Semaphore : public KernelObject
std::vector<SceUID> waitingThreads;
};
static int semaWaitTimer = 0;
static int semaWaitTimer = -1;
void __KernelSemaInit()
{
@ -109,7 +109,7 @@ bool __KernelUnlockSemaForThread(Semaphore *s, SceUID threadID, u32 &error, int
s->ns.numWaitThreads--;
}
if (timeoutPtr != 0 && semaWaitTimer != 0)
if (timeoutPtr != 0 && semaWaitTimer != -1)
{
// Remove any event for this thread.
u64 cyclesLeft = CoreTiming::UnscheduleEvent(semaWaitTimer, threadID);
@ -137,7 +137,7 @@ bool __KernelClearSemaThreads(Semaphore *s, int reason)
int sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr)
{
DEBUG_LOG(HLE, "sceKernelCancelSema(%i)", id);
DEBUG_LOG(HLE, "sceKernelCancelSema(%i, %i, %08x)", id, newCount, numWaitThreadsPtr);
u32 error;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
@ -304,7 +304,7 @@ void __KernelSemaTimeout(u64 userdata, int cycleslate)
void __KernelSetSemaTimeout(Semaphore *s, u32 timeoutPtr)
{
if (timeoutPtr == 0 || semaWaitTimer == 0)
if (timeoutPtr == 0 || semaWaitTimer == -1)
return;
int micro = (int) Memory::Read_U32(timeoutPtr);

View File

@ -35,7 +35,7 @@ static u8 umdActivated = 1;
static u32 umdStatus = 0;
static u32 umdErrorStat = 0;
static int driveCBId = -1;
static int umdStatTimer = 0;
static int umdStatTimer = -1;
#define PSP_UMD_TYPE_GAME 0x10