From e088fb9c35ff82a1b96045558254680d22a4587b Mon Sep 17 00:00:00 2001 From: Aloshi Date: Thu, 28 Mar 2013 21:55:29 -0500 Subject: [PATCH] Hopefully fixed issue #57. --- changelog.txt | 5 ++++- src/InputManager.cpp | 2 ++ src/main.cpp | 16 ++++------------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/changelog.txt b/changelog.txt index d880d47ef..060f76b1f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ +March 28, 2013 +-Hopefully fixed bad joystick events at startup. + March 25, 2013 --Hopefully fixed waking up from sleep with axes. +-Fixed waking up from sleep with axes. March 19, 2013 -Finally added a "dim" or sleep mode. Change behavior with "--dimtime [positive integer time in seconds]", with 0 for off. diff --git a/src/InputManager.cpp b/src/InputManager.cpp index edb395cde..c347757ef 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -299,6 +299,8 @@ void InputManager::openJoystick() }else{ LOG(LogDebug) << " no joysticks detected by SDL_NumJoysticks(), so no joystick opened"; } + + SDL_JoystickEventState(SDL_ENABLE); } std::string InputManager::getConfigPath() diff --git a/src/main.cpp b/src/main.cpp index 1fe4e2bc2..c5eed1012 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,10 +114,6 @@ int main(int argc, char* argv[]) //initialize audio AudioManager::init(); - - SDL_JoystickEventState(SDL_ENABLE); - - //try loading the system config file if(!fs::exists(SystemData::getConfigPath())) //if it doesn't exist, create the example and quit { @@ -137,27 +133,23 @@ int main(int argc, char* argv[]) //choose which GUI to open depending on Input configuration if(fs::exists(InputManager::getConfigPath())) { - if(DEBUG) - std::cout << "Found input config in " << InputManager::getConfigPath() << "\n"; + LOG(LogDebug) << "Found input config in " << InputManager::getConfigPath() << "\n"; //an input config already exists - load it and proceed to the gamelist as usual. InputManager::loadConfig(); GuiGameList::create(); }else{ + if(DEBUG) std::cout << "SDL_NumJoysticks() reports " << SDL_NumJoysticks() << " present.\n"; //if no input.cfg is present, but a joystick is connected, launch the input config GUI if(SDL_NumJoysticks() > 0) { - if(DEBUG) - std::cout << " at least one joystick detected, launching config GUI...\n"; - + LOG(LogDebug) << " at least one joystick detected, launching config GUI...\n"; new GuiInputConfig(); }else{ - if(DEBUG) - std::cout << " no joystick detected, ignoring...\n"; - + LOG(LogDebug) << " no joystick detected, ignoring...\n"; GuiGameList::create(); }