diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index f6b1d9ee25..057b2f752a 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -164,8 +164,8 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in else { // XInput triggers for Xbox360 pads - _PadState.axis[CTL_L_SHOULDER] = XInput::GetXI(0, _PadMapping.buttons[CTL_L_SHOULDER] - 1000); - _PadState.axis[CTL_R_SHOULDER] = XInput::GetXI(0, _PadMapping.buttons[CTL_R_SHOULDER] - 1000); + _PadState.axis[CTL_L_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_L_SHOULDER] - 1000); + _PadState.axis[CTL_R_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_R_SHOULDER] - 1000); } #endif @@ -326,7 +326,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h { for(int i = 0; i <= InputCommon::XI_TRIGGER_R; i++) { - if(XInput::GetXI(0, i)) + if(XInput::GetXI(ControllerID, i)) { pressed = i + 1000; type = InputCommon::CTL_AXIS; diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 87b89eaf6b..f8f6be3c61 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -187,7 +187,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) else if (WiiMoteEmu::NumGoodPads > 0) { InputCommon::GetButton( - WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, + WiiMoteEmu::WiiMapping[m_Page].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, KeyPressed, value, type, pressed, Succeed, Stop, LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index 684288468e..7c1dbbe7b8 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -129,10 +129,12 @@ PADConfigDialognJoy::PADConfigDialognJoy(wxWindow *parent, wxWindowID id, const // Reset values GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; - - // Start the constant timer - int TimesPerSecond = 10; - m_ConstantTimer->Start(1000 / TimesPerSecond); + if (NumGoodPads) + { + // Start the constant timer + int TimesPerSecond = 10; + m_ConstantTimer->Start(1000 / TimesPerSecond); + } #endif // wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys @@ -166,6 +168,7 @@ void PADConfigDialognJoy::OnClose(wxCloseEvent& event) // Close pads, unless we are running a game //if (!g_EmulatorRunning) Shutdown(); + g_FrameOpen = false; EndModal(wxID_CLOSE); } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 4c76165e38..623354db66 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -48,6 +48,7 @@ std::vector joyinfo; InputCommon::CONTROLLER_STATE PadState[4]; InputCommon::CONTROLLER_MAPPING PadMapping[4]; bool g_EmulatorRunning = false; +bool g_FrameOpen = false; int NumPads = 0, NumGoodPads = 0, LastPad = 0; #ifdef _WIN32 HWND m_hWnd = NULL, m_hConsole = NULL; // Handle to window @@ -154,11 +155,13 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) // ------------------ void DllConfig(HWND _hParent) { - // Init Joystick + Haptic (force feedback) subsystem on SDL 1.3 - // Populate joyinfo for all attached devices - Search_Devices(joyinfo, NumPads, NumGoodPads); - - g_Config.Load(); // load settings + if (!g_EmulatorRunning) + { + g_Config.Load(); // load settings + // Init Joystick + Haptic (force feedback) subsystem on SDL 1.3 + // Populate joyinfo for all attached devices + Search_Devices(joyinfo, NumPads, NumGoodPads); + } #if defined(HAVE_WX) && HAVE_WX if (!m_ConfigFrame) @@ -168,9 +171,15 @@ void DllConfig(HWND _hParent) // Only allow one open at a time if (!m_ConfigFrame->IsShown()) + { + g_FrameOpen = true; m_ConfigFrame->ShowModal(); + } else + { + g_FrameOpen = false; m_ConfigFrame->Hide(); + } #endif } @@ -185,18 +194,20 @@ void Initialize(void *init) g_PADInitialize = (SPADInitialize*)init; g_EmulatorRunning = true; - #ifdef _WIN32 - m_hWnd = (HWND)g_PADInitialize->hWnd; - #endif +#ifdef _WIN32 + m_hWnd = (HWND)g_PADInitialize->hWnd; +#endif - #ifdef _DEBUG - DEBUG_INIT(); - #endif +#ifdef _DEBUG + DEBUG_INIT(); +#endif - // Populate joyinfo for all attached devices - Search_Devices(joyinfo, NumPads, NumGoodPads); - - g_Config.Load(); // load settings + if (!g_FrameOpen) + { + g_Config.Load(); // load settings + // Populate joyinfo for all attached devices + Search_Devices(joyinfo, NumPads, NumGoodPads); + } } void Close_Devices() diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 665e2774ce..d4a1c25cbc 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -95,6 +95,7 @@ #ifdef _WIN32 extern HWND m_hWnd, m_hConsole; // Handle to window #endif + extern bool g_FrameOpen; extern int NumPads, NumGoodPads, LastPad; // Number of goods pads #endif