CoreTiming: make loops easier to read

This commit is contained in:
Tillmann Karras 2015-08-26 14:53:58 +02:00
parent a36b135473
commit 0f4861cac2
1 changed files with 11 additions and 28 deletions

View File

@ -324,21 +324,11 @@ bool IsScheduled(int event_type)
void RemoveEvent(int event_type) void RemoveEvent(int event_type)
{ {
if (!first) while (first && first->type == event_type)
return;
while (first)
{ {
if (first->type == event_type) Event* next = first->next;
{ FreeEvent(first);
Event *next = first->next; first = next;
FreeEvent(first);
first = next;
}
else
{
break;
}
} }
if (!first) if (!first)
@ -434,21 +424,14 @@ void Advance()
lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f; lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength); PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
while (first) while (first && first->time <= globalTimer)
{ {
if (first->time <= globalTimer) //LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
{ // event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
//LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ", Event* evt = first;
// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time); first = first->next;
Event* evt = first; event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
first = first->next; FreeEvent(evt);
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
FreeEvent(evt);
}
else
{
break;
}
} }
if (!first) if (!first)