From 8a9fcd3014a4aee23b6fb7008a02679f8bf96200 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 14 Apr 2013 22:53:10 -0400 Subject: Kill off dangling else's in the InputCommon project. Some indentations were also too far for some things. Fixed this. Also update the license header to show Git instead of SVN. Got rid of some trailing spaces/tabs too. --- .../Src/ControllerInterface/DInput/DInputJoystick.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index 9bc5364e76..ed5d1383ec 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -319,9 +319,13 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI eff.lpvTypeSpecificParams = &diCF; } else if (1 == f) + { eff.cbTypeSpecificParams = sizeof(DIRAMPFORCE); + } else + { eff.cbTypeSpecificParams = sizeof(DIPERIODIC); + } LPDIRECTINPUTEFFECT pEffect; if (SUCCEEDED(m_device->CreateEffect(force_type_names[f].guid, &eff, &pEffect, NULL))) @@ -427,7 +431,9 @@ bool Joystick::UpdateInput() } } else + { hr = m_device->GetDeviceState(sizeof(m_state_in), &m_state_in); + } // try reacquire if input lost if (DIERR_INPUTLOST == hr || DIERR_NOTACQUIRED == hr) @@ -460,12 +466,16 @@ bool Joystick::UpdateOutput() ok_count += SUCCEEDED(i->iface->SetParameters(&eff, DIEP_TYPESPECIFICPARAMS | DIEP_START)); } else + { ok_count += SUCCEEDED(i->iface->Stop()); + } i->params = NULL; } else + { ++ok_count; + } } return (m_state_out.size() == ok_count); @@ -492,7 +502,9 @@ std::string Joystick::Axis::GetName() const } // slider else + { ss << "Slider " << (int)(m_index - 6); + } ss << (m_range < 0 ? '-' : '+'); return ss.str(); -- cgit v1.2.3 From d244bca1f5f210e03839d0e0a485fc5511ede2d6 Mon Sep 17 00:00:00 2001 From: lioncash Date: Fri, 19 Apr 2013 09:21:45 -0400 Subject: Fix a bunch of random typos in comments and logging. Also update the comment headers for two functions in GCMemcard.cpp. --- .../ControllerInterface/DInput/DInputJoystick.cpp | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index ed5d1383ec..916d142149 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -22,13 +22,13 @@ static const struct } force_type_names[] = { {GUID_ConstantForce, "Constant"}, // DICONSTANTFORCE - {GUID_RampForce, "Ramp"}, // DIRAMPFORCE - {GUID_Square, "Square"}, // DIPERIODIC ... + {GUID_RampForce, "Ramp"}, // DIRAMPFORCE + {GUID_Square, "Square"}, // DIPERIODIC ... {GUID_Sine, "Sine"}, {GUID_Triangle, "Triangle"}, {GUID_SawtoothUp, "Sawtooth Up"}, {GUID_SawtoothDown, "Sawtooth Down"}, - //{GUID_Spring, "Spring"}, // DICUSTOMFORCE ... < i think + //{GUID_Spring, "Spring"}, // DICUSTOMFORCE ... < I think //{GUID_Damper, "Damper"}, //{GUID_Inertia, "Inertia"}, //{GUID_Friction, "Friction"}, @@ -70,9 +70,9 @@ void GetXInputGUIDS( std::vector& guids ) if( FAILED(hr) || pIWbemLocator == NULL ) goto LCleanup; - bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup; - bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup; - bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup; + bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup; + bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup; + bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup; // Connect to WMI hr = pIWbemLocator->ConnectServer( bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices ); @@ -81,7 +81,7 @@ void GetXInputGUIDS( std::vector& guids ) // Switch security level to IMPERSONATE. CoSetProxyBlanket( pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); + RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); hr = pIWbemServices->CreateInstanceEnum( bstrClassName, 0, NULL, &pEnumDevices ); if( FAILED(hr) || pEnumDevices == NULL ) @@ -184,7 +184,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vectortszInstanceName]++); - // only add if it has some inputs/outpus + // only add if it has some inputs/outputs if (js->Inputs().size() || js->Outputs().size()) devices.push_back(js); else @@ -196,7 +196,6 @@ void InitJoystick(IDirectInput8* const idi8, std::vectorRelease(); } } - } } @@ -226,7 +225,7 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI if (FAILED(m_device->GetCapabilities(&js_caps))) return; - // max of 32 buttons and 4 hats / the limit of the data format i am using + // max of 32 buttons and 4 hats / the limit of the data format I am using js_caps.dwButtons = std::min((DWORD)32, js_caps.dwButtons); js_caps.dwPOVs = std::min((DWORD)4, js_caps.dwPOVs); @@ -258,9 +257,9 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI 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 - // this also checks that the axis is present + // but I guess not all devices support setting range + // so I getproperty right afterward incase it didn't set. + // This also checks that the axis is present if (SUCCEEDED(m_device->GetProperty(DIPROP_RANGE, &range.diph))) { const LONG base = (range.lMin + range.lMax) / 2; @@ -404,7 +403,7 @@ bool Joystick::UpdateInput() HRESULT hr = 0; // just always poll, - // msdn says if this isn't needed it doesnt do anything + // MSDN says if this isn't needed it doesn't do anything m_device->Poll(); if (m_buffered) @@ -539,7 +538,7 @@ ControlState Joystick::Button::GetState() const ControlState Joystick::Hat::GetState() const { // can this func be simplified ? - // hat centered code from msdn + // hat centered code from MSDN if (0xFFFF == LOWORD(m_hat)) return 0; return (abs((int)(m_hat / 4500 - m_direction * 2 + 8) % 8 - 4) > 2); -- cgit v1.2.3