[Scummvm-git-logs] scummvm master -> 52e7ba5e54380868d2b8d9f97151cd0625ee869e

bluegr bluegr at gmail.com
Mon Jul 8 00:25:00 CEST 2019


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
30109816fe SDL: Initial implementation of joystick events
cf107e7f90 PEGASUS: Implement joystick support
4cf9d1815c COMMON: Open the main menu when the joystick START button is pressed
52e7ba5e54 SDL: Support joystick hat input


Commit: 30109816fe3a0dae80795483ff28e9a50e6009a4
    https://github.com/scummvm/scummvm/commit/30109816fe3a0dae80795483ff28e9a50e6009a4
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-08T01:24:55+03:00

Commit Message:
SDL: Initial implementation of joystick events

Changed paths:
    backends/events/sdl/sdl-events.cpp
    backends/events/sdl/sdl-events.h
    common/events.h
    engines/engine.h


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 29be7d4..494e1bf 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -30,6 +30,8 @@
 #include "common/config-manager.h"
 #include "common/textconsole.h"
 #include "common/fs.h"
+#include "engines/engine.h"
+#include "gui/gui-manager.h"
 
 // FIXME move joystick defines out and replace with confile file options
 // we should really allow users to map any key to a joystick button
@@ -902,7 +904,45 @@ void SdlEventSource::closeJoystick() {
 	}
 }
 
+bool SdlEventSource::shouldGenerateMouseEvents() {
+	// Engine doesn't support joystick -> emulate mouse events
+	if (g_engine && !g_engine->hasFeature(Engine::kSupportsJoystick)) {
+		return true;
+	}
+	if (g_gui.isActive()) {
+		return true;
+	}
+	return false;
+}
+
+int SdlEventSource::mapSDLJoystickButtonToOSystem(Uint8 sdlButton) {
+	Common::JoystickButton osystemButtons[] = {
+	    Common::JOYSTICK_BUTTON_A,
+	    Common::JOYSTICK_BUTTON_B,
+	    Common::JOYSTICK_BUTTON_X,
+	    Common::JOYSTICK_BUTTON_Y,
+	    Common::JOYSTICK_BUTTON_LEFT_SHOULDER,
+	    Common::JOYSTICK_BUTTON_RIGHT_SHOULDER,
+	    Common::JOYSTICK_BUTTON_BACK,
+	    Common::JOYSTICK_BUTTON_START,
+	    Common::JOYSTICK_BUTTON_LEFT_STICK,
+	    Common::JOYSTICK_BUTTON_RIGHT_STICK
+	};
+
+	if (sdlButton >= ARRAYSIZE(osystemButtons)) {
+		return -1;
+	}
+
+	return osystemButtons[sdlButton];
+}
+
 bool SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
+	if (!shouldGenerateMouseEvents()) {
+		event.type = Common::EVENT_JOYBUTTON_DOWN;
+		event.joystick.button = mapSDLJoystickButtonToOSystem(ev.jbutton.button);
+		return true;
+	}
+
 	if (ev.jbutton.button == JOY_BUT_LMOUSE) {
 		event.type = Common::EVENT_LBUTTONDOWN;
 		return processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
@@ -939,6 +979,12 @@ bool SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
 }
 
 bool SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
+	if (!shouldGenerateMouseEvents()) {
+		event.type = Common::EVENT_JOYBUTTON_UP;
+		event.joystick.button = mapSDLJoystickButtonToOSystem(ev.jbutton.button);
+		return true;
+	}
+
 	if (ev.jbutton.button == JOY_BUT_LMOUSE) {
 		event.type = Common::EVENT_LBUTTONUP;
 		return processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
@@ -975,6 +1021,16 @@ bool SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
 }
 
 bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
+	// TODO: move handleAxisToMouseMotion to Common?
+#if 0
+	if (!shouldGenerateMouseEvents()) {
+		event.type = Common::EVENT_JOYAXIS_MOTION;
+		event.joystick.axis = ev.jaxis.axis;
+		event.joystick.position = ev.jaxis.value;
+		return true;
+	}
+#endif
+
 	if (ev.jaxis.axis == JOY_XAXIS) {
 		_km.joy_x = ev.jaxis.value;
 		return handleAxisToMouseMotion(_km.joy_x, _km.joy_y);
@@ -1024,6 +1080,32 @@ bool SdlEventSource::handleJoystickRemoved(const SDL_JoyDeviceEvent &device) {
 	return false;
 }
 
+int SdlEventSource::mapSDLControllerButtonToOSystem(Uint8 sdlButton) {
+	Common::JoystickButton osystemButtons[] = {
+	    Common::JOYSTICK_BUTTON_A,
+	    Common::JOYSTICK_BUTTON_B,
+	    Common::JOYSTICK_BUTTON_X,
+	    Common::JOYSTICK_BUTTON_Y,
+	    Common::JOYSTICK_BUTTON_BACK,
+	    Common::JOYSTICK_BUTTON_GUIDE,
+	    Common::JOYSTICK_BUTTON_START,
+	    Common::JOYSTICK_BUTTON_LEFT_STICK,
+	    Common::JOYSTICK_BUTTON_RIGHT_STICK,
+	    Common::JOYSTICK_BUTTON_LEFT_SHOULDER,
+	    Common::JOYSTICK_BUTTON_RIGHT_SHOULDER,
+	    Common::JOYSTICK_BUTTON_DPAD_UP,
+	    Common::JOYSTICK_BUTTON_DPAD_DOWN,
+	    Common::JOYSTICK_BUTTON_DPAD_LEFT,
+	    Common::JOYSTICK_BUTTON_DPAD_RIGHT
+	};
+
+	if (sdlButton >= ARRAYSIZE(osystemButtons)) {
+		return -1;
+	}
+
+	return osystemButtons[sdlButton];
+}
+
 bool SdlEventSource::handleControllerButton(const SDL_Event &ev, Common::Event &event, bool buttonUp) {
 	using namespace Common;
 
@@ -1071,6 +1153,15 @@ bool SdlEventSource::handleControllerButton(const SDL_Event &ev, Common::Event &
 			{ EVENT_KEYDOWN, KeyState(KEYCODE_KP6, 0), EVENT_KEYDOWN, KeyState(KEYCODE_KP3, 0) }
 	};
 
+	if (!shouldGenerateMouseEvents()) {
+		event.type = buttonUp ? Common::EVENT_JOYBUTTON_UP : Common::EVENT_JOYBUTTON_DOWN;
+		event.joystick.button = mapSDLControllerButtonToOSystem(ev.cbutton.button);
+		if (event.joystick.button == -1)
+				return false;
+
+		return true;
+	}
+
 	if (ev.cbutton.button > SDL_CONTROLLER_BUTTON_DPAD_RIGHT) {
 		warning("Unknown SDL controller button: '%d'", ev.cbutton.button);
 		return false;
@@ -1115,6 +1206,16 @@ bool SdlEventSource::handleControllerButton(const SDL_Event &ev, Common::Event &
 }
 
 bool SdlEventSource::handleControllerAxisMotion(const SDL_Event &ev, Common::Event &event) {
+	// TODO: move handleAxisToMouseMotion to Common?
+#if 0
+	if (!shouldGenerateMouseEvents()) {
+		event.type = Common::EVENT_JOYAXIS_MOTION;
+		event.joystick.axis = ev.caxis.axis;
+		event.joystick.position = ev.caxis.value;
+		return true;
+	}
+#endif
+
 	if (ev.caxis.axis == SDL_CONTROLLER_AXIS_LEFTX) {
 		_km.joy_x = ev.caxis.value;
 		return handleAxisToMouseMotion(_km.joy_x, _km.joy_y);
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index c2ae002..6050c80 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -139,6 +139,7 @@ protected:
 	virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
 	virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
 	virtual bool handleSysWMEvent(SDL_Event &ev, Common::Event &event);
+	virtual int mapSDLJoystickButtonToOSystem(Uint8 sdlButton);
 	virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
 	virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
 	virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
@@ -148,10 +149,13 @@ protected:
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	virtual bool handleJoystickAdded(const SDL_JoyDeviceEvent &event);
 	virtual bool handleJoystickRemoved(const SDL_JoyDeviceEvent &device);
+	virtual int mapSDLControllerButtonToOSystem(Uint8 sdlButton);
 	virtual bool handleControllerButton(const SDL_Event &ev, Common::Event &event, bool buttonUp);
 	virtual bool handleControllerAxisMotion(const SDL_Event &ev, Common::Event &event);
 #endif
 
+	bool shouldGenerateMouseEvents();
+
 	//@}
 
 	/**
diff --git a/common/events.h b/common/events.h
index 4b35725..ff5d287 100644
--- a/common/events.h
+++ b/common/events.h
@@ -86,7 +86,52 @@ enum EventType {
 	EVENT_VIRTUAL_KEYBOARD = 20,
 #endif
 
-	EVENT_DROP_FILE = 23
+	EVENT_DROP_FILE = 23,
+
+	EVENT_JOYAXIS_MOTION = 24,
+	EVENT_JOYBUTTON_DOWN = 25,
+	EVENT_JOYBUTTON_UP = 26
+};
+
+const int16 JOYAXIS_MIN = -32768;
+const int16 JOYAXIS_MAX = 32767;
+
+/**
+ * Data structure for joystick events
+ */
+struct JoystickState {
+	/** The axis for EVENT_JOYAXIS_MOTION events */
+	byte axis;
+	/** The new axis position for EVENT_JOYAXIS_MOTION events */
+	int16 position;
+	/**
+	 * The button index for EVENT_JOYBUTTON_DOWN/UP events
+	 *
+	 * Some of the button indices match well-known game controller
+	 * buttons. See JoystickButton.
+	 */
+	byte button;
+};
+
+/**
+ *  The list named buttons available from a joystick
+ */
+enum JoystickButton {
+	JOYSTICK_BUTTON_A,
+	JOYSTICK_BUTTON_B,
+	JOYSTICK_BUTTON_X,
+	JOYSTICK_BUTTON_Y,
+	JOYSTICK_BUTTON_BACK,
+	JOYSTICK_BUTTON_GUIDE,
+	JOYSTICK_BUTTON_START,
+	JOYSTICK_BUTTON_LEFT_STICK,
+	JOYSTICK_BUTTON_RIGHT_STICK,
+	JOYSTICK_BUTTON_LEFT_SHOULDER,
+	JOYSTICK_BUTTON_RIGHT_SHOULDER,
+	JOYSTICK_BUTTON_DPAD_UP,
+	JOYSTICK_BUTTON_DPAD_DOWN,
+	JOYSTICK_BUTTON_DPAD_LEFT,
+	JOYSTICK_BUTTON_DPAD_RIGHT
 };
 
 typedef uint32 CustomEventType;
@@ -130,6 +175,12 @@ struct Event {
 	/* The path of the file or directory dragged to the ScummVM window */
 	Common::String path;
 
+	/**
+	 * Joystick data; only valid for joystick events (EVENT_JOYAXIS_MOTION,
+	 * EVENT_JOYBUTTON_DOWN and EVENT_JOYBUTTON_UP).
+	 */
+	JoystickState joystick;
+
 	Event() : type(EVENT_INVALID), kbdRepeat(false) {
 #ifdef ENABLE_KEYMAPPER
 		customType = 0;
diff --git a/engines/engine.h b/engines/engine.h
index d004c29..cc7994e 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -132,7 +132,15 @@ public:
 		 * If this feature is supported, then the corresponding MetaEngine *must*
 		 * support the kSupportsListSaves feature.
 		 */
-		kSupportsSavingDuringRuntime
+		kSupportsSavingDuringRuntime,
+
+		/**
+		 * Engine must receive joystick events because the game uses them.
+		 * For engines which have not this feature, joystick events are converted
+		 * to mouse events.
+		 */
+		kSupportsJoystick
+
 	};
 
 


Commit: cf107e7f905c55d7c4b2383cd86eb23e2d8dcc88
    https://github.com/scummvm/scummvm/commit/cf107e7f905c55d7c4b2383cd86eb23e2d8dcc88
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-08T01:24:55+03:00

Commit Message:
PEGASUS: Implement joystick support

Changed paths:
    engines/pegasus/detection.cpp
    engines/pegasus/input.cpp
    engines/pegasus/input.h
    engines/pegasus/pegasus.cpp


diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp
index 01a3113..74867c1 100644
--- a/engines/pegasus/detection.cpp
+++ b/engines/pegasus/detection.cpp
@@ -43,7 +43,8 @@ bool PegasusEngine::hasFeature(EngineFeature f) const {
 	return
 		(f == kSupportsRTL)
 		|| (f == kSupportsLoadingDuringRuntime)
-		|| (f == kSupportsSavingDuringRuntime);
+		|| (f == kSupportsSavingDuringRuntime)
+		|| (f == kSupportsJoystick);
 }
 
 bool PegasusEngine::isDemo() const {
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index 36a84db..50267ae 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -175,6 +175,35 @@ void InputDeviceManager::waitInput(const InputBits filter) {
 	}
 }
 
+uint InputDeviceManager::convertJoystickToKey(uint joybutton) {
+	switch (joybutton) {
+	case Common::JOYSTICK_BUTTON_A:
+		return Common::KEYCODE_RETURN; // Action
+	case Common::JOYSTICK_BUTTON_B:
+		// nothing
+		break;
+	case Common::JOYSTICK_BUTTON_X:
+		return Common::KEYCODE_i; // Display Object Info
+	case Common::JOYSTICK_BUTTON_Y:
+		return Common::KEYCODE_t; // Toggle Data Display
+	case Common::JOYSTICK_BUTTON_LEFT_SHOULDER:
+		return Common::KEYCODE_TILDE; // Open Inventory Panel
+	case Common::JOYSTICK_BUTTON_RIGHT_SHOULDER:
+		return Common::KEYCODE_KP_MULTIPLY; // Open Biochip Panel
+	case Common::JOYSTICK_BUTTON_START:
+		return Common::KEYCODE_p; // Pause
+	case Common::JOYSTICK_BUTTON_DPAD_UP:
+		return Common::KEYCODE_UP;
+	case Common::JOYSTICK_BUTTON_DPAD_DOWN:
+		return Common::KEYCODE_DOWN;
+	case Common::JOYSTICK_BUTTON_DPAD_LEFT:
+		return Common::KEYCODE_LEFT;
+	case Common::JOYSTICK_BUTTON_DPAD_RIGHT:
+		return Common::KEYCODE_RIGHT;
+	}
+	return 0;
+}
+
 bool InputDeviceManager::notifyEvent(const Common::Event &event) {
 	if (GUI::GuiManager::instance().isActive()) {
 		// For some reason, the engine hooks in the event system using an EventObserver.
@@ -215,6 +244,16 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
 		if (_keyMap.contains(event.kbd.keycode))
 			_keyMap[event.kbd.keycode] = false;
 		break;
+	case Common::EVENT_JOYAXIS_MOTION:
+		break;
+	case Common::EVENT_JOYBUTTON_DOWN:
+		if (_keyMap.contains(convertJoystickToKey(event.joystick.button)))
+			_keyMap[convertJoystickToKey(event.joystick.button)] = true;
+		break;
+	case Common::EVENT_JOYBUTTON_UP:
+		if (_keyMap.contains(convertJoystickToKey(event.joystick.button)))
+			_keyMap[convertJoystickToKey(event.joystick.button)] = false;
+		break;
 	default:
 		break;
 	}
diff --git a/engines/pegasus/input.h b/engines/pegasus/input.h
index 4259076..3b06b15 100644
--- a/engines/pegasus/input.h
+++ b/engines/pegasus/input.h
@@ -52,6 +52,8 @@ public:
 
 	void pumpEvents();
 
+	uint convertJoystickToKey(uint joybutton);
+
 protected:
 	friend class Common::Singleton<SingletonBaseType>;
 
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index f2c0afb..043fddc 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -1279,6 +1279,7 @@ void PegasusEngine::showTempScreen(const Common::String &fileName) {
 			case Common::EVENT_LBUTTONUP:
 			case Common::EVENT_RBUTTONUP:
 			case Common::EVENT_KEYDOWN:
+			case Common::EVENT_JOYBUTTON_DOWN:
 				done = true;
 				break;
 			default:


Commit: 4cf9d1815c7980313e00ce1a0b71b19d9fa62327
    https://github.com/scummvm/scummvm/commit/4cf9d1815c7980313e00ce1a0b71b19d9fa62327
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-08T01:24:55+03:00

Commit Message:
COMMON: Open the main menu when the joystick START button is pressed

Changed paths:
    common/EventMapper.cpp
    engines/pegasus/input.cpp


diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp
index f84d24b..203a6e0 100644
--- a/common/EventMapper.cpp
+++ b/common/EventMapper.cpp
@@ -73,6 +73,12 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
 #endif
 	}
 
+	if (ev.type == EVENT_JOYBUTTON_DOWN) {
+		if (ev.joystick.button == JOYSTICK_BUTTON_START || ev.joystick.button == JOYSTICK_BUTTON_GUIDE) {
+			mappedEvent.type = EVENT_MAINMENU;
+		}
+	}
+
 	// if it didn't get mapped, just pass it through
 	if (mappedEvent.type == EVENT_INVALID)
 		mappedEvent = ev;
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index 50267ae..6738ad4 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -190,7 +190,7 @@ uint InputDeviceManager::convertJoystickToKey(uint joybutton) {
 		return Common::KEYCODE_TILDE; // Open Inventory Panel
 	case Common::JOYSTICK_BUTTON_RIGHT_SHOULDER:
 		return Common::KEYCODE_KP_MULTIPLY; // Open Biochip Panel
-	case Common::JOYSTICK_BUTTON_START:
+	case Common::JOYSTICK_BUTTON_BACK:
 		return Common::KEYCODE_p; // Pause
 	case Common::JOYSTICK_BUTTON_DPAD_UP:
 		return Common::KEYCODE_UP;


Commit: 52e7ba5e54380868d2b8d9f97151cd0625ee869e
    https://github.com/scummvm/scummvm/commit/52e7ba5e54380868d2b8d9f97151cd0625ee869e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-08T01:24:55+03:00

Commit Message:
SDL: Support joystick hat input

Changed paths:
    backends/events/sdl/sdl-events.cpp
    backends/events/sdl/sdl-events.h


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 494e1bf..c3c316e 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -101,7 +101,7 @@ void SdlEventSource::loadGameControllerMappingFile() {
 #endif
 
 SdlEventSource::SdlEventSource()
-    : EventSource(), _scrollLock(false), _joystick(0), _lastScreenID(0), _graphicsManager(0), _queuedFakeMouseMove(false)
+    : EventSource(), _scrollLock(false), _joystick(0), _lastScreenID(0), _graphicsManager(0), _queuedFakeMouseMove(false), _lastHatPosition(SDL_HAT_CENTERED)
 #if SDL_VERSION_ATLEAST(2, 0, 0)
       , _queuedFakeKeyUp(false), _fakeKeyUp(), _controller(nullptr)
 #endif
@@ -674,6 +674,8 @@ bool SdlEventSource::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) {
 			return handleJoyButtonUp(ev, event);
 		case SDL_JOYAXISMOTION:
 			return handleJoyAxisMotion(ev, event);
+		case SDL_JOYHATMOTION:
+			return handleJoyHatMotion(ev, event);
 		}
 	}
 
@@ -1042,6 +1044,39 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
 	return false;
 }
 
+#define HANDLE_HAT_UP(new, old, mask, joybutton) \
+	if ((old & mask) && !(new & mask)) { \
+		event.joystick.button = joybutton; \
+		g_system->getEventManager()->pushEvent(event); \
+	}
+
+#define HANDLE_HAT_DOWN(new, old, mask, joybutton) \
+	if ((new & mask) && !(old & mask)) { \
+		event.joystick.button = joybutton; \
+		g_system->getEventManager()->pushEvent(event); \
+	}
+
+bool SdlEventSource::handleJoyHatMotion(SDL_Event &ev, Common::Event &event) {
+	if (shouldGenerateMouseEvents())
+		return false;
+
+	event.type = Common::EVENT_JOYBUTTON_UP;
+	HANDLE_HAT_UP(ev.jhat.value, _lastHatPosition, SDL_HAT_UP, Common::JOYSTICK_BUTTON_DPAD_UP)
+	HANDLE_HAT_UP(ev.jhat.value, _lastHatPosition, SDL_HAT_DOWN, Common::JOYSTICK_BUTTON_DPAD_DOWN)
+	HANDLE_HAT_UP(ev.jhat.value, _lastHatPosition, SDL_HAT_LEFT, Common::JOYSTICK_BUTTON_DPAD_LEFT)
+	HANDLE_HAT_UP(ev.jhat.value, _lastHatPosition, SDL_HAT_RIGHT, Common::JOYSTICK_BUTTON_DPAD_RIGHT)
+
+	event.type = Common::EVENT_JOYBUTTON_DOWN;
+	HANDLE_HAT_DOWN(ev.jhat.value, _lastHatPosition, SDL_HAT_UP, Common::JOYSTICK_BUTTON_DPAD_UP)
+	HANDLE_HAT_DOWN(ev.jhat.value, _lastHatPosition, SDL_HAT_DOWN, Common::JOYSTICK_BUTTON_DPAD_DOWN)
+	HANDLE_HAT_DOWN(ev.jhat.value, _lastHatPosition, SDL_HAT_LEFT, Common::JOYSTICK_BUTTON_DPAD_LEFT)
+	HANDLE_HAT_DOWN(ev.jhat.value, _lastHatPosition, SDL_HAT_RIGHT, Common::JOYSTICK_BUTTON_DPAD_RIGHT)
+
+	_lastHatPosition = ev.jhat.value;
+
+	return false;
+}
+
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 bool SdlEventSource::handleJoystickAdded(const SDL_JoyDeviceEvent &device) {
 	debug(5, "SdlEventSource: Received joystick added event for index '%d'", device.which);
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index 6050c80..bf17cc9 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -143,6 +143,7 @@ protected:
 	virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
 	virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
 	virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
+	virtual bool handleJoyHatMotion(SDL_Event &ev, Common::Event &event);
 	virtual void updateKbdMouse();
 	virtual bool handleKbdMouse(Common::Event &event);
 
@@ -224,6 +225,8 @@ protected:
 	 */
 	Common::Event _fakeMouseMove;
 
+	uint8 _lastHatPosition;
+
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	/**
 	 * Whether _fakeKeyUp contains an event we need to send.





More information about the Scummvm-git-logs mailing list