diff options
| author | skidau <skidau@gmail.com> | 2013-01-04 14:08:09 +1100 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2013-01-04 14:08:09 +1100 |
| commit | 4d6056f146252afe70d18effc10fd66d3f1c44aa (patch) | |
| tree | e0105d018d966ebd8efe1e393e3b551a6d0a1dfd /Source/Core/InputCommon/Src/ControllerInterface/DInput | |
| parent | 9b51c99c6ba5f1b5f256032f6750540d7d8b2b0e (diff) | |
| parent | 3fd1b4ee83e02de1d9ed8d145ec21b88c16b523c (diff) | |
Added GC Steering Wheel emulation.
To set it up, change the Port 1 controller to "Steering Wheel" under the GameCube tab. This will tell the game that you have a force feedback steering wheel connected.
In the Gamecube Pad Settings, change the Rumble Motor to "Constant".
Configure the controls:
Main Stick Left/Right = Steer Left/Right
Main Stick Up = Accelerate
Main Stick Down = Brake
Thanks to ulao for the device communications info.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index 08d62bcfc1..b7ac3bf82e 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -254,9 +254,9 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI for (unsigned int offset = 0; offset < DIJOFS_BUTTON(0) / sizeof(LONG); ++offset) { range.diph.dwObj = offset * sizeof(LONG); - // try to set some nice power of 2 values (8192) - range.lMin = -(1 << 13); - range.lMax = (1 << 13); + // try to set some nice power of 2 values (128) to match the GameCube controls + range.lMin = -(1 << 7); + range.lMax = (1 << 7); m_device->SetProperty(DIPROP_RANGE, &range.diph); // but i guess not all devices support setting range // so i getproperty right afterward incase it didn't set :P @@ -281,17 +281,19 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI if ( objects.size() ) { // temporary - DWORD rgdwAxes[] = {DIJOFS_X, DIJOFS_Y}; - LONG rglDirection[] = {0, 0}; + DWORD rgdwAxes[2] = {DIJOFS_X, DIJOFS_Y}; + LONG rglDirection[2] = {-200, 0}; DIEFFECT eff; ZeroMemory(&eff, sizeof(eff)); eff.dwSize = sizeof(DIEFFECT); eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; eff.dwDuration = INFINITE; // (4 * DI_SECONDS) + eff.dwSamplePeriod = 0; eff.dwGain = DI_FFNOMINALMAX; eff.dwTriggerButton = DIEB_NOTRIGGER; - eff.cAxes = std::min((DWORD)2, (DWORD)objects.size()); + eff.dwTriggerRepeatInterval = 0; + eff.cAxes = std::min((DWORD)1, (DWORD)objects.size()); eff.rgdwAxes = rgdwAxes; eff.rglDirection = rglDirection; @@ -310,7 +312,12 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI { // ugly if ladder if (0 == f) + { + DICONSTANTFORCE diCF = {-10000}; + diCF.lMagnitude = DI_FFNOMINALMAX; eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE); + eff.lpvTypeSpecificParams = &diCF; + } else if (1 == f) eff.cbTypeSpecificParams = sizeof(DIRAMPFORCE); else @@ -528,7 +535,11 @@ ControlState Joystick::Hat::GetState() const void Joystick::ForceConstant::SetState(const ControlState state) { - const LONG new_val = LONG(10000 * state); + float force = abs(state - 0.5) * 2; + if (state < 0.5) + force = -force; + + const LONG new_val = LONG(10000 * force); LONG &val = params.lMagnitude; if (val != new_val) |
