Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Instructions for these are in the beginning of the [guide](Guide.md#installation
No. Once settings are passed to the driver by the GUI, they stay in use until the computer is shut down.

## Does the GUI need to be run every time I start my PC?
Yes. The driver itself does not store your settings. To enable them on PC start, run the GUI, or run `writer.exe settings.json`.
Yes. The driver itself does not store your settings. To enable them on PC start, run the GUI, or run `writer.exe %LOCALAPPDATA%\rawaccel\settings.json`.

## I don't understand something, or have some other question.
Read the guide to see if it answers your question. If not, join our [Discord](https://discord.gg/7pQh8zH) and ask.
2 changes: 1 addition & 1 deletion doc/Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Natural features a concave curve which starts at 1 and approaches some maximum s
![JumpExample](images/jump_example.png)

### Look Up Table
This curve style is a blank canvas on which to create a curve. It allows the user to define the points which will make up the curve. For this reason, this mode is only for experts who know exactly what they want. Points can be supplied in the GUI according to format x1,y1;x2,y2;...xn.yn or in the settings.json in json format. The default Windows mouse acceleration settings (Enhanced Pointer Precision) can be very closely emulated with this style, using velocity points: "1.505035,0.85549892;4.375,3.30972978;13.51,15.17478447;140,354.7026875;".
This curve style is a blank canvas on which to create a curve. It allows the user to define the points which will make up the curve. For this reason, this mode is only for experts who know exactly what they want. Points can be supplied in the GUI according to format x1,y1;x2,y2;...xn.yn or in the `%LOCALAPPDATA%\rawaccel\settings.json` file in json format. The default Windows mouse acceleration settings (Enhanced Pointer Precision) can be very closely emulated with this style, using velocity points: "1.505035,0.85549892;4.375,3.30972978;13.51,15.17478447;140,354.7026875;".
![LUTExample](images/LUT_example.png)

## Further Help
Expand Down
5 changes: 0 additions & 5 deletions grapher/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ public static class Constants
/// <summary> Text for y component. </summary>
public const string YComponent = "Y";

/// <summary> Default name of settings file. </summary>
public const string DefaultSettingsFileName = @"settings.json";

public const string GuiConfigFileName = ".config";

/// <summary> Text to directionality panel title when panel is closed. </summary>
public const string DirectionalityTitleClosed = "Anisotropy \u25BC";

Expand Down
12 changes: 11 additions & 1 deletion grapher/Common/Helper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
namespace grapher.Common
using System;
using System.IO;

namespace grapher.Common
{
public static class Helper
{
public static string GetCfgPath() => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"rawaccel");

public static string GetDefaultSettingsFilePath() => Path.Combine(
GetCfgPath(), @"settings.json");

public static double GetSensitivityFactor(Profile profile) => GetSensitivityFactor(profile.outputDPI);

public static double GetSensitivityFactor(double outputDPI) => outputDPI / Constants.DriverNormalizedDPI;
Expand Down
3 changes: 2 additions & 1 deletion grapher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ static void MakeStartupShortcut(bool gui)

try
{
if (!gui) lnk.Arguments = Constants.DefaultSettingsFileName;
if (!gui) lnk.Arguments = Helper.GetDefaultSettingsFilePath();

lnk.TargetPath = $@"{Application.StartupPath}\{name}.exe";
lnk.Save();
}
Expand Down
11 changes: 9 additions & 2 deletions grapher/Models/Serialized/GUISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public GUISettings() {}
[DefaultValue("Light Theme")]
public string CurrentColorScheme { get; set; }

[JsonIgnore]
public static string GuiConfigFileName {
get {
return Path.Combine(Helper.GetCfgPath(), ".config");
}
}

#endregion Properties

#region Methods
Expand Down Expand Up @@ -79,7 +86,7 @@ public override int GetHashCode()

public void Save()
{
File.WriteAllText(Constants.GuiConfigFileName, JsonConvert.SerializeObject(this));
File.WriteAllText(GuiConfigFileName, JsonConvert.SerializeObject(this));
}

public static GUISettings MaybeLoad()
Expand All @@ -89,7 +96,7 @@ public static GUISettings MaybeLoad()
try
{
settings = JsonConvert.DeserializeObject<GUISettings>(
File.ReadAllText(Constants.GuiConfigFileName));
File.ReadAllText(GuiConfigFileName));
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions grapher/Models/Serialized/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public bool TryActivate(DriverConfig settings, out string errors)

UserConfig = settings;
ActiveConfig = settings;
File.WriteAllText(Constants.DefaultSettingsFileName, settings.ToJSON());
File.WriteAllText(Helper.GetDefaultSettingsFilePath(), settings.ToJSON());

new Thread(() => ActiveConfig.Activate()).Start();
}
Expand Down Expand Up @@ -300,7 +300,7 @@ public void OnDeviceChangeMessage()

private DriverConfig InitActiveAndGetUserConfig()
{
var path = Constants.DefaultSettingsFileName;
var path = Helper.GetDefaultSettingsFilePath();
if (File.Exists(path))
{
try
Expand Down
4 changes: 2 additions & 2 deletions grapher/Models/Theming/IO/ThemeFileOperations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using grapher.Common;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -13,7 +13,7 @@ public class ThemeFileOperations

public IEnumerable<ColorScheme> LoadThemes()
{
ThemePath = Path.Combine(Environment.CurrentDirectory, "themes");
ThemePath = Path.Combine(Helper.GetCfgPath(), "themes");

var pathFound = Directory.Exists(ThemePath);

Expand Down