aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostas Nakos2007-01-11 21:53:30 +0000
committerKostas Nakos2007-01-11 21:53:30 +0000
commit9b3025deee353f33252780aa28f2ee2e0861c73b (patch)
tree30d8f764c2ee9a474458e35f19b93b779615101b
parent1638cf2f0ba3a99542ef52feb43a85ee50f0cee4 (diff)
downloadscummvm-rg350-9b3025deee353f33252780aa28f2ee2e0861c73b.tar.gz
scummvm-rg350-9b3025deee353f33252780aa28f2ee2e0861c73b.tar.bz2
scummvm-rg350-9b3025deee353f33252780aa28f2ee2e0861c73b.zip
Fix backend timer problems. Also fix wrong sound mix rate in bass
svn-id: r25067
-rw-r--r--backends/platform/wince/wince-sdl.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index b2ee8e4adf..88cc25f36b 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -31,6 +31,7 @@
#include "sound/mixer.h"
#include "common/config-manager.h"
+#include "backends/timer/default/default-timer.h"
#include "scumm/scumm.h"
@@ -238,6 +239,11 @@ void drawError(char *error) {
}
// ********************************************************************************************
+static DefaultTimerManager *_int_timer = NULL;
+static Uint32 timer_handler_wrapper(Uint32 interval) {
+ _int_timer->handler();
+ return interval;
+}
void OSystem_WINCE3::initBackend()
{
@@ -254,6 +260,13 @@ void OSystem_WINCE3::initBackend()
_mixer = new Audio::Mixer();
}
+ // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
+ // We work around this by using the SetTimer function, since we only use
+ // one timer in scummvm (for the time being)
+ _timer = _int_timer = new DefaultTimerManager();
+ _timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
+ SDL_SetTimer(10, &timer_handler_wrapper);
+
// Chain init
OSystem_SDL::initBackend();
}
@@ -670,8 +683,7 @@ void OSystem_WINCE3::get_sample_rate() {
}
}
// See if the output frequency is forced by the game
- if (gameid == "ft" || gameid == "dig" || gameid == "comi" || gameid == "queen" ||
- strncmp(gameid.c_str(), "sword", 5) == 0 || strncmp(gameid.c_str(), "sky", 3) == 0)
+ if (gameid == "ft" || gameid == "dig" || gameid == "comi" || gameid == "queen" || gameid == "sword")
_sampleRate = SAMPLES_PER_SEC_NEW;
else {
if (ConfMan.hasKey("high_sample_rate") && ConfMan.getBool("high_sample_rate"))
@@ -2071,20 +2083,17 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
CEDevice::wakeUp();
- //if (_isSmartphone)
- currentTime = GetTickCount();
+ currentTime = GetTickCount();
while(SDL_PollEvent(&ev)) {
switch(ev.type) {
case SDL_KEYDOWN:
// KMOD_RESERVED is used if the key has been injected by an external buffer
if (ev.key.keysym.mod != KMOD_RESERVED) {
- //if (_isSmartphone) {
- keyEvent = true;
- _lastKeyPressed = ev.key.keysym.sym;
- _keyRepeatTime = currentTime;
- _keyRepeat = 0;
- //}
+ keyEvent = true;
+ _lastKeyPressed = ev.key.keysym.sym;
+ _keyRepeatTime = currentTime;
+ _keyRepeat = 0;
if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, true))
return true;
@@ -2102,10 +2111,8 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
case SDL_KEYUP:
// KMOD_RESERVED is used if the key has been injected by an external buffer
if (ev.key.keysym.mod != KMOD_RESERVED) {
- //if (_isSmartphone) {
- keyEvent = true;
- _lastKeyPressed = 0;
- //}
+ keyEvent = true;
+ _lastKeyPressed = 0;
if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, false))
return true;
@@ -2175,8 +2182,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
setGraphicsMode(GFX_NORMAL);
hotswapGFXMode();
}
- }
- else {
+ } else {
if (!_freeLook)
memcpy(&event, &temp_event, sizeof(Event));
}
@@ -2220,17 +2226,13 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
// Simulate repeated key for Smartphones
- if (!keyEvent) {
- //if (_isSmartphone) {
- if (_lastKeyPressed) {
- if (currentTime > _keyRepeatTime + _keyRepeatTrigger) {
- _keyRepeatTime = currentTime;
- _keyRepeat++;
- GUI_Actions::Instance()->performMapped(_lastKeyPressed, true);
- }
+ if (!keyEvent)
+ if (_lastKeyPressed)
+ if (currentTime > _keyRepeatTime + _keyRepeatTrigger) {
+ _keyRepeatTime = currentTime;
+ _keyRepeat++;
+ GUI_Actions::Instance()->performMapped(_lastKeyPressed, true);
}
- //}
- }
return false;
}