aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/events/psp2sdl/psp2sdl-events.cpp1
-rw-r--r--backends/events/sdl/sdl-events.cpp38
-rw-r--r--backends/events/sdl/sdl-events.h2
-rw-r--r--backends/events/symbiansdl/symbiansdl-events.cpp36
-rw-r--r--backends/events/symbiansdl/symbiansdl-events.h2
-rw-r--r--backends/platform/sdl/sdl.cpp4
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp7
-rw-r--r--backends/platform/symbian/src/SymbianOS.h1
8 files changed, 47 insertions, 44 deletions
diff --git a/backends/events/psp2sdl/psp2sdl-events.cpp b/backends/events/psp2sdl/psp2sdl-events.cpp
index e58e49d9a8..f5554599d6 100644
--- a/backends/events/psp2sdl/psp2sdl-events.cpp
+++ b/backends/events/psp2sdl/psp2sdl-events.cpp
@@ -37,7 +37,6 @@
#include "math.h"
#define JOY_DEADZONE 2000
-#define JOY_ANALOG
#define JOY_XAXIS 0
#define JOY_YAXIS 1
#define JOY_XAXISR 2
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 09530675c4..6d48b8d372 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -30,18 +30,10 @@
#include "common/config-manager.h"
#include "common/textconsole.h"
-#ifdef JOY_ANALOG
-#include "math.h"
-#endif
-
// FIXME move joystick defines out and replace with confile file options
// we should really allow users to map any key to a joystick button
#define JOY_DEADZONE 3200
-#ifndef __SYMBIAN32__ // Symbian wants dialog joystick i.e cursor for movement/selection
- #define JOY_ANALOG
-#endif
-
// #define JOY_INVERT_Y
#define JOY_XAXIS 0
#define JOY_YAXIS 1
@@ -1023,7 +1015,6 @@ bool SdlEventSource::handleAxisToMouseMotion(int16 xAxis, int16 yAxis) {
yAxis = -yAxis;
#endif
-#ifdef JOY_ANALOG
// conversion factor between keyboard mouse and joy axis value
int vel_to_axis = (1500 / MULTIPLIER);
@@ -1047,35 +1038,6 @@ bool SdlEventSource::handleAxisToMouseMotion(int16 xAxis, int16 yAxis) {
_km.x_vel = 0;
_km.y_vel = 0;
}
-#else
- if (xAxis > JOY_DEADZONE) {
- xAxis -= JOY_DEADZONE;
- } else if (xAxis < -JOY_DEADZONE) {
- xAxis += JOY_DEADZONE;
- } else
- xAxis = 0;
- if (yAxis > JOY_DEADZONE) {
- yAxis -= JOY_DEADZONE;
- } else if (yAxis < -JOY_DEADZONE) {
- yAxis += JOY_DEADZONE;
- } else
- yAxis = 0;
-
- if (xAxis != 0) {
- _km.x_vel = (xAxis > 0) ? 1 * MULTIPLIER:-1 * MULTIPLIER;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
- if (yAxis != 0) {
- _km.y_vel = (yAxis > 0) ? 1 * MULTIPLIER: -1 * MULTIPLIER;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-#endif
return false;
}
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index cea944fb1a..33d971a605 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -132,7 +132,7 @@ protected:
/**
* Update the virtual mouse according to a joystick or game controller axis position change
*/
- bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis);
+ virtual bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis);
/**
* Assigns the mouse coords to the mouse event. Furthermore notify the
diff --git a/backends/events/symbiansdl/symbiansdl-events.cpp b/backends/events/symbiansdl/symbiansdl-events.cpp
index 4649f9f90a..0ae5824681 100644
--- a/backends/events/symbiansdl/symbiansdl-events.cpp
+++ b/backends/events/symbiansdl/symbiansdl-events.cpp
@@ -31,6 +31,8 @@
#include <bautils.h>
+#define JOY_DEADZONE 3200
+
SymbianSdlEventSource::zoneDesc SymbianSdlEventSource::_zones[TOTAL_ZONES] = {
{ 0, 0, 320, 145 },
{ 0, 145, 150, 55 },
@@ -200,4 +202,38 @@ bool SymbianSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return false;
}
+bool SymbianSdlEventSource::handleAxisToMouseMotion(int16 xAxis, int16 yAxis) {
+ // Symbian wants dialog joystick i.e cursor for movement/selection
+
+ if (xAxis > JOY_DEADZONE) {
+ xAxis -= JOY_DEADZONE;
+ } else if (xAxis < -JOY_DEADZONE) {
+ xAxis += JOY_DEADZONE;
+ } else
+ xAxis = 0;
+ if (yAxis > JOY_DEADZONE) {
+ yAxis -= JOY_DEADZONE;
+ } else if (yAxis < -JOY_DEADZONE) {
+ yAxis += JOY_DEADZONE;
+ } else
+ yAxis = 0;
+
+ if (xAxis != 0) {
+ _km.x_vel = (xAxis > 0) ? 1 * MULTIPLIER:-1 * MULTIPLIER;
+ _km.x_down_count = 1;
+ } else {
+ _km.x_vel = 0;
+ _km.x_down_count = 0;
+ }
+ if (yAxis != 0) {
+ _km.y_vel = (yAxis > 0) ? 1 * MULTIPLIER: -1 * MULTIPLIER;
+ _km.y_down_count = 1;
+ } else {
+ _km.y_vel = 0;
+ _km.y_down_count = 0;
+ }
+
+ return false;
+}
+
#endif
diff --git a/backends/events/symbiansdl/symbiansdl-events.h b/backends/events/symbiansdl/symbiansdl-events.h
index 2664bc267d..0393e398f0 100644
--- a/backends/events/symbiansdl/symbiansdl-events.h
+++ b/backends/events/symbiansdl/symbiansdl-events.h
@@ -50,6 +50,8 @@ protected:
static zoneDesc _zones[TOTAL_ZONES];
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
+
+ virtual bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis);
};
#endif
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f6ab180897..68499b1ed8 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -180,9 +180,7 @@ bool OSystem_SDL::hasFeature(Feature f) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
if (f == kFeatureClipboardSupport) return true;
#endif
-#ifdef JOY_ANALOG
if (f == kFeatureJoystickDeadzone) return true;
-#endif
if (f == kFeatureKbdMouseSpeed) return true;
return ModularBackend::hasFeature(f);
}
@@ -293,12 +291,10 @@ void OSystem_SDL::initBackend() {
ConfMan.registerDefault("kbdmouse_speed", 3);
ConfMan.setInt("kbdmouse_speed", 3);
}
-#ifdef JOY_ANALOG
if (!ConfMan.hasKey("joystick_deadzone")) {
ConfMan.registerDefault("joystick_deadzone", 3);
ConfMan.setInt("joystick_deadzone", 3);
}
-#endif
ModularBackend::initBackend();
// We have to initialize the graphics manager before the event manager
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 4d417b5a66..87e1c09a63 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -173,6 +173,13 @@ Common::String OSystem_SDL_Symbian::getDefaultConfigFileName() {
return configFile;
}
+bool OSystem_SDL_Symbian::hasFeature(Feature f) {
+ if (f == kFeatureJoystickDeadzone) return false;
+
+ return OSystem_SDL::hasFeature(f);
+}
+
+
RFs& OSystem_SDL_Symbian::FsSession() {
return *_RFs;
}
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 617540941d..fea1ebc0b2 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -39,6 +39,7 @@ public:
virtual void engineDone();
virtual bool setGraphicsMode(const char *name);
virtual Common::String getDefaultConfigFileName();
+ virtual bool hasFeature(Feature f);
/**
* Returns reference to File session