protected override void SampleDs4(DsPacket Packet) { Int32 Axis; base.SampleDs4(Packet); // Axis Control : Left Stick -> WASD Axis = Packet.Axis(Ds4Axis.LX); m_A = Button(m_A, Axis < (Centre - m_Threshold), Keys.A, false); m_D = Button(m_D, Axis > (Centre + m_Threshold), Keys.D, false); Axis = Packet.Axis(Ds4Axis.LY); m_W = Button(m_W, Axis < (Centre - m_Threshold), Keys.W, false); m_S = Button(m_S, Axis > (Centre + m_Threshold), Keys.S, false); // Mouse Buttons m_LMB = Mouse(m_LMB, Packet.Button(Ds4Button.R2), KbmPost.MouseButtons.Left); // Attack m_MMB = Mouse(m_MMB, Packet.Button(Ds4Button.L2), KbmPost.MouseButtons.Middle); // Zoom m_RMB = Mouse(m_RMB, Packet.Button(Ds4Button.Circle), KbmPost.MouseButtons.Right); // Jump // Keyboard Buttons m_OB = Button(m_OB, Packet.Button(Ds4Button.L1), Keys.OemOpenBrackets, false); // Next m_CB = Button(m_CB, Packet.Button(Ds4Button.R1), Keys.OemCloseBrackets, false); // Prev m_Esc = Button(m_Esc, Packet.Button(Ds4Button.PS), Keys.Escape, false); // Menu m_Tab = Button(m_Tab, Packet.Button(Ds4Button.TouchPad), Keys.Tab, false); // PDA m_End = Button(m_End, Packet.Button(Ds4Button.Cross), Keys.End, true); // Centre View m_R = Button(m_R, Packet.Button(Ds4Button.Triangle), Keys.R, false); // Reload m_C = Button(m_C, Packet.Button(Ds4Button.Square), Keys.C, false); // Crouch }
protected override void SampleDs3(DsPacket Packet) { Int32 Axis; base.SampleDs3(Packet); // Axis Control : Left Stick -> WASD Axis = Packet.Axis(Ds3Axis.LX); m_A = Button(m_A, Axis < (Centre - m_Threshold), Keys.A, false); m_D = Button(m_D, Axis > (Centre + m_Threshold), Keys.D, false); Axis = Packet.Axis(Ds3Axis.LY); m_W = Button(m_W, Axis < (Centre - m_Threshold), Keys.W, false); m_S = Button(m_S, Axis > (Centre + m_Threshold), Keys.S, false); // Mouse Buttons m_LMB = Mouse(m_LMB, Packet.Button(Ds3Button.R2 ), KbmPost.MouseButtons.Left ); // Attack m_MMB = Mouse(m_MMB, Packet.Button(Ds3Button.L2 ), KbmPost.MouseButtons.Middle ); // Zoom m_RMB = Mouse(m_RMB, Packet.Button(Ds3Button.Circle ), KbmPost.MouseButtons.Right ); // Jump // Keyboard Buttons m_OB = Button(m_OB, Packet.Button(Ds3Button.L1 ), Keys.OemOpenBrackets, false); // Next m_CB = Button(m_CB, Packet.Button(Ds3Button.R1 ), Keys.OemCloseBrackets, false); // Prev m_Esc = Button(m_Esc, Packet.Button(Ds3Button.PS ), Keys.Escape, false); // Menu m_End = Button(m_End, Packet.Button(Ds3Button.Cross ), Keys.End, true ); // Centre View m_R = Button(m_R, Packet.Button(Ds3Button.Triangle), Keys.R, false); // Reload m_C = Button(m_C, Packet.Button(Ds3Button.Square ), Keys.C, false); // Crouch m_Tab = Button(m_Tab, Packet.Button(Ds3Button.Start), Keys.Tab, false); // Open/close PDA }
private void Parse(object sender, DsPacket e) { lock (this) { if (e.Detail.Pad == (DsPadId)m_SelectedPad) { if (e.Detail.State != DsState.Connected) { ResetControls(); return; } scpProxy.Remap(m_SelectedProfile, e); switch (e.Detail.Model) { case DsModel.DS3: { axLX.Value = e.Axis(Ds3Axis.LX); axLY.Value = e.Axis(Ds3Axis.LY); axRX.Value = e.Axis(Ds3Axis.RX); axRY.Value = e.Axis(Ds3Axis.RY); axL1.Value = e.Axis(Ds3Axis.L1); axR1.Value = e.Axis(Ds3Axis.R1); axL2.Value = e.Axis(Ds3Axis.L2); axR2.Value = e.Axis(Ds3Axis.R2); axL3.Value = (Byte)(e.Button(Ds3Button.L3) ? 255 : 0); axR3.Value = (Byte)(e.Button(Ds3Button.R3) ? 255 : 0); axSH.Value = (Byte)(e.Button(Ds3Button.Select) ? 255 : 0); axOP.Value = (Byte)(e.Button(Ds3Button.Start) ? 255 : 0); axT.Value = e.Axis(Ds3Axis.Triangle); axC.Value = e.Axis(Ds3Axis.Circle); axX.Value = e.Axis(Ds3Axis.Cross); axS.Value = e.Axis(Ds3Axis.Square); axU.Value = e.Axis(Ds3Axis.Up); axR.Value = e.Axis(Ds3Axis.Right); axD.Value = e.Axis(Ds3Axis.Down); axL.Value = e.Axis(Ds3Axis.Left); axPS.Value = (Byte)(e.Button(Ds3Button.PS) ? 255 : 0); } break; case DsModel.DS4: { axLX.Value = e.Axis(Ds4Axis.LX); axLY.Value = e.Axis(Ds4Axis.LY); axRX.Value = e.Axis(Ds4Axis.RX); axRY.Value = e.Axis(Ds4Axis.RY); axL2.Value = e.Axis(Ds4Axis.L2); axR2.Value = e.Axis(Ds4Axis.R2); axL1.Value = (Byte)(e.Button(Ds4Button.L1) ? 255 : 0); axR1.Value = (Byte)(e.Button(Ds4Button.R1) ? 255 : 0); axL3.Value = (Byte)(e.Button(Ds4Button.L3) ? 255 : 0); axR3.Value = (Byte)(e.Button(Ds4Button.R3) ? 255 : 0); axSH.Value = (Byte)(e.Button(Ds4Button.Share) ? 255 : 0); axOP.Value = (Byte)(e.Button(Ds4Button.Options) ? 255 : 0); axT.Value = (Byte)(e.Button(Ds4Button.Triangle) ? 255 : 0); axC.Value = (Byte)(e.Button(Ds4Button.Circle) ? 255 : 0); axX.Value = (Byte)(e.Button(Ds4Button.Cross) ? 255 : 0); axS.Value = (Byte)(e.Button(Ds4Button.Square) ? 255 : 0); axU.Value = (Byte)(e.Button(Ds4Button.Up) ? 255 : 0); axR.Value = (Byte)(e.Button(Ds4Button.Right) ? 255 : 0); axD.Value = (Byte)(e.Button(Ds4Button.Down) ? 255 : 0); axL.Value = (Byte)(e.Button(Ds4Button.Left) ? 255 : 0); axPS.Value = (Byte)(e.Button(Ds4Button.PS) ? 255 : 0); axTP.Value = (Byte)(e.Button(Ds4Button.TouchPad) ? 255 : 0); } break; } } } }
protected void Parse(object sender, DsPacket e) { lock (this) { if (e.Detail.Pad == (DsPadId)m_SelectedPad) { if (e.Detail.State != DsState.Connected) { ResetControls(); return; } scpProxy.Remap(m_SelectedProfile, e); switch (e.Detail.Model) { case DsModel.DS3: { axLX.Value = e.Axis(Ds3Axis.LX); axLY.Value = e.Axis(Ds3Axis.LY); axRX.Value = e.Axis(Ds3Axis.RX); axRY.Value = e.Axis(Ds3Axis.RY); axL1.Value = e.Axis(Ds3Axis.L1); axR1.Value = e.Axis(Ds3Axis.R1); axL2.Value = e.Axis(Ds3Axis.L2); axR2.Value = e.Axis(Ds3Axis.R2); axL3.Value = (Byte)(e.Button(Ds3Button.L3) ? 255 : 0); axR3.Value = (Byte)(e.Button(Ds3Button.R3) ? 255 : 0); axSH.Value = (Byte)(e.Button(Ds3Button.Select) ? 255 : 0); axOP.Value = (Byte)(e.Button(Ds3Button.Start) ? 255 : 0); axT.Value = e.Axis(Ds3Axis.Triangle); axC.Value = e.Axis(Ds3Axis.Circle); axX.Value = e.Axis(Ds3Axis.Cross); axS.Value = e.Axis(Ds3Axis.Square); axU.Value = e.Axis(Ds3Axis.Up); axR.Value = e.Axis(Ds3Axis.Right); axD.Value = e.Axis(Ds3Axis.Down); axL.Value = e.Axis(Ds3Axis.Left); axPS.Value = (Byte)(e.Button(Ds3Button.PS) ? 255 : 0); } break; case DsModel.DS4: { axLX.Value = e.Axis(Ds4Axis.LX); axLY.Value = e.Axis(Ds4Axis.LY); axRX.Value = e.Axis(Ds4Axis.RX); axRY.Value = e.Axis(Ds4Axis.RY); axL2.Value = e.Axis(Ds4Axis.L2); axR2.Value = e.Axis(Ds4Axis.R2); axL1.Value = (Byte)(e.Button(Ds4Button.L1) ? 255 : 0); axR1.Value = (Byte)(e.Button(Ds4Button.R1) ? 255 : 0); axL3.Value = (Byte)(e.Button(Ds4Button.L3) ? 255 : 0); axR3.Value = (Byte)(e.Button(Ds4Button.R3) ? 255 : 0); axSH.Value = (Byte)(e.Button(Ds4Button.Share) ? 255 : 0); axOP.Value = (Byte)(e.Button(Ds4Button.Options) ? 255 : 0); axT.Value = (Byte)(e.Button(Ds4Button.Triangle) ? 255 : 0); axC.Value = (Byte)(e.Button(Ds4Button.Circle) ? 255 : 0); axX.Value = (Byte)(e.Button(Ds4Button.Cross) ? 255 : 0); axS.Value = (Byte)(e.Button(Ds4Button.Square) ? 255 : 0); axU.Value = (Byte)(e.Button(Ds4Button.Up) ? 255 : 0); axR.Value = (Byte)(e.Button(Ds4Button.Right) ? 255 : 0); axD.Value = (Byte)(e.Button(Ds4Button.Down) ? 255 : 0); axL.Value = (Byte)(e.Button(Ds4Button.Left) ? 255 : 0); axPS.Value = (Byte)(e.Button(Ds4Button.PS) ? 255 : 0); axTP.Value = (Byte)(e.Button(Ds4Button.TouchPad) ? 255 : 0); } break; } } } }
public void Update(DsPacket Data) { lock (this) { uint dsID = (uint)Data.Detail.Pad + 1; switch (Data.Detail.Model) { #region DS3 case DsModel.DS3: { #region Axis vJPad.JoyAxis(config.axisL2, Data.Axis(Ds3Axis.L2), dsID); vJPad.JoyAxis(config.axisR2, Data.Axis(Ds3Axis.R2), dsID); SetAxis(Data.Axis(Ds3Axis.LX), config.axisLX, config.invertLX, dsID); SetAxis(Data.Axis(Ds3Axis.LY), config.axisLY, config.invertLY, dsID); SetAxis(Data.Axis(Ds3Axis.RX), config.axisRX, config.invertRX, dsID); SetAxis(Data.Axis(Ds3Axis.RY), config.axisRY, config.invertRY, dsID); #endregion #region Buttons SetButton(Data.Button(Ds3Button.Cross), config.cross, dsID); SetButton(Data.Button(Ds3Button.Circle), config.circle, dsID); SetButton(Data.Button(Ds3Button.Square), config.square, dsID); SetButton(Data.Button(Ds3Button.Triangle), config.triangle, dsID); SetButton(Data.Button(Ds3Button.L1), config.l1, dsID); SetButton(Data.Button(Ds3Button.R1), config.r1, dsID); SetButton(Data.Button(Ds3Button.L2), config.l2, dsID); SetButton(Data.Button(Ds3Button.R2), config.r2, dsID); SetButton(Data.Button(Ds3Button.Select), config.select_share, dsID); SetButton(Data.Button(Ds3Button.Start), config.start_options, dsID); SetButton(Data.Button(Ds3Button.L3), config.l3, dsID); SetButton(Data.Button(Ds3Button.R3), config.r3, dsID); SetButton(Data.Button(Ds3Button.PS), config.ps, dsID); //Dpad as button SetButton(Data.Button(Ds3Button.Up), config.up, dsID); SetButton(Data.Button(Ds3Button.Down), config.down, dsID); SetButton(Data.Button(Ds3Button.Left), config.left, dsID); SetButton(Data.Button(Ds3Button.Right), config.right, dsID); //AxisAsButton SetAxisAsButton(Data.Axis(Ds3Axis.LX), config.aLRight, config.aLLeft, dsID); SetAxisAsButton(Data.Axis(Ds3Axis.LY), config.aLDown, config.aLUp, dsID); SetAxisAsButton(Data.Axis(Ds3Axis.RX), config.aRRight, config.aRLeft, dsID); SetAxisAsButton(Data.Axis(Ds3Axis.RY), config.aRDown, config.aRUp, dsID); #endregion #region Dpad //Dpad Direction DSPov = Direction.None; if (CheckDpadDs3(Data, config.pUp)) { DSPov = DSPov | Direction.Up; } if (CheckDpadDs3(Data, config.pDown)) { DSPov = DSPov | Direction.Down; } if (CheckDpadDs3(Data, config.pLeft)) { DSPov = DSPov | Direction.Left; } if (CheckDpadDs3(Data, config.pRight)) { DSPov = DSPov | Direction.Right; } //Axis as Dpad if (CheckDpadDs3AxisAsButton(Data, config.aPUp)) { DSPov = DSPov | Direction.Up; } if (CheckDpadDs3AxisAsButton(Data, config.aPDown)) { DSPov = DSPov | Direction.Down; } if (CheckDpadDs3AxisAsButton(Data, config.aPLeft)) { DSPov = DSPov | Direction.Left; } if (CheckDpadDs3AxisAsButton(Data, config.aPRight)) { DSPov = DSPov | Direction.Right; } vJPad.JoyPov(DSPov, dsID); #endregion } break; #endregion #region DS4 case DsModel.DS4: { #region Axis vJPad.JoyAxis(config.axisL2, Data.Axis(Ds4Axis.L2), dsID); vJPad.JoyAxis(config.axisR2, Data.Axis(Ds4Axis.R2), dsID); SetAxis(Data.Axis(Ds4Axis.LX), config.axisLX, config.invertLX, dsID); SetAxis(Data.Axis(Ds4Axis.LY), config.axisLY, config.invertLY, dsID); SetAxis(Data.Axis(Ds4Axis.RX), config.axisRX, config.invertRX, dsID); SetAxis(Data.Axis(Ds4Axis.RY), config.axisRY, config.invertRY, dsID); #endregion #region Buttons SetButton(Data.Button(Ds4Button.Cross), config.cross, dsID); SetButton(Data.Button(Ds4Button.Circle), config.circle, dsID); SetButton(Data.Button(Ds4Button.Square), config.square, dsID); SetButton(Data.Button(Ds4Button.Triangle), config.triangle, dsID); SetButton(Data.Button(Ds4Button.L1), config.l1, dsID); SetButton(Data.Button(Ds4Button.R1), config.r1, dsID); SetButton(Data.Button(Ds4Button.L2), config.l2, dsID); SetButton(Data.Button(Ds4Button.R2), config.r2, dsID); SetButton(Data.Button(Ds4Button.Share), config.select_share, dsID); SetButton(Data.Button(Ds4Button.Options), config.start_options, dsID); SetButton(Data.Button(Ds4Button.L3), config.l3, dsID); SetButton(Data.Button(Ds4Button.R3), config.r3, dsID); SetButton(Data.Button(Ds4Button.PS), config.ps, dsID); //Dpad as button SetButton(Data.Button(Ds4Button.Up), config.up, dsID); SetButton(Data.Button(Ds4Button.Down), config.down, dsID); SetButton(Data.Button(Ds4Button.Left), config.left, dsID); SetButton(Data.Button(Ds4Button.Right), config.right, dsID); //AxisAsButton SetAxisAsButton(Data.Axis(Ds4Axis.LX), config.aLRight, config.aLLeft, dsID); SetAxisAsButton(Data.Axis(Ds4Axis.LY), config.aLDown, config.aLUp, dsID); SetAxisAsButton(Data.Axis(Ds4Axis.RX), config.aRRight, config.aRLeft, dsID); SetAxisAsButton(Data.Axis(Ds4Axis.RY), config.aRDown, config.aRUp, dsID); #endregion #region Dpad //Dpad Direction DSPov = Direction.None; if (CheckDpadDs4(Data, config.pUp)) { DSPov = DSPov | Direction.Up; } if (CheckDpadDs4(Data, config.pDown)) { DSPov = DSPov | Direction.Down; } if (CheckDpadDs4(Data, config.pLeft)) { DSPov = DSPov | Direction.Left; } if (CheckDpadDs4(Data, config.pRight)) { DSPov = DSPov | Direction.Right; } //Axis as Dpad if (CheckDpadDs4AxisAsButton(Data, config.aPUp)) { DSPov = DSPov | Direction.Up; } if (CheckDpadDs4AxisAsButton(Data, config.aPDown)) { DSPov = DSPov | Direction.Down; } if (CheckDpadDs4AxisAsButton(Data, config.aPLeft)) { DSPov = DSPov | Direction.Left; } if (CheckDpadDs4AxisAsButton(Data, config.aPRight)) { DSPov = DSPov | Direction.Right; } vJPad.JoyPov(DSPov, dsID); #endregion } break; #endregion } vJPad.JoySubmit(dsID); } }
private bool CheckDpadDs4AxisAsButton(DsPacket Data, DSAxis parAxis) { if (parAxis.DS4 != Ds4Axis.None) { return CheckDpadAxisAsButton(Data.Axis(parAxis.DS4), parAxis.triggerHigh); } else { return false; } }
protected virtual void SampleDs4(DsPacket Packet) { m_dx = Mouse(Packet.Axis(Ds4Axis.RX), m_vx); m_dy = Mouse(Packet.Axis(Ds4Axis.RY), m_vy); }