Skip to content

Commit

Permalink
Build 0.13.0.0 (#301)
Browse files Browse the repository at this point in the history
* rebase (#298)

* prevent crash on exited process when foreground window changes

* Lower TDP minimum limit as per user request (#293)

* Split UMC motion multiplier #85 (#294)

* Remove device width height ratio.

* Split sensitivity in x and y

* Improve look and text

* Tweak ranges part 2

* Add AOKZOE illustration to resource.

* build 0.12.4.0

Co-authored-by: CasperH2O <[email protected]>
Co-authored-by: CasperH <[email protected]>

* oups

* added XInputController Gamepad.TriggerThreshold

* qol

* cleanup

* add input listener to quickprofilespage

* qol

* Prevent crash on null profile

* more work on AOKZOE A1

* more work on AYANEO Next

* Fix special key colors for DualSense and Xbox One controller models.

* more work on process priority

* fixed gyro injection when target is Xbox360

* fix quickprofiles hotkey label update on profile change

* fix profile pipe update to service

* fix vibrationstrength value

* no-longer manage HIDmode at UI level

* improve lock mechanism on quickprofilespage

* misc UI improvements

* add supports for AOKZOE A1 (Home, long-press) through OEM6

* implement SetVibration

* force ShowActivated on Quicktools

* SerializeProfile on UpdateOrCreate

* Update Ayaneo 2021 OEM keys as hotkeys and 3D overlay highlight.

* Quicktools prefix TDP and motion sensitivity sliders with text info.

* Add UMC default activation to QuickTools.

* prevent running profile from being deleted

* brings back separator and improve quicktools TDP readability

* implement device specific min/max GfxClock

* prevent a crash with gfxLock

* improve suspender UI interface

* improve overall quickpages readability with reduced top/bottom margins

* beta build 0.13.0.0

Co-authored-by: CasperH2O <[email protected]>
Co-authored-by: CasperH <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2022
1 parent e05fc18 commit ccd8f68
Show file tree
Hide file tree
Showing 73 changed files with 1,718 additions and 1,584 deletions.
10 changes: 1 addition & 9 deletions ControllerCommon/Controllers/DInputController.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using ControllerCommon.Managers;
using SharpDX.DirectInput;
using SharpDX.XInput;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SharpDX.DirectInput;

namespace ControllerCommon.Controllers
{
Expand Down
13 changes: 3 additions & 10 deletions ControllerCommon/Controllers/DS4Controller.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
using ControllerCommon.Managers;
using SharpDX.DirectInput;
using SharpDX.XInput;
using SharpDX.DirectInput;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

namespace ControllerCommon.Controllers
{
public class DS4Controller : DInputController
{
public DS4Controller(Joystick joystick, PnPDetails details) : base (joystick, details)
public DS4Controller(Joystick joystick, PnPDetails details) : base(joystick, details)
{
if (!IsConnected())
return;
Expand Down Expand Up @@ -77,7 +70,7 @@ public override void UpdateReport()
if (State.Buttons[13]) // TouchpadClick
Inputs.Buttons |= ControllerButtonFlags.Special;

switch(State.PointOfViewControllers[0])
switch (State.PointOfViewControllers[0])
{
case 0:
Inputs.Buttons |= ControllerButtonFlags.DPadUp;
Expand Down
10 changes: 7 additions & 3 deletions ControllerCommon/Controllers/IController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public enum ControllerButtonFlags : ulong
OEM2 = 1073741824,
OEM3 = 2147483648,
OEM4 = 4294967296,
OEM5 = 8589934592
OEM5 = 8589934592,
OEM6 = 17179869184
}

[Serializable]
Expand All @@ -72,7 +73,7 @@ public abstract class IController
public ControllerButtonFlags prevInjectedButtons;

protected int UserIndex;
protected double VibrationStrength = 100.0d;
protected double VibrationStrength = 1.0d;

public const short UPDATE_INTERVAL = 5;

Expand Down Expand Up @@ -138,9 +139,12 @@ public void InjectButton(ControllerButtonFlags button, bool IsKeyDown, bool IsKe

public void SetVibrationStrength(double value)
{
VibrationStrength = value;
VibrationStrength = value / 100;
}

public virtual void SetVibration(ushort LargeMotor, ushort SmallMotor)
{ }

public virtual bool IsConnected()
{
return false;
Expand Down
3 changes: 1 addition & 2 deletions ControllerCommon/Controllers/NetpuneController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ControllerCommon.Managers;
using neptune_hidapi.net;
using neptune_hidapi.net;
using SharpDX.DirectInput;
using System;
using System.Threading.Tasks;
Expand Down
27 changes: 15 additions & 12 deletions ControllerCommon/Controllers/XInputController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ ref XInputCapabilitiesEx pCapabilities // [out] Receives the capabilities
private XInputStateSecret State;
private XInputStateSecret prevState;

private Vibration Vibration = new Vibration() { LeftMotorSpeed = ushort.MaxValue, RightMotorSpeed = ushort.MaxValue };

public XInputController(int index)
{
Controller = new Controller((UserIndex)index);
Expand Down Expand Up @@ -191,9 +189,9 @@ public override void UpdateReport()
if (Gamepad.Buttons.HasFlag(GamepadButtonFlags.Back))
Inputs.Buttons |= ControllerButtonFlags.Back;

if (Gamepad.LeftTrigger > 0)
if (Gamepad.LeftTrigger > Gamepad.TriggerThreshold)
Inputs.Buttons |= ControllerButtonFlags.LeftTrigger;
if (Gamepad.RightTrigger > 0)
if (Gamepad.RightTrigger > Gamepad.TriggerThreshold)
Inputs.Buttons |= ControllerButtonFlags.RightTrigger;

if (Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftThumb))
Expand Down Expand Up @@ -261,13 +259,23 @@ public override bool IsConnected()
return (bool)(Controller?.IsConnected);
}

public override void SetVibration(ushort LargeMotor, ushort SmallMotor)
{
ushort LeftMotorSpeed = (ushort)((LargeMotor * ushort.MaxValue / byte.MaxValue) * VibrationStrength);
ushort RightMotorSpeed = (ushort)((SmallMotor * ushort.MaxValue / byte.MaxValue) * VibrationStrength);

Vibration vibration = new Vibration() { LeftMotorSpeed = LeftMotorSpeed, RightMotorSpeed = RightMotorSpeed };
Controller.SetVibration(vibration);
}

public override async void Rumble()
{
for (int i = 0; i < 2; i++)
{
Controller.SetVibration(Vibration);
SetVibration(ushort.MaxValue, ushort.MaxValue);
await Task.Delay(100);
Controller.SetVibration(new Vibration());

SetVibration(0, 0);
await Task.Delay(100);
}
base.Rumble();
Expand All @@ -292,12 +300,7 @@ private void OnServerMessage(PipeMessage message)
case PipeCode.SERVER_VIBRATION:
{
PipeClientVibration e = (PipeClientVibration)message;

ushort LeftMotorSpeed = (ushort)((e.LargeMotor * ushort.MaxValue / byte.MaxValue) * VibrationStrength);
ushort RightMotorSpeed = (ushort)((e.SmallMotor * ushort.MaxValue / byte.MaxValue) * VibrationStrength);

Vibration vibration = new Vibration() { LeftMotorSpeed = LeftMotorSpeed, RightMotorSpeed = RightMotorSpeed };
Controller.SetVibration(vibration);
SetVibration(e.LargeMotor, e.SmallMotor);
}
break;
}
Expand Down
31 changes: 22 additions & 9 deletions ControllerCommon/Devices/AOKZOEA1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public AOKZOEA1() : base()
// https://www.amd.com/en/products/apu/amd-ryzen-7-6800u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 10, 28 };
this.GfxClock = new double[] { 100, 2200 };

this.AngularVelocityAxisSwap = new()
{
Expand All @@ -25,7 +26,7 @@ public AOKZOEA1() : base()
{ 'Z', 'Y' },
};

this.AccelerationAxis = new Vector3(-1.0f, -1.0f, 1.0f);
this.AccelerationAxis = new Vector3(-1.0f, 1.0f, -1.0f);
this.AccelerationAxisSwap = new()
{
{ 'X', 'X' },
Expand All @@ -34,33 +35,45 @@ public AOKZOEA1() : base()
};

// Home
listeners.Add(new DeviceChord("Home key",
listeners.Add(new DeviceChord("Home",
new List<KeyCode>() { KeyCode.LWin, KeyCode.D },
new List<KeyCode>() { KeyCode.LWin, KeyCode.D }
new List<KeyCode>() { KeyCode.LWin, KeyCode.D },
false, Controllers.ControllerButtonFlags.OEM1
));

// Home (long press 1.5s)
listeners.Add(new DeviceChord("Home, Long-press",
new List<KeyCode>() { KeyCode.LWin, KeyCode.G },
new List<KeyCode>() { KeyCode.LWin, KeyCode.G },
false, Controllers.ControllerButtonFlags.OEM6
));

// Keyboard
listeners.Add(new DeviceChord("Keyboard key",
listeners.Add(new DeviceChord("Keyboard",
new List<KeyCode>() { KeyCode.RControlKey, KeyCode.LWin, KeyCode.O },
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey }
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey },
false, Controllers.ControllerButtonFlags.OEM2
));

// Turbo
listeners.Add(new DeviceChord("Turbo key",
listeners.Add(new DeviceChord("Turbo",
new List<KeyCode>() { KeyCode.LControl, KeyCode.LWin, KeyCode.LMenu },
new List<KeyCode>() { KeyCode.LControl, KeyCode.LWin, KeyCode.LMenu },
new List<KeyCode>() { KeyCode.LControl, KeyCode.LWin, KeyCode.LMenu }
false, Controllers.ControllerButtonFlags.OEM3
));

// Home + Keyboard
listeners.Add(new DeviceChord("Home + Keyboard",
new List<KeyCode>() { KeyCode.RAlt, KeyCode.RControlKey, KeyCode.Delete },
new List<KeyCode>() { KeyCode.Delete, KeyCode.RControlKey, KeyCode.RAlt }
new List<KeyCode>() { KeyCode.Delete, KeyCode.RControlKey, KeyCode.RAlt },
false, Controllers.ControllerButtonFlags.OEM4
));

// Home + Turbo
listeners.Add(new DeviceChord("Home + Turbo",
new List<KeyCode>() { KeyCode.LWin, KeyCode.Snapshot },
new List<KeyCode>() { KeyCode.Snapshot, KeyCode.LWin }
new List<KeyCode>() { KeyCode.Snapshot, KeyCode.LWin },
false, Controllers.ControllerButtonFlags.OEM5
));
}
}
Expand Down
12 changes: 8 additions & 4 deletions ControllerCommon/Devices/AYANEO2021.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public AYANEO2021() : base()

// https://www.amd.com/fr/products/apu/amd-ryzen-5-4500u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 10, 25 };
this.cTDP = new double[] { 10, 25 };
this.GfxClock = new double[] { 100, 1750 };

this.AngularVelocityAxisSwap = new()
{
Expand All @@ -33,21 +34,24 @@ public AYANEO2021() : base()

listeners.Add(new DeviceChord("WIN key",
new List<KeyCode>() { KeyCode.LWin },
new List<KeyCode>() { KeyCode.LWin }
new List<KeyCode>() { KeyCode.LWin },
false, Controllers.ControllerButtonFlags.OEM1
));

// Conflicts with OS
//listeners.Add("TM key", new ChordClick(KeyCode.RAlt, KeyCode.RControlKey, KeyCode.Delete));

listeners.Add(new DeviceChord("ESC key",
new List<KeyCode>() { KeyCode.Escape },
new List<KeyCode>() { KeyCode.Escape }
new List<KeyCode>() { KeyCode.Escape },
false, Controllers.ControllerButtonFlags.OEM2
));

// Conflicts with Ayaspace when installed
listeners.Add(new DeviceChord("KB key",
new List<KeyCode>() { KeyCode.RControlKey, KeyCode.LWin, KeyCode.O },
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey }
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey },
false, Controllers.ControllerButtonFlags.OEM3
));
}
}
Expand Down
10 changes: 7 additions & 3 deletions ControllerCommon/Devices/AYANEO2021Pro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public AYANEO2021Pro() : base()
// https://www.amd.com/fr/products/apu/amd-ryzen-7-4800u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 10, 25 };
this.GfxClock = new double[] { 100, 1750 };

this.AngularVelocityAxisSwap = new()
{
Expand All @@ -33,21 +34,24 @@ public AYANEO2021Pro() : base()

listeners.Add(new DeviceChord("WIN key",
new List<KeyCode>() { KeyCode.LWin },
new List<KeyCode>() { KeyCode.LWin }
new List<KeyCode>() { KeyCode.LWin },
false, Controllers.ControllerButtonFlags.OEM1
));

// Conflicts with OS
//listeners.Add("TM key", new ChordClick(KeyCode.RAlt, KeyCode.RControlKey, KeyCode.Delete));

listeners.Add(new DeviceChord("ESC key",
new List<KeyCode>() { KeyCode.Escape },
new List<KeyCode>() { KeyCode.Escape }
new List<KeyCode>() { KeyCode.Escape },
false, Controllers.ControllerButtonFlags.OEM2
));

// Conflicts with Ayaspace when installed
listeners.Add(new DeviceChord("KB key",
new List<KeyCode>() { KeyCode.RControlKey, KeyCode.LWin, KeyCode.O },
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey }
new List<KeyCode>() { KeyCode.O, KeyCode.LWin, KeyCode.RControlKey },
false, Controllers.ControllerButtonFlags.OEM3
));
}
}
Expand Down
3 changes: 2 additions & 1 deletion ControllerCommon/Devices/AYANEOAIR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public AYANEOAIR() : base()

// https://www.amd.com/en/products/apu/amd-ryzen-5-5560u
this.nTDP = new double[] { 12, 12, 15 };
this.cTDP = new double[] { 8, 15 };
this.cTDP = new double[] { 8, 15 };
this.GfxClock = new double[] { 100, 1600 };

this.AngularVelocityAxisSwap = new()
{
Expand Down
3 changes: 2 additions & 1 deletion ControllerCommon/Devices/AYANEOAIRLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public AYANEOAIRLite() : base()

// https://www.amd.com/en/products/apu/amd-ryzen-5-5560u
this.nTDP = new double[] { 8, 8, 12 };
this.cTDP = new double[] { 8, 12 };
this.cTDP = new double[] { 8, 12 };
this.GfxClock = new double[] { 100, 1600 };

this.AngularVelocityAxisSwap = new()
{
Expand Down
3 changes: 2 additions & 1 deletion ControllerCommon/Devices/AYANEOAIRPro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public AYANEOAIRPro() : base()

// https://www.amd.com/en/products/apu/amd-ryzen-7-5825u
this.nTDP = new double[] { 12, 12, 15 };
this.cTDP = new double[] { 8, 18 };
this.cTDP = new double[] { 8, 18 };
this.GfxClock = new double[] { 100, 2000 };

this.AngularVelocityAxisSwap = new()
{
Expand Down
7 changes: 5 additions & 2 deletions ControllerCommon/Devices/AYANEONEXT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public AYANEONEXT() : base()
// https://www.amd.com/fr/products/apu/amd-ryzen-7-5825u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 10, 25 };
this.GfxClock = new double[] { 100, 2000 };

this.AngularVelocityAxisSwap = new()
{
Expand All @@ -34,12 +35,14 @@ public AYANEONEXT() : base()

listeners.Add(new DeviceChord("Custom key BIG",
new List<KeyCode>() { KeyCode.RControlKey, KeyCode.LWin, KeyCode.F12 },
new List<KeyCode>() { KeyCode.F12, KeyCode.LWin, KeyCode.RControlKey }
new List<KeyCode>() { KeyCode.F12, KeyCode.LWin, KeyCode.RControlKey },
false, Controllers.ControllerButtonFlags.OEM1
));

listeners.Add(new DeviceChord("Custom key Small",
new List<KeyCode>() { KeyCode.LWin, KeyCode.D },
new List<KeyCode>() { KeyCode.LWin, KeyCode.D }
new List<KeyCode>() { KeyCode.LWin, KeyCode.D },
false, Controllers.ControllerButtonFlags.OEM2
));
}
}
Expand Down
7 changes: 0 additions & 7 deletions ControllerCommon/Devices/DefaultDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ public class DefaultDevice : Device
{
public DefaultDevice() : base()
{
for (int i = (int)KeyCode.F1; i < (int)KeyCode.F12; i++)
{
listeners.Add(new DeviceChord($"Function {i}",
new List<KeyCode>() { (KeyCode)i },
new List<KeyCode>() { (KeyCode)i }
));
}
}
}
}
2 changes: 2 additions & 0 deletions ControllerCommon/Devices/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public abstract class Device
public double[] nTDP = { 15, 15, 20 };
// device configurable TDP (down, up)
public double[] cTDP = { 10, 25 };
// device GfxClock frequency limits
public double[] GfxClock = { 100, 1800 };

public Vector3 AngularVelocityAxis = new Vector3(1.0f, 1.0f, 1.0f);
public Dictionary<char, char> AngularVelocityAxisSwap = new()
Expand Down
1 change: 1 addition & 0 deletions ControllerCommon/Devices/GPDWinMax2AMD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public GPDWinMax2AMD() : base()
// https://www.amd.com/fr/products/apu/amd-ryzen-7-6800u
this.nTDP = new double[] { 15, 15, 28 };
this.cTDP = new double[] { 15, 28 };
this.GfxClock = new double[] { 100, 2200 };

this.AngularVelocityAxis = new Vector3(1.0f, 1.0f, -1.0f);
this.AngularVelocityAxisSwap = new()
Expand Down
2 changes: 2 additions & 0 deletions ControllerCommon/Devices/GPDWinMax2Intel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ public GPDWinMax2Intel() : base()
// device specific settings
this.ProductIllustration = "device_gpd_winmax2";

// https://ark.intel.com/content/www/us/en/ark/products/226254/intel-core-i71260p-processor-18m-cache-up-to-4-70-ghz.html
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 15, 28 };
this.GfxClock = new double[] { 100, 1400 };

this.AngularVelocityAxis = new Vector3(1.0f, -1.0f, 1.0f);
this.AngularVelocityAxisSwap = new()
Expand Down
1 change: 1 addition & 0 deletions ControllerCommon/Devices/OneXPlayerMiniAMD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public OneXPlayerMiniAMD() : base()
// https://www.amd.com/fr/products/apu/amd-ryzen-7-5800u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 10, 25 };
this.GfxClock = new double[] { 100, 2000 };

this.AngularVelocityAxisSwap = new()
{
Expand Down
Loading

0 comments on commit ccd8f68

Please sign in to comment.