mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-21 14:41:39 +00:00
Don't allow two drawsyncs to be in play at once.
This commit is contained in:
parent
210c7b1639
commit
6190918158
@ -315,6 +315,52 @@ s64 UnscheduleEvent(int event_type, u64 userdata)
|
||||
return result;
|
||||
}
|
||||
|
||||
s64 UnscheduleThreadsafeEvent(int event_type, u64 userdata)
|
||||
{
|
||||
s64 result = 0;
|
||||
std::lock_guard<std::recursive_mutex> lk(externalEventSection);
|
||||
if (!tsFirst)
|
||||
return result;
|
||||
while(tsFirst)
|
||||
{
|
||||
if (tsFirst->type == event_type && tsFirst->userdata == userdata)
|
||||
{
|
||||
result = tsFirst->time - globalTimer;
|
||||
|
||||
Event *next = tsFirst->next;
|
||||
FreeTsEvent(tsFirst);
|
||||
tsFirst = next;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tsFirst)
|
||||
return result;
|
||||
|
||||
Event *prev = tsFirst;
|
||||
Event *ptr = prev->next;
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->type == event_type && ptr->userdata == userdata)
|
||||
{
|
||||
result = ptr->time - globalTimer;
|
||||
|
||||
prev->next = ptr->next;
|
||||
FreeTsEvent(ptr);
|
||||
ptr = prev->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Warning: not included in save state.
|
||||
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted))
|
||||
{
|
||||
|
@ -94,6 +94,7 @@ namespace CoreTiming
|
||||
void ScheduleEvent_Threadsafe(s64 cyclesIntoFuture, int event_type, u64 userdata=0);
|
||||
void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata=0);
|
||||
s64 UnscheduleEvent(int event_type, u64 userdata);
|
||||
s64 UnscheduleThreadsafeEvent(int event_type, u64 userdata);
|
||||
|
||||
void RemoveEvent(int event_type);
|
||||
void RemoveThreadsafeEvent(int event_type);
|
||||
|
@ -195,6 +195,8 @@ void __GeShutdown()
|
||||
bool __GeTriggerSync(WaitType waitType, int id, u64 atTicks)
|
||||
{
|
||||
u64 userdata = (u64)id << 32 | (u64) waitType;
|
||||
if (waitType == WAITTYPE_GEDRAWSYNC)
|
||||
CoreTiming::UnscheduleThreadsafeEvent(geSyncEvent, userdata);
|
||||
CoreTiming::ScheduleEvent_Threadsafe(atTicks - CoreTiming::GetTicks(), geSyncEvent, userdata);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user