Ticket #8349: timer-v6.patch
File timer-v6.patch, 30.0 KB (added by , 20 years ago) |
---|
-
backends/midi/adlib.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v retrieving revision 1.58 diff -u -d -r1.58 adlib.cpp
19 19 */ 20 20 21 21 #include "stdafx.h" 22 23 #include "common/system.h" 24 #include "common/util.h" 25 22 26 #include "sound/mididrv.h" 23 27 #include "sound/fmopl.h" 24 28 #include "sound/mixer.h" 25 #include "common/util.h"26 29 27 30 #define BASE_FREQ 250 28 31 #define FIXP_SHIFT 16 … … 559 562 void setPitchBendRange(byte channel, uint range); 560 563 void sysEx_customInstrument(byte channel, uint32 type, byte *instr); 561 564 562 void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc);565 void setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc); 563 566 uint32 getBaseTempo() { 564 567 return 1000000 / BASE_FREQ; 565 568 } … … 575 578 byte *_adlib_reg_cache; 576 579 SoundMixer *_mixer; 577 580 578 Timer::TimerProc _timer_proc;581 OSystem::TimerProc _timer_proc; 579 582 void *_timer_param; 580 583 581 584 int _adlib_timer_counter; … … 964 967 _parts[channel].sysEx_customInstrument(type, instr); 965 968 } 966 969 967 void MidiDriver_ADLIB::setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) {970 void MidiDriver_ADLIB::setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc) { 968 971 _timer_proc = timer_proc; 969 972 _timer_param = timer_param; 970 973 } -
backends/midi/ym2612.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/midi/ym2612.cpp,v retrieving revision 1.23 diff -u -d -r1.23 ym2612.cpp
23 23 */ 24 24 25 25 #include "stdafx.h" 26 27 #include "common/system.h" 26 28 #include "common/util.h" 29 27 30 #include "sound/mididrv.h" 28 31 #include "sound/mixer.h" 29 32 … … 166 169 167 170 bool _isOpen; 168 171 SoundMixer *_mixer; 169 Timer::TimerProc _timer_proc;172 OSystem::TimerProc _timer_proc; 170 173 void *_timer_param; 171 174 int _next_tick; 172 175 int _samples_per_tick; … … 193 196 void setPitchBendRange(byte channel, uint range) { } 194 197 void sysEx(byte *msg, uint16 length); 195 198 196 void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc);199 void setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc); 197 200 uint32 getBaseTempo() { return 1000000 / BASE_FREQ; } 198 201 199 202 MidiChannel *allocateChannel() { return 0; } … … 768 771 _mixer->setupPremix(0, 0); 769 772 } 770 773 771 void MidiDriver_YM2612::setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) {774 void MidiDriver_YM2612::setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc) { 772 775 _timer_proc = timer_proc; 773 776 _timer_param = timer_param; 774 777 } -
backends/sdl/sdl-common.h
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v retrieving revision 1.62 diff -u -d -r1.62 sdl-common.h
30 30 #include "backends/intern.h" 31 31 32 32 #include <SDL.h> 33 #include <SDL_thread.h> 33 34 34 35 #ifndef _WIN32_WCE 35 36 // Uncomment this to enable the 'on screen display' code. 36 37 #define USE_OSD 1 37 38 #endif 38 39 40 #ifndef OLD_TIMER 39 41 class OSystem_SDL : public OSystem { 42 #else 43 class OSystem_SDL : public OSystemWithDefaultTimerCode { 44 #endif 40 45 public: 41 46 OSystem_SDL(); 42 47 virtual ~OSystem_SDL(); … … 103 108 void quit(); 104 109 105 110 111 #ifdef OLD_TIMER 106 112 // Add a callback timer 107 void setTimerCallback(TimerProc callback, int timer); 108 113 void setTimerCallback(TimerCallback callback, int timer); 114 #else 115 // Install/Remove callback timer 116 bool installTimerProc(TimerProc procedure, int32 interval, void *refCon); 117 void removeTimerProc(TimerProc procedure); 118 #endif 109 119 // Mutex handling 110 120 MutexRef createMutex(); 111 121 void lockMutex(MutexRef mutex); … … 208 218 bool cksum_valid; 209 219 int CKSUM_NUM; 210 220 221 #ifndef OLD_TIMER 222 // Timer Management 223 #define SDL_MAX_TIMERS 5 224 #define THREAD_RUN 0 225 #define THREAD_REMOVE 1 226 227 class TimerSlot { 228 friend class OSystem_SDL; 229 private: 230 TimerProc _threadFunc; 231 SDL_Thread *_threadHandle; 232 int _threadState; 233 double _interval; 234 void *_refCon; 235 double _startTime; 236 double _lastTime; 237 238 bool wait(); 239 void thread(); 240 public: 241 static int threadHandler(void *slotRef); 242 } _timerSlots[SDL_MAX_TIMERS]; 243 244 MutexRef _timerMutex; 245 246 bool createTimer(); 247 void deleteTimer(); 248 void resetTimerSlot(int slot); 249 #endif 250 211 251 // Keyboard mouse emulation 212 252 struct KbdMouse { 213 253 int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count; -
backends/sdl/sdl.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v retrieving revision 1.72 diff -u -d -r1.72 sdl.cpp
81 81 setup_icon(); 82 82 #endif 83 83 84 #ifndef OLD_TIMER 85 createTimer(); 86 #endif 87 84 88 // enable joystick 85 89 if (joystick_num > -1 && SDL_NumJoysticks() > 0) { 86 90 printf("Using joystick: %s\n", SDL_JoystickName(0)); … … 118 122 OSystem_SDL::~OSystem_SDL() { 119 123 // unload_gfx_mode(); 120 124 125 #ifndef OLD_TIMER 126 deleteTimer(); 127 #endif 128 121 129 if (_dirty_checksums) 122 130 free(_dirty_checksums); 123 131 free(_currentPalette); … … 136 144 SDL_Delay(msecs); 137 145 } 138 146 139 void OSystem_SDL::setTimerCallback(TimerProc callback, int timer) { 147 #ifdef OLD_TIMER 148 void OSystem_SDL::setTimerCallback(TimerCallback callback, int timer) { 140 149 SDL_SetTimer(timer, (SDL_TimerCallback) callback); 141 150 } 151 #else 152 153 bool OSystem_SDL::createTimer() { 154 _timerMutex = createMutex(); 155 156 for (int i = 0; i < SDL_MAX_TIMERS; i++) { 157 resetTimerSlot(i); 158 } 159 160 return true; 161 } 162 163 void OSystem_SDL::deleteTimer() { 164 { 165 Common::StackLock lock(_timerMutex); 166 for (int i = 0; i < SDL_MAX_TIMERS; i++) { 167 if (_timerSlots[i]._threadFunc) { 168 _timerSlots[i]._threadState = THREAD_REMOVE; 169 SDL_WaitThread(_timerSlots[i]._threadHandle, NULL); 170 resetTimerSlot(i); 171 } 172 } 173 } 174 175 deleteMutex(_timerMutex); 176 } 177 178 void OSystem_SDL::resetTimerSlot(int slot) { 179 _timerSlots[slot]._threadHandle = NULL; 180 _timerSlots[slot]._threadFunc = NULL; 181 _timerSlots[slot]._threadState = THREAD_REMOVE; 182 _timerSlots[slot]._interval = 0.0; 183 _timerSlots[slot]._refCon = NULL; 184 _timerSlots[slot]._startTime = 0.0; 185 _timerSlots[slot]._lastTime = 0.0; 186 } 187 188 bool OSystem_SDL::installTimerProc(TimerProc procedure, int32 interval, void *refCon) { 189 assert(interval > 0); 190 Common::StackLock lock(_timerMutex); 191 192 for (int i = 0; i < SDL_MAX_TIMERS; i++) { 193 if (!_timerSlots[i]._threadFunc) { 194 _timerSlots[i]._threadFunc = procedure; 195 _timerSlots[i]._interval = interval; 196 _timerSlots[i]._refCon = refCon; 197 _timerSlots[i]._startTime = SDL_GetTicks() * 1000.0; 198 _timerSlots[i]._lastTime = _timerSlots[i]._startTime; 199 _timerSlots[i]._threadState = THREAD_RUN; 200 _timerSlots[i]._threadHandle = SDL_CreateThread(_timerSlots[i].threadHandler, (void *)&_timerSlots[i]); 201 if (_timerSlots[i]._threadHandle == NULL) { 202 resetTimerSlot(i); 203 warning("SDL Timer, installTimerProc() Couldn't create thread!"); 204 return false; 205 } 206 return true; 207 } 208 } 209 210 warning("SDL Timer, installTimerProc() Couldn't find free timer slot!"); 211 return false; 212 } 213 214 void OSystem_SDL::removeTimerProc(TimerProc procedure) { 215 assert(procedure); 216 Common::StackLock lock(_timerMutex); 217 218 for (int i = 0; i < SDL_MAX_TIMERS; i++) { 219 if (_timerSlots[i]._threadFunc == procedure) { 220 _timerSlots[i]._threadState = THREAD_REMOVE; 221 SDL_WaitThread(_timerSlots[i]._threadHandle, NULL); 222 resetTimerSlot(i); 223 } 224 } 225 } 226 227 bool OSystem_SDL::TimerSlot::wait() { 228 double interval = 0.0; 229 230 if (_threadState == THREAD_REMOVE) { 231 return false; 232 } 233 234 double currentTime = SDL_GetTicks() * 1000.0; 235 236 if ((currentTime - _lastTime) < _interval) { 237 double elapsedTime = (currentTime - _startTime); 238 interval = _interval - (elapsedTime - ((uint32)(elapsedTime / _interval) * _interval)); 239 } 240 241 SDL_Delay((uint32)(interval / 1000.0)); 242 _lastTime = SDL_GetTicks() * 1000.0; 243 244 return true; 245 } 246 247 void OSystem_SDL::TimerSlot::thread() { 248 do { 249 (_threadFunc)(_refCon); 250 } while (wait()); 251 } 252 253 int OSystem_SDL::TimerSlot::threadHandler(void *slotRef) { 254 TimerSlot *slot = (TimerSlot *)slotRef; 255 slot->thread(); 256 return 0; 257 } 258 #endif 142 259 143 260 void OSystem_SDL::setWindowCaption(const char *caption) { 144 261 SDL_WM_SetCaption(caption, caption); -
backends/wince/wince-sdl.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v retrieving revision 1.14 diff -u -d -r1.14 wince-sdl.cpp
26 26 #include "base/gameDetector.h" 27 27 #include "base/engine.h" 28 28 #include "base/plugins.h" 29 #include "common/timer.h"30 29 31 30 #include "common/config-manager.h" 32 31 -
base/engine.cpp
RCS file: /cvsroot/scummvm/scummvm/base/engine.cpp,v retrieving revision 1.20 diff -u -d -r1.20 engine.cpp
26 26 #include "base/gameDetector.h" 27 27 #include "common/config-manager.h" 28 28 #include "common/file.h" 29 #include "common/timer.h"30 29 #include "sound/mixer.h" 31 30 32 31 /* FIXME - BIG HACK for MidiEmu */ … … 39 38 g_engine = this; 40 39 _mixer = GameDetector::createMixer(); 41 40 42 _timer = g_timer;43 44 41 // Add default file directory 45 42 File::addDefaultDirectory(_gameDataPath); 46 43 -
base/engine.h
RCS file: /cvsroot/scummvm/scummvm/base/engine.h,v retrieving revision 1.12 diff -u -d -r1.12 engine.h
26 26 #include "common/system.h" 27 27 28 28 class SoundMixer; 29 class Timer;30 29 31 30 class Engine { 32 31 public: 33 32 OSystem *_system; 34 33 SoundMixer *_mixer; 35 Timer * _timer;36 34 37 35 protected: 38 36 const Common::String _gameDataPath; -
base/main.cpp
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v retrieving revision 1.48 diff -u -d -r1.48 main.cpp
36 36 #include "common/config-manager.h" 37 37 #include "common/file.h" 38 38 #include "common/scaler.h" // For GFX_NORMAL 39 #include "common/timer.h"40 39 #include "gui/newgui.h" 41 40 #include "gui/launcher.h" 42 41 #include "gui/message.h" … … 365 364 // at an earlier point, though!) 366 365 OSystem *system = OSystem::instance(); 367 366 368 // Create the timer services369 g_timer = new Timer(system);370 371 367 // Set initial window caption 372 368 system->setWindowCaption(gScummVMFullVersion); 373 369 … … 394 390 //} 395 391 396 392 // ...and quit (the return 0 should never be reached) 397 delete g_timer;398 393 system->quit(); 399 394 delete system; 400 395 return 0; -
common/module.mk
RCS file: /cvsroot/scummvm/scummvm/common/module.mk,v retrieving revision 1.18 diff -u -d -r1.18 module.mk
6 6 common/md5.o \ 7 7 common/str.o \ 8 8 common/stream.o \ 9 common/timer.o \10 9 common/util.o \ 11 10 common/savefile.o \ 12 11 common/system.o -
common/system.cpp
RCS file: /cvsroot/scummvm/scummvm/common/system.cpp,v retrieving revision 1.12 diff -u -d -r1.12 system.cpp
59 59 } 60 60 61 61 OSystem *OSystem::instance() { 62 if (!s_system) 62 if (!s_system) { 63 63 s_system = createSystem(); 64 assert(s_system); 65 s_system->init(); 66 } 64 67 return s_system; 65 68 } 66 69 … … 92 95 dialog.runModal(); 93 96 } 94 97 98 #pragma mark - 99 95 100 SaveFileManager *OSystem::get_savefile_manager() { 96 101 return new DefaultSaveFileManager(); 97 102 } 98 103 104 OSystemWithDefaultTimerCode::OSystemWithDefaultTimerCode() { 105 _timerMutex = NULL; 106 _timerCallback = NULL; 107 _timerLastTime = 0; 108 } 109 110 void OSystemWithDefaultTimerCode::init() { 111 _timerMutex = createMutex(); 112 113 for (int i = 0; i < MAX_TIMERS; i++) { 114 _timerSlots[i].procedure = NULL; 115 _timerSlots[i].interval = 0; 116 _timerSlots[i].counter = 0; 117 } 118 119 _timerThisTime = get_msecs(); 120 121 // Set the timer last, after everything has been initialised 122 setTimerCallback(&timerCallback, 10); 123 } 124 125 void OSystemWithDefaultTimerCode::deinit() { 126 // Remove the timer callback. 127 // Note: backends *must* gurantee that after this method call returns, 128 // the handler is not in use anymore; else race condtions could occurs. 129 setTimerCallback(0, 0); 130 131 { 132 Common::StackLock lock(_timerMutex); 133 for (int i = 0; i < MAX_TIMERS; i++) { 134 _timerSlots[i].procedure = NULL; 135 _timerSlots[i].interval = 0; 136 _timerSlots[i].counter = 0; 137 } 138 } 139 140 deleteMutex(_timerMutex); 141 } 142 143 bool OSystemWithDefaultTimerCode::installTimerProc(TimerProc proc, int32 interval, void *refCon) { 144 assert(interval > 0); 145 Common::StackLock lock(_timerMutex); 146 147 for (int l = 0; l < MAX_TIMERS; l++) { 148 if (!_timerSlots[l].procedure) { 149 _timerSlots[l].procedure = proc; 150 _timerSlots[l].interval = interval; 151 _timerSlots[l].counter = interval; 152 _timerSlots[l].refCon = refCon; 153 return true; 154 } 155 } 156 157 warning("Couldn't find free timer slot!"); 158 return false; 159 } 160 161 void OSystemWithDefaultTimerCode::removeTimerProc(TimerProc proc) { 162 Common::StackLock lock(_timerMutex); 163 164 for (int l = 0; l < MAX_TIMERS; l++) { 165 if (_timerSlots[l].procedure == proc) { 166 _timerSlots[l].procedure = 0; 167 _timerSlots[l].interval = 0; 168 _timerSlots[l].counter = 1; // Work around a problem when a timer proc removes its 169 _timerSlots[l].refCon = 0; 170 } 171 } 172 } 173 174 int OSystemWithDefaultTimerCode::timerCallback(int t) { 175 return ((OSystemWithDefaultTimerCode *)g_system)->timerMain(t); 176 } 177 178 int OSystemWithDefaultTimerCode::timerMain(int t) { 179 Common::StackLock lock(_timerMutex); 180 uint32 interval, l; 181 182 _timerLastTime = _timerThisTime; 183 _timerThisTime = get_msecs(); 184 interval = 1000 * (_timerThisTime - _timerLastTime); 185 186 for (l = 0; l < MAX_TIMERS; l++) { 187 if (_timerSlots[l].procedure && _timerSlots[l].interval > 0) { 188 _timerSlots[l].counter -= interval; 189 while (_timerSlots[l].counter <= 0) { 190 // A small paranoia check which catches the case where 191 // a timer removes itself (which it never should do). 192 assert(_timerSlots[l].procedure && _timerSlots[l].interval > 0); 193 _timerSlots[l].counter += _timerSlots[l].interval; 194 _timerSlots[l].procedure(_timerSlots[l].refCon); 195 } 196 } 197 } 198 199 return t; 200 } 201 99 202 #pragma mark - 100 203 101 204 -
common/system.h
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v retrieving revision 1.68 diff -u -d -r1.68 system.h
49 49 */ 50 50 static OSystem *instance(); 51 51 52 protected: 53 /** Internal init function, called by instance(). */ 54 virtual void init() {} 55 52 56 public: 53 57 54 58 /** Empty virtual destructor. DO NOT REMOVE! */ … … 367 371 /** @name Events and Time */ 368 372 //@{ 369 373 370 typedef int (*TimerProc)(int interval);371 372 374 /** 373 375 * The types of events backends may generate. 374 376 * @see Event … … 454 456 /** Delay/sleep for the specified amount of milliseconds. */ 455 457 virtual void delay_msecs(uint msecs) = 0; 456 458 459 typedef void (*TimerProc)(void *refCon); 457 460 /** 458 * Set the timer callback, a function which is periodically invoked by the 459 * backend. This can for example be done via a background thread. 460 * There is at most one active timer; if this method is called while there 461 * is already an active timer, then the new timer callback should replace 462 * the previous one. In particular, passing a callback pointer value of 0 463 * is legal and can be used to clear the current timer callback. 464 * @see Common::Timer 465 * @note The implementation of this method must be 'atomic' in the sense 466 * that when the method returns, the previously set callback must 467 * not be in use anymore (in particular, if timers are implemented 468 * via threads, then it must be ensured that the timer thread is 469 * not using the old callback function anymore). 461 * Install a new timer callback. It will from now be called every interval microseconds. 462 * The timer may be invoked from a separate thread. Hence any timer code should be 463 * written following the same safety guidelines as any other threaded code. 470 464 * 471 * @param callback pointer to the callback. May be 0 to reset the timer 472 * @param interval the interval (in milliseconds) between invocations 473 * of the callback 465 * @note Although the interval is specified in microseconds, the actual timer resolution 466 * may be lower. In particular, with the SDL backend the timer resolution is 10ms. 467 * @param proc the callback 468 * @param interval the interval in which the timer shall be invoked (in microseconds) 469 * @param refCon an arbitrary void pointer; will be passed to the timer callback 470 * @return true if the timer was installed successfully, false otherwise 474 471 */ 475 virtual void setTimerCallback(TimerProc callback, int interval) = 0; 472 virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon) = 0; 473 474 /** 475 * Remove the given timer callback. It will not be invoked anymore. 476 */ 477 virtual void removeTimerProc(TimerProc proc) = 0; 476 478 477 479 //@} 478 480 … … 627 629 //@} 628 630 }; 629 631 632 633 /** 634 * This class provides a default implementation of the new OSystem timer API 635 * by emulating it using the old timer API. This makes it easy to get old 636 * backends to work with the new code, and also makes it easier to write new 637 * backends from scratch. 638 */ 639 class OSystemWithDefaultTimerCode : public OSystem { 640 public: 641 OSystemWithDefaultTimerCode(); 642 643 bool installTimerProc(TimerProc proc, int32 interval, void *refCon); 644 void removeTimerProc(TimerProc proc); 645 646 typedef int (*TimerCallback)(int interval); 647 648 /** 649 * Set the timer callback, a function which is periodically invoked by the 650 * backend. This can for example be done via a background thread. 651 * There is at most one active timer; if this method is called while there 652 * is already an active timer, then the new timer callback should replace 653 * the previous one. In particular, passing a callback pointer value of 0 654 * is legal and can be used to clear the current timer callback. 655 * @see Common::Timer 656 * @note The implementation of this method must be 'atomic' in the sense 657 * that when the method returns, the previously set callback must 658 * not be in use anymore (in particular, if timers are implemented 659 * via threads, then it must be ensured that the timer thread is 660 * not using the old callback function anymore). 661 * 662 * @param callback pointer to the callback. May be 0 to reset the timer 663 * @param interval the interval (in milliseconds) between invocations 664 * of the callback 665 */ 666 virtual void setTimerCallback(TimerCallback callback, int interval) = 0; 667 668 protected: 669 void init(); 670 671 // TODO: The deinit() methods currently is never called. However, that 672 // should hopefully never be a problem, since the quit() method of classes 673 // derived from this class should remove any timer callbacks anyway... 674 void deinit(); 675 676 private: 677 #define MAX_TIMERS 2 678 679 MutexRef _timerMutex; 680 void *_timerCallback; 681 int32 _timerThisTime; 682 int32 _timerLastTime; 683 684 struct TimerSlots { 685 TimerProc procedure; 686 int32 interval; 687 int32 counter; 688 void *refCon; 689 } _timerSlots[MAX_TIMERS]; 690 691 static int timerCallback(int t); 692 int timerMain(int t); 693 }; 694 630 695 /** The global OSystem instance. Inited in main(). */ 631 696 #define g_system (OSystem::instance()) 632 697 -
queen/queen.cpp
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v retrieving revision 1.90 diff -u -d -r1.90 queen.cpp
28 28 29 29 #include "common/config-manager.h" 30 30 #include "common/file.h" 31 #include "common/timer.h"32 31 33 32 #include "queen/queen.h" 34 33 #include "queen/bankman.h" -
saga/render.cpp
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v retrieving revision 1.31 diff -u -d -r1.31 render.cpp
38 38 #include "saga/objectmap.h" 39 39 40 40 #include "saga/render.h" 41 #include <common/timer.h>42 41 43 42 namespace Saga { 44 43 … … 62 61 GAME_GetDisplayInfo(&disp_info); 63 62 64 63 // Initialize FPS timer callback 65 g_timer->installTimerProc(&fpsTimerCallback, 1000000, this);64 system->installTimerProc(&fpsTimerCallback, 1000000, this); 66 65 67 66 // Create background buffer 68 67 _bg_buf_w = disp_info.logical_w; -
scumm/midiparser_ro.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/midiparser_ro.cpp,v retrieving revision 1.6 diff -u -d -r1.6 midiparser_ro.cpp
20 20 */ 21 21 22 22 #include "stdafx.h" 23 24 #include "common/util.h" 25 23 26 #include "sound/midiparser.h" 24 27 #include "sound/mididrv.h" 25 #include "common/util.h"26 28 27 29 28 30 namespace Scumm { -
scumm/sound.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v retrieving revision 1.381 diff -u -d -r1.381 sound.cpp
29 29 #include "scumm/sound.h" 30 30 31 31 #include "common/config-manager.h" 32 #include "common/timer.h"33 32 #include "common/util.h" 34 33 35 34 #include "sound/audiocd.h" … … 1122 1121 else 1123 1122 timer_interval = 101; 1124 1123 1125 _vm->_ timer->removeTimerProc(&cd_timer_handler);1126 _vm->_ timer->installTimerProc(&cd_timer_handler, 1000 * timer_interval, _vm);1124 _vm->_system->removeTimerProc(&cd_timer_handler); 1125 _vm->_system->installTimerProc(&cd_timer_handler, 1000 * timer_interval, _vm); 1127 1126 } 1128 1127 1129 1128 void Sound::stopCDTimer() { 1130 _vm->_ timer->removeTimerProc(&cd_timer_handler);1129 _vm->_system->removeTimerProc(&cd_timer_handler); 1131 1130 } 1132 1131 1133 1132 void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) { -
scumm/imuse_digi/dimuse.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v retrieving revision 1.108 diff -u -d -r1.108 dimuse.cpp
19 19 */ 20 20 21 21 #include "stdafx.h" 22 #include "common/timer.h"23 22 24 23 #include "scumm/actor.h" 25 24 #include "scumm/scumm.h" … … 55 54 _track[l] = new Track; 56 55 _track[l]->used = false; 57 56 } 58 _vm->_ timer->installTimerProc(timer_handler, 1000000 / _callbackFps, this);57 _vm->_system->installTimerProc(timer_handler, 1000000 / _callbackFps, this); 59 58 } 60 59 61 60 IMuseDigital::~IMuseDigital() { 62 61 stopAllSounds(); 63 _vm->_ timer->removeTimerProc(timer_handler);62 _vm->_system->removeTimerProc(timer_handler); 64 63 for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) { 65 64 delete _track[l]; 66 65 } -
scumm/imuse_digi/dimuse_script.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_script.cpp,v retrieving revision 1.24 diff -u -d -r1.24 dimuse_script.cpp
19 19 */ 20 20 21 21 #include "stdafx.h" 22 #include "common/timer.h"23 22 24 23 #include "scumm/actor.h" 25 24 #include "scumm/scumm.h" -
scumm/imuse_digi/dimuse_track.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_track.cpp,v retrieving revision 1.33 diff -u -d -r1.33 dimuse_track.cpp
19 19 */ 20 20 21 21 #include "stdafx.h" 22 #include "common/timer.h"23 22 24 23 #include "scumm/actor.h" 25 24 #include "scumm/scumm.h" -
scumm/smush/smush_player.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v retrieving revision 1.130 diff -u -d -r1.130 smush_player.cpp
26 26 #include "common/config-manager.h" 27 27 #include "common/file.h" 28 28 #include "common/util.h" 29 #include "common/timer.h"30 29 31 30 #include "scumm/bomp.h" 32 31 #include "scumm/imuse_digi/dimuse.h" … … 255 254 _vm->setDirtyColors(0, 255); 256 255 _dst = _vm->virtscr[0].getPixels(0, 0); 257 256 _smixer = new SmushMixer(_vm->_mixer); 258 g_timer->installTimerProc(&timerCallback, _speed, this);257 _vm->_system->installTimerProc(&timerCallback, _speed, this); 259 258 } 260 259 261 260 void SmushPlayer::release() { 262 _vm->_ timer->removeTimerProc(&timerCallback);261 _vm->_system->removeTimerProc(&timerCallback); 263 262 264 263 _vm->_smushVideoShouldFinish = true; 265 264 -
sky/sky.cpp
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v retrieving revision 1.147 diff -u -d -r1.147 sky.cpp
28 28 29 29 #include "common/config-manager.h" 30 30 #include "common/file.h" 31 #include "common/timer.h"32 31 33 32 #include "sky/compact.h" 34 33 #include "sky/control.h" … … 296 295 _skyMouse->useLogicInstance(_skyLogic); 297 296 298 297 // initialize timer *after* _skyScreen has been initialized. 299 _ timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second298 _system->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second 300 299 301 300 _skyControl = new Control(_saveFileMan, _skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _system, getSavePath()); 302 301 _skyLogic->useControlInstance(_skyControl); -
sound/mididrv.h
RCS file: /cvsroot/scummvm/scummvm/sound/mididrv.h,v retrieving revision 1.36 diff -u -d -r1.36 mididrv.h
24 24 #define SOUND_MIDIDRV_H 25 25 26 26 #include "common/scummsys.h" 27 #include "common/ timer.h"27 #include "common/system.h" 28 28 29 29 class MidiChannel; 30 30 class SoundMixer; … … 125 125 virtual void metaEvent (byte type, byte*data, uint16 length) { } 126 126 127 127 // Timing functions - MidiDriver now operates timers 128 virtual void setTimerCallback (void *timer_param, Timer::TimerProc timer_proc) = 0;128 virtual void setTimerCallback (void *timer_param, OSystem::TimerProc timer_proc) = 0; 129 129 virtual uint32 getBaseTempo (void) = 0; 130 130 131 131 // Channel allocation functions -
sound/mpu401.cpp
RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.cpp,v retrieving revision 1.26 diff -u -d -r1.26 mpu401.cpp
19 19 */ 20 20 21 21 #include "stdafx.h" 22 #include "mpu401.h" 23 #include "common/ timer.h"22 23 #include "common/system.h" 24 24 #include "common/util.h" // for ARRAYSIZE 25 25 26 #include "sound/mpu401.h" 27 26 28 void MidiChannel_MPU401::init(MidiDriver_MPU401 *owner, byte channel) { 27 29 _owner = owner; 28 30 _channel = channel; … … 93 95 94 96 void MidiDriver_MPU401::close() { 95 97 if (_timer_proc) 96 g_ timer->removeTimerProc(_timer_proc);98 g_system->removeTimerProc(_timer_proc); 97 99 _timer_proc = 0; 98 100 for (int i = 0; i < 16; ++i) 99 101 send (0x7B << 8 | 0xB0 | i); … … 125 127 return NULL; 126 128 } 127 129 128 void MidiDriver_MPU401::setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) {130 void MidiDriver_MPU401::setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc) { 129 131 if (!_timer_proc || !timer_proc) { 130 132 if (_timer_proc) 131 g_ timer->removeTimerProc(_timer_proc);133 g_system->removeTimerProc(_timer_proc); 132 134 _timer_proc = timer_proc; 133 135 if (timer_proc) 134 g_ timer->installTimerProc(timer_proc, 10000, timer_param);136 g_system->installTimerProc(timer_proc, 10000, timer_param); 135 137 } 136 138 } -
sound/mpu401.h
RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.h,v retrieving revision 1.19 diff -u -d -r1.19 mpu401.h
23 23 #define SOUND_MPU401_H 24 24 25 25 #include "stdafx.h" 26 26 27 #include "common/system.h" 27 #include "mididrv.h" 28 29 #include "sound/mididrv.h" 28 30 29 31 //////////////////////////////////////// 30 32 // … … 71 73 class MidiDriver_MPU401 : public MidiDriver { 72 74 private: 73 75 MidiChannel_MPU401 _midi_channels [16]; 74 Timer::TimerProc _timer_proc;76 OSystem::TimerProc _timer_proc; 75 77 uint16 _channel_mask; 76 78 77 79 public: 78 80 MidiDriver_MPU401(); 79 81 80 82 virtual void close(); 81 void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc);83 void setTimerCallback(void *timer_param, OSystem::TimerProc timer_proc); 82 84 uint32 getBaseTempo(void) { return 10000; } 83 85 uint32 property(int prop, uint32 param); 84 86 -
sword1/sword1.cpp
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v retrieving revision 1.51 diff -u -d -r1.51 sword1.cpp
27 27 #include "base/plugins.h" 28 28 #include "common/config-manager.h" 29 29 #include "common/file.h" 30 #include "common/timer.h"31 30 32 31 #include "memman.h" 33 32 #include "resman.h"