Ticket #8349: timer_v7.patch
File timer_v7.patch, 28.0 KB (added by , 20 years ago) |
---|
-
backends/midi/adlib.cpp
diff -u -d -r scummvm_official/backends/midi/adlib.cpp scummvm/backends/midi/adlib.cpp
old new 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
diff -u -d -r scummvm_official/backends/midi/ym2612.cpp scummvm/backends/midi/ym2612.cpp
old new 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
diff -u -d -r scummvm_official/backends/sdl/sdl-common.h scummvm/backends/sdl/sdl-common.h
old new 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(); … … 101 106 void quit(); 102 107 103 108 109 #ifdef OLD_TIMER 104 110 // Add a callback timer 105 void setTimerCallback(TimerProc callback, int timer); 106 111 void setTimerCallback(TimerCallback callback, int timer); 112 #else 113 // Install/Remove callback timer 114 bool installTimerProc(TimerProc procedure, int32 interval, void *refCon); 115 void removeTimerProc(TimerProc procedure); 116 #endif 107 117 // Mutex handling 108 118 MutexRef createMutex(); 109 119 void lockMutex(MutexRef mutex); … … 206 216 bool cksum_valid; 207 217 int CKSUM_NUM; 208 218 219 #ifndef OLD_TIMER 220 // Timer Management 221 #define SDL_MAX_TIMERS 5 222 #define THREAD_RUN 0 223 #define THREAD_REMOVE 1 224 225 class TimerSlot { 226 friend class OSystem_SDL; 227 private: 228 TimerProc _threadFunc; 229 SDL_Thread *_threadHandle; 230 int _threadState; 231 double _interval; 232 void *_refCon; 233 double _startTime; 234 double _lastTime; 235 236 bool wait(); 237 void thread(); 238 public: 239 static int threadHandler(void *slotRef); 240 } _timerSlots[SDL_MAX_TIMERS]; 241 242 MutexRef _timerMutex; 243 244 bool createTimer(); 245 void deleteTimer(); 246 void resetTimerSlot(int slot); 247 #endif 248 209 249 // Keyboard mouse emulation 210 250 struct KbdMouse { 211 251 int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count; -
backends/sdl/sdl.cpp
diff -u -d -r scummvm_official/backends/sdl/sdl.cpp scummvm/backends/sdl/sdl.cpp
old new 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
diff -u -d -r scummvm_official/backends/wince/wince-sdl.cpp scummvm/backends/wince/wince-sdl.cpp
old new 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
diff -u -d -r scummvm_official/base/engine.cpp scummvm/base/engine.cpp
old new 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
diff -u -d -r scummvm_official/base/engine.h scummvm/base/engine.h
old new 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
diff -u -d -r scummvm_official/base/main.cpp scummvm/base/main.cpp
old new 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
diff -u -d -r scummvm_official/common/module.mk scummvm/common/module.mk
old new 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
diff -u -d -r scummvm_official/common/system.cpp scummvm/common/system.cpp
old new 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
diff -u -d -r scummvm_official/common/system.h scummvm/common/system.h
old new 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! */ … … 354 358 /** @name Events and Time */ 355 359 //@{ 356 360 357 typedef int (*TimerProc)(int interval);358 359 361 /** 360 362 * The types of events backends may generate. 361 363 * @see Event … … 441 443 /** Delay/sleep for the specified amount of milliseconds. */ 442 444 virtual void delay_msecs(uint msecs) = 0; 443 445 446 typedef void (*TimerProc)(void *refCon); 444 447 /** 445 * Set the timer callback, a function which is periodically invoked by the 446 * backend. This can for example be done via a background thread. 447 * There is at most one active timer; if this method is called while there 448 * is already an active timer, then the new timer callback should replace 449 * the previous one. In particular, passing a callback pointer value of 0 450 * is legal and can be used to clear the current timer callback. 451 * @see Common::Timer 452 * @note The implementation of this method must be 'atomic' in the sense 453 * that when the method returns, the previously set callback must 454 * not be in use anymore (in particular, if timers are implemented 455 * via threads, then it must be ensured that the timer thread is 456 * not using the old callback function anymore). 448 * Install a new timer callback. It will from now be called every interval microseconds. 449 * The timer may be invoked from a separate thread. Hence any timer code should be 450 * written following the same safety guidelines as any other threaded code. 457 451 * 458 * @param callback pointer to the callback. May be 0 to reset the timer 459 * @param interval the interval (in milliseconds) between invocations 460 * of the callback 452 * @note Although the interval is specified in microseconds, the actual timer resolution 453 * may be lower. In particular, with the SDL backend the timer resolution is 10ms. 454 * @param proc the callback 455 * @param interval the interval in which the timer shall be invoked (in microseconds) 456 * @param refCon an arbitrary void pointer; will be passed to the timer callback 457 * @return true if the timer was installed successfully, false otherwise 461 458 */ 462 virtual void setTimerCallback(TimerProc callback, int interval) = 0; 459 virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon) = 0; 460 461 /** 462 * Remove the given timer callback. It will not be invoked anymore. 463 */ 464 virtual void removeTimerProc(TimerProc proc) = 0; 463 465 464 466 //@} 465 467 … … 614 616 //@} 615 617 }; 616 618 619 620 /** 621 * This class provides a default implementation of the new OSystem timer API 622 * by emulating it using the old timer API. This makes it easy to get old 623 * backends to work with the new code, and also makes it easier to write new 624 * backends from scratch. 625 */ 626 class OSystemWithDefaultTimerCode : public OSystem { 627 public: 628 OSystemWithDefaultTimerCode(); 629 630 bool installTimerProc(TimerProc proc, int32 interval, void *refCon); 631 void removeTimerProc(TimerProc proc); 632 633 typedef int (*TimerCallback)(int interval); 634 635 /** 636 * Set the timer callback, a function which is periodically invoked by the 637 * backend. This can for example be done via a background thread. 638 * There is at most one active timer; if this method is called while there 639 * is already an active timer, then the new timer callback should replace 640 * the previous one. In particular, passing a callback pointer value of 0 641 * is legal and can be used to clear the current timer callback. 642 * @see Common::Timer 643 * @note The implementation of this method must be 'atomic' in the sense 644 * that when the method returns, the previously set callback must 645 * not be in use anymore (in particular, if timers are implemented 646 * via threads, then it must be ensured that the timer thread is 647 * not using the old callback function anymore). 648 * 649 * @param callback pointer to the callback. May be 0 to reset the timer 650 * @param interval the interval (in milliseconds) between invocations 651 * of the callback 652 */ 653 virtual void setTimerCallback(TimerCallback callback, int interval) = 0; 654 655 protected: 656 void init(); 657 658 // TODO: The deinit() methods currently is never called. However, that 659 // should hopefully never be a problem, since the quit() method of classes 660 // derived from this class should remove any timer callbacks anyway... 661 void deinit(); 662 663 private: 664 #define MAX_TIMERS 2 665 666 MutexRef _timerMutex; 667 void *_timerCallback; 668 int32 _timerThisTime; 669 int32 _timerLastTime; 670 671 struct TimerSlots { 672 TimerProc procedure; 673 int32 interval; 674 int32 counter; 675 void *refCon; 676 } _timerSlots[MAX_TIMERS]; 677 678 static int timerCallback(int t); 679 int timerMain(int t); 680 }; 681 617 682 /** The global OSystem instance. Inited in main(). */ 618 683 #define g_system (OSystem::instance()) 619 684 -
queen/queen.cpp
diff -u -d -r scummvm_official/queen/queen.cpp scummvm/queen/queen.cpp
old new 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
diff -u -d -r scummvm_official/saga/render.cpp scummvm/saga/render.cpp
old new 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/imuse_digi/dimuse.cpp
diff -u -d -r scummvm_official/scumm/imuse_digi/dimuse.cpp scummvm/scumm/imuse_digi/dimuse.cpp
old new 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
diff -u -d -r scummvm_official/scumm/imuse_digi/dimuse_script.cpp scummvm/scumm/imuse_digi/dimuse_script.cpp
old new 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
diff -u -d -r scummvm_official/scumm/imuse_digi/dimuse_track.cpp scummvm/scumm/imuse_digi/dimuse_track.cpp
old new 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/midiparser_ro.cpp
diff -u -d -r scummvm_official/scumm/midiparser_ro.cpp scummvm/scumm/midiparser_ro.cpp
old new 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/smush/smush_player.cpp
diff -u -d -r scummvm_official/scumm/smush/smush_player.cpp scummvm/scumm/smush/smush_player.cpp
old new 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 -
scumm/sound.cpp
diff -u -d -r scummvm_official/scumm/sound.cpp scummvm/scumm/sound.cpp
old new 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) { -
sky/sky.cpp
diff -u -d -r scummvm_official/sky/sky.cpp scummvm/sky/sky.cpp
old new 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
diff -u -d -r scummvm_official/sound/mididrv.h scummvm/sound/mididrv.h
old new 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
diff -u -d -r scummvm_official/sound/mpu401.cpp scummvm/sound/mpu401.cpp
old new 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
diff -u -d -r scummvm_official/sound/mpu401.h scummvm/sound/mpu401.h
old new 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
diff -u -d -r scummvm_official/sword1/sword1.cpp scummvm/sword1/sword1.cpp
old new 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"