Disabled the rumblepad hack.

If you want to use it, uncomment #define USE_RUMBLE_DINPUT_HACK in nJoy.h.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@172 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Laurence Muller 2008-08-10 18:46:55 +00:00
parent 3540466f63
commit 5fc50dc63c
3 changed files with 30 additions and 10 deletions

View File

@ -41,6 +41,7 @@ static const char* ControllerType[] =
{ {
"Joystick (default)", "Joystick (default)",
"Joystick (no hat)", "Joystick (no hat)",
// "Joytstick (xbox360)", // Shoulder buttons -> axis
// "Keyboard" // Not supported yet, sorry F|RES ;( ... // "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]));
arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK_NO_HAT])); 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])); // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD]));
char buffer [8]; 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_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_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_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_Y_BUTTON]; m_JoyButtonY[controller]->SetValue(tmp); tmp.clear();
tmp << joysticks[controller].buttons[CTL_Z_TRIGGER]; m_JoyButtonZ[controller]->SetValue(tmp); tmp.clear(); tmp << joysticks[controller].buttons[CTL_Z_TRIGGER]; m_JoyButtonZ[controller]->SetValue(tmp); tmp.clear();

View File

@ -44,10 +44,15 @@ bool emulator_running = FALSE;
// Handle to window // Handle to window
HWND m_hWnd; HWND m_hWnd;
#ifdef USE_RUMBLE_DINPUT_HACK
bool g_rumbleEnable = FALSE; bool g_rumbleEnable = FALSE;
#endif
// Rumble in windows // Rumble in windows
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
LPDIRECTINPUT8 g_pDI = NULL; LPDIRECTINPUT8 g_pDI = NULL;
LPDIRECTINPUTDEVICE8 g_pDevice = NULL; LPDIRECTINPUTDEVICE8 g_pDevice = NULL;
LPDIRECTINPUTEFFECT g_pEffect = NULL; LPDIRECTINPUTEFFECT g_pEffect = NULL;
@ -65,6 +70,8 @@ BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pCont
HRESULT SetDeviceForcesXY(); HRESULT SetDeviceForcesXY();
#endif #endif
#endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// wxWidgets // wxWidgets
// ¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯
@ -282,8 +289,10 @@ void PAD_Shutdown()
emulator_running = FALSE; emulator_running = FALSE;
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
FreeDirectInput(); FreeDirectInput();
#endif #endif
#endif
} }
// Set PAD status // Set PAD status
@ -400,6 +409,7 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
if(joystate[_numPAD].halfpress) if(joystate[_numPAD].halfpress)
if(!g_pDI) if(!g_pDI)
if(FAILED(InitDirectInput(m_hWnd))) if(FAILED(InitDirectInput(m_hWnd)))
@ -419,6 +429,7 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
g_pEffect->Start(1, 0); g_pEffect->Start(1, 0);
} }
#endif #endif
#endif
} }
// Set PAD rumble // Set PAD rumble
@ -426,12 +437,13 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
// (Stop=0, Rumble=1) // (Stop=0, Rumble=1)
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
{ {
if(_numPAD > 0) //if(_numPAD > 0)
return; // return;
// not supported by SDL // not supported by SDL
// So we need to use platform specific stuff // So we need to use platform specific stuff
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
static int a = 0; static int a = 0;
if ((_uType == 0) || (_uType == 2)) if ((_uType == 0) || (_uType == 2))
@ -454,7 +466,7 @@ void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
g_nYForce = a; g_nYForce = a;
SetDeviceForcesXY(); SetDeviceForcesXY();
} }
#endif
#endif #endif
} }
@ -707,7 +719,7 @@ void LoadConfig()
// Rumble stuff :D! // Rumble stuff :D!
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// //
#ifdef USE_RUMBLE_DINPUT_HACK
HRESULT InitDirectInput( HWND hDlg ) HRESULT InitDirectInput( HWND hDlg )
{ {
DIPROPDWORD dipdw; DIPROPDWORD dipdw;
@ -883,5 +895,5 @@ HRESULT SetDeviceForcesXY()
// Now set the new parameters and start the effect immediately. // Now set the new parameters and start the effect immediately.
return g_pEffect->SetParameters(&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START); return g_pEffect->SetParameters(&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS | DIEP_START);
} }
#endif
#endif #endif

View File

@ -32,15 +32,22 @@
// Set this if you want to use the new wxWidgets GUI // Set this if you want to use the new wxWidgets GUI
#define USE_WXWIDGETS #define USE_WXWIDGETS
// Set this if you want to use the rumble 'hack' for controller one
//#define USE_RUMBLE_DINPUT_HACK
#ifdef _WIN32 #ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <tchar.h> #include <tchar.h>
#include <math.h> #include <math.h>
#ifdef USE_RUMBLE_DINPUT_HACK
#include <dinput.h> // used for rumble #include <dinput.h> // used for rumble
#endif #endif
#endif
#include <vector> #include <vector>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
@ -69,10 +76,12 @@
#pragma comment(lib, "comctl32.lib") #pragma comment(lib, "comctl32.lib")
// Required for the rumble part // Required for the rumble part
#ifdef USE_RUMBLE_DINPUT_HACK
#pragma comment(lib, "dxguid.lib") #pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "dinput8.lib") #pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "winmm.lib") #pragma comment(lib, "winmm.lib")
#endif #endif
#endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Define // Define
@ -85,10 +94,6 @@
#define RELYEAR "2008" #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." #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 // Structures
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
@ -148,6 +153,7 @@ enum
{ {
CTL_TYPE_JOYSTICK = 0, CTL_TYPE_JOYSTICK = 0,
CTL_TYPE_JOYSTICK_NO_HAT, CTL_TYPE_JOYSTICK_NO_HAT,
CTL_TYPE_JOYSTICK_XBOX360,
CTL_TYPE_KEYBOARD CTL_TYPE_KEYBOARD
}; };