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 (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();

View File

@ -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

View File

@ -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 <tchar.h>
#include <math.h>
#ifdef USE_RUMBLE_DINPUT_HACK
#include <dinput.h> // used for rumble
#endif
#endif
#include <vector>
#include <stdio.h>
#include <time.h>
@ -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
};