private void DoUpdateInput(OutputControllerDualShock4InputState new_state) { controller.SetButtonState(DualShock4Button.Triangle, new_state.triangle); controller.SetButtonState(DualShock4Button.Circle, new_state.circle); controller.SetButtonState(DualShock4Button.Cross, new_state.cross); controller.SetButtonState(DualShock4Button.Square, new_state.square); controller.SetButtonState(DualShock4Button.ShoulderLeft, new_state.shoulder_left); controller.SetButtonState(DualShock4Button.ShoulderRight, new_state.shoulder_right); controller.SetButtonState(DualShock4Button.TriggerLeft, new_state.trigger_left); controller.SetButtonState(DualShock4Button.TriggerRight, new_state.trigger_right); controller.SetButtonState(DualShock4Button.ThumbLeft, new_state.thumb_left); controller.SetButtonState(DualShock4Button.ThumbRight, new_state.thumb_right); controller.SetButtonState(DualShock4Button.Share, new_state.share); controller.SetButtonState(DualShock4Button.Options, new_state.options); controller.SetButtonState(DualShock4SpecialButton.Ps, new_state.ps); controller.SetButtonState(DualShock4SpecialButton.Touchpad, new_state.touchpad); controller.SetDPadDirection(MapDPadDirection(new_state.dPad)); controller.SetAxisValue(DualShock4Axis.LeftThumbX, new_state.thumb_left_x); controller.SetAxisValue(DualShock4Axis.LeftThumbY, new_state.thumb_left_y); controller.SetAxisValue(DualShock4Axis.RightThumbX, new_state.thumb_right_x); controller.SetAxisValue(DualShock4Axis.RightThumbY, new_state.thumb_right_y); controller.SetSliderValue(DualShock4Slider.LeftTrigger, new_state.trigger_left_value); controller.SetSliderValue(DualShock4Slider.RightTrigger, new_state.trigger_right_value); controller.SubmitReport(); current_state = new_state; }
public bool IsEqual(OutputControllerDualShock4InputState other) { bool buttons = triangle == other.triangle && circle == other.circle && cross == other.cross && square == other.square && trigger_left == other.trigger_left && trigger_right == other.trigger_right && shoulder_left == other.shoulder_left && shoulder_right == other.shoulder_right && options == other.options && share == other.share && ps == other.ps && touchpad == other.touchpad && thumb_left == other.thumb_left && thumb_right == other.thumb_right && dPad == other.dPad; bool axis = thumb_left_x == other.thumb_left_x && thumb_left_y == other.thumb_left_y && thumb_right_x == other.thumb_right_x && thumb_right_y == other.thumb_right_y; bool triggers = trigger_left_value == other.trigger_left_value && trigger_right_value == other.trigger_right_value; return(buttons && axis && triggers); }
public bool UpdateInput(OutputControllerDualShock4InputState new_state) { if (current_state.IsEqual(new_state)) { return(false); } DoUpdateInput(new_state); return(true); }