internal DsPacket(Byte[] Native) { Byte[] Local = new Byte[6]; Array.Copy(Native, (Int32)DsOffset.Address, Local, 0, Local.Length); m_Detail = new DsDetail( (DsPadId)Native[(Int32)DsOffset.Pad], (DsState)Native[(Int32)DsOffset.State], (DsModel)Native[(Int32)DsOffset.Model], Local, (DsConnection)Native[(Int32)DsOffset.Connection], (DsBattery)Native[(Int32)DsOffset.Battery] ); m_Packet = (Int32)(Native[4] << 0 | Native[5] << 8 | Native[6] << 16 | Native[7] << 24); m_Native = Native; switch (m_Detail.Model) { case DsModel.DS3: m_Ds3Button = (Ds3Button)((Native[10] << 0) | (Native[11] << 8) | (Native[12] << 16) | (Native[13] << 24)); break; case DsModel.DS4: m_Ds4Button = (Ds4Button)((Native[13] << 0) | (Native[14] << 8) | ((Native[15] & 0x03) << 16)); break; } }
internal DsPacket Load(byte[] Native) { Array.Copy(Native, (int)DsOffset.Address, m_Local, 0, m_Local.Length); m_Detail.Load( (DsPadId)Native[(int)DsOffset.Pad], (DsState)Native[(int)DsOffset.State], (DsModel)Native[(int)DsOffset.Model], m_Local, (DsConnection)Native[(int)DsOffset.Connection], (DsBattery)Native[(int)DsOffset.Battery] ); m_Packet = Native[4] << 0 | Native[5] << 8 | Native[6] << 16 | Native[7] << 24; Array.Copy(Native, m_Native, m_Native.Length); switch (m_Detail.Model) { case DsModel.DS3: m_Ds3Button = (Ds3Button)((Native[10] << 0) | (Native[11] << 8) | (Native[12] << 16) | (Native[13] << 24)); break; case DsModel.DS4: m_Ds4Button = (Ds4Button)((Native[13] << 0) | (Native[14] << 8) | ((Native[15] & 0x03) << 16)); break; } return(this); }
public bool GetButtonDown(PlayerIndex playerIndex, Ds4Button btn) { if (playerIndex == PlayerIndex.One || playerIndex == PlayerIndex.Two) { return(false); } int indexToUse = GetCorrectIndex(playerIndex); switch (btn) { case Ds4Button.Cross: return(Input.GetButtonDown("SkillOne" + indexToUse.ToString())); case Ds4Button.Circle: return(Input.GetButtonDown("SkillTwo" + indexToUse.ToString())); case Ds4Button.Square: return(Input.GetButtonDown("Shoot" + indexToUse.ToString())); default: break; } return(false); }
public Boolean Button(Ds4Button Flag) { if (m_Detail.Model != DsModel.DS4) { throw new InvalidEnumArgumentException(); } return(m_Ds4Button.HasFlag(Flag)); }
internal void Remapped() { switch (m_Detail.Model) { case DsModel.DS3: m_Ds3Button = (Ds3Button)((Native[10] << 0) | (Native[11] << 8) | (Native[12] << 16) | (Native[13] << 24)); break; case DsModel.DS4: m_Ds4Button = (Ds4Button)((Native[13] << 0) | (Native[14] << 8) | ((Native[15] & 0x03) << 16)); break; } }
public bool GetButtonUp(PlayerIndex playerIndex, Ds4Button btn) { if (playerIndex == PlayerIndex.Two || playerIndex == PlayerIndex.One) { return(_joystickInstance.GetButtonUp(playerIndex, btn)); } else { return(_joystickInstance.GetButtonUp(playerIndex, btn) || _keyboardInstance.GetButtonUp(playerIndex, btn)); } }
public bool GetButtonUp(PlayerIndex playerIndex, Ds4Button btn) { var curState = GetCurState(playerIndex); var lastState = GetLastState(playerIndex); switch (btn) { case Ds4Button.Cross: return(curState.Buttons.A == ButtonState.Released && lastState.Buttons.A == ButtonState.Pressed); case Ds4Button.Circle: return(curState.Buttons.B == ButtonState.Released && lastState.Buttons.B == ButtonState.Pressed); case Ds4Button.Square: return(curState.Buttons.X == ButtonState.Released && lastState.Buttons.X == ButtonState.Pressed); case Ds4Button.Triangle: return(curState.Buttons.Y == ButtonState.Released && lastState.Buttons.Y == ButtonState.Pressed); case Ds4Button.R1: return(curState.Buttons.RightShoulder == ButtonState.Released && lastState.Buttons.RightShoulder == ButtonState.Pressed); case Ds4Button.L1: return(curState.Buttons.LeftShoulder == ButtonState.Released && lastState.Buttons.LeftShoulder == ButtonState.Pressed); //Pad case Ds4Button.Left: return(curState.DPad.Left == ButtonState.Released && lastState.DPad.Left == ButtonState.Pressed); case Ds4Button.Down: return(curState.DPad.Down == ButtonState.Released && lastState.DPad.Down == ButtonState.Pressed); case Ds4Button.Right: return(curState.DPad.Right == ButtonState.Released && lastState.DPad.Right == ButtonState.Pressed); case Ds4Button.Up: return(curState.DPad.Up == ButtonState.Released && lastState.DPad.Up == ButtonState.Pressed); } return(false); }
public bool Button(Ds4Button Flag) { if (m_Detail.Model != DsModel.DS4) throw new InvalidEnumArgumentException(); return m_Ds4Button.HasFlag(Flag); }
public bool IsTapped(Ds4Button button) { return(IsDown(button) && WasUp(button)); }
public bool IsReleased(Ds4Button button) { return(WasDown(button) && IsUp(button)); }
public bool IsUp(Ds4Button button) { return(!IsDown(button)); }
public bool WasUp(Ds4Button button) { return(!WasDown(button)); }
public virtual Boolean RemapDs4(Profile Map, Byte[] Input, Byte[] Output) { Boolean Mapped = false; try { Array.Copy(Input, Output, Input.Length); // Map Buttons Ds4Button In = (Ds4Button)(UInt32)((Input[13] << 0) | (Input[14] << 8) | (Input[15] << 16)); Ds4Button Out = In; foreach (Ds4Button Item in Map.Ds4Button.Keys) { if ((Out & Item) != Ds4Button.None) { Out ^= Item; } } foreach (Ds4Button Item in Map.Ds4Button.Keys) { if ((In & Item) != Ds4Button.None) { Out |= Map.Ds4Button[Item]; } } Output[13] = (Byte)((UInt32)Out >> 0 & 0xFF); Output[14] = (Byte)((UInt32)Out >> 8 & 0xFF); Output[15] = (Byte)((UInt32)Out >> 16 & 0xFF); // Map Axis foreach (Ds4Axis Item in Map.Ds4Axis.Keys) { switch (Item) { case Ds4Axis.LX: case Ds4Axis.LY: case Ds4Axis.RX: case Ds4Axis.RY: Output[(UInt32)Item] = 127; // Centred break; default: Output[(UInt32)Item] = 0; break; } } foreach (Ds4Axis Item in Map.Ds4Axis.Keys) { if (Map.Ds4Axis[Item] != Ds4Axis.None) { Output[(UInt32)Map.Ds4Axis[Item]] = Input[(UInt32)Item]; } } // Fix up Button-Axis Relations foreach (Ds4Button Key in Ds4ButtonAxis.Keys) { if ((Out & Key) != Ds4Button.None && Output[(UInt32)Ds4ButtonAxis[Key]] == 0) { Output[(UInt32)Ds4ButtonAxis[Key]] = 0xFF; } } Mapped = true; } catch { } return(Mapped); }
protected override void Parse(Byte[] Report) { if (Report[0] != 0x01) { return; } m_Packet++; m_ReportArgs.Report[2] = m_BatteryStatus = MapBattery(Report[30]); m_ReportArgs.Report[4] = (Byte)(m_Packet >> 0 & 0xFF); m_ReportArgs.Report[5] = (Byte)(m_Packet >> 8 & 0xFF); m_ReportArgs.Report[6] = (Byte)(m_Packet >> 16 & 0xFF); m_ReportArgs.Report[7] = (Byte)(m_Packet >> 24 & 0xFF); Ds4Button Buttons = (Ds4Button)((Report[5] << 0) | (Report[6] << 8) | (Report[7] << 16)); //++ Convert HAT to DPAD Report[5] &= 0xF0; switch ((UInt32)Buttons & 0xF) { case 0: Report[5] |= (Byte)(Ds4Button.Up); break; case 1: Report[5] |= (Byte)(Ds4Button.Up | Ds4Button.Right); break; case 2: Report[5] |= (Byte)(Ds4Button.Right); break; case 3: Report[5] |= (Byte)(Ds4Button.Right | Ds4Button.Down); break; case 4: Report[5] |= (Byte)(Ds4Button.Down); break; case 5: Report[5] |= (Byte)(Ds4Button.Down | Ds4Button.Left); break; case 6: Report[5] |= (Byte)(Ds4Button.Left); break; case 7: Report[5] |= (Byte)(Ds4Button.Left | Ds4Button.Up); break; } //-- for (int Index = 8; Index < 72; Index++) { m_ReportArgs.Report[Index] = Report[Index - 8]; } Publish(); }
public virtual Boolean Initialize(XmlDocument Map) { try { m_Remapping = false; m_Mapper.Clear(); XmlNode Node = Map.SelectSingleNode("/ScpMapper"); m_Description = Node.SelectSingleNode("Description").FirstChild.Value; m_Version = Node.SelectSingleNode("Version").FirstChild.Value; m_Active = Node.SelectSingleNode("Active").FirstChild.Value; foreach (XmlNode ProfileNode in Node.SelectNodes("Mapping/Profile")) { String Name = ProfileNode.SelectSingleNode("Name").FirstChild.Value; String Type = ProfileNode.SelectSingleNode("Type").FirstChild.Value; String Qualifier = String.Empty; try { XmlNode QualifierNode = ProfileNode.SelectSingleNode("Value"); if (QualifierNode.HasChildNodes) { Qualifier = QualifierNode.FirstChild.Value; } } catch { } Profile Profile = new Profile(Name == m_Active, Name, Type, Qualifier); try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds3Button Target = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.ParentNode.Name); Ds3Button Mapped = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.Value); Profile.Ds3Button[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds3Axis Target = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.ParentNode.Name); Ds3Axis Mapped = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.Value); Profile.Ds3Axis[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds4Button Target = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.ParentNode.Name); Ds4Button Mapped = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.Value); Profile.Ds4Button[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds4Axis Target = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.ParentNode.Name); Ds4Axis Mapped = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.Value); Profile.Ds4Axis[Target] = Mapped; } } } catch { } m_Mapper[Profile.Name] = Profile; } Int32 Mappings = m_Mapper[m_Active].Ds3Button.Count + m_Mapper[m_Active].Ds3Axis.Count + m_Mapper[m_Active].Ds4Button.Count + m_Mapper[m_Active].Ds4Axis.Count; LogDebug(String.Format("## Mapper.Initialize() - Profiles [{0}] Active [{1}] Mappings [{2}]", m_Mapper.Count, m_Active, Mappings)); m_Remapping = true; } catch { } return(m_Remapping); }
internal DsPacket Load(byte[] Native) { Buffer.BlockCopy(Native, (int)DsOffset.Address, m_Local, 0, m_Local.Length); m_Detail.Load( (DsPadId)Native[(int)DsOffset.Pad], (DsState)Native[(int)DsOffset.State], (DsModel)Native[(int)DsOffset.Model], m_Local, (DsConnection)Native[(int)DsOffset.Connection], (DsBattery)Native[(int)DsOffset.Battery] ); m_Packet = Native[4] << 0 | Native[5] << 8 | Native[6] << 16 | Native[7] << 24; Array.Copy(Native, m_Native, m_Native.Length); switch (m_Detail.Model) { case DsModel.DS3: m_Ds3Button = (Ds3Button)((Native[10] << 0) | (Native[11] << 8) | (Native[12] << 16) | (Native[13] << 24)); break; case DsModel.DS4: m_Ds4Button = (Ds4Button)((Native[13] << 0) | (Native[14] << 8) | ((Native[15] & 0x03) << 16)); break; } return this; }
public Ds4ButtonMap(Ds4Button Name, Ds4Button Value) { m_Name = Name; m_Value = Value; }
public static bool IsButtonDown(DS4State state, Ds4Button button) { switch (button) { case Ds4Button.None: return(false); case Ds4Button.Maru: return(state.Circle); case Ds4Button.Batsu: return(state.Cross); case Ds4Button.Shikaku: return(state.Square); case Ds4Button.Sankaku: return(state.Triangle); case Ds4Button.DpadRight: return(state.DpadRight); case Ds4Button.DpadDown: return(state.DpadDown); case Ds4Button.DpadLeft: return(state.DpadLeft); case Ds4Button.DpadUp: return(state.DpadUp); case Ds4Button.Options: return(state.Options); case Ds4Button.Share: return(state.Share); case Ds4Button.PS: return(state.PS); case Ds4Button.R1: return(state.R1); case Ds4Button.L1: return(state.L1); case Ds4Button.R2: return(state.R2 >= TriggerThreshold); case Ds4Button.L2: return(state.L2 >= TriggerThreshold); case Ds4Button.R3: return(state.R3); case Ds4Button.L3: return(state.L3); case Ds4Button.LeftStickLeft: return(state.LX <= StickLowerThreshold); case Ds4Button.LeftStickRight: return(state.LX >= StickUpperThreshold); case Ds4Button.RightStickLeft: return(state.RX <= StickLowerThreshold); case Ds4Button.RightStickRight: return(state.RX >= StickUpperThreshold); case Ds4Button.TouchButton: return(state.TouchButton); case Ds4Button.TouchLeft: return(state.TouchLeft); case Ds4Button.TouchRight: return(state.TouchRight); default: return(false); } }
public override void Parse(Byte[] Report) { m_Packet++; m_ReportArgs.Report[2] = m_BatteryStatus = (Byte)((Report[41] + 2) / 2); m_ReportArgs.Report[4] = (Byte)(m_Packet >> 0 & 0xFF); m_ReportArgs.Report[5] = (Byte)(m_Packet >> 8 & 0xFF); m_ReportArgs.Report[6] = (Byte)(m_Packet >> 16 & 0xFF); m_ReportArgs.Report[7] = (Byte)(m_Packet >> 24 & 0xFF); Ds4Button Buttons = (Ds4Button)((Report[16] << 0) | (Report[17] << 8) | (Report[18] << 16)); Boolean Trigger = false, Active = false; //++ Convert HAT to DPAD Report[16] &= 0xF0; switch ((UInt32)Buttons & 0xF) { case 0: Report[16] |= (Byte)(Ds4Button.Up); break; case 1: Report[16] |= (Byte)(Ds4Button.Up | Ds4Button.Right); break; case 2: Report[16] |= (Byte)(Ds4Button.Right); break; case 3: Report[16] |= (Byte)(Ds4Button.Right | Ds4Button.Down); break; case 4: Report[16] |= (Byte)(Ds4Button.Down); break; case 5: Report[16] |= (Byte)(Ds4Button.Down | Ds4Button.Left); break; case 6: Report[16] |= (Byte)(Ds4Button.Left); break; case 7: Report[16] |= (Byte)(Ds4Button.Left | Ds4Button.Up); break; } //-- // Quick Disconnect if ((Buttons & Ds4Button.L1) == Ds4Button.L1 && (Buttons & Ds4Button.R1) == Ds4Button.R1 && (Buttons & Ds4Button.PS) == Ds4Button.PS ) { Trigger = true; Report[18] ^= 0x1; } for (Int32 Index = 8; Index < 84; Index++) { m_ReportArgs.Report[Index] = Report[Index + 3]; } m_ReportArgs.Report[8] = Report[9]; // Buttons for (Int32 Index = 16; Index < 18 && !Active; Index++) { if (Report[Index] != 0) { Active = true; } } // Axis for (Int32 Index = 12; Index < 16 && !Active; Index++) { if (Report[Index] < 117 || Report[Index] > 137) { Active = true; } } // Triggers for (Int32 Index = 19; Index < 21 && !Active; Index++) { if (Report[Index] != 0) { Active = true; } } if (Active) { m_IsIdle = false; } else if (!m_IsIdle) { m_IsIdle = true; m_Idle = DateTime.Now; } if (Trigger && !m_IsDisconnect) { m_IsDisconnect = true; m_Disconnect = DateTime.Now; } else if (!Trigger && m_IsDisconnect) { m_IsDisconnect = false; } Publish(); }
public DSButton(Ds3Button parDs3Button, Ds4Button parDs4Button) { m_DS3 = parDs3Button; m_DS4 = parDs4Button; }
public virtual Int32 Parse(Byte[] Input, Byte[] Output, DsModel Type = DsModel.DS3) { Int32 Serial = IndexToSerial(Input[0]); for (Int32 Index = 0; Index < ReportSize; Index++) { Output[Index] = 0x00; } Output[0] = 0x1C; Output[4] = (Byte)((Serial >> 0) & 0xFF); Output[5] = (Byte)((Serial >> 8) & 0xFF); Output[6] = (Byte)((Serial >> 16) & 0xFF); Output[7] = (Byte)((Serial >> 24) & 0xFF); Output[9] = 0x14; X360Button XButton = X360Button.None; if (Input[1] == 0x02) // Pad is active { switch (Type) { case DsModel.DS3: { Ds3Button Buttons = (Ds3Button)((Input[10] << 0) | (Input[11] << 8) | (Input[12] << 16) | (Input[13] << 24)); if (Buttons.HasFlag(Ds3Button.Select)) { XButton |= X360Button.Back; } if (Buttons.HasFlag(Ds3Button.Start)) { XButton |= X360Button.Start; } if (Buttons.HasFlag(Ds3Button.Up)) { XButton |= X360Button.Up; } if (Buttons.HasFlag(Ds3Button.Right)) { XButton |= X360Button.Right; } if (Buttons.HasFlag(Ds3Button.Down)) { XButton |= X360Button.Down; } if (Buttons.HasFlag(Ds3Button.Left)) { XButton |= X360Button.Left; } if (Buttons.HasFlag(Ds3Button.L1)) { XButton |= X360Button.LB; } if (Buttons.HasFlag(Ds3Button.R1)) { XButton |= X360Button.RB; } if (Buttons.HasFlag(Ds3Button.Triangle)) { XButton |= X360Button.Y; } if (Buttons.HasFlag(Ds3Button.Circle)) { XButton |= X360Button.B; } if (Buttons.HasFlag(Ds3Button.Cross)) { XButton |= X360Button.A; } if (Buttons.HasFlag(Ds3Button.Square)) { XButton |= X360Button.X; } if (Buttons.HasFlag(Ds3Button.PS)) { XButton |= X360Button.Guide; } if (Buttons.HasFlag(Ds3Button.L3)) { XButton |= X360Button.LS; } if (Buttons.HasFlag(Ds3Button.R3)) { XButton |= X360Button.RS; } Output[(UInt32)X360Axis.BT_Lo] = (Byte)((UInt32)XButton >> 0 & 0xFF); Output[(UInt32)X360Axis.BT_Hi] = (Byte)((UInt32)XButton >> 8 & 0xFF); Output[(UInt32)X360Axis.LT] = Input[(UInt32)Ds3Axis.L2]; Output[(UInt32)X360Axis.RT] = Input[(UInt32)Ds3Axis.R2]; if (!DeadZone(Global.DeadZoneL, Input[(UInt32)Ds3Axis.LX], Input[(UInt32)Ds3Axis.LY])) // Left Stick DeadZone { Int32 ThumbLX = +Scale(Input[(UInt32)Ds3Axis.LX], Global.FlipLX); Int32 ThumbLY = -Scale(Input[(UInt32)Ds3Axis.LY], Global.FlipLY); Output[(UInt32)X360Axis.LX_Lo] = (Byte)((ThumbLX >> 0) & 0xFF); // LX Output[(UInt32)X360Axis.LX_Hi] = (Byte)((ThumbLX >> 8) & 0xFF); Output[(UInt32)X360Axis.LY_Lo] = (Byte)((ThumbLY >> 0) & 0xFF); // LY Output[(UInt32)X360Axis.LY_Hi] = (Byte)((ThumbLY >> 8) & 0xFF); } if (!DeadZone(Global.DeadZoneR, Input[(UInt32)Ds3Axis.RX], Input[(UInt32)Ds3Axis.RY])) // Right Stick DeadZone { Int32 ThumbRX = +Scale(Input[(UInt32)Ds3Axis.RX], Global.FlipRX); Int32 ThumbRY = -Scale(Input[(UInt32)Ds3Axis.RY], Global.FlipRY); Output[(UInt32)X360Axis.RX_Lo] = (Byte)((ThumbRX >> 0) & 0xFF); // RX Output[(UInt32)X360Axis.RX_Hi] = (Byte)((ThumbRX >> 8) & 0xFF); Output[(UInt32)X360Axis.RY_Lo] = (Byte)((ThumbRY >> 0) & 0xFF); // RY Output[(UInt32)X360Axis.RY_Hi] = (Byte)((ThumbRY >> 8) & 0xFF); } } break; case DsModel.DS4: { Ds4Button Buttons = (Ds4Button)((Input[13] << 0) | (Input[14] << 8) | (Input[15] << 16)); if (Buttons.HasFlag(Ds4Button.Share)) { XButton |= X360Button.Back; } if (Buttons.HasFlag(Ds4Button.Options)) { XButton |= X360Button.Start; } if (Buttons.HasFlag(Ds4Button.Up)) { XButton |= X360Button.Up; } if (Buttons.HasFlag(Ds4Button.Right)) { XButton |= X360Button.Right; } if (Buttons.HasFlag(Ds4Button.Down)) { XButton |= X360Button.Down; } if (Buttons.HasFlag(Ds4Button.Left)) { XButton |= X360Button.Left; } if (Buttons.HasFlag(Ds4Button.L1)) { XButton |= X360Button.LB; } if (Buttons.HasFlag(Ds4Button.R1)) { XButton |= X360Button.RB; } if (Buttons.HasFlag(Ds4Button.Triangle)) { XButton |= X360Button.Y; } if (Buttons.HasFlag(Ds4Button.Circle)) { XButton |= X360Button.B; } if (Buttons.HasFlag(Ds4Button.Cross)) { XButton |= X360Button.A; } if (Buttons.HasFlag(Ds4Button.Square)) { XButton |= X360Button.X; } if (Buttons.HasFlag(Ds4Button.PS)) { XButton |= X360Button.Guide; } if (Buttons.HasFlag(Ds4Button.L3)) { XButton |= X360Button.LS; } if (Buttons.HasFlag(Ds4Button.R3)) { XButton |= X360Button.RS; } Output[(UInt32)X360Axis.BT_Lo] = (Byte)((UInt32)XButton >> 0 & 0xFF); Output[(UInt32)X360Axis.BT_Hi] = (Byte)((UInt32)XButton >> 8 & 0xFF); Output[(UInt32)X360Axis.LT] = Input[(UInt32)Ds4Axis.L2]; Output[(UInt32)X360Axis.RT] = Input[(UInt32)Ds4Axis.R2]; if (!DeadZone(Global.DeadZoneL, Input[(UInt32)Ds4Axis.LX], Input[(UInt32)Ds4Axis.LY])) // Left Stick DeadZone { Int32 ThumbLX = +Scale(Input[(UInt32)Ds4Axis.LX], Global.FlipLX); Int32 ThumbLY = -Scale(Input[(UInt32)Ds4Axis.LY], Global.FlipLY); Output[(UInt32)X360Axis.LX_Lo] = (Byte)((ThumbLX >> 0) & 0xFF); // LX Output[(UInt32)X360Axis.LX_Hi] = (Byte)((ThumbLX >> 8) & 0xFF); Output[(UInt32)X360Axis.LY_Lo] = (Byte)((ThumbLY >> 0) & 0xFF); // LY Output[(UInt32)X360Axis.LY_Hi] = (Byte)((ThumbLY >> 8) & 0xFF); } if (!DeadZone(Global.DeadZoneR, Input[(UInt32)Ds4Axis.RX], Input[(UInt32)Ds4Axis.RY])) // Right Stick DeadZone { Int32 ThumbRX = +Scale(Input[(UInt32)Ds4Axis.RX], Global.FlipRX); Int32 ThumbRY = -Scale(Input[(UInt32)Ds4Axis.RY], Global.FlipRY); Output[(UInt32)X360Axis.RX_Lo] = (Byte)((ThumbRX >> 0) & 0xFF); // RX Output[(UInt32)X360Axis.RX_Hi] = (Byte)((ThumbRX >> 8) & 0xFF); Output[(UInt32)X360Axis.RY_Lo] = (Byte)((ThumbRY >> 0) & 0xFF); // RY Output[(UInt32)X360Axis.RY_Hi] = (Byte)((ThumbRY >> 8) & 0xFF); } } break; } } return(Input[0]); }
public virtual Boolean Construct(ref XmlDocument Map) { Boolean Constructed = true; try { XmlNode Node; XmlDocument Doc = new XmlDocument(); Node = Doc.CreateXmlDeclaration("1.0", "utf-8", String.Empty); Doc.AppendChild(Node); Node = Doc.CreateComment(String.Format(" ScpMapper Configuration Data. {0} ", DateTime.Now)); Doc.AppendChild(Node); Node = Doc.CreateNode(XmlNodeType.Element, "ScpMapper", null); { CreateTextNode(Doc, Node, "Description", "SCP Mapping File"); CreateTextNode(Doc, Node, "Version", Assembly.GetExecutingAssembly().GetName().Version.ToString()); XmlNode Mapping = Doc.CreateNode(XmlNodeType.Element, "Mapping", null); { foreach (Profile Item in m_Mapper.Values) { if (Item.Default) { CreateTextNode(Doc, Node, "Active", Item.Name); } XmlNode Profile = Doc.CreateNode(XmlNodeType.Element, "Profile", null); { CreateTextNode(Doc, Profile, "Name", Item.Name); CreateTextNode(Doc, Profile, "Type", Item.Type); CreateTextNode(Doc, Profile, "Value", Item.Qualifier); XmlNode Ds3 = Doc.CreateNode(XmlNodeType.Element, DsModel.DS3.ToString(), null); { XmlNode Button = Doc.CreateNode(XmlNodeType.Element, "Button", null); { foreach (Ds3Button Ds3Button in Item.Ds3Button.Keys) { CreateTextNode(Doc, Button, Ds3Button.ToString(), Item.Ds3Button[Ds3Button].ToString()); } } Ds3.AppendChild(Button); XmlNode Axis = Doc.CreateNode(XmlNodeType.Element, "Axis", null); { foreach (Ds3Axis Ds3Axis in Item.Ds3Axis.Keys) { CreateTextNode(Doc, Axis, Ds3Axis.ToString(), Item.Ds3Axis[Ds3Axis].ToString()); } } Ds3.AppendChild(Axis); } Profile.AppendChild(Ds3); XmlNode Ds4 = Doc.CreateNode(XmlNodeType.Element, DsModel.DS4.ToString(), null); { XmlNode Button = Doc.CreateNode(XmlNodeType.Element, "Button", null); { foreach (Ds4Button Ds4Button in Item.Ds4Button.Keys) { CreateTextNode(Doc, Button, Ds4Button.ToString(), Item.Ds4Button[Ds4Button].ToString()); } } Ds4.AppendChild(Button); XmlNode Axis = Doc.CreateNode(XmlNodeType.Element, "Axis", null); { foreach (Ds4Axis Ds4Axis in Item.Ds4Axis.Keys) { CreateTextNode(Doc, Axis, Ds4Axis.ToString(), Item.Ds4Axis[Ds4Axis].ToString()); } } Ds4.AppendChild(Axis); } Profile.AppendChild(Ds4); } Mapping.AppendChild(Profile); } } Node.AppendChild(Mapping); } Doc.AppendChild(Node); Map = Doc; } catch { Constructed = false; } return(Constructed); }
public bool IsDown(Ds4Button button) { return(Ds4Helper.IsButtonDown(CurrentState, button)); }
public bool WasDown(Ds4Button button) { return(Ds4Helper.IsButtonDown(PreviousState, button)); }