diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index 9f83da568f..2f5b2b2318 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -41,6 +41,7 @@ static const char* ControllerType[] = { "Joystick (default)", "Joystick (no hat)", +// "Joytstick (xbox360)", // Shoulder buttons -> axis // "Keyboard" // Not supported yet, sorry F|RES ;( ... }; @@ -140,6 +141,7 @@ void ConfigBox::CreateGUIControls() arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK])); arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK_NO_HAT])); + // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK_XBOX360])); // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD])); char buffer [8]; @@ -310,7 +312,7 @@ void ConfigBox::SetControllerAll(int controller) tmp << joysticks[controller].buttons[CTL_R_SHOULDER]; m_JoyShoulderR[controller]->SetValue(tmp); tmp.clear(); tmp << joysticks[controller].buttons[CTL_A_BUTTON]; m_JoyButtonA[controller]->SetValue(tmp); tmp.clear(); - tmp << joysticks[controller].buttons[CTL_A_BUTTON]; m_JoyButtonB[controller]->SetValue(tmp); tmp.clear(); + tmp << joysticks[controller].buttons[CTL_B_BUTTON]; m_JoyButtonB[controller]->SetValue(tmp); tmp.clear(); tmp << joysticks[controller].buttons[CTL_X_BUTTON]; m_JoyButtonX[controller]->SetValue(tmp); tmp.clear(); tmp << joysticks[controller].buttons[CTL_Y_BUTTON]; m_JoyButtonY[controller]->SetValue(tmp); tmp.clear(); tmp << joysticks[controller].buttons[CTL_Z_TRIGGER]; m_JoyButtonZ[controller]->SetValue(tmp); tmp.clear(); diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 9588fb0ab6..6f862c6f0a 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -44,10 +44,15 @@ bool emulator_running = FALSE; // Handle to window HWND m_hWnd; + +#ifdef USE_RUMBLE_DINPUT_HACK bool g_rumbleEnable = FALSE; +#endif // Rumble in windows #ifdef _WIN32 + +#ifdef USE_RUMBLE_DINPUT_HACK LPDIRECTINPUT8 g_pDI = NULL; LPDIRECTINPUTDEVICE8 g_pDevice = NULL; LPDIRECTINPUTEFFECT g_pEffect = NULL; @@ -65,6 +70,8 @@ BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pCont HRESULT SetDeviceForcesXY(); #endif +#endif + ////////////////////////////////////////////////////////////////////////////////////////// // wxWidgets // ŻŻŻŻŻŻŻŻŻ @@ -282,8 +289,10 @@ void PAD_Shutdown() emulator_running = FALSE; #ifdef _WIN32 + #ifdef USE_RUMBLE_DINPUT_HACK FreeDirectInput(); #endif + #endif } // Set PAD status @@ -400,6 +409,7 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) #ifdef _WIN32 + #ifdef USE_RUMBLE_DINPUT_HACK if(joystate[_numPAD].halfpress) if(!g_pDI) if(FAILED(InitDirectInput(m_hWnd))) @@ -419,6 +429,7 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) g_pEffect->Start(1, 0); } #endif + #endif } // Set PAD rumble @@ -426,12 +437,13 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) // (Stop=0, Rumble=1) void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) { - if(_numPAD > 0) - return; + //if(_numPAD > 0) + // return; // not supported by SDL // So we need to use platform specific stuff #ifdef _WIN32 + #ifdef USE_RUMBLE_DINPUT_HACK static int a = 0; if ((_uType == 0) || (_uType == 2)) @@ -454,7 +466,7 @@ void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) g_nYForce = a; SetDeviceForcesXY(); } - + #endif #endif } @@ -707,7 +719,7 @@ void LoadConfig() // Rumble stuff :D! // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ // - +#ifdef USE_RUMBLE_DINPUT_HACK HRESULT InitDirectInput( HWND hDlg ) { DIPROPDWORD dipdw; @@ -883,5 +895,5 @@ HRESULT SetDeviceForcesXY() // Now set the new parameters and start the effect immediately. return g_pEffect->SetParameters(&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START); } - +#endif #endif diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 98ce57e394..f6507567b2 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -32,15 +32,22 @@ // Set this if you want to use the new wxWidgets GUI #define USE_WXWIDGETS +// Set this if you want to use the rumble 'hack' for controller one +//#define USE_RUMBLE_DINPUT_HACK + #ifdef _WIN32 #define _CRT_SECURE_NO_WARNINGS #define DIRECTINPUT_VERSION 0x0800 #define WIN32_LEAN_AND_MEAN #include #include + +#ifdef USE_RUMBLE_DINPUT_HACK #include // used for rumble #endif +#endif + #include #include #include @@ -69,10 +76,12 @@ #pragma comment(lib, "comctl32.lib") // Required for the rumble part +#ifdef USE_RUMBLE_DINPUT_HACK #pragma comment(lib, "dxguid.lib") #pragma comment(lib, "dinput8.lib") #pragma comment(lib, "winmm.lib") #endif +#endif ////////////////////////////////////////////////////////////////////////////////////////// // Define @@ -85,10 +94,6 @@ #define RELYEAR "2008" #define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu." -#ifdef _WIN32 -// Rumble stuff :D! -#endif - ////////////////////////////////////////////////////////////////////////////////////////// // Structures // ŻŻŻŻŻŻŻŻŻŻ @@ -148,6 +153,7 @@ enum { CTL_TYPE_JOYSTICK = 0, CTL_TYPE_JOYSTICK_NO_HAT, + CTL_TYPE_JOYSTICK_XBOX360, CTL_TYPE_KEYBOARD };