diff options
author | Eugene Sandulenko | 2011-08-05 10:15:20 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2011-08-06 11:28:35 +0100 |
commit | 78f1ea769060cd631c210fc01020bb921afe3607 (patch) | |
tree | 3d12aedc45efe68e6e5d81ee24d90c428bfc186c | |
parent | e72c2fae8896b14553f2e2246726b2e426f0e9bb (diff) | |
download | scummvm-rg350-78f1ea769060cd631c210fc01020bb921afe3607.tar.gz scummvm-rg350-78f1ea769060cd631c210fc01020bb921afe3607.tar.bz2 scummvm-rg350-78f1ea769060cd631c210fc01020bb921afe3607.zip |
OSYSTEM: extended installTimerProc() with timer ID parameter
-rw-r--r-- | audio/mpu401.cpp | 2 | ||||
-rw-r--r-- | audio/softsynth/mt32.cpp | 2 | ||||
-rw-r--r-- | backends/timer/default/default-timer.cpp | 2 | ||||
-rw-r--r-- | backends/timer/default/default-timer.h | 3 | ||||
-rw-r--r-- | common/timer.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 4 | ||||
-rw-r--r-- | engines/groovie/music.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/sound.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/lastexpress.cpp | 2 | ||||
-rw-r--r-- | engines/saga/interface.cpp | 6 | ||||
-rw-r--r-- | engines/saga/music.cpp | 2 | ||||
-rw-r--r-- | engines/saga/puzzle.cpp | 18 | ||||
-rw-r--r-- | engines/saga/render.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/palette.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/screen.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/sound.cpp | 2 | ||||
-rw-r--r-- | engines/testbed/misc.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/sound.cpp | 2 | ||||
-rw-r--r-- | gui/widgets/scrollbar.cpp | 8 |
20 files changed, 38 insertions, 36 deletions
diff --git a/audio/mpu401.cpp b/audio/mpu401.cpp index 966e367a93..103a3501db 100644 --- a/audio/mpu401.cpp +++ b/audio/mpu401.cpp @@ -146,6 +146,6 @@ void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::TimerManager g_system->getTimerManager()->removeTimerProc(_timer_proc); _timer_proc = timer_proc; if (timer_proc) - g_system->getTimerManager()->installTimerProc(timer_proc, 10000, timer_param); + g_system->getTimerManager()->installTimerProc(timer_proc, 10000, timer_param, "MPU401"); } } diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 6703a6f7b7..eabde21296 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -486,7 +486,7 @@ void MidiDriver_ThreadedMT32::setTimerCallback(void *timer_param, TimerManager:: _vm->_timer->removeTimerProc(_timer_proc); _timer_proc = timer_proc; if (timer_proc) - _vm->_timer->installTimerProc(timer_proc, getBaseTempo(), timer_param); + _vm->_timer->installTimerProc(timer_proc, getBaseTempo(), timer_param, "MT32tempo"); } } diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp index 8480fcc7ee..e17aaea444 100644 --- a/backends/timer/default/default-timer.cpp +++ b/backends/timer/default/default-timer.cpp @@ -109,7 +109,7 @@ void DefaultTimerManager::handler() { } } -bool DefaultTimerManager::installTimerProc(TimerProc callback, int32 interval, void *refCon) { +bool DefaultTimerManager::installTimerProc(TimerProc callback, int32 interval, void *refCon, const Common::String &id) { assert(interval > 0); Common::StackLock lock(_mutex); diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h index 66d2e3b091..33dd46cc57 100644 --- a/backends/timer/default/default-timer.h +++ b/backends/timer/default/default-timer.h @@ -22,6 +22,7 @@ #ifndef BACKENDS_TIMER_DEFAULT_H #define BACKENDS_TIMER_DEFAULT_H +#include "common/str.h" #include "common/timer.h" #include "common/mutex.h" @@ -36,7 +37,7 @@ private: public: DefaultTimerManager(); virtual ~DefaultTimerManager(); - virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon); + virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id); virtual void removeTimerProc(TimerProc proc); /** diff --git a/common/timer.h b/common/timer.h index 40438f078c..621751f825 100644 --- a/common/timer.h +++ b/common/timer.h @@ -43,9 +43,10 @@ public: * @param proc the callback * @param interval the interval in which the timer shall be invoked (in microseconds) * @param refCon an arbitrary void pointer; will be passed to the timer callback + * @param id unique string id of the installed timer. Used by the event recorder * @return true if the timer was installed successfully, false otherwise */ - virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon) = 0; + virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id) = 0; /** * Remove the given timer callback. It will not be invoked anymore, diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index caf3a987c4..5c1394cc2d 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -224,7 +224,7 @@ Common::Error DreamWebEngine::run() { _loadSavefile = -1; } - getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this); + getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync"); _context.__start(); _context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0; @@ -237,7 +237,7 @@ void DreamWebEngine::setSpeed(uint speed) { debug(0, "setting speed %u", speed); _speed = speed; getTimerManager()->removeTimerProc(vSyncInterrupt); - getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this); + getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this, "dreamwebVSync"); } void DreamWebEngine::openFile(const Common::String &name) { diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index c6e990dfcf..0a812939a6 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -766,7 +766,7 @@ Common::SeekableReadStream *MusicPlayerMac::decompressMidi(Common::SeekableReadS } MusicPlayerIOS::MusicPlayerIOS(GroovieEngine *vm) : MusicPlayer(vm) { - vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this); + vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this, "groovieMusic"); } MusicPlayerIOS::~MusicPlayerIOS() { diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index 1fea1f4343..fe34e6ff2d 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -270,7 +270,7 @@ void SoundHandler::pcspkr_player() { static const uint16 pcspkrFlats[8] = {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb _vm->getTimerManager()->removeTimerProc(&loopPlayer); - _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this); + _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop"); uint16 count; // Value to set timer chip to for note bool cmd_note; @@ -372,7 +372,7 @@ void SoundHandler::loadIntroSong(Common::ReadStream &in) { } void SoundHandler::initPcspkrPlayer() { - _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this); + _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop"); } } // End of namespace Hugo diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp index 885ca8b212..5a882b154b 100644 --- a/engines/lastexpress/lastexpress.cpp +++ b/engines/lastexpress/lastexpress.cpp @@ -146,7 +146,7 @@ Common::Error LastExpressEngine::run() { // Start sound manager and setup timer _soundMan = new SoundManager(this); - _timer->installTimerProc(&soundTimer, 17000, this); + _timer->installTimerProc(&soundTimer, 17000, this, "lastexpressSound"); // Menu _menu = new Menu(this); diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 08c5ddc6f9..fe37ed8995 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -320,7 +320,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { _disableAbortSpeeches = false; // set save game reminder alarm - _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this); + _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this, "sagaSaveReminder"); } Interface::~Interface() { @@ -335,7 +335,7 @@ void Interface::updateSaveReminder() { _saveReminderState = _saveReminderState % _vm->getDisplayInfo().saveReminderNumSprites + 1; drawStatusBar(); _vm->getTimerManager()->removeTimerProc(&saveReminderCallback); - _vm->getTimerManager()->installTimerProc(&saveReminderCallback, ((_vm->getGameId() == GID_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this); + _vm->getTimerManager()->installTimerProc(&saveReminderCallback, ((_vm->getGameId() == GID_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this, "sagaSaveReminder"); } } @@ -1390,7 +1390,7 @@ void Interface::setSave(PanelButton *panelButton) { void Interface::resetSaveReminder() { _vm->getTimerManager()->removeTimerProc(&saveReminderCallback); - _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this); + _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this, "sagaSaveReminder"); setSaveReminderState(1); } diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 49d3f91d77..b195206209 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -213,7 +213,7 @@ void Music::setVolume(int volume, int time) { return; } - _vm->getTimerManager()->installTimerProc(&musicVolumeGaugeCallback, time * 3000L, this); + _vm->getTimerManager()->installTimerProc(&musicVolumeGaugeCallback, time * 3000L, this, "sagaMusicVolume"); } bool Music::isPlaying() { diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp index d5d83c706f..63d9a88fee 100644 --- a/engines/saga/puzzle.cpp +++ b/engines/saga/puzzle.cpp @@ -140,7 +140,7 @@ void Puzzle::initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY, void Puzzle::execute() { _active = true; - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint"); initPieces(); @@ -408,12 +408,12 @@ void Puzzle::solicitHint() { switch (_hintRqState) { case kRQSpeaking: if (_vm->_actor->isSpeaking()) { - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50 * 1000000, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50 * 1000000, this, "sagaPuzzleHint"); break; } _hintRqState = _hintNextRqState; - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 100*1000000/3, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 100*1000000/3, this, "sagaPuzzleHint"); break; case kRQNoHint: @@ -436,11 +436,11 @@ void Puzzle::solicitHint() { // Roll to see if Sakka scolds if (_vm->_rnd.getRandomNumber(1)) { _hintRqState = kRQSakkaDenies; - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 200*1000000, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 200*1000000, this, "sagaPuzzleHint"); } else { _hintRqState = kRQSpeaking; _hintNextRqState = kRQHintRequested; - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this, "sagaPuzzleHint"); } break; @@ -453,7 +453,7 @@ void Puzzle::solicitHint() { _hintRqState = kRQSpeaking; _hintNextRqState = kRQHintRequestedStage2; - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, 50*1000000, this, "sagaPuzzleHint"); _vm->_interface->converseClear(); _vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0); @@ -480,7 +480,7 @@ void Puzzle::solicitHint() { _vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0); _vm->_interface->converseDisplayText(); - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint"); _hintRqState = kRQSkipEverything; break; @@ -504,7 +504,7 @@ void Puzzle::handleReply(int reply) { _vm->_actor->abortSpeech(); _hintRqState = kRQNoHint; _vm->getTimerManager()->removeTimerProc(&hintTimerCallback); - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this, "sagaPuzzleHint"); clearHint(); break; } @@ -566,7 +566,7 @@ void Puzzle::giveHint() { _vm->_interface->converseDisplayText(); _vm->getTimerManager()->removeTimerProc(&hintTimerCallback); - _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this); + _vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this, "sagaPuzzleHint"); } void Puzzle::clearHint() { diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 757374a3a3..a9ef23381e 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -50,7 +50,7 @@ Render::Render(SagaEngine *vm, OSystem *system) { #ifdef SAGA_DEBUG // Initialize FPS timer callback - _vm->getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this); + _vm->getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this, "sagaFPS"); #endif _backGroundSurface.create(_vm->getDisplayInfo().width, _vm->getDisplayInfo().height, Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index c5a3545701..38919593b4 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -683,7 +683,7 @@ bool GfxPalette::palVaryLoadTargetPalette(GuiResourceId resourceId) { void GfxPalette::palVaryInstallTimer() { int16 ticks = _palVaryTicks > 0 ? _palVaryTicks : 1; // Call signal increase every [ticks] - g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this); + g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this, "sciPalette"); } void GfxPalette::palVaryRemoveTimer() { diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index dbe2135143..6469bc0cb3 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -20,9 +20,9 @@ * */ -#include "common/timer.h" #include "common/util.h" #include "common/system.h" +#include "common/timer.h" #include "graphics/surface.h" #include "engines/util.h" diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 23f57a01b9..eb3717494f 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -58,7 +58,7 @@ IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer, int fps) memset(_track[l], 0, sizeof(Track)); _track[l]->trackId = l; } - _vm->getTimerManager()->installTimerProc(timer_handler, 1000000 / _callbackFps, this); + _vm->getTimerManager()->installTimerProc(timer_handler, 1000000 / _callbackFps, this, "IMuseDigital"); _audioNames = NULL; _numAudioNames = 0; diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index b4836d0c31..7fdc710142 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1016,7 +1016,7 @@ void Sound::startCDTimer() { // appears. _vm->getTimerManager()->removeTimerProc(&cd_timer_handler); - _vm->getTimerManager()->installTimerProc(&cd_timer_handler, 100700, _vm); + _vm->getTimerManager()->installTimerProc(&cd_timer_handler, 100700, _vm, "scummCDtimer"); } void Sound::stopCDTimer() { diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp index 034d3eb27e..aee3ccd294 100644 --- a/engines/testbed/misc.cpp +++ b/engines/testbed/misc.cpp @@ -110,7 +110,7 @@ TestExitStatus MiscTests::testDateTime() { TestExitStatus MiscTests::testTimers() { int valToModify = 0; - if (g_system->getTimerManager()->installTimerProc(timerCallback, 100000, &valToModify)) { + if (g_system->getTimerManager()->installTimerProc(timerCallback, 100000, &valToModify, "testbedTimer")) { g_system->delayMillis(150); g_system->getTimerManager()->removeTimerProc(timerCallback); @@ -133,7 +133,7 @@ TestExitStatus MiscTests::testMutexes() { SharedVars sv = {1, 1, true, g_system->createMutex()}; - if (g_system->getTimerManager()->installTimerProc(criticalSection, 100000, &sv)) { + if (g_system->getTimerManager()->installTimerProc(criticalSection, 100000, &sv, "testbedMutex")) { g_system->delayMillis(150); } diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 1d932fd9ba..9ee32e4927 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -85,7 +85,7 @@ void SoundManager::postInit() { // it handles updates for both music and Fx. However, since Adlib updates also get done in a // thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to // call the update method, rather than having it be called separately -// g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL); +// g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL, "tsageSoundUpdate"); __sndmgrReady = true; } } diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp index cc8e587668..e0dbcec59c 100644 --- a/gui/widgets/scrollbar.cpp +++ b/gui/widgets/scrollbar.cpp @@ -55,7 +55,7 @@ static void upArrowRepeater(void *ref) { sb->checkBounds(old_pos); g_system->getTimerManager()->removeTimerProc(&upArrowRepeater); - g_system->getTimerManager()->installTimerProc(&upArrowRepeater, 1000000/10, ref); + g_system->getTimerManager()->installTimerProc(&upArrowRepeater, 1000000/10, ref, "guiScrollBarUp"); } static void downArrowRepeater(void *ref) { @@ -66,7 +66,7 @@ static void downArrowRepeater(void *ref) { sb->checkBounds(old_pos); g_system->getTimerManager()->removeTimerProc(&downArrowRepeater); - g_system->getTimerManager()->installTimerProc(&downArrowRepeater, 1000000/10, ref); + g_system->getTimerManager()->installTimerProc(&downArrowRepeater, 1000000/10, ref, "guiScrollBarDown"); } void ScrollBarWidget::handleMouseDown(int x, int y, int button, int clickCount) { @@ -80,12 +80,12 @@ void ScrollBarWidget::handleMouseDown(int x, int y, int button, int clickCount) // Up arrow _currentPos--; _draggingPart = kUpArrowPart; - g_system->getTimerManager()->installTimerProc(&upArrowRepeater, 1000000/2, this); + g_system->getTimerManager()->installTimerProc(&upArrowRepeater, 1000000/2, this, "guiScrollBarUp"); } else if (y >= _h - UP_DOWN_BOX_HEIGHT) { // Down arrow _currentPos++; _draggingPart = kDownArrowPart; - g_system->getTimerManager()->installTimerProc(&downArrowRepeater, 1000000/2, this); + g_system->getTimerManager()->installTimerProc(&downArrowRepeater, 1000000/2, this, "guiScrollBarDown"); } else if (y < _sliderPos) { _currentPos -= _entriesPerPage - 1; } else if (y >= _sliderPos + _sliderHeight) { |