Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
20bade5
Add platform driver abstraction with Windows backend
lexm2 May 25, 2026
abee9b0
Transplant userspace-backend + GUI changes from userinterface-linux-h…
lexm2 May 27, 2026
6f3eb0b
userspace-backend: reconcile dangling Linux refs after transplant
lexm2 May 27, 2026
b7eaa54
userspace-backend-tests: make full-backend tests green on non-Windows
lexm2 May 28, 2026
1e6ff30
userspace-backend-tests: drop FakeAccelEvaluator comment
lexm2 May 28, 2026
6575825
userspace-backend: rename Contracts aliases to clear wrapper-global c…
lexm2 May 29, 2026
c533d2c
grapher: restore catch variable name in LUTPanelOptions
lexm2 May 29, 2026
b1f554f
userspace-backend: capture live mouse speed on Windows for the chart …
lexm2 May 29, 2026
1439a0f
userspace-backend: audit-driven fixes to Windows driver layer
lexm2 May 29, 2026
0e96510
userspace-backend: TODO to namespace wrapper globals on net8 migration
lexm2 May 29, 2026
241558c
userspace-backend: trim padded and verbose comments
lexm2 May 29, 2026
5ba4ce8
userspace-backend: enforce profile name uniqueness via ProfileNameVal…
lexm2 May 29, 2026
ebd4d80
RawAccel.Contracts: trim repeated comments; add versioning TODO
lexm2 May 29, 2026
0485f3c
userinterface+tests: trim padded comments to match codebase style
lexm2 May 29, 2026
40768c4
userspace-backend: unify formula defaults into FormulaDefaults
lexm2 May 29, 2026
4e85aae
userspace-backend-tests: extend formula subtype test to cover all six…
lexm2 May 30, 2026
9a4b186
Revert trimmed comments; extend gitignore for linux build artifacts
lexm2 May 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,10 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

# Linux build directories and Rust/CMake artifacts
linux/build/
linux/build-*/
linux/target/
Testing/
32 changes: 32 additions & 0 deletions RawAccel.Contracts/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace RawAccel.Contracts
{
// Mirrors common/rawaccel-base.hpp; keep values in sync with the native side.
public static class RawAccelConstants
{
public const int PollRateMin = 125;
public const int PollRateMax = 8000;

// NORMALIZED_DPI: the unit curve math uses (counts/ms at 1000 DPI).
public const double NormalizedDpi = 1000.0;

public const double DefaultTimeMin = 1000.0 / PollRateMax / 2.0;
public const double DefaultTimeMax = 100.0;

public const double WriteDelayMs = 1000.0;

public const int MaxDevIdLen = 200;
public const int MaxNameLen = 256;

public const int LutRawDataCapacity = 514;
public const int LutPointsCapacity = LutRawDataCapacity / 2;

public const string SettingsKey = "Driver settings";

// TODO: make a versioning system to update all of the versions so
// 1.7.1 issue where driver is still on 1.7.0 doesnt happen again.
public const int VersionMajor = 1;
public const int VersionMinor = 7;
public const int VersionPatch = 0;
public const string VersionString = "1.7.0";
}
}
26 changes: 26 additions & 0 deletions RawAccel.Contracts/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace RawAccel.Contracts
{
// JSON names match wrapper.cpp so settings.json round-trips unchanged.
[JsonConverter(typeof(StringEnumConverter))]
public enum AccelMode
{
classic,
jump,
natural,
synchronous,
power,
lut,
noaccel,
}

[JsonConverter(typeof(StringEnumConverter))]
public enum CapMode
{
in_out,
input,
output,
}
}
15 changes: 15 additions & 0 deletions RawAccel.Contracts/RawAccel.Contracts.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>RawAccel.Contracts</RootNamespace>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
43 changes: 43 additions & 0 deletions RawAccel.Contracts/RawAccelAccelArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Newtonsoft.Json;

namespace RawAccel.Contracts
{
// Mirrors AccelArgs in wrapper.cpp.
public class RawAccelAccelArgs
{
// Max LUT (input, output) pairs; resolves to ra::LUT_POINTS_CAPACITY.
public const int MaxLutPoints = RawAccelConstants.LutPointsCapacity;

public AccelMode mode { get; set; } = AccelMode.noaccel;

[JsonProperty("Gain / Velocity")]
public bool gain { get; set; } = true;

public double inputOffset { get; set; }
public double outputOffset { get; set; }
public double acceleration { get; set; } = 0.005;
public double decayRate { get; set; } = 0.1;
public double gamma { get; set; } = 1.0;
public double motivity { get; set; } = 1.5;
public double exponentClassic { get; set; } = 2.0;
public double scale { get; set; } = 1.0;
public double exponentPower { get; set; } = 0.05;
public double limit { get; set; } = 1.5;
public double syncSpeed { get; set; } = 5.0;
public double smooth { get; set; } = 0.5;

[JsonProperty("Cap / Jump")]
public Vec2<double> cap { get; set; } = new Vec2<double> { x = 15.0, y = 1.5 };

[JsonProperty("Cap mode")]
public CapMode capMode { get; set; } = CapMode.output;

// Native marshalling bookkeeping; not serialized.
[JsonIgnore]
public int length { get; set; }

// Carries only the populated points (length samples); native resizes
// to capacity. Empty not null: wrapper's OnDeserialized derefs Length.
public float[] data { get; set; } = System.Array.Empty<float>();
}
}
19 changes: 19 additions & 0 deletions RawAccel.Contracts/RawAccelConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace RawAccel.Contracts
{
// Root JSON contract, consumed unchanged by both the Windows wrapper
// (IOCTL) and Linux agent (socket) paths. These POCOs mirror the
// wrapper.cpp types; the JsonProperty names are the wire format
// (settings.json + driver), so renaming a field breaks compatibility.
public class RawAccelConfig
{
public string version { get; set; } = string.Empty;

public RawAccelDeviceConfig defaultDeviceConfig { get; set; } = new RawAccelDeviceConfig();

public List<RawAccelProfile> profiles { get; set; } = new List<RawAccelProfile>();

public List<RawAccelDeviceSettings> devices { get; set; } = new List<RawAccelDeviceSettings>();
}
}
32 changes: 32 additions & 0 deletions RawAccel.Contracts/RawAccelDeviceConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Newtonsoft.Json;

namespace RawAccel.Contracts
{
// Mirrors DeviceConfig in wrapper.cpp. ShouldSerialize* hide default
// values to keep the JSON compact.
public class RawAccelDeviceConfig
{
public bool disable { get; set; }

public bool setExtraInfo { get; set; }

[JsonProperty("Use constant time interval based on polling rate")]
public bool pollTimeLock { get; set; }

[JsonProperty("DPI (normalizes input speed unit: counts/ms -> in/s)")]
public int dpi { get; set; } = 1000;

[JsonProperty("Polling rate Hz (keep at 0 for automatic adjustment)")]
public int pollingRate { get; set; }

public double minimumTime { get; set; } = RawAccelConstants.DefaultTimeMin;

public double maximumTime { get; set; } = RawAccelConstants.DefaultTimeMax;

public bool ShouldSerializesetExtraInfo() => setExtraInfo;

public bool ShouldSerializeminimumTime() => minimumTime != RawAccelConstants.DefaultTimeMin;

public bool ShouldSerializemaximumTime() => maximumTime != RawAccelConstants.DefaultTimeMax;
}
}
15 changes: 15 additions & 0 deletions RawAccel.Contracts/RawAccelDeviceSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace RawAccel.Contracts
{
// Mirrors DeviceSettings in wrapper.cpp. Length limits (MaxNameLen /
// MaxDevIdLen) are enforced by the conversion layer, not here.
public class RawAccelDeviceSettings
{
public string name { get; set; } = string.Empty;

public string profile { get; set; } = string.Empty;

public string id { get; set; } = string.Empty;

public RawAccelDeviceConfig config { get; set; } = new RawAccelDeviceConfig();
}
}
50 changes: 50 additions & 0 deletions RawAccel.Contracts/RawAccelProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Newtonsoft.Json;

namespace RawAccel.Contracts
{
// Mirrors Profile in wrapper.cpp. Relaxed here (partial JSON tolerated);
// the native side does the strict all-fields-present validation.
public class RawAccelProfile
{
public string name { get; set; } = "default";

[JsonProperty("Stretches domain for horizontal vs vertical inputs")]
public Vec2<double> domainXY { get; set; } = new Vec2<double> { x = 1.0, y = 1.0 };

[JsonProperty("Stretches accel range for horizontal vs vertical inputs")]
public Vec2<double> rangeXY { get; set; } = new Vec2<double> { x = 1.0, y = 1.0 };

[JsonProperty("Whole or horizontal accel parameters")]
public RawAccelAccelArgs argsX { get; set; } = new RawAccelAccelArgs();

[JsonProperty("Vertical accel parameters")]
public RawAccelAccelArgs argsY { get; set; } = new RawAccelAccelArgs();

[JsonProperty("Input speed calculation parameters")]
public RawAccelSpeedArgs inputSpeedArgs { get; set; } = new RawAccelSpeedArgs();

[JsonProperty("Output DPI")]
public double outputDPI { get; set; } = 1000.0;

[JsonProperty("Y/X output DPI ratio (vertical sens multiplier)")]
public double yxOutputDPIRatio { get; set; } = 1.0;

[JsonProperty("L/R output DPI ratio (left sens multiplier)")]
public double lrOutputDPIRatio { get; set; } = 1.0;

[JsonProperty("U/D output DPI ratio (up sens multiplier)")]
public double udOutputDPIRatio { get; set; } = 1.0;

[JsonProperty("Degrees of rotation")]
public double rotation { get; set; }

[JsonProperty("Degrees of angle snapping")]
public double snap { get; set; }

[JsonIgnore]
public double minimumSpeed { get; set; }

[JsonProperty("Input Speed Cap")]
public double maximumSpeed { get; set; }
}
}
22 changes: 22 additions & 0 deletions RawAccel.Contracts/RawAccelSpeedArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Newtonsoft.Json;

namespace RawAccel.Contracts
{
// Mirrors SpeedArgs in wrapper.cpp.
public class RawAccelSpeedArgs
{
[JsonProperty("Whole/combined accel (set false for 'by component' mode)")]
public bool combineMagnitudes { get; set; } = true;

public double lpNorm { get; set; } = 2.0;

[JsonProperty("Time in ms after which an input is weighted at half its original value.")]
public double inputSmoothHalflife { get; set; }

[JsonProperty("Time in ms after which scale is weighted at half its original value.")]
public double scaleSmoothHalflife { get; set; }

[JsonProperty("Time in ms after which an output is weighted at half its original value.")]
public double outputSmoothHalflife { get; set; }
}
}
9 changes: 9 additions & 0 deletions RawAccel.Contracts/Vec2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace RawAccel.Contracts
{
// 2D vector for cap, domainXY, rangeXY. Mirrors Vec2<T> in wrapper.cpp.
public struct Vec2<T>
{
public T x;
public T y;
}
}
4 changes: 2 additions & 2 deletions grapher/Models/Options/LUT/LUTPanelOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private static (Vec2<float>[], int length) UserTextToPoints(string userText)
{
x = float.Parse(pointSplit[0]);
}
catch (Exception)
catch (Exception ex)
{
throw new ApplicationException($"X-value for point at index {index} is malformed. Expected: float. Given: {pointSplit[0]}", ex);
}
Expand All @@ -206,7 +206,7 @@ private static (Vec2<float>[], int length) UserTextToPoints(string userText)
{
y = float.Parse(pointSplit[1]);
}
catch (Exception)
catch (Exception ex)
{
throw new ApplicationException($"Y-value for point at index {index} is malformed. Expected: float. Given: {pointSplit[1]}", ex);
}
Expand Down
Loading