mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
OSYSTEM: extended installTimerProc() with timer ID parameter
This commit is contained in:
parent
e72c2fae88
commit
78f1ea7690
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
|
@ -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() {
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user