From: Shamus Hammons Date: Wed, 8 Oct 2014 20:32:43 +0000 (-0500) Subject: Added logging to Gamepad::CheckButtonPressed(). X-Git-Tag: 2.1.1~2 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=virtualjaguar;a=commitdiff_plain;h=5b056aa1b8278aff14df2dacb5df2787d2eb8bdf Added logging to Gamepad::CheckButtonPressed(). --- diff --git a/docs/INSTALL b/docs/INSTALL index 3709f0d..c81b0a5 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -13,7 +13,7 @@ The minimum requirements for compiling Virtual Jaguar from source are: o zlib v1.2.5 o libcdio v0.90 or higher (optional, for Jaguar CD support) o OpenGL libraries - o Qt 4.7.3 or higher + o Qt 4.7.3 or higher (but not Qt 5!) o supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw, MacOS); other OSs may work to but you may need to change some items in the Makefile. diff --git a/src/gui/gamepad.cpp b/src/gui/gamepad.cpp index b8ebdde..4615c82 100644 --- a/src/gui/gamepad.cpp +++ b/src/gui/gamepad.cpp @@ -137,9 +137,10 @@ bool Gamepad::GetState(int joystickID, int buttonID) } -//UNUSED int Gamepad::CheckButtonPressed(void) { + DumpJoystickStatesToLog(); + // This translates the hat direction to a mask index. int hatNum[16] = { -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1 }; @@ -211,6 +212,83 @@ void Gamepad::Update(void) } +void Gamepad::DumpJoystickStatesToLog(void) +{ + bool pressed = false; + + for(int i=0; i 32000) + { + pressed = true; + break; + break; + } + + if (axis[i][j] < -32000) + { + pressed = true; + break; + break; + } + } + } + + if (!pressed) + return; + + WriteLog("Gamepad: CheckButtonPressed...\n"); + + for(int i=0; i 32000) + WriteLog("Gamepad: Pad #%i, axis %i pushed down...\n", i, j); + + if (axis[i][j] < -32000) + WriteLog("Gamepad: Pad #%i, axis %i pushed up...\n", i, j); + } + } +} + + // However, SDL 2 *does* support hot-plugging! :-D #if 0 // Need to test this. It may be that the only time joysticks are detected is diff --git a/src/gui/gamepad.h b/src/gui/gamepad.h index 73aaef8..902dae1 100644 --- a/src/gui/gamepad.h +++ b/src/gui/gamepad.h @@ -44,6 +44,7 @@ class Gamepad static int GetButtonID(void); static int GetJoystickID(void); static void Update(void); + static void DumpJoystickStatesToLog(void); // Support up to 8 gamepads static int numJoysticks; diff --git a/src/gui/profile.cpp b/src/gui/profile.cpp index a4d8e57..434d01d 100644 --- a/src/gui/profile.cpp +++ b/src/gui/profile.cpp @@ -357,7 +357,7 @@ One more stab at this... */ void AutoConnectProfiles(void) { - int foundProfiles[MAX_PROFILES]; +// int foundProfiles[MAX_PROFILES]; controller1Profile = -1; controller2Profile = -1; gamepadIDSlot1 = -1;