Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
- Range can now be configured per-axis.
Browse files Browse the repository at this point in the history
- Ready for release 1.09
  • Loading branch information
Valkirie committed Oct 16, 2021
1 parent 8b7219e commit 2e3fc64
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 38 deletions.
6 changes: 4 additions & 2 deletions AyaGyroAiming/AyaGyroAiming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net461</TargetFrameworks>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.18</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>0.19</Version>
<NoWin32Manifest>true</NoWin32Manifest>
<PackageProjectUrl>https://github.com/Valkirie/AyaGyroAiming</PackageProjectUrl>
<RepositoryUrl>https://github.com/Valkirie/AyaGyroAiming</RepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net461|AnyCPU'">
Expand Down
11 changes: 5 additions & 6 deletions AyaGyroAiming/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Nefarius.ViGEm.Client;
using Nefarius.ViGEm.Client.Targets;
using Nefarius.ViGEm.Client.Targets.Xbox360;
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -218,7 +216,7 @@ static void MonitorBatteryLife()
UDPServer.padMeta.BatteryStatus = DsBattery.Charging;
else if (ChargeStatus.HasFlag(BatteryChargeStatus.NoSystemBattery))
UDPServer.padMeta.BatteryStatus = DsBattery.None;
else if(ChargeStatus.HasFlag(BatteryChargeStatus.High))
else if (ChargeStatus.HasFlag(BatteryChargeStatus.High))
UDPServer.padMeta.BatteryStatus = DsBattery.High;
else if (ChargeStatus.HasFlag(BatteryChargeStatus.Low))
UDPServer.padMeta.BatteryStatus = DsBattery.Low;
Expand Down Expand Up @@ -320,12 +318,13 @@ static void UpdateSettings()
PullRate = 10,
MaxSample = 1,
Aggressivity = 0.5f,
Range = 10000.0f,
RangeAxisX = 1.0f,
RangeAxisY = 1.0f,
RangeAxisZ = 1.0f,
InvertAxisX = false,
InvertAxisY = false,
InvertAxisZ = false,
Trigger = "",
MonitorRatio = false
Trigger = ""
};
}

Expand Down
12 changes: 7 additions & 5 deletions AyaGyroAiming/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
using Nefarius.ViGEm.Client.Targets.Xbox360;

namespace AyaGyroAiming
namespace AyaGyroAiming
{
public class Settings
{
public bool GyroAiming { get; set; }
public float Aggressivity { get; set; }
public float Range { get; set; }

public float RangeAxisX { get; set; }
public float RangeAxisY { get; set; }
public float RangeAxisZ { get; set; }

public bool InvertAxisX { get; set; }
public bool InvertAxisY { get; set; }
public bool InvertAxisZ { get; set; }

public string Trigger { get; set; }
public uint PullRate { get; set; }
public uint MaxSample { get; set; }
public bool MonitorRatio { get; set; }
}
}
14 changes: 5 additions & 9 deletions AyaGyroAiming/XInputGirometer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using SharpDX.XInput;
using System;
using System.Drawing;
using System.Linq;
using System.Numerics;
using System.Windows.Forms;
using Windows.Devices.Sensors;

namespace AyaGyroAiming
Expand Down Expand Up @@ -32,7 +30,7 @@ public class XInputGirometer
float GyroStickAlpha = 0.2f;
float GyroStickMagnitude = 3.5f;
float GyroStickThreshold = 0.1f;
float GyroStickRatio = 1.7f;
float GyroStickRange = 10000.0f;

// Settings
Settings settings;
Expand Down Expand Up @@ -60,10 +58,6 @@ public void UpdateSettings(Settings _settings)
{
settings = _settings;

// resolution settings
Rectangle resolution = Screen.PrimaryScreen.Bounds;
GyroStickRatio = settings.MonitorRatio ? ((float)resolution.Width / (float)resolution.Height) : 1.0f;

poolsize = settings.MaxSample;
gyroPool = new Vector3[poolsize];

Expand Down Expand Up @@ -126,8 +120,10 @@ void GyroReadingChanged(Gyrometer sender, GyrometerReadingChangedEventArgs args)
Z = (float)(settings.InvertAxisZ ? 1.0f : -1.0f) * (float)gyroPool.Select(a => a.Z).Average(),
};

posAverage *= settings.Range;
posAverage.X *= GyroStickRatio; // take screen ratio in consideration 1.7f (16:9)
posAverage *= GyroStickRange;
posAverage.X *= settings.RangeAxisX;
posAverage.Y *= settings.RangeAxisY;
posAverage.Z *= settings.RangeAxisZ;

posAverage.X = (float)(Math.Sign(posAverage.X) * Math.Pow(Math.Abs(posAverage.X) / Gamepad.RightThumbDeadZone, settings.Aggressivity) * Gamepad.RightThumbDeadZone);
posAverage.Y = (float)(Math.Sign(posAverage.Y) * Math.Pow(Math.Abs(posAverage.Y) / Gamepad.RightThumbDeadZone, settings.Aggressivity) * Gamepad.RightThumbDeadZone);
Expand Down
9 changes: 5 additions & 4 deletions AyaGyroAiming/profiles/Kena-Win64-Shipping.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"GyroAiming": true,
"Aggressivity": 0.5,
"Range": 15000,
"RangeAxisX": 1.5,
"RangeAxisY": 1.5,
"RangeAxisZ": 1.5,
"InvertAxisX": false,
"InvertAxisY": false,
"InvertAxisZ": false,
"Trigger": "",
"Trigger": "LeftTrigger",
"PullRate": 10,
"MaxSample": 1,
"MonitorRatio": false
"MaxSample": 1
}
7 changes: 4 additions & 3 deletions AyaGyroAiming/profiles/cemu.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"GyroAiming": false,
"Aggressivity": 0.5,
"Range": 10000,
"RangeAxisX": 1.0,
"RangeAxisY": 1.0,
"RangeAxisZ": 1.0,
"InvertAxisX": false,
"InvertAxisY": false,
"InvertAxisZ": false,
"Trigger": "",
"PullRate": 10,
"MaxSample": 1,
"MonitorRatio": false
"MaxSample": 1
}
7 changes: 4 additions & 3 deletions AyaGyroAiming/profiles/default.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"GyroAiming": true,
"Aggressivity": 0.5,
"Range": 10000,
"RangeAxisX": 1.0,
"RangeAxisY": 1.0,
"RangeAxisZ": 1.0,
"InvertAxisX": false,
"InvertAxisY": false,
"InvertAxisZ": false,
"Trigger": "",
"PullRate": 10,
"MaxSample": 1,
"MonitorRatio": false
"MaxSample": 1
}
7 changes: 4 additions & 3 deletions AyaGyroAiming/profiles/ryujinx.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"GyroAiming": false,
"Aggressivity": 0.5,
"Range": 10000,
"RangeAxisX": 1.0,
"RangeAxisY": 1.0,
"RangeAxisZ": 1.0,
"InvertAxisX": false,
"InvertAxisY": false,
"InvertAxisZ": false,
"Trigger": "",
"PullRate": 10,
"MaxSample": 1,
"MonitorRatio": false
"MaxSample": 1
}
7 changes: 4 additions & 3 deletions AyaGyroAiming/profiles/yuzu.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"GyroAiming": false,
"Aggressivity": 0.5,
"Range": 10000,
"RangeAxisX": 1.0,
"RangeAxisY": 1.0,
"RangeAxisZ": 1.0,
"InvertAxisX": false,
"InvertAxisY": false,
"InvertAxisZ": false,
"Trigger": "",
"PullRate": 10,
"MaxSample": 1,
"MonitorRatio": false
"MaxSample": 1
}

0 comments on commit 2e3fc64

Please sign in to comment.