public static uint XInputGetExtended(uint dwUserIndex, ref SCP_EXTN pPressure) { // TODO: add error handling pPressure = _scpProxy.GetExtended(dwUserIndex); return 0; // success }
public static uint XInputGetExtended(uint dwUserIndex, ref SCP_EXTN pPressure) { try { pPressure = _scpProxy.GetExtended(dwUserIndex); } catch (Exception ex) { Log.ErrorFormat("Couldn't receive pressure information: {0}", ex); } return 0; // success }
/// <summary> /// Used by ScpXInputBridge to request pressure sensitive button information. /// </summary> /// <param name="dwUserIndex">The pad index to request data from (zero-based).</param> /// <returns>The pressure sensitive button/axis information.</returns> public SCP_EXTN GetExtended(uint dwUserIndex) { ScpHidReport inputReport; var extended = default(SCP_EXTN); try { inputReport = _packetCache[(DsPadId) dwUserIndex]; } catch (KeyNotFoundException) { return extended; } switch (inputReport.Model) { case DsModel.None: break; case DsModel.DS3: // translate and wrap button/axis information extended = new SCP_EXTN { SCP_UP = inputReport[Ds3Axis.Up].Pressure, SCP_RIGHT = inputReport[Ds3Axis.Right].Pressure, SCP_DOWN = inputReport[Ds3Axis.Down].Pressure, SCP_LEFT = inputReport[Ds3Axis.Left].Pressure, SCP_LX = inputReport[Ds3Axis.Lx].Axis, SCP_LY = -inputReport[Ds3Axis.Ly].Axis, SCP_L1 = inputReport[Ds3Axis.L1].Pressure, SCP_L2 = inputReport[Ds3Axis.L2].Pressure, SCP_L3 = inputReport[Ds3Button.L3].Pressure, SCP_RX = inputReport[Ds3Axis.Rx].Axis, SCP_RY = -inputReport[Ds3Axis.Ry].Axis, SCP_R1 = inputReport[Ds3Axis.R1].Pressure, SCP_R2 = inputReport[Ds3Axis.R2].Pressure, SCP_R3 = inputReport[Ds3Button.R3].Pressure, SCP_T = inputReport[Ds3Axis.Triangle].Pressure, SCP_C = inputReport[Ds3Axis.Circle].Pressure, SCP_X = inputReport[Ds3Axis.Cross].Pressure, SCP_S = inputReport[Ds3Axis.Square].Pressure, SCP_SELECT = inputReport[Ds3Button.Select].Pressure, SCP_START = inputReport[Ds3Button.Start].Pressure, SCP_PS = inputReport[Ds3Button.Ps].Pressure }; break; case DsModel.DS4: extended = new SCP_EXTN { SCP_UP = inputReport[Ds4Button.Up].Pressure, SCP_RIGHT = inputReport[Ds4Button.Right].Pressure, SCP_DOWN = inputReport[Ds4Button.Down].Pressure, SCP_LEFT = inputReport[Ds4Button.Left].Pressure, SCP_LX = inputReport[Ds4Axis.Lx].Value, SCP_LY = inputReport[Ds4Axis.Ly].Value, SCP_L1 = inputReport[Ds4Button.L1].Pressure, SCP_L2 = inputReport[Ds4Axis.L2].Pressure, SCP_L3 = inputReport[Ds4Button.L3].Pressure, SCP_RX = inputReport[Ds4Axis.Rx].Value, SCP_RY = inputReport[Ds4Axis.Ry].Value, SCP_R1 = inputReport[Ds4Button.R1].Pressure, SCP_R2 = inputReport[Ds4Axis.R2].Pressure, SCP_R3 = inputReport[Ds4Button.R3].Pressure, SCP_T = inputReport[Ds4Button.Triangle].Pressure, SCP_C = inputReport[Ds4Button.Circle].Pressure, SCP_X = inputReport[Ds4Button.Cross].Pressure, SCP_S = inputReport[Ds4Button.Square].Pressure, SCP_SELECT = inputReport[Ds4Button.Share].Pressure, SCP_START = inputReport[Ds4Button.Options].Pressure, SCP_PS = inputReport[Ds4Button.Ps].Pressure }; break; } return extended; }
/// <summary> /// Used by ScpXInputBridge to request pressure sensitive button information. /// </summary> /// <param name="dwUserIndex">The pad index to request data from (zero-based).</param> /// <returns>The pressure sensitive button/axis information.</returns> public SCP_EXTN GetExtended(uint dwUserIndex) { DsPacket packet; var extended = default(SCP_EXTN); try { packet = _packetCache[(DsPadId) dwUserIndex]; } catch (KeyNotFoundException) { return extended; } var native = packet.Native; switch (packet.Detail.Model) { case DsModel.None: break; case DsModel.DS3: // translate and wrap button/axis information extended = new SCP_EXTN { SCP_UP = native.GetDpadUpAnalog().ToPressure(), SCP_RIGHT = native.GetDpadRightAnalog().ToPressure(), SCP_DOWN = native.GetDpadDownAnalog().ToPressure(), SCP_LEFT = native.GetDpadLeftAnalog().ToPressure(), SCP_LX = native.GetLeftAxisX(), SCP_LY = native.GetLeftAxisY(), SCP_L1 = native.GetLeftShoulderAnalog().ToPressure(), SCP_L2 = native.GetLeftTriggerAnalog().ToPressure(), SCP_L3 = native.GetLeftThumb() ? 1.0f : 0.0f, SCP_RX = native.GetRightAxisX(), SCP_RY = native.GetRightAxisY(), SCP_R1 = native.GetRightShoulderAnalog().ToPressure(), SCP_R2 = native.GetRightTriggerAnalog().ToPressure(), SCP_R3 = native.GetRightThumb() ? 1.0f : 0.0f, SCP_T = native.GetTriangleAnalog().ToPressure(), SCP_C = native.GetCircleAnalog().ToPressure(), SCP_X = native.GetCrossAnalog().ToPressure(), SCP_S = native.GetSquareAnalog().ToPressure(), SCP_SELECT = native.GetSelect() ? 1.0f : 0.0f, SCP_START = native.GetStart() ? 1.0f : 0.0f, SCP_PS = native.GetPs() ? 1.0f : 0.0f }; break; // TODO: implement DS4 and Generic } return extended; }