diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/dc/dc.h | 4 | ||||
-rw-r--r-- | backends/dc/dcmain.cpp | 4 | ||||
-rw-r--r-- | backends/dc/input.cpp | 6 | ||||
-rw-r--r-- | backends/dc/time.cpp | 12 |
4 files changed, 22 insertions, 4 deletions
diff --git a/backends/dc/dc.h b/backends/dc/dc.h index c1f3aa09e4..8291bc7c34 100644 --- a/backends/dc/dc.h +++ b/backends/dc/dc.h @@ -104,6 +104,10 @@ class OSystem_Dreamcast : public OSystem { int _screen_buffer, _overlay_buffer, _mouse_buffer; float _overlay_fade; + uint32 _timer_duration, _timer_next_expiry; + bool _timer_active; + int (*_timer_callback) (int); + unsigned char *screen; unsigned short *mouse; unsigned short *overlay; diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp index d576701cbb..78768a79d2 100644 --- a/backends/dc/dcmain.cpp +++ b/backends/dc/dcmain.cpp @@ -122,10 +122,6 @@ void *OSystem_Dreamcast::create_thread(ThreadProc *proc, void *param) { warning("Creating a thread! (not supported.)\n"); } -void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int)) -{ - warning("Setting a timer! (not supported.)\n"); -} /* Mutex handling */ void *OSystem_Dreamcast::create_mutex(void) diff --git a/backends/dc/input.cpp b/backends/dc/input.cpp index c12731fe01..9505f22983 100644 --- a/backends/dc/input.cpp +++ b/backends/dc/input.cpp @@ -140,6 +140,12 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, bool OSystem_Dreamcast::poll_event(Event *event) { unsigned int t = Timer(); + + if(_timer_active && ((int)(t-_timer_next_expiry))>=0) { + _timer_duration = _timer_callback(_timer_duration); + _timer_next_expiry = t+USEC_TO_TIMER(1000*_timer_duration); + } + if(((int)(t-_devpoll))<0) return false; _devpoll += USEC_TO_TIMER(17000); diff --git a/backends/dc/time.cpp b/backends/dc/time.cpp index 9892e0c621..453b62fdc5 100644 --- a/backends/dc/time.cpp +++ b/backends/dc/time.cpp @@ -53,6 +53,18 @@ void OSystem_Dreamcast::delay_msecs(uint msecs) get_msecs(); } +void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int)) +{ + if (callback != NULL) { + _timer_duration = timer; + _timer_next_expiry = Timer() + USEC_TO_TIMER(1000*timer); + _timer_callback = callback; + _timer_active = true; + } else { + _timer_active = false; + } +} + /* void waitForTimer(Scumm *s, int time) |