aboutsummaryrefslogtreecommitdiff
path: root/backends/events
diff options
context:
space:
mode:
authorBastien Bouclet2017-12-27 07:27:12 +0100
committerBastien Bouclet2017-12-27 07:30:53 +0100
commit1fa80ea3a35a4086c627228b834c0e17c4aa3cc1 (patch)
treef2c9ce3d1d987f6c563c2c9255c02160a0db512b /backends/events
parent66e531c92bca67f5330a454b8859f4bf1d6cb5b2 (diff)
downloadscummvm-rg350-1fa80ea3a35a4086c627228b834c0e17c4aa3cc1.tar.gz
scummvm-rg350-1fa80ea3a35a4086c627228b834c0e17c4aa3cc1.tar.bz2
scummvm-rg350-1fa80ea3a35a4086c627228b834c0e17c4aa3cc1.zip
SDL: Add debug traces for joystick hotplug
Diffstat (limited to 'backends/events')
-rw-r--r--backends/events/sdl/sdl-events.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 8a59aeb1a8..258f51a310 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -924,8 +924,12 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
#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);
+
int joystick_num = ConfMan.getInt("joystick_num");
if (joystick_num == device.which) {
+ debug(5, "SdlEventSource: Newly added joystick with index '%d' matches 'joysticky_num', trying to use it", device.which);
+
closeJoystick();
openJoystick(joystick_num);
}
@@ -934,6 +938,8 @@ bool SdlEventSource::handleJoystickAdded(const SDL_JoyDeviceEvent &device) {
}
bool SdlEventSource::handleJoystickRemoved(const SDL_JoyDeviceEvent &device) {
+ debug(5, "SdlEventSource: Received joystick removed event for instance id '%d'", device.which);
+
SDL_Joystick *joystick;
if (_controller) {
joystick = SDL_GameControllerGetJoystick(_controller);
@@ -946,6 +952,8 @@ bool SdlEventSource::handleJoystickRemoved(const SDL_JoyDeviceEvent &device) {
}
if (SDL_JoystickInstanceID(joystick) == device.which) {
+ debug(5, "SdlEventSource: Newly removed joystick with instance id '%d' matches currently used joystick, closing current joystick", device.which);
+
closeJoystick();
}