mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ALL: Sync with ScummVM - rev a94849abc4
This commit is contained in:
1 parent
17df02d25d
commit
fa277fcb48
23 files changed
+284
-3731
No files matched your search
@@ -62,6 +62,7 @@ void insertPrioQueue(TimerSlot *head, TimerSlot *newSlot) {
|
||||
|
||||
|
||||
DefaultTimerManager::DefaultTimerManager() :
|
||||
_timerCallbackNext(0),
|
||||
_head(0) {
|
||||
|
||||
_head = new TimerSlot();
|
||||
@@ -84,6 +85,10 @@ void DefaultTimerManager::handler() {
|
||||
|
||||
uint32 curTime = g_system->getMillis(true);
|
||||
|
||||
// On slow systems this could still be run after destructor
|
||||
if (!_head)
|
||||
return;
|
||||
|
||||
// Repeat as long as there is a TimerSlot that is scheduled to fire.
|
||||
TimerSlot *slot = _head->next;
|
||||
while (slot && slot->nextFireTime < curTime) {
|
||||
@@ -110,6 +115,16 @@ void DefaultTimerManager::handler() {
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultTimerManager::checkTimers(uint32 interval) {
|
||||
uint32 curTime = g_system->getMillis();
|
||||
|
||||
// Timer checking & firing
|
||||
if (curTime >= _timerCallbackNext) {
|
||||
handler();
|
||||
_timerCallbackNext = curTime + interval;
|
||||
}
|
||||
}
|
||||
|
||||
bool DefaultTimerManager::installTimerProc(TimerProc callback, int32 interval, void *refCon, const Common::String &id) {
|
||||
assert(interval > 0);
|
||||
Common::StackLock lock(_mutex);
|
||||
@@ -163,7 +178,7 @@ void DefaultTimerManager::removeTimerProc(TimerProc callback) {
|
||||
// callbacks.
|
||||
//
|
||||
// Another issues occurs when one plays a game with ALSA as music driver,
|
||||
// does RTL and starts a different engine game with ALSA as music driver.
|
||||
// returns to launcher and starts a different engine game with ALSA as music driver.
|
||||
// In this case the MPU401 code will add different timer procs with the
|
||||
// same name, resulting in two different callbacks added with the same
|
||||
// name and causing installTimerProc to error out.
|
||||
|
||||
Reference in new issue
Block a user