diff --git a/HandheldCompanion.iss b/HandheldCompanion.iss index 3525802ac..f8f0678b6 100644 --- a/HandheldCompanion.iss +++ b/HandheldCompanion.iss @@ -26,7 +26,7 @@ #define InstallerVersion '0.2' #define MyAppSetupName 'Handheld Companion' #define MyBuildId 'HandheldCompanion' -#define MyAppVersion '0.21.0.1' +#define MyAppVersion '0.21.2.4' #define MyAppPublisher 'BenjaminLSR' #define MyAppCopyright 'Copyright @ BenjaminLSR' #define MyAppURL 'https://github.com/Valkirie/HandheldCompanion' diff --git a/HandheldCompanion/App.config b/HandheldCompanion/App.config index ea88d8c68..87f62a2e7 100644 --- a/HandheldCompanion/App.config +++ b/HandheldCompanion/App.config @@ -68,12 +68,6 @@ 0 - - 0 - - - 0 - False @@ -87,7 +81,7 @@ 30 - False + True True @@ -186,7 +180,7 @@ True - 3 + 1 1 @@ -269,9 +263,6 @@ 2 - - 2 - 2 diff --git a/HandheldCompanion/App.xaml.cs b/HandheldCompanion/App.xaml.cs index e67b73c86..3e14c5c13 100644 --- a/HandheldCompanion/App.xaml.cs +++ b/HandheldCompanion/App.xaml.cs @@ -36,10 +36,8 @@ protected override void OnStartup(StartupEventArgs args) var CurrentAssembly = Assembly.GetExecutingAssembly(); var fileVersionInfo = FileVersionInfo.GetVersionInfo(CurrentAssembly.Location); - // set environment variables - Environment.SetEnvironmentVariable("APP_BASE_DIRECTORY", AppContext.BaseDirectory); - // initialize log + Environment.SetEnvironmentVariable("APP_BASE_DIRECTORY", AppContext.BaseDirectory); LogManager.Initialize("HandheldCompanion"); LogManager.LogInformation("{0} ({1})", CurrentAssembly.GetName(), fileVersionInfo.FileVersion); diff --git a/HandheldCompanion/Controls/ProcessEx.cs b/HandheldCompanion/Controls/ProcessEx.cs index 4847ea3bb..d11221a32 100644 --- a/HandheldCompanion/Controls/ProcessEx.cs +++ b/HandheldCompanion/Controls/ProcessEx.cs @@ -71,38 +71,55 @@ public static string GetAppCompatFlags(string Path) if (string.IsNullOrEmpty(Path)) return string.Empty; - using (var key = Registry.CurrentUser.OpenSubKey(AppCompatRegistry)) + lock (registryLock) { - string valueStr = (string)key?.GetValue(Path); - return valueStr; + try + { + using (var key = Registry.CurrentUser.OpenSubKey(AppCompatRegistry)) + { + string valueStr = (string)key?.GetValue(Path); + return valueStr; + } + } + catch { } } + + return string.Empty; } + private static object registryLock = new(); public static void SetAppCompatFlag(string Path, string Flag, bool value) { if (string.IsNullOrEmpty(Path)) return; - using (var key = Registry.CurrentUser.CreateSubKey(AppCompatRegistry, RegistryKeyPermissionCheck.ReadWriteSubTree)) + lock (registryLock) { - if (key != null) + try { - List values = new List { "~" }; ; - string valueStr = (string)key.GetValue(Path); + using (var key = Registry.CurrentUser.CreateSubKey(AppCompatRegistry, RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + if (key != null) + { + List values = new List { "~" }; ; + string valueStr = (string)key.GetValue(Path); - if (!string.IsNullOrEmpty(valueStr)) - values = valueStr.Split(' ').ToList(); + if (!string.IsNullOrEmpty(valueStr)) + values = valueStr.Split(' ').ToList(); - values.Remove(Flag); + values.Remove(Flag); - if (value) - values.Add(Flag); + if (value) + values.Add(Flag); - if (values.Count == 1 && values[0] == "~" && !string.IsNullOrEmpty(valueStr)) - key.DeleteValue(Path); - else - key.SetValue(Path, string.Join(" ", values), RegistryValueKind.String); + if (values.Count == 1 && values[0] == "~" && !string.IsNullOrEmpty(valueStr)) + key.DeleteValue(Path); + else + key.SetValue(Path, string.Join(" ", values), RegistryValueKind.String); + } + } } + catch { } } } diff --git a/HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs b/HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs index f00bb45cd..714126c6c 100644 --- a/HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs +++ b/HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs @@ -127,6 +127,6 @@ public override string GetGlyph(ButtonFlags button) return "\u2211"; } - return defaultGlyph; + return base.GetGlyph(button); } } \ No newline at end of file diff --git a/HandheldCompanion/Devices/AOKZOE/AOKZOEA2.cs b/HandheldCompanion/Devices/AOKZOE/AOKZOEA2.cs new file mode 100644 index 000000000..22985a413 --- /dev/null +++ b/HandheldCompanion/Devices/AOKZOE/AOKZOEA2.cs @@ -0,0 +1,166 @@ +using HidLibrary; +using System; +using System.Linq; +using System.Windows.Media; +using static HandheldCompanion.Utils.DeviceUtils; + +namespace HandheldCompanion.Devices; + +public class AOKZOEA2 : AOKZOEA1Pro +{ + HidDevice hidDevice; + + public AOKZOEA2() + { + // device specific settings + ProductModel = "AOKZOEA2"; + + // device specific capacities + Capabilities |= DeviceCapabilities.DynamicLighting; + Capabilities |= DeviceCapabilities.DynamicLightingBrightness; + DynamicLightingCapabilities |= LEDLevel.SolidColor; + DynamicLightingCapabilities |= LEDLevel.Rainbow; + + // LED HID Device + _vid = 0x1A2C; + _pid = 0xB001; + } + public override bool IsReady() + { + // Prepare list for all HID devices + HidDevice[] HidDeviceList = HidDevices.Enumerate(_vid, new int[] { _pid }).ToArray(); + + // Check every HID device to find LED device + foreach (HidDevice device in HidDeviceList) + { + // OneXFly device for LED control does not support a FeatureReport, hardcoded to match the Interface Number + if (device.IsConnected && device.DevicePath.Contains("&mi_00")) + { + hidDevice = device; + return true; + } + } + + return false; + } + + public override bool SetLedBrightness(int brightness) + { + // OneXFly brightness range is: 0 - 4 range, 0 is off, convert from 0 - 100 % range + brightness = (int)Math.Round(brightness / 20.0); + + // Check if device is availible + if (hidDevice is null || !hidDevice.IsConnected) + return false; + + // Define the HID message for setting brightness. + byte[] msg = { 0x00, 0x07, 0xFF, 0xFD, 0x01, 0x05, (byte)brightness }; + + // Write the HID message to set the LED brightness. + hidDevice.Write(msg); + + return true; + } + + public override bool SetLedColor(Color mainColor, Color secondaryColor, LEDLevel level, int speed = 100) + { + if (!DynamicLightingCapabilities.HasFlag(level)) + return false; + + // Data message consists of a prefix, LED option, RGB data, and closing byte (0x00) + byte[] prefix = { 0x00, 0x07, 0xFF }; + byte[] LEDOption = { 0x00 }; + byte[] rgbData = { 0x00 }; + + // Perform functions and command build-up based on LED level + switch (level) + { + case LEDLevel.SolidColor: + // Find nearest possible color due to RGB limitations of the device + Color ledColor = FindClosestColor(mainColor); + + LEDOption = new byte[] { 0xFE }; + + // RGB data repeats 20 times, fill accordingly + rgbData = Enumerable.Repeat(new[] { ledColor.R, ledColor.G, ledColor.B }, 20) + .SelectMany(colorBytes => colorBytes) + .ToArray(); + break; + + case LEDLevel.Rainbow: + // OneXConsole "Flowing Light" effect as a rainbow effect + LEDOption = new byte[] { 0x03 }; + + // RGB data empty, repeats 60 times, fill accordingly + rgbData = Enumerable.Repeat((byte)0x00, 60).ToArray(); + break; + + default: + return false; + } + + // Check if device is availible + if (hidDevice is null || !hidDevice.IsConnected) + return false; + + // Combine prefix, LED Option, RGB data, and closing byte (0x00) + byte[] msg = prefix.Concat(LEDOption).Concat(rgbData).Concat(new byte[] { 0x00 }).ToArray(); + + // Write the HID message to set the RGB color effect + hidDevice.Write(msg); + + return true; + } + + static Color FindClosestColor(Color inputColor) + { + // Predefined colors that work on the device + Color[] predefinedColors = new Color[] + { + Color.FromRgb(255, 0, 0), // Red (255,0,0) + Color.FromRgb(255, 82, 0), // Orange (255, 165, 0) + Color.FromRgb(255, 255, 0), // Yellow (255, 255, 0) + Color.FromRgb(130, 255, 0), // Lime Green (50, 205, 50) + Color.FromRgb(0, 255, 0), // Green (0, 128, 0) + Color.FromRgb(0, 255, 110), // Turquoise (Cyan) (0, 255, 255) + Color.FromRgb(0, 255, 255), // Teal (0, 128, 128) + Color.FromRgb(130, 255, 255), // Blue (? ? ?) + Color.FromRgb(0, 0, 255), // Dark Blue (? ? ?) + Color.FromRgb(122, 0, 255), // Purple (Violet) (128, 0, 128) + Color.FromRgb(255, 0, 255), // Pink (255, 182, 193) + Color.FromRgb(255, 0, 129), // Magenta (255, 0, 255) + }; + + // Initialize with the first color + Color closestColor = predefinedColors[0]; + double minDistance = CalculateDistance(inputColor, closestColor); + + // Iterate through predefined colors to find the closest one + foreach (var predefinedColor in predefinedColors) + { + double distance = CalculateDistance(inputColor, predefinedColor); + + // Update closest color if a closer one is found + if (distance < minDistance) + { + minDistance = distance; + closestColor = predefinedColor; + } + } + + // Return the closest predefined color + return closestColor; + } + + static double CalculateDistance(Color color1, Color color2) + { + // Helper method to calculate the Euclidean distance between two colors + + int deltaR = color2.R - color1.R; + int deltaG = color2.G - color1.G; + int deltaB = color2.B - color1.B; + + // Euclidean distance formula + return Math.Sqrt(deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); + } +} \ No newline at end of file diff --git a/HandheldCompanion/Devices/ASUS/ROGAlly.cs b/HandheldCompanion/Devices/ASUS/ROGAlly.cs index 803598f71..a6b731a30 100644 --- a/HandheldCompanion/Devices/ASUS/ROGAlly.cs +++ b/HandheldCompanion/Devices/ASUS/ROGAlly.cs @@ -328,6 +328,15 @@ public override bool Open() if (asusACPI is null) return false; + if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice device)) + { + device.OpenDevice(); + device.MonitorDeviceEvents = true; + + Task ReportDevice = Task.Run(async () => await device.ReadReportAsync()); + ReportDevice.ContinueWith(t => OnReport(ReportDevice.Result, device)); + } + // force M1/M2 to send F17 and F18 ConfigureController(true); @@ -369,13 +378,7 @@ public override bool IsReady() if (device.ReadFeatureData(out byte[] data, INPUT_HID_ID)) { - device.OpenDevice(); - device.MonitorDeviceEvents = true; - hidDevices[INPUT_HID_ID] = device; - - Task ReportDevice = Task.Run(async () => await device.ReadReportAsync()); - ReportDevice.ContinueWith(t => OnReport(ReportDevice.Result, device)); } else if (device.ReadFeatureData(out data, AURA_HID_ID)) { @@ -383,18 +386,19 @@ public override bool IsReady() } } - hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice hidDevice); - if (hidDevice is null || !hidDevice.IsConnected) - return false; + if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice hidDevice)) + { + PnPDevice pnpDevice = PnPDevice.GetDeviceByInterfaceId(hidDevice.DevicePath); + string device_parent = pnpDevice.GetProperty(DevicePropertyKey.Device_Parent); - PnPDevice pnpDevice = PnPDevice.GetDeviceByInterfaceId(hidDevice.DevicePath); - string device_parent = pnpDevice.GetProperty(DevicePropertyKey.Device_Parent); + PnPDevice pnpParent = PnPDevice.GetDeviceByInstanceId(device_parent); + Guid parent_guid = pnpParent.GetProperty(DevicePropertyKey.Device_ClassGuid); + string parent_instanceId = pnpParent.GetProperty(DevicePropertyKey.Device_InstanceId); - PnPDevice pnpParent = PnPDevice.GetDeviceByInstanceId(device_parent); - Guid parent_guid = pnpParent.GetProperty(DevicePropertyKey.Device_ClassGuid); - string parent_instanceId = pnpParent.GetProperty(DevicePropertyKey.Device_InstanceId); + return DeviceHelper.IsDeviceAvailable(parent_guid, parent_instanceId); + } - return DeviceHelper.IsDeviceAvailable(parent_guid, parent_instanceId); + return false; } private void OnReport(HidReport result, HidDevice device) @@ -612,7 +616,7 @@ public override string GetGlyph(ButtonFlags button) return "\u2213"; } - return defaultGlyph; + return base.GetGlyph(button); } private void ConfigureController(bool Remap) diff --git a/HandheldCompanion/Devices/AYANEO/AYANEO2021.cs b/HandheldCompanion/Devices/AYANEO/AYANEO2021.cs index 48804a09f..304ce64ac 100644 --- a/HandheldCompanion/Devices/AYANEO/AYANEO2021.cs +++ b/HandheldCompanion/Devices/AYANEO/AYANEO2021.cs @@ -70,6 +70,6 @@ public override string GetGlyph(ButtonFlags button) return "\u243D"; } - return defaultGlyph; + return base.GetGlyph(button); } } \ No newline at end of file diff --git a/HandheldCompanion/Devices/AYANEO/AYANEOFlipDS.cs b/HandheldCompanion/Devices/AYANEO/AYANEOFlipDS.cs new file mode 100644 index 000000000..75ed73d51 --- /dev/null +++ b/HandheldCompanion/Devices/AYANEO/AYANEOFlipDS.cs @@ -0,0 +1,22 @@ +namespace HandheldCompanion.Devices; + +public class AYANEOFlipDS : AYANEOFlipKB +{ + public AYANEOFlipDS() + { + // device specific settings + this.ProductIllustration = "device_aya_flip_ds"; + this.ProductModel = "AYANEO Flip DS"; + + // TODO: Check if there really is no RGB but looks like it + this.Capabilities -= DeviceCapabilities.DynamicLighting; + this.Capabilities -= DeviceCapabilities.DynamicLightingBrightness; + + // TODO: Add OEMChords for "Dual-Screen Keys" key here + } + + protected void CEcControl_SetSecDispBrightness(short brightness) + { + this.ECRAMWrite(0x4e, (byte)((brightness * 0xff) / 100)); + } +} \ No newline at end of file diff --git a/HandheldCompanion/Devices/AYANEO/AYANEOFlipKB.cs b/HandheldCompanion/Devices/AYANEO/AYANEOFlipKB.cs new file mode 100644 index 000000000..3e32adb8b --- /dev/null +++ b/HandheldCompanion/Devices/AYANEO/AYANEOFlipKB.cs @@ -0,0 +1,25 @@ +using HandheldCompanion.Inputs; +using System.Collections.Generic; +using System.Windows.Media; +using WindowsInput.Events; +namespace HandheldCompanion.Devices; + +public class AYANEOFlipKB : AYANEO.AYANEODeviceCEc +{ + public AYANEOFlipKB() + { + // device specific settings + this.ProductIllustration = "device_aya_flip_kb"; + this.ProductModel = "AYANEO Flip KB"; + + // https://www.amd.com/en/products/apu/amd-ryzen-7-7840u + // https://www.amd.com/en/products/apu/amd-ryzen-7-8840u + this.nTDP = new double[] { 15, 15, 20 }; + this.cTDP = new double[] { 3, 28 }; + this.GfxClock = new double[] { 100, 2700 }; + this.CpuClock = 5100; + + + // TODO: Add OEMChords for "three dots" key here + } +} \ No newline at end of file diff --git a/HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs b/HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs index 7cb05f4f8..a46e71831 100644 --- a/HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs +++ b/HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs @@ -59,6 +59,6 @@ public override string GetGlyph(ButtonFlags button) return "\u220B"; } - return defaultGlyph; + return base.GetGlyph(button); } } \ No newline at end of file diff --git a/HandheldCompanion/Devices/Ayn/AynLoki.cs b/HandheldCompanion/Devices/Ayn/AynLoki.cs index fa6bdd612..9211c6fb6 100644 --- a/HandheldCompanion/Devices/Ayn/AynLoki.cs +++ b/HandheldCompanion/Devices/Ayn/AynLoki.cs @@ -172,6 +172,6 @@ public override string GetGlyph(ButtonFlags button) return "\u220D"; } - return defaultGlyph; + return base.GetGlyph(button); } } \ No newline at end of file diff --git a/HandheldCompanion/Devices/GPD/GPDWin3.cs b/HandheldCompanion/Devices/GPD/GPDWin3.cs index 1d57fad14..521213c28 100644 --- a/HandheldCompanion/Devices/GPD/GPDWin3.cs +++ b/HandheldCompanion/Devices/GPD/GPDWin3.cs @@ -39,8 +39,8 @@ public override string GetGlyph(ButtonFlags button) return "\u220E"; case ButtonFlags.OEM2: return "\u220F"; - } - - return defaultGlyph; + } + + return base.GetGlyph(button); } } \ No newline at end of file diff --git a/HandheldCompanion/Devices/GPD/GPDWin4-2024-8640U.cs b/HandheldCompanion/Devices/GPD/GPDWin4-2024-8640U.cs new file mode 100644 index 000000000..dde4bce38 --- /dev/null +++ b/HandheldCompanion/Devices/GPD/GPDWin4-2024-8640U.cs @@ -0,0 +1,11 @@ +namespace HandheldCompanion.Devices; + +public class GPDWin4_2024_8640U : GPDWin4_2024_8840U +{ + public GPDWin4_2024_8640U() + { + // https://www.amd.com/en/support/apu/amd-ryzen-processors/amd-ryzen-5-processors-radeon-graphics/amd-ryzen-5-8640u + GfxClock = new double[] { 200, 2600 }; + CpuClock = 4900; + } +} diff --git a/HandheldCompanion/Devices/GPD/GPDWin4-2024-8840U.cs b/HandheldCompanion/Devices/GPD/GPDWin4-2024-8840U.cs new file mode 100644 index 000000000..881ff45f5 --- /dev/null +++ b/HandheldCompanion/Devices/GPD/GPDWin4-2024-8840U.cs @@ -0,0 +1,88 @@ +using HandheldCompanion.Inputs; +using System.Collections.Generic; +using System.Numerics; +using WindowsInput.Events; + +namespace HandheldCompanion.Devices; + +public class GPDWin4_2024_8840U : IDevice +{ + public GPDWin4_2024_8840U() + { + // device specific settings + ProductIllustration = "device_gpd4"; + + // https://www.amd.com/en/products/apu/amd-ryzen-7-8840u + nTDP = new double[] { 15, 15, 28 }; + cTDP = new double[] { 5, 30 }; + GfxClock = new double[] { 200, 2700 }; + CpuClock = 5100; + + // device specific capacities + Capabilities = DeviceCapabilities.FanControl; + + ECDetails = new ECDetails + { + AddressFanControl = 0x275, + AddressFanDuty = 0x1809, + AddressStatusCommandPort = 0x4E, + AddressDataPort = 0x4F, + FanValueMin = 0, + FanValueMax = 184 + }; + + GyrometerAxis = new Vector3(1.0f, -1.0f, -1.0f); + GyrometerAxisSwap = new SortedDictionary + { + { 'X', 'Y' }, + { 'Y', 'Z' }, + { 'Z', 'X' } + }; + + AccelerometerAxis = new Vector3(-1.0f, -1.0f, 1.0f); + AccelerometerAxisSwap = new SortedDictionary + { + { 'X', 'X' }, + { 'Y', 'Z' }, + { 'Z', 'Y' } + }; + + // Note, OEM1 not configured as this device has it's own Menu button for guide button + + // Note, chords need to be manually configured in GPD app first by end user + + // GPD Back buttons do not have a "hold", configured buttons are key down and up immediately + // Holding back buttons will result in same key down and up input every 2-3 seconds + // Configured chords in GPD app need unique characters otherwise this leads to a + // "mixed" result when pressing both buttons at the same time + OEMChords.Add(new DeviceChord("Bottom button left", + new List { KeyCode.F11, KeyCode.L }, + new List { KeyCode.F11, KeyCode.L }, + false, ButtonFlags.OEM2 + )); + + OEMChords.Add(new DeviceChord("Bottom button right", + new List { KeyCode.F12, KeyCode.R }, + new List { KeyCode.F12, KeyCode.R }, + false, ButtonFlags.OEM3 + )); + } + + public override string GetGlyph(ButtonFlags button) + { + switch (button) + { + case ButtonFlags.OEM2: + return "\u220E"; + case ButtonFlags.OEM3: + return "\u220F"; + } + + return defaultGlyph; + } + + public override void Close() + { + base.Close(); + } +} diff --git a/HandheldCompanion/Devices/IDevice.cs b/HandheldCompanion/Devices/IDevice.cs index 37b62377f..b96973111 100644 --- a/HandheldCompanion/Devices/IDevice.cs +++ b/HandheldCompanion/Devices/IDevice.cs @@ -241,6 +241,9 @@ public static IDevice GetCurrent() case "AOKZOE A1 Pro": device = new AOKZOEA1Pro(); break; + case "AOKZOE A2 Pro": + device = new AOKZOEA2(); + break; } } break; @@ -303,6 +306,12 @@ public static IDevice GetCurrent() case "GEEK 1S": device = new AYANEO2S(); break; + case "FLIP KB": + device = new AYANEOFlipKB(); + break; + case "FLIP DS": + device = new AYANEOFlipDS(); + break; } } break; @@ -351,6 +360,13 @@ public static IDevice GetCurrent() case "AMD Ryzen 7 7840U w/ Radeon 780M Graphics": device = new GPDWin4_2023_7840U(); break; + case "AMD Ryzen 5 8640U w/ Radeon 760M Graphics": + device = new GPDWin4_2024_8640U(); + break; + case "AMD Ryzen 7 8840U w/ Radeon 780M Graphics": + device = new GPDWin4_2024_8840U(); + break; + } break; case "G1619-03": @@ -368,6 +384,12 @@ public static IDevice GetCurrent() { switch (ProductName) { + case "ONEXPLAYER X1 i": + device = new OneXPlayerX1Intel(); + break; + case "ONEXPLAYER X1 a": // TDOO: check name after release + device = new OneXPlayerX1AMD(); + break; case "ONEXPLAYER F1": { switch (Version) @@ -844,13 +866,13 @@ public string GetButtonName(ButtonFlags button) public GlyphIconInfo GetGlyphIconInfo(ButtonFlags button, int fontIconSize = 14) { - var glyph = GetGlyph(button); + string? glyph = GetGlyph(button); return new GlyphIconInfo { Name = GetButtonName(button), - Glyph = glyph, - FontSize = glyph is not null ? 28 : fontIconSize, - FontFamily = glyph is not null ? GlyphFontFamily : null, + Glyph = glyph is not null ? glyph : defaultGlyph, + FontSize = fontIconSize, + FontFamily = GlyphFontFamily, Foreground = null }; } @@ -858,7 +880,7 @@ public GlyphIconInfo GetGlyphIconInfo(ButtonFlags button, int fontIconSize = 14) [Obsolete("GetFontIcon has dependencies on UI and should be avoided. Use GetGlyphIconInfo instead.")] public FontIcon GetFontIcon(ButtonFlags button, int FontIconSize = 14) { - var FontIcon = new FontIcon + FontIcon FontIcon = new FontIcon { Glyph = GetGlyph(button), FontSize = FontIconSize, @@ -866,10 +888,7 @@ public FontIcon GetFontIcon(ButtonFlags button, int FontIconSize = 14) }; if (FontIcon.Glyph is not null) - { FontIcon.FontFamily = GlyphFontFamily; - FontIcon.FontSize = 28; - } return FontIcon; } diff --git a/HandheldCompanion/Devices/MSI/ClawA1M.cs b/HandheldCompanion/Devices/MSI/ClawA1M.cs index f6504282f..fae80b0ec 100644 --- a/HandheldCompanion/Devices/MSI/ClawA1M.cs +++ b/HandheldCompanion/Devices/MSI/ClawA1M.cs @@ -2,6 +2,7 @@ using HandheldCompanion.Managers; using HandheldCompanion.Utils; using HidLibrary; +using Nefarius.Utilities.DeviceManagement.PnP; using System; using System.Collections.Generic; using System.Management; @@ -72,6 +73,9 @@ private enum CommandType private ManagementEventWatcher? specialKeyWatcher; private Dictionary hidDevices = new(); + // todo: find the right value, this is placeholder + private const byte INPUT_HID_ID = 0x01; + public ClawA1M() { // device specific settings @@ -235,11 +239,23 @@ public override bool IsReady() if (device.Capabilities.InputReportByteLength != 64) continue; - byte[] msg = { 15, 0, 0, 60, (byte)CommandType.SwitchMode, (byte)GamepadMode.XInput, (byte)MKeysFunction.Macro }; - device.Write(msg); + hidDevices[INPUT_HID_ID] = device; + break; } - return true; + if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice hidDevice)) + { + PnPDevice pnpDevice = PnPDevice.GetDeviceByInterfaceId(hidDevice.DevicePath); + string device_parent = pnpDevice.GetProperty(DevicePropertyKey.Device_Parent); + + PnPDevice pnpParent = PnPDevice.GetDeviceByInstanceId(device_parent); + Guid parent_guid = pnpParent.GetProperty(DevicePropertyKey.Device_ClassGuid); + string parent_instanceId = pnpParent.GetProperty(DevicePropertyKey.Device_InstanceId); + + return DeviceHelper.IsDeviceAvailable(parent_guid, parent_instanceId); + } + + return false; } public override bool Open() @@ -251,6 +267,13 @@ public override bool Open() // start WMI event monitor StartWatching(); + // configure controller to XInput + if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice device)) + { + byte[] msg = { 15, 0, 0, 60, (byte)CommandType.SwitchMode, (byte)GamepadMode.XInput, (byte)MKeysFunction.Macro }; + device.Write(msg); + } + return true; } @@ -259,6 +282,26 @@ public override void Close() // stop WMI event monitor StopWatching(); + // configure controller to Desktop + if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice device)) + { + byte[] msg = { 15, 0, 0, 60, (byte)CommandType.SwitchMode, (byte)GamepadMode.Desktop, (byte)MKeysFunction.Macro }; + device.Write(msg); + } + + // close devices + foreach (HidDevice hidDevice in hidDevices.Values) + { + if (!hidDevice.IsConnected) + continue; + + if (hidDevice.IsOpen) + { + hidDevice.MonitorDeviceEvents = false; + hidDevice.CloseDevice(); + } + } + base.Close(); } diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs new file mode 100644 index 000000000..b55401dc8 --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs @@ -0,0 +1,84 @@ +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using System.Collections.Generic; +using System.Numerics; +using WindowsInput.Events; + +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1 : IDevice +{ + public OneXPlayerX1() + { + // device specific settings + ProductIllustration = "device_onexplayer_x1"; + ProductModel = "ONEXPLAYERX1"; + + GyrometerAxis = new Vector3(1.0f, -1.0f, 1.0f); + GyrometerAxisSwap = new SortedDictionary + { + { 'X', 'X' }, + { 'Y', 'Z' }, + { 'Z', 'Y' }, + }; + + AccelerometerAxis = new Vector3(1.0f, -1.0f, -1.0f); + AccelerometerAxisSwap = new SortedDictionary + { + { 'X', 'X' }, + { 'Y', 'Z' }, + { 'Z', 'Y' }, + }; + + // device specific capacities + Capabilities = DeviceCapabilities.FanControl; + + ECDetails = new ECDetails + { + AddressFanControl = 0x44A, + AddressFanDuty = 0x44B, + AddressStatusCommandPort = 0x4E, + AddressDataPort = 0x4F, + FanValueMin = 0, + FanValueMax = 184 + }; + + OEMChords.Add(new DeviceChord("Turbo", + new List { KeyCode.RControlKey, KeyCode.LWin, KeyCode.LMenu }, + new List { KeyCode.LMenu, KeyCode.LWin, KeyCode.RControlKey }, + false, ButtonFlags.OEM1 + )); + } + + public override string GetGlyph(ButtonFlags button) + { + switch (button) + { + case ButtonFlags.OEM1: + return "\u2211"; + } + + return defaultGlyph; + } + + public override bool Open() + { + var success = base.Open(); + if (!success) + return false; + + // allow OneX button to pass key inputs + LogManager.LogInformation("Unlocked {0} OEM button", ButtonFlags.OEM1); + + ECRamDirectWrite(0x4EB, ECDetails, 0x40); + + return ECRamReadByte(0x4EB, ECDetails) == 0x40; + } + + public override void Close() + { + LogManager.LogInformation("Locked {0} OEM button", ButtonFlags.OEM1); + ECRamDirectWrite(0x4EB, ECDetails, 0x00); + base.Close(); + } +} diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs new file mode 100644 index 000000000..a8af602c0 --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs @@ -0,0 +1,22 @@ +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using HandheldCompanion.Misc; +using System; +using System.Collections.Generic; +using System.Numerics; +using WindowsInput.Events; +using static HandheldCompanion.Utils.DeviceUtils; + +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1AMD : OneXPlayerX1 +{ + public OneXPlayerX1AMD() + { + // https://www.amd.com/en/products/apu/amd-ryzen-7-8840u + nTDP = new double[] { 15, 15, 28 }; + cTDP = new double[] { 15, 30 }; + GfxClock = new double[] { 100, 2700 }; + CpuClock = 5100; + } +} diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs new file mode 100644 index 000000000..5919b66db --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs @@ -0,0 +1,14 @@ +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1Intel : OneXPlayerX1 +{ + public OneXPlayerX1Intel() + { + // https://www.intel.com/content/www/us/en/products/sku/236847/intel-core-ultra-7-processor-155h-24m-cache-up-to-4-80-ghz/specifications.html + // follow the values presented in OneXConsole + nTDP = new double[] { 15, 15, 35 }; + cTDP = new double[] { 6, 35 }; + GfxClock = new double[] { 100, 2250 }; + CpuClock = 4800; + } +} diff --git a/HandheldCompanion/Devices/Valve/SteamDeck.cs b/HandheldCompanion/Devices/Valve/SteamDeck.cs index 82866112d..3198581fe 100644 --- a/HandheldCompanion/Devices/Valve/SteamDeck.cs +++ b/HandheldCompanion/Devices/Valve/SteamDeck.cs @@ -84,7 +84,7 @@ public SteamDeck() cTDP = new double[] { 4, 15 }; // https://www.techpowerup.com/gpu-specs/steam-deck-gpu.c3897 - GfxClock = new double[] { 200, 1600 }; + GfxClock = new double[] { 200, 2500 }; CpuClock = 3500; OEMChords.Add(new DeviceChord("...", diff --git a/HandheldCompanion/HandheldCompanion.csproj b/HandheldCompanion/HandheldCompanion.csproj index b6e102c4b..de71d5550 100644 --- a/HandheldCompanion/HandheldCompanion.csproj +++ b/HandheldCompanion/HandheldCompanion.csproj @@ -12,7 +12,7 @@ HandheldCompanion.App $(SolutionDir)bin\$(Configuration) Resources\icon.ico - 0.21.0.1 + 0.21.2.4 app.manifest AnyCPU;x64;x86 true @@ -63,7 +63,9 @@ - + + + @@ -80,6 +82,7 @@ + @@ -108,7 +111,9 @@ - + + + @@ -139,6 +144,7 @@ + @@ -150,13 +156,12 @@ - + - - + - + @@ -165,7 +170,6 @@ - @@ -2312,12 +2316,24 @@ ..\Resources\HidLibrary.dll + + ..\Resources\iNKORE.UI.WPF.dll + + + ..\Resources\Inkore.UI.WPF.Modern.dll + + + ..\Resources\Inkore.UI.WPF.Modern.Controls.dll + ..\Resources\Microsoft.Win32.TaskScheduler.dll ..\Resources\Nefarius.Utilities.DeviceManagement.dll + + ..\Resources\Nefarius.ViGEm.Client.dll + Resources\RTSSSharedMemoryNET.dll diff --git a/HandheldCompanion/Helpers/VangoghGPU.cs b/HandheldCompanion/Helpers/VangoghGPU.cs index d04ba8521..e96d24e30 100644 --- a/HandheldCompanion/Helpers/VangoghGPU.cs +++ b/HandheldCompanion/Helpers/VangoghGPU.cs @@ -18,6 +18,7 @@ internal class VangoghGPU : IDisposable new Device("AMD Custom GPU 0932", 0x80600000, 0x8067ffff, new uint[] { 0x063F0E00 }), // BIOS 107 new Device("AMD Custom GPU 0932", 0x80500000, 0x8057ffff, new uint[] { 0x063F0F00 }), + new Device("AMD Custom GPU 0932", 0x80600000, 0x8067ffff, new uint[] { 0x063F0A00 }), // SteamDeck unofficial APU drivers // https://sourceforge.net/projects/amernimezone/files/Release%20Polaris-Vega-Navi/AMD%20SOC%20Driver%20Variant/ @@ -73,7 +74,7 @@ public static DetectionStatus Detect() if (!discoveredDevices.ContainsKey(deviceName)) { - LogManager.LogError("GPU: {0}: Not matched.", deviceName); + LogManager.LogDebug("GPU: {0}: Not matched.", deviceName); continue; } @@ -81,13 +82,13 @@ public static DetectionStatus Detect() var ranges = DeviceManager.GetDeviceMemResources(devicePNP); if (ranges is null) { - LogManager.LogError("GPU: {0}: {1}: No memory ranges", deviceName, devicePNP); + LogManager.LogDebug("GPU: {0}: {1}: No memory ranges", deviceName, devicePNP); continue; } var expectedRange = new Tuple(new UIntPtr(device.Item2), new UIntPtr(device.Item3)); if (!ranges.Contains(expectedRange)) { - LogManager.LogError("GPU: {0}: {1}: Memory range not found: {2}", + LogManager.LogDebug("GPU: {0}: {1}: Memory range not found: {2}", deviceName, devicePNP, String.Join(",", ranges.Select((item) => item.ToString())) @@ -99,7 +100,7 @@ public static DetectionStatus Detect() { if (gpu is null) { - LogManager.LogError("GPU: {0}: {1}: Failed to open.", deviceName, devicePNP); + LogManager.LogDebug("GPU: {0}: {1}: Failed to open.", deviceName, devicePNP); continue; } @@ -108,10 +109,9 @@ public static DetectionStatus Detect() { // Silence SMU_Version = 0 since it happens fairly often if (smuVersion != 0) - { - LogManager.LogError("GPU: {0}: {1}: SMU not supported: {2:X8} (IO: {3})", deviceName, devicePNP, smuVersion, expectedRange); - } - return DetectionStatus.Retryable; + LogManager.LogDebug("GPU: {0}: {1}: SMU not supported: {2:X8} (IO: {3})", deviceName, devicePNP, smuVersion, expectedRange); + + continue; } LogManager.LogInformation("GPU: {0}: Matched!", deviceName); diff --git a/HandheldCompanion/Inputs/ButtonFlags.cs b/HandheldCompanion/Inputs/ButtonFlags.cs index 1d9f0bff6..91ad53171 100644 --- a/HandheldCompanion/Inputs/ButtonFlags.cs +++ b/HandheldCompanion/Inputs/ButtonFlags.cs @@ -59,7 +59,6 @@ public enum ButtonFlags : byte OEM9 = 38, OEM10 = 39, - // Steam Deck [Description("Left Pad Touch")] LeftPadTouch = 40, [Description("Right Pad Touch")] RightPadTouch = 41, diff --git a/HandheldCompanion/Managers/ControllerManager.cs b/HandheldCompanion/Managers/ControllerManager.cs index 478b16eef..6aac639ab 100644 --- a/HandheldCompanion/Managers/ControllerManager.cs +++ b/HandheldCompanion/Managers/ControllerManager.cs @@ -749,7 +749,7 @@ private static void watchdogThreadLoop(object? obj) private static void UpdateStatus(ControllerManagerStatus status) { managerStatus = status; - StatusChanged?.Invoke(status); + StatusChanged?.Invoke(status, ControllerManagementAttempts); } private static async void XUsbDeviceArrived(PnPDetails details, DeviceEventArgs obj) @@ -1087,7 +1087,7 @@ public static List GetControllers() } private static ControllerState mutedState = new ControllerState(); - private static void UpdateInputs(ControllerState controllerState, GamepadMotion gamepadMotion, float delta) + private static void UpdateInputs(ControllerState controllerState, GamepadMotion gamepadMotion, float deltaTimeSeconds) { // raise event InputsUpdated?.Invoke(controllerState); @@ -1097,15 +1097,15 @@ private static void UpdateInputs(ControllerState controllerState, GamepadMotion case SensorFamily.Windows: case SensorFamily.SerialUSBIMU: gamepadMotion = IDevice.GetCurrent().GamepadMotion; - SensorsManager.UpdateReport(controllerState, gamepadMotion, ref delta); + SensorsManager.UpdateReport(controllerState, gamepadMotion, ref deltaTimeSeconds); break; } // compute motion if (gamepadMotion is not null) { - MotionManager.UpdateReport(controllerState, gamepadMotion, delta); - MainWindow.overlayModel.UpdateReport(controllerState, gamepadMotion); + MotionManager.UpdateReport(controllerState, gamepadMotion); + MainWindow.overlayModel.UpdateReport(controllerState, gamepadMotion, deltaTimeSeconds); } // controller is muted @@ -1165,7 +1165,7 @@ internal static IController GetEmulatedController() public delegate void InputsUpdatedEventHandler(ControllerState Inputs); public static event StatusChangedEventHandler StatusChanged; - public delegate void StatusChangedEventHandler(ControllerManagerStatus status); + public delegate void StatusChangedEventHandler(ControllerManagerStatus status, int attempts); public static event InitializedEventHandler Initialized; public delegate void InitializedEventHandler(); diff --git a/HandheldCompanion/Managers/Hotkeys/Hotkey.cs b/HandheldCompanion/Managers/Hotkeys/Hotkey.cs index a7b403367..aa2b4f714 100644 --- a/HandheldCompanion/Managers/Hotkeys/Hotkey.cs +++ b/HandheldCompanion/Managers/Hotkeys/Hotkey.cs @@ -317,15 +317,10 @@ public void DrawInput() case Inputs.ButtonFlags.OEM8: case Inputs.ButtonFlags.OEM9: case Inputs.ButtonFlags.OEM10: - { - // - fontIcon = IDevice.GetCurrent().GetFontIcon(button); - } + fontIcon = IDevice.GetCurrent().GetFontIcon(button, 28); break; default: - { - fontIcon = controller.GetFontIcon(button); - } + fontIcon = controller.GetFontIcon(button, 28); break; } diff --git a/HandheldCompanion/Managers/MotionManager.cs b/HandheldCompanion/Managers/MotionManager.cs index ade9eb858..d6769acb0 100644 --- a/HandheldCompanion/Managers/MotionManager.cs +++ b/HandheldCompanion/Managers/MotionManager.cs @@ -19,8 +19,6 @@ public static class MotionManager private static GyroActions gyroAction = new(); private static Inclination inclination = new(); - private static IEnumerable resetFlags = new List() { ButtonFlags.B1, ButtonFlags.B2, ButtonFlags.B3, ButtonFlags.B4 }; - public static event SettingsMode0EventHandler SettingsMode0Update; public delegate void SettingsMode0EventHandler(Vector3 gyrometer); @@ -34,7 +32,6 @@ public static class MotionManager static MotionManager() { - float samplePeriod = TimerManager.GetPeriod() / 1000f; } public static void Start() @@ -48,18 +45,15 @@ public static void Stop() IsInitialized = false; } - public static void UpdateReport(ControllerState controllerState, GamepadMotion gamepadMotion, float delta) + public static void UpdateReport(ControllerState controllerState, GamepadMotion gamepadMotion) { - SetupMotion(controllerState, gamepadMotion, delta); - ProcessMotion(controllerState, gamepadMotion, delta); - - if (controllerState.ButtonState.Buttons.Intersect(resetFlags).Count() == 4) - gamepadMotion.ResetMotion(); + SetupMotion(controllerState, gamepadMotion); + ProcessMotion(controllerState, gamepadMotion); } // this function sets some basic motion settings, sensitivity and inverts // and is enough for DS4/DSU gyroscope handling - private static void SetupMotion(ControllerState controllerState, GamepadMotion gamepadMotion, float delta) + private static void SetupMotion(ControllerState controllerState, GamepadMotion gamepadMotion) { Profile current = ProfileManager.GetCurrent(); @@ -128,8 +122,8 @@ private static void SetupMotion(ControllerState controllerState, GamepadMotion g } // this function is used for advanced motion calculations used by - // gyro to joy/mouse mappings, by UI that configures them and by 3D overlay - private static void ProcessMotion(ControllerState controllerState, GamepadMotion gamepadMotion, float delta) + // gyro to joy/mouse mappings and by UI that configures them + private static void ProcessMotion(ControllerState controllerState, GamepadMotion gamepadMotion) { // TODO: handle this race condition gracefully. LayoutManager might be updating currentlayout as we land here Layout currentLayout = LayoutManager.GetCurrent(); @@ -238,4 +232,6 @@ private static void ProcessMotion(ControllerState controllerState, GamepadMotion controllerState.AxisState[AxisFlags.GyroY] = (short)Math.Clamp(output.Y, short.MinValue, short.MaxValue); } } + + } \ No newline at end of file diff --git a/HandheldCompanion/Managers/PerformanceManager.cs b/HandheldCompanion/Managers/PerformanceManager.cs index 3935e886d..fc019afc3 100644 --- a/HandheldCompanion/Managers/PerformanceManager.cs +++ b/HandheldCompanion/Managers/PerformanceManager.cs @@ -84,7 +84,7 @@ public static class PerformanceManager private static readonly double[] FPSHistory = new double[6]; private static bool gfxWatchdogPendingStop; - private static Processor processor; + private static Processor? processor; private static double ProcessValueFPSPrevious; private static double StoredGfxClock; @@ -888,7 +888,7 @@ public static void Stop() if (!IsInitialized) return; - if (processor.IsInitialized) + if (processor is not null && processor.IsInitialized) processor.Stop(); powerWatchdog.Stop(); @@ -901,10 +901,7 @@ public static void Stop() LogManager.LogInformation("{0} has started", "PerformanceManager"); } - public static Processor GetProcessor() - { - return processor; - } + public static Processor GetProcessor() => processor; #region imports diff --git a/HandheldCompanion/Managers/ProcessManager.cs b/HandheldCompanion/Managers/ProcessManager.cs index fdb10c136..d030e1064 100644 --- a/HandheldCompanion/Managers/ProcessManager.cs +++ b/HandheldCompanion/Managers/ProcessManager.cs @@ -274,7 +274,7 @@ private static void ProcessHalted(object? sender, EventArgs e) if (foregroundProcess == processEx) { LogManager.LogDebug("{0} process {1} that had foreground has halted", foregroundProcess.Platform, foregroundProcess.Executable); - ForegroundChanged?.Invoke(Empty, foregroundProcess); + ForegroundChanged?.Invoke(null, foregroundProcess); } Processes.TryRemove(new KeyValuePair(processId, processEx)); @@ -551,7 +551,7 @@ public static bool CheckXInput(Process process) public static event ForegroundChangedEventHandler ForegroundChanged; - public delegate void ForegroundChangedEventHandler(ProcessEx processEx, ProcessEx backgroundEx); + public delegate void ForegroundChangedEventHandler(ProcessEx? processEx, ProcessEx? backgroundEx); public static event ProcessStartedEventHandler ProcessStarted; diff --git a/HandheldCompanion/Managers/ProfileManager.cs b/HandheldCompanion/Managers/ProfileManager.cs index bd3d47ce3..c81fc0dff 100644 --- a/HandheldCompanion/Managers/ProfileManager.cs +++ b/HandheldCompanion/Managers/ProfileManager.cs @@ -39,14 +39,6 @@ static ProfileManager() ProfilesPath = Path.Combine(MainWindow.SettingsPath, "profiles"); if (!Directory.Exists(ProfilesPath)) Directory.CreateDirectory(ProfilesPath); - - ProcessManager.ForegroundChanged += ProcessManager_ForegroundChanged; - ProcessManager.ProcessStarted += ProcessManager_ProcessStarted; - ProcessManager.ProcessStopped += ProcessManager_ProcessStopped; - - PowerProfileManager.Deleted += PowerProfileManager_Deleted; - - ControllerManager.ControllerPlugged += ControllerManager_ControllerPlugged; } public static FileSystemWatcher profileWatcher { get; set; } @@ -90,6 +82,13 @@ public static void Start() IsInitialized = true; Initialized?.Invoke(); + // listen to external events when ready + ProcessManager.ForegroundChanged += ProcessManager_ForegroundChanged; + ProcessManager.ProcessStarted += ProcessManager_ProcessStarted; + ProcessManager.ProcessStopped += ProcessManager_ProcessStopped; + PowerProfileManager.Deleted += PowerProfileManager_Deleted; + ControllerManager.ControllerPlugged += ControllerManager_ControllerPlugged; + LogManager.LogInformation("{0} has started", "ProfileManager"); } @@ -240,8 +239,7 @@ public static void CycleSubProfiles(bool previous = false) } - private static void ApplyProfile(Profile profile, UpdateSource source = UpdateSource.Background, - bool announce = true) + private static void ApplyProfile(Profile profile, UpdateSource source = UpdateSource.Background, bool announce = true) { // might not be the same anymore if disabled profile = GetProfileFromGuid(profile.Guid, false, profile.IsSubProfile); @@ -257,12 +255,24 @@ private static void ApplyProfile(Profile profile, UpdateSource source = UpdateSo // raise event Applied?.Invoke(profile, source); - // send toast // todo: localize me if (announce) - { - LogManager.LogInformation("Profile {0} applied", profile.Name); - ToastManager.SendToast($"Profile {profile.Name} applied"); + { + string announcement = string.Empty; + switch(profile.IsSubProfile) + { + case false: + announcement = $"Profile {profile.Name} applied"; + break; + case true: + string mainProfileName = GetProfileForSubProfile(profile).Name; + announcement = $"Subprofile {mainProfileName} {profile.Name} applied"; + break; + } + + // push announcement + LogManager.LogInformation(announcement); + ToastManager.SendToast(announcement); } } @@ -358,33 +368,37 @@ private static void ProcessManager_ProcessStarted(ProcessEx processEx, bool OnSt } } - private static void ProcessManager_ForegroundChanged(ProcessEx proc, ProcessEx back) + private static void ProcessManager_ForegroundChanged(ProcessEx? processEx, ProcessEx? backgroundEx) { + if (processEx is null || processEx == ProcessManager.Empty) + return; + try { - var profile = GetProfileFromPath(proc.Path, false); + Profile profile = GetProfileFromPath(processEx.Path, false); - // update profile executable path if (!profile.Default) { - profile.Path = proc.Path; - UpdateOrCreateProfile(profile); + if (!profile.Path.Equals(processEx.Path)) + { + // update profile path + profile.Path = processEx.Path; + UpdateOrCreateProfile(profile); + } } // raise event - if (back is not null) + if (backgroundEx is not null) { - var backProfile = GetProfileFromPath(back.Path, false); + Profile backProfile = GetProfileFromPath(backgroundEx.Path, false); - if (backProfile != profile) + if (!backProfile.Guid.Equals(profile.Guid)) Discarded?.Invoke(backProfile); } ApplyProfile(profile); } - catch - { - } + catch { } } private static void ProfileCreated(object sender, FileSystemEventArgs e) @@ -446,11 +460,15 @@ public static Profile GetCurrent() private static void ProcessProfile(string fileName, bool imported = false) { - Profile profile = null; + Profile profile; try { - var outputraw = File.ReadAllText(fileName); - var jObject = JObject.Parse(outputraw); + string outputraw = File.ReadAllText(fileName); + JObject jObject = JObject.Parse(outputraw); + + string rawName = Path.GetFileNameWithoutExtension(fileName); + if (string.IsNullOrEmpty(rawName)) + throw new Exception("Profile has an incorrect file name."); // latest pre-versionning release Version version = new("0.15.0.4"); @@ -477,20 +495,19 @@ private static void ProcessProfile(string fileName, bool imported = false) break; } - profile = JsonConvert.DeserializeObject(outputraw, new JsonSerializerSettings - { - TypeNameHandling = TypeNameHandling.All - }); + // parse profile + profile = JsonConvert.DeserializeObject(outputraw, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); } catch (Exception ex) { LogManager.LogError("Could not parse profile {0}. {1}", fileName, ex.Message); + return; } // failed to parse - if (profile is null || profile.Name is null || profile.Path is null) + if (!profile.Default && (string.IsNullOrEmpty(profile.Name) || string.IsNullOrEmpty(profile.Path))) { - LogManager.LogError("Failed to parse profile {0}", fileName); + LogManager.LogError("Corrupted profile {0}. Profile has an empty name or an empty path.", fileName); return; } @@ -711,7 +728,8 @@ private static void SanitizeProfile(Profile profile) public static void UpdateOrCreateProfile(Profile profile, UpdateSource source = UpdateSource.Background) { - LogManager.LogInformation($"Attempting to update/create profile {profile.Name} => sub profile? {profile.IsSubProfile}"); + LogManager.LogInformation($"Attempting to update/create {(profile.IsSubProfile ? "subprofile" : "profile")} {profile.Name}"); + bool isCurrent = false; switch (source) { @@ -776,7 +794,6 @@ public static void UpdateOrCreateProfile(Profile profile, UpdateSource source = } // apply profile (silently) - LogManager.LogInformation($"Checking if profile: {profile} is current => {isCurrent}"); if (isCurrent) { SetSubProfileAsFavorite(profile); // if sub profile, set it as favorite for main profile diff --git a/HandheldCompanion/Managers/VirtualManager.cs b/HandheldCompanion/Managers/VirtualManager.cs index 7d0508467..79f43fde9 100644 --- a/HandheldCompanion/Managers/VirtualManager.cs +++ b/HandheldCompanion/Managers/VirtualManager.cs @@ -73,6 +73,7 @@ public static void Start() SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged; ProfileManager.Applied += ProfileManager_Applied; ProfileManager.Discarded += ProfileManager_Discarded; + ControllerManager.StatusChanged += ControllerManager_StatusChanged; IsInitialized = true; Initialized?.Invoke(); @@ -85,7 +86,7 @@ public static void Stop() if (!IsInitialized) return; - Suspend(); + Suspend(true); // unsubscrive events SettingsManager.SettingValueChanged -= SettingsManager_SettingValueChanged; @@ -97,36 +98,50 @@ public static void Stop() LogManager.LogInformation("{0} has stopped", "VirtualManager"); } - public static void Resume() + public static void Resume(bool OS) { - // create new ViGEm client - if (vClient is null) - vClient = new ViGEmClient(); + lock (threadLock) + { + if (OS) + { + // create new ViGEm client + if (vClient is null) + vClient = new ViGEmClient(); - // set controller mode - SetControllerMode(HIDmode); + // update DSU status + SetDSUStatus(SettingsManager.GetBoolean("DSUEnabled")); + } - SetDSUStatus(SettingsManager.GetBoolean("DSUEnabled")); + // set controller mode + SetControllerMode(HIDmode); + } } - public static void Suspend() + public static void Suspend(bool OS) { - // dispose virtual controller - if (vTarget is not null) + lock (threadLock) { - vTarget.Disconnect(); - vTarget.Dispose(); - vTarget = null; - } + // dispose virtual controller + if (vTarget is not null) + { + vTarget.Disconnect(); + vTarget.Dispose(); + vTarget = null; + } - // dispose ViGEm drivers - if (vClient is not null) - { - vClient.Dispose(); - vClient = null; - } + if (OS) + { + // dispose ViGEm drivers + if (vClient is not null) + { + vClient.Dispose(); + vClient = null; + } - DSUServer.Stop(); + // halt DSU + SetDSUStatus(false); + } + } } private static void SettingsManager_SettingValueChanged(string name, object value) @@ -176,6 +191,20 @@ private static async void ProfileManager_Discarded(Profile profile) SetControllerMode(defaultHIDmode); } + private static void ControllerManager_StatusChanged(ControllerManagerStatus status, int attempts) + { + switch(status) + { + // busy or pending + case ControllerManagerStatus.Pending: + case ControllerManagerStatus.Busy: + break; + + default: + break; + } + } + private static void SetDSUStatus(bool started) { if (started) @@ -205,6 +234,11 @@ public static void SetControllerMode(HIDmode mode) vTarget = null; } + // this shouldn't happen ! + // todo: improve the overall locking logic here + if (vClient is null) + return; + switch (mode) { default: @@ -246,10 +280,10 @@ public static void SetControllerMode(HIDmode mode) // update current HIDmode HIDmode = mode; - } - // update status - SetControllerStatus(HIDstatus); + // update status + SetControllerStatus(HIDstatus); + } } public static void SetControllerStatus(HIDstatus status) @@ -259,19 +293,21 @@ public static void SetControllerStatus(HIDstatus status) if (vTarget is null) return; + bool success = false; switch (status) { default: case HIDstatus.Connected: - vTarget.Connect(); + success = vTarget.Connect(); break; case HIDstatus.Disconnected: - vTarget.Disconnect(); + success = vTarget.Disconnect(); break; } // update current HIDstatus - HIDstatus = status; + if (success) + HIDstatus = status; } } diff --git a/HandheldCompanion/Misc/MadgwickAHRS.cs b/HandheldCompanion/Misc/MadgwickAHRS.cs new file mode 100644 index 000000000..7c7861fe7 --- /dev/null +++ b/HandheldCompanion/Misc/MadgwickAHRS.cs @@ -0,0 +1,110 @@ +using System; +using System.Numerics; + +namespace HandheldCompanion; + +// MadgwickAHRS class. Implementation of Madgwick's IMU and AHRS algorithms. +// From: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms +// +// Optimised for minimal arithmetic. +// Total ±: 45 +// Total *: 85 +// Total /: 3 +// Total sqrt: 3 +// +// Requires only gyroscope and accelerometer data. +// Gyro in rad/s +// Accelerometer measurement in any calibrated units. + +public class MadgwickAHRS +{ + public MadgwickAHRS(float samplePeriod) : this(samplePeriod, 1f) {} + + // Sample period + // Beta, algorithm gain beta. + public MadgwickAHRS(float samplePeriod, float beta) + { + SamplePeriod = samplePeriod; + Beta = beta; + Quaternion = new[] { 0f, 0f, -1f, 0f }; + } + + public void Reset() + { + Quaternion = new[] { 0f, 0f, -1f, 0f }; + } + + public float SamplePeriod { get; set; } + public float Beta { get; set; } + public float[] Quaternion { get; set; } + + public void UpdateReport(float gx, float gy, float gz, float ax, float ay, float az, double DeltaSeconds) + { + SamplePeriod = (float)DeltaSeconds; + + float q1 = Quaternion[0], + q2 = Quaternion[1], + q3 = Quaternion[2], + q4 = Quaternion[3]; // short name local variable for readability + float norm; + float s1, s2, s3, s4; + float qDot1, qDot2, qDot3, qDot4; + + // Auxiliary variables to avoid repeated arithmetic + var _2q1 = 2f * q1; + var _2q2 = 2f * q2; + var _2q3 = 2f * q3; + var _2q4 = 2f * q4; + var _4q1 = 4f * q1; + var _4q2 = 4f * q2; + var _4q3 = 4f * q3; + var _8q2 = 8f * q2; + var _8q3 = 8f * q3; + var q1q1 = q1 * q1; + var q2q2 = q2 * q2; + var q3q3 = q3 * q3; + var q4q4 = q4 * q4; + + // Normalise accelerometer measurement + norm = (float)Math.Sqrt(ax * ax + ay * ay + az * az); + if (norm == 0f) return; // handle NaN + norm = 1 / norm; // use reciprocal for division + ax *= norm; + ay *= norm; + az *= norm; + + // Gradient decent algorithm corrective step + s1 = _4q1 * q3q3 + _2q3 * ax + _4q1 * q2q2 - _2q2 * ay; + s2 = _4q2 * q4q4 - _2q4 * ax + 4f * q1q1 * q2 - _2q1 * ay - _4q2 + _8q2 * q2q2 + _8q2 * q3q3 + _4q2 * az; + s3 = 4f * q1q1 * q3 + _2q1 * ax + _4q3 * q4q4 - _2q4 * ay - _4q3 + _8q3 * q2q2 + _8q3 * q3q3 + _4q3 * az; + s4 = 4f * q2q2 * q4 - _2q2 * ax + 4f * q3q3 * q4 - _2q3 * ay; + norm = 1f / (float)Math.Sqrt(s1 * s1 + s2 * s2 + s3 * s3 + s4 * s4); // normalise step magnitude + s1 *= norm; + s2 *= norm; + s3 *= norm; + s4 *= norm; + + // Compute rate of change of quaternion + qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - Beta * s1; + qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - Beta * s2; + qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - Beta * s3; + qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - Beta * s4; + + // Integrate to yield quaternion + q1 += qDot1 * SamplePeriod; + q2 += qDot2 * SamplePeriod; + q3 += qDot3 * SamplePeriod; + q4 += qDot4 * SamplePeriod; + norm = 1f / (float)Math.Sqrt(q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4); // normalise quaternion + Quaternion[0] = q1 * norm; + Quaternion[1] = q2 * norm; + Quaternion[2] = q3 * norm; + Quaternion[3] = q4 * norm; + } + + public Quaternion GetQuaternion() + { + return new Quaternion(Quaternion[0], Quaternion[1], Quaternion[2], Quaternion[3]); + } + +} \ No newline at end of file diff --git a/HandheldCompanion/Misc/MotherboardInfo.cs b/HandheldCompanion/Misc/MotherboardInfo.cs index 3829feba7..5b740e81b 100644 --- a/HandheldCompanion/Misc/MotherboardInfo.cs +++ b/HandheldCompanion/Misc/MotherboardInfo.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Management; using System.Runtime.CompilerServices; @@ -39,51 +40,52 @@ static MotherboardInfo() Directory.CreateDirectory(cacheDirectory); } - public static void Collect() + private static Dictionary> collections = new() { - if (!loadCache()) - { - baseboardCollection = baseboardSearcher.Get(); - motherboardCollection = motherboardSearcher.Get(); - processorCollection = processorSearcher.Get(); - displayCollection = displaySearcher.Get(); - videoControllerCollection = videoControllerSearcher.Get(); - } - } - + { "baseboard", new(baseboardCollection, baseboardSearcher) }, + { "motherboard", new(motherboardCollection, motherboardSearcher) }, + { "processor", new(processorCollection, processorSearcher) }, + { "display", new(displayCollection, displaySearcher) }, + { "video", new(videoControllerCollection, videoControllerSearcher) }, + }; + + // unused public static string Availability { get { - string result = Convert.ToString(queryCacheValue(motherboardCollection, "Availability")); + string result = Convert.ToString(queryCacheValue("motherboard", "Availability")); if (int.TryParse(result, out var value)) return GetAvailability(value); else return result; } - } - + } + + // unused public static List DisplayDescription { get { - return (List)queryCacheValue(displayCollection, "Description"); + return (List)queryCacheValue("display", "Description"); } - } - + } + + // unused public static bool HostingBoard { get { - return Convert.ToBoolean(queryCacheValue(baseboardCollection, "HostingBoard")); + return Convert.ToBoolean(queryCacheValue("baseboard", "HostingBoard")); } - } - + } + + // unused public static string InstallDate { get { - string result = Convert.ToString(queryCacheValue(baseboardCollection, "InstallDate")); + string result = Convert.ToString(queryCacheValue("baseboard", "InstallDate")); if (!string.IsNullOrEmpty(result)) return ConvertToDateTime(result); else @@ -95,15 +97,16 @@ public static string Manufacturer { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "Manufacturer")); + return Convert.ToString(queryCacheValue("baseboard", "Manufacturer")); } - } - + } + + // unused public static string Model { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "Model")); + return Convert.ToString(queryCacheValue("baseboard", "Model")); } } @@ -111,31 +114,34 @@ public static int NumberOfCores { get { - return Convert.ToInt32(queryCacheValue(processorCollection, "NumberOfCores")); + return Convert.ToInt32(queryCacheValue("processor", "NumberOfCores")); } - } - + } + + // unused public static string PartNumber { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "PartNumber")); + return Convert.ToString(queryCacheValue("baseboard", "PartNumber")); } - } - + } + + // unused public static string PNPDeviceID { get { - return Convert.ToString(queryCacheValue(motherboardCollection, "PNPDeviceID")); + return Convert.ToString(queryCacheValue("motherboard", "PNPDeviceID")); } - } - + } + + // unused public static string PrimaryBusType { get { - return Convert.ToString(queryCacheValue(motherboardCollection, "PrimaryBusType")); + return Convert.ToString(queryCacheValue("motherboard", "PrimaryBusType")); } } @@ -143,7 +149,7 @@ public static string ProcessorID { get { - return Convert.ToString(queryCacheValue(processorCollection, "processorID")).TrimEnd(); + return Convert.ToString(queryCacheValue("processor", "processorID")).TrimEnd(); } } @@ -151,7 +157,7 @@ public static string ProcessorName { get { - return Convert.ToString(queryCacheValue(processorCollection, "Name")).TrimEnd(); + return Convert.ToString(queryCacheValue("processor", "Name")).TrimEnd(); } } @@ -159,15 +165,16 @@ public static string ProcessorManufacturer { get { - return Convert.ToString(queryCacheValue(processorCollection, "Manufacturer")).TrimEnd(); + return Convert.ToString(queryCacheValue("processor", "Manufacturer")).TrimEnd(); } - } - + } + + // unused public static uint ProcessorMaxClockSpeed { get { - return Convert.ToUInt32(queryCacheValue(processorCollection, "MaxClockSpeed")); + return Convert.ToUInt32(queryCacheValue("processor", "MaxClockSpeed")); } } @@ -189,55 +196,61 @@ public static string Product { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "Product")); + return Convert.ToString(queryCacheValue("baseboard", "Product")); } - } - + } + + // unused public static bool Removable { get { - return Convert.ToBoolean(queryCacheValue(baseboardCollection, "Removable")); + return Convert.ToBoolean(queryCacheValue("baseboard", "Removable")); } - } - + } + + // unused public static bool Replaceable { get { - return Convert.ToBoolean(queryCacheValue(baseboardCollection, "Replaceable")); + return Convert.ToBoolean(queryCacheValue("baseboard", "Replaceable")); } - } - + } + + // unused public static string RevisionNumber { get { - return Convert.ToString(queryCacheValue(motherboardCollection, "RevisionNumber")); + return Convert.ToString(queryCacheValue("motherboard", "RevisionNumber")); } - } - + } + + // unused public static string SecondaryBusType { get { - return Convert.ToString(queryCacheValue(motherboardCollection, "SecondaryBusType")); + return Convert.ToString(queryCacheValue("motherboard", "SecondaryBusType")); } - } - + } + + // unused public static string SerialNumber { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "SerialNumber")); + return Convert.ToString(queryCacheValue("baseboard", "SerialNumber")); } } + // unused public static string Status { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "Status")); + return Convert.ToString(queryCacheValue("baseboard", "Status")); } } @@ -245,7 +258,7 @@ public static string SystemName { get { - return Convert.ToString(queryCacheValue(motherboardCollection, "SystemName")); + return Convert.ToString(queryCacheValue("motherboard", "SystemName")); } } @@ -253,33 +266,48 @@ public static string Version { get { - return Convert.ToString(queryCacheValue(baseboardCollection, "Version")); + return Convert.ToString(queryCacheValue("baseboard", "Version")); } } - private static object queryCacheValue(ManagementObjectCollection collection, string query, [CallerArgumentExpression("collection")] string collectionName = "") + private static object queryCacheValue(string collectionName, string query) { - if (!cache.ContainsKey($"{collectionName}-{query}")) + bool hasvalue = false; + + // pull value if it exsts and check if correct + if (cache.TryGetValue($"{collectionName}-{query}", out object? result)) { - if (collection is not null) + switch (result) { - foreach (ManagementObject queryObj in collection) - { - object queryResult = queryObj[query]; - if (queryResult is not null) - { - cache.Add($"{collectionName}-{query}", queryResult); - writeCache(); - break; - } - } + case string s when !string.IsNullOrEmpty(s): + case int i when i != 0: + case uint ui when ui != 0: + hasvalue = true; + break; } } - if (cache.TryGetValue($"{collectionName}-{query}", out var result)) - return result; + if (!hasvalue) + { + ManagementObjectCollection collection = collections[collectionName].Key; + ManagementObjectSearcher searcher = collections[collectionName].Value; + + // use searcher if collection is null + collection ??= searcher.Get(); + + // set or update result + result = collection.Cast().Select(queryObj => queryObj[query]).FirstOrDefault(result => result != null); + + if (result != null) + { + // update cache + cache[$"{collectionName}-{query}"] = result; + writeCache(); + } + else return string.Empty; + } - return string.Empty; + return result; } private static string GetAvailability(int availability) @@ -328,7 +356,7 @@ private static string ConvertToDateTime(string unconvertedTime) return convertedTime; } - private static bool loadCache() + public static bool Collect() { lock (cacheLock) { diff --git a/HandheldCompanion/Platforms/RTSS.cs b/HandheldCompanion/Platforms/RTSS.cs index d7d8b1178..35e72c4ce 100644 --- a/HandheldCompanion/Platforms/RTSS.cs +++ b/HandheldCompanion/Platforms/RTSS.cs @@ -107,9 +107,8 @@ public override bool Start() // If RTSS was started while HC was fully initialized, we need to pass both current profile and foreground process if (SettingsManager.IsInitialized) { - var foregroundProcess = ProcessManager.GetForegroundProcess(); - if (foregroundProcess is not null) - ProcessManager_ForegroundChanged(foregroundProcess, null); + ProcessEx foregroundProcess = ProcessManager.GetForegroundProcess(); + ProcessManager_ForegroundChanged(foregroundProcess, null); ProfileManager_Applied(ProfileManager.GetCurrent(), UpdateSource.Background); } @@ -151,8 +150,11 @@ private void ProfileManager_Applied(Profile profile, UpdateSource source) } } - private async void ProcessManager_ForegroundChanged(ProcessEx processEx, ProcessEx backgroundEx) + private async void ProcessManager_ForegroundChanged(ProcessEx? processEx, ProcessEx? backgroundEx) { + if (processEx is null || processEx == ProcessManager.Empty) + return; + // hook new process AppEntry appEntry = null; diff --git a/HandheldCompanion/Processors/AMDProcessor.cs b/HandheldCompanion/Processors/AMDProcessor.cs index 52d637111..a55f3a2b6 100644 --- a/HandheldCompanion/Processors/AMDProcessor.cs +++ b/HandheldCompanion/Processors/AMDProcessor.cs @@ -3,6 +3,7 @@ using HandheldCompanion.Processors.AMD; using System; using System.Threading; +using System.Timers; namespace HandheldCompanion.Processors; @@ -64,6 +65,77 @@ public AMDProcessor() IsInitialized = true; } + + foreach (var type in (PowerType[])Enum.GetValues(typeof(PowerType))) + { + // write default limits + m_Limits[type] = 0; + m_PrevLimits[type] = 0; + + /* + // write default values + m_Values[type] = 0; + m_PrevValues[type] = 0; + */ + } + } + + public override void Initialize() + { + updateTimer.Elapsed += UpdateTimer_Elapsed; + base.Initialize(); + } + + public override void Stop() + { + updateTimer.Elapsed -= UpdateTimer_Elapsed; + base.Stop(); + } + + protected override void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e) + { + if (Monitor.TryEnter(IsBusy)) + { + RyzenAdj.get_table_values(ry); + RyzenAdj.refresh_table(ry); + + // read limit(s) + var limit_fast = (int)RyzenAdj.get_fast_limit(ry); + var limit_slow = (int)RyzenAdj.get_slow_limit(ry); + var limit_stapm = (int)RyzenAdj.get_stapm_limit(ry); + + if (limit_fast != 0) + m_Limits[PowerType.Fast] = limit_fast; + if (limit_slow != 0) + m_Limits[PowerType.Slow] = limit_slow; + if (limit_stapm != 0) + m_Limits[PowerType.Stapm] = limit_stapm; + + // read value(s) + var value_fast = (int)RyzenAdj.get_fast_value(ry); + var value_slow = (int)RyzenAdj.get_slow_value(ry); + var value_stapm = (int)RyzenAdj.get_stapm_value(ry); + + while (value_fast == 0) + value_fast = (int)RyzenAdj.get_fast_value(ry); + while (value_slow == 0) + value_slow = (int)RyzenAdj.get_slow_value(ry); + while (value_stapm == 0) + value_stapm = (int)RyzenAdj.get_stapm_value(ry); + + m_Values[PowerType.Fast] = value_fast; + m_Values[PowerType.Slow] = value_slow; + m_Values[PowerType.Stapm] = value_stapm; + + // read gfx_clk + var gfx_clk = (int)RyzenAdj.get_gfx_clk(ry); + if (gfx_clk != 0) + m_Misc["gfx_clk"] = gfx_clk; + + base.UpdateTimer_Elapsed(sender, e); + + Monitor.Exit(IsBusy); + } } public override void SetTDPLimit(PowerType type, double limit, bool immediate, int result) @@ -71,7 +143,7 @@ public override void SetTDPLimit(PowerType type, double limit, bool immediate, i if (ry == IntPtr.Zero) return; - lock (updateLock) + if (Monitor.TryEnter(IsBusy)) { // 15W : 15000 limit *= 1000; @@ -92,12 +164,14 @@ public override void SetTDPLimit(PowerType type, double limit, bool immediate, i } base.SetTDPLimit(type, limit, immediate, error); + + Monitor.Exit(IsBusy); } } public override void SetGPUClock(double clock, int result) { - lock (updateLock) + if (Monitor.TryEnter(IsBusy)) { switch (family) { @@ -152,6 +226,8 @@ public override void SetGPUClock(double clock, int result) } break; } + + Monitor.Exit(IsBusy); } } diff --git a/HandheldCompanion/Properties/Settings.Designer.cs b/HandheldCompanion/Properties/Settings.Designer.cs index fb2960e33..0fedae925 100644 --- a/HandheldCompanion/Properties/Settings.Designer.cs +++ b/HandheldCompanion/Properties/Settings.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -29,993 +29,1377 @@ public static Settings Default [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool ToastEnable { - get { + public bool ToastEnable + { + get + { return ((bool)(this["ToastEnable"])); } - set { + set + { this["ToastEnable"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool RunAtStartup { - get { + public bool RunAtStartup + { + get + { return ((bool)(this["RunAtStartup"])); } - set { + set + { this["RunAtStartup"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool StartMinimized { - get { + public bool StartMinimized + { + get + { return ((bool)(this["StartMinimized"])); } - set { + set + { this["StartMinimized"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool CloseMinimises { - get { + public bool CloseMinimises + { + get + { return ((bool)(this["CloseMinimises"])); } - set { + set + { this["CloseMinimises"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("720")] - public double MainWindowHeight { - get { + public double MainWindowHeight + { + get + { return ((double)(this["MainWindowHeight"])); } - set { + set + { this["MainWindowHeight"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1280")] - public double MainWindowWidth { - get { + public double MainWindowWidth + { + get + { return ((double)(this["MainWindowWidth"])); } - set { + set + { this["MainWindowWidth"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double MainWindowLeft { - get { + public double MainWindowLeft + { + get + { return ((double)(this["MainWindowLeft"])); } - set { + set + { this["MainWindowLeft"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double MainWindowTop { - get { + public double MainWindowTop + { + get + { return ((double)(this["MainWindowTop"])); } - set { + set + { this["MainWindowTop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] - public int MainWindowState { - get { + public int MainWindowState + { + get + { return ((int)(this["MainWindowState"])); } - set { + set + { this["MainWindowState"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int MainWindowTheme { - get { + public int MainWindowTheme + { + get + { return ((int)(this["MainWindowTheme"])); } - set { + set + { this["MainWindowTheme"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1989-12-20")] - public global::System.DateTime UpdateLastChecked { - get { + public global::System.DateTime UpdateLastChecked + { + get + { return ((global::System.DateTime)(this["UpdateLastChecked"])); } - set { + set + { this["UpdateLastChecked"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int OverlayModel { - get { + public int OverlayModel + { + get + { return ((int)(this["OverlayModel"])); } - set { + set + { this["OverlayModel"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("7")] - public int OverlayControllerAlignment { - get { + public int OverlayControllerAlignment + { + get + { return ((int)(this["OverlayControllerAlignment"])); } - set { + set + { this["OverlayControllerAlignment"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("300")] - public double OverlayControllerSize { - get { + public double OverlayControllerSize + { + get + { return ((double)(this["OverlayControllerSize"])); } - set { + set + { this["OverlayControllerSize"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] - public int OverlayTrackpadsAlignment { - get { + public int OverlayTrackpadsAlignment + { + get + { return ((int)(this["OverlayTrackpadsAlignment"])); } - set { + set + { this["OverlayTrackpadsAlignment"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0.25")] - public double OverlayTrackpadsOpacity { - get { + public double OverlayTrackpadsOpacity + { + get + { return ((double)(this["OverlayTrackpadsOpacity"])); } - set { + set + { this["OverlayTrackpadsOpacity"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("250")] - public double OverlayTrackpadsSize { - get { + public double OverlayTrackpadsSize + { + get + { return ((double)(this["OverlayTrackpadsSize"])); } - set { + set + { this["OverlayTrackpadsSize"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("en-US")] - public string CurrentCulture { - get { + public string CurrentCulture + { + get + { return ((string)(this["CurrentCulture"])); } - set { + set + { this["CurrentCulture"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double OverlayControllerRestingPitch { - get { + public double OverlayControllerRestingPitch + { + get + { return ((double)(this["OverlayControllerRestingPitch"])); } - set { + set + { this["OverlayControllerRestingPitch"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double OverlayControllerRestingYaw { - get { + public double OverlayControllerRestingYaw + { + get + { return ((double)(this["OverlayControllerRestingYaw"])); } - set { + set + { this["OverlayControllerRestingYaw"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double OverlayControllerRestingRoll { - get { + public double OverlayControllerRestingRoll + { + get + { return ((double)(this["OverlayControllerRestingRoll"])); } - set { + set + { this["OverlayControllerRestingRoll"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool SensorPlacementUpsideDown { - get { + public bool SensorPlacementUpsideDown + { + get + { return ((bool)(this["SensorPlacementUpsideDown"])); } - set { + set + { this["SensorPlacementUpsideDown"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] - public int SensorSelection { - get { + public int SensorSelection + { + get + { return ((int)(this["SensorSelection"])); } - set { + set + { this["SensorSelection"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int SensorPlacement { - get { + public int SensorPlacement + { + get + { return ((int)(this["SensorPlacement"])); } - set { + set + { this["SensorPlacement"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("30")] - public double OverlayRenderInterval { - get { + public double OverlayRenderInterval + { + get + { return ((double)(this["OverlayRenderInterval"])); } - set { + set + { this["OverlayRenderInterval"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool OverlayRenderAntialiasing { - get { + public bool OverlayRenderAntialiasing + { + get + { return ((bool)(this["OverlayRenderAntialiasing"])); } - set { + set + { this["OverlayRenderAntialiasing"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool OverlayFaceCamera { - get { + public bool OverlayFaceCamera + { + get + { return ((bool)(this["OverlayFaceCamera"])); } - set { + set + { this["OverlayFaceCamera"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("720")] - public double QuickToolsHeight { - get { + public double QuickToolsHeight + { + get + { return ((double)(this["QuickToolsHeight"])); } - set { + set + { this["QuickToolsHeight"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool ConfigurableTDPOverride { - get { + public bool ConfigurableTDPOverride + { + get + { return ((bool)(this["ConfigurableTDPOverride"])); } - set { + set + { this["ConfigurableTDPOverride"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double ConfigurableTDPOverrideUp { - get { + public double ConfigurableTDPOverrideUp + { + get + { return ((double)(this["ConfigurableTDPOverrideUp"])); } - set { + set + { this["ConfigurableTDPOverrideUp"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double ConfigurableTDPOverrideDown { - get { + public double ConfigurableTDPOverrideDown + { + get + { return ((double)(this["ConfigurableTDPOverrideDown"])); } - set { + set + { this["ConfigurableTDPOverrideDown"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] - public double OverlayControllerOpacity { - get { + public double OverlayControllerOpacity + { + get + { return ((double)(this["OverlayControllerOpacity"])); } - set { + set + { this["OverlayControllerOpacity"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("#00000000")] - public string OverlayControllerBackgroundColor { - get { + public string OverlayControllerBackgroundColor + { + get + { return ((string)(this["OverlayControllerBackgroundColor"])); } - set { + set + { this["OverlayControllerBackgroundColor"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int MainWindowPrevState { - get { + public int MainWindowPrevState + { + get + { return ((int)(this["MainWindowPrevState"])); } - set { + set + { this["MainWindowPrevState"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool FirstStart { - get { + public bool FirstStart + { + get + { return ((bool)(this["FirstStart"])); } - set { + set + { this["FirstStart"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] - public int MainWindowBackdrop { - get { + public int MainWindowBackdrop + { + get + { return ((int)(this["MainWindowBackdrop"])); } - set { + set + { this["MainWindowBackdrop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool UseEnergyStar { - get { + public bool UseEnergyStar + { + get + { return ((bool)(this["UseEnergyStar"])); } - set { + set + { this["UseEnergyStar"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("https://api.github.com/repos/Valkirie/HandheldCompanion")] - public string UpdateUrl { - get { + public string UpdateUrl + { + get + { return ((string)(this["UpdateUrl"])); } - set { + set + { this["UpdateUrl"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool OverlayControllerAlwaysOnTop { - get { + public bool OverlayControllerAlwaysOnTop + { + get + { return ((bool)(this["OverlayControllerAlwaysOnTop"])); } - set { + set + { this["OverlayControllerAlwaysOnTop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool HIDuncloakonclose { - get { + public bool HIDuncloakonclose + { + get + { return ((bool)(this["HIDuncloakonclose"])); } - set { + set + { this["HIDuncloakonclose"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("100")] - public double VibrationStrength { - get { + public double VibrationStrength + { + get + { return ((double)(this["VibrationStrength"])); } - set { + set + { this["VibrationStrength"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] - public string HIDInstancePath { - get { + public string HIDInstancePath + { + get + { return ((string)(this["HIDInstancePath"])); } - set { + set + { this["HIDInstancePath"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool OverlayControllerMotion { - get { + public bool OverlayControllerMotion + { + get + { return ((bool)(this["OverlayControllerMotion"])); } - set { + set + { this["OverlayControllerMotion"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool SteamControllerMute { - get { + public bool SteamControllerMute + { + get + { return ((bool)(this["SteamControllerMute"])); } - set { + set + { this["SteamControllerMute"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool HIDcloakonconnect { - get { + public bool HIDcloakonconnect + { + get + { return ((bool)(this["HIDcloakonconnect"])); } - set { + set + { this["HIDcloakonconnect"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool HIDvibrateonconnect { - get { + public bool HIDvibrateonconnect + { + get + { return ((bool)(this["HIDvibrateonconnect"])); } - set { + set + { this["HIDvibrateonconnect"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool QuickToolsIsPaneOpen { - get { + public bool QuickToolsIsPaneOpen + { + get + { return ((bool)(this["QuickToolsIsPaneOpen"])); } - set { + set + { this["QuickToolsIsPaneOpen"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool LayoutFilterOnDevice { - get { + public bool LayoutFilterOnDevice + { + get + { return ((bool)(this["LayoutFilterOnDevice"])); } - set { + set + { this["LayoutFilterOnDevice"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("40")] - public double QuietModeDuty { - get { + public double QuietModeDuty + { + get + { return ((double)(this["QuietModeDuty"])); } - set { + set + { this["QuietModeDuty"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool QuietModeToggled { - get { + public bool QuietModeToggled + { + get + { return ((bool)(this["QuietModeToggled"])); } - set { + set + { this["QuietModeToggled"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool QuietModeEnabled { - get { + public bool QuietModeEnabled + { + get + { return ((bool)(this["QuietModeEnabled"])); } - set { + set + { this["QuietModeEnabled"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool MainWindowIsPaneOpen { - get { + public bool MainWindowIsPaneOpen + { + get + { return ((bool)(this["MainWindowIsPaneOpen"])); } - set { + set + { this["MainWindowIsPaneOpen"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool DesktopProfileOnStart { - get { + public bool DesktopProfileOnStart + { + get + { return ((bool)(this["DesktopProfileOnStart"])); } - set { + set + { this["DesktopProfileOnStart"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool QuietModeDisclosure { - get { + public bool QuietModeDisclosure + { + get + { return ((bool)(this["QuietModeDisclosure"])); } - set { + set + { this["QuietModeDisclosure"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int OnScreenDisplayLevel { - get { + public int OnScreenDisplayLevel + { + get + { return ((int)(this["OnScreenDisplayLevel"])); } - set { + set + { this["OnScreenDisplayLevel"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1000")] - public double OnScreenDisplayRefreshRate { - get { + public double OnScreenDisplayRefreshRate + { + get + { return ((double)(this["OnScreenDisplayRefreshRate"])); } - set { + set + { this["OnScreenDisplayRefreshRate"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] - public int NativeDisplayOrientation { - get { + public int NativeDisplayOrientation + { + get + { return ((int)(this["NativeDisplayOrientation"])); } - set { + set + { this["NativeDisplayOrientation"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool PlatformRTSSEnabled { - get { + public bool PlatformRTSSEnabled + { + get + { return ((bool)(this["PlatformRTSSEnabled"])); } - set { + set + { this["PlatformRTSSEnabled"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("3")] - public int QuickToolsLocation { - get { + public int QuickToolsLocation + { + get + { return ((int)(this["QuickToolsLocation"])); } - set { + set + { this["QuickToolsLocation"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] - public int QuicktoolsBackdrop { - get { + public int QuicktoolsBackdrop + { + get + { return ((int)(this["QuicktoolsBackdrop"])); } - set { + set + { this["QuicktoolsBackdrop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool QuickToolsAutoHide { - get { + public bool QuickToolsAutoHide + { + get + { return ((bool)(this["QuickToolsAutoHide"])); } - set { + set + { this["QuickToolsAutoHide"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool ControllerManagement { - get { + public bool ControllerManagement + { + get + { return ((bool)(this["ControllerManagement"])); } - set { + set + { this["ControllerManagement"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection SuspendedControllers { - get { + public global::System.Collections.Specialized.StringCollection SuspendedControllers + { + get + { return ((global::System.Collections.Specialized.StringCollection)(this["SuspendedControllers"])); } - set { + set + { this["SuspendedControllers"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool HidModeDoNotShowAgain { - get { + public bool HidModeDoNotShowAgain + { + get + { return ((bool)(this["HidModeDoNotShowAgain"])); } - set { + set + { this["HidModeDoNotShowAgain"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int HIDmode { - get { + public int HIDmode + { + get + { return ((int)(this["HIDmode"])); } - set { + set + { this["HIDmode"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] - public int HIDstatus { - get { + public int HIDstatus + { + get + { return ((int)(this["HIDstatus"])); } - set { + set + { this["HIDstatus"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool DSUEnabled { - get { + public bool DSUEnabled + { + get + { return ((bool)(this["DSUEnabled"])); } - set { + set + { this["DSUEnabled"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("26760")] - public int DSUport { - get { + public int DSUport + { + get + { return ((int)(this["DSUport"])); } - set { + set + { this["DSUport"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("127.0.0.1")] - public string DSUip { - get { + public string DSUip + { + get + { return ((string)(this["DSUip"])); } - set { + set + { this["DSUip"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("50")] - public double LEDBrightness { - get { + public double LEDBrightness + { + get + { return ((double)(this["LEDBrightness"])); } - set { + set + { this["LEDBrightness"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("#FFFFFF00")] - public string LEDMainColor { - get { + public string LEDMainColor + { + get + { return ((string)(this["LEDMainColor"])); } - set { + set + { this["LEDMainColor"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool LEDAmbilightVerticalBlackBarDetection { - get { + public bool LEDAmbilightVerticalBlackBarDetection + { + get + { return ((bool)(this["LEDAmbilightVerticalBlackBarDetection"])); } - set { + set + { this["LEDAmbilightVerticalBlackBarDetection"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool LEDUseSecondColor { - get { + public bool LEDUseSecondColor + { + get + { return ((bool)(this["LEDUseSecondColor"])); } - set { + set + { this["LEDUseSecondColor"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int LEDSettingsLevel { - get { + public int LEDSettingsLevel + { + get + { return ((int)(this["LEDSettingsLevel"])); } - set { + set + { this["LEDSettingsLevel"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool LEDSettingsEnabled { - get { + public bool LEDSettingsEnabled + { + get + { return ((bool)(this["LEDSettingsEnabled"])); } - set { + set + { this["LEDSettingsEnabled"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("#FFFFFF00")] - public string LEDSecondColor { - get { + public string LEDSecondColor + { + get + { return ((string)(this["LEDSecondColor"])); } - set { + set + { this["LEDSecondColor"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool LEDSettingsUseAccentColor { - get { + public bool LEDSettingsUseAccentColor + { + get + { return ((bool)(this["LEDSettingsUseAccentColor"])); } - set { + set + { this["LEDSettingsUseAccentColor"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("50")] - public double LEDSpeed { - get { + public double LEDSpeed + { + get + { return ((double)(this["LEDSpeed"])); } - set { + set + { this["LEDSpeed"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection SuspendedDevices { - get { + public global::System.Collections.Specialized.StringCollection SuspendedDevices + { + get + { return ((global::System.Collections.Specialized.StringCollection)(this["SuspendedDevices"])); } - set { + set + { this["SuspendedDevices"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool LegionControllerPassthrough { - get { + public bool LegionControllerPassthrough + { + get + { return ((bool)(this["LegionControllerPassthrough"])); } - set { + set + { this["LegionControllerPassthrough"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool OnScreenDisplayToggle { - get { + public bool OnScreenDisplayToggle + { + get + { return ((bool)(this["OnScreenDisplayToggle"])); } - set { + set + { this["OnScreenDisplayToggle"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] - public int LastOnScreenDisplayLevel { - get { + public int LastOnScreenDisplayLevel + { + get + { return ((int)(this["LastOnScreenDisplayLevel"])); } - set { + set + { this["LastOnScreenDisplayLevel"] = value; } } - + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayTimeLevel + { + get + { + return ((int)(this["OnScreenDisplayTimeLevel"])); + } + set + { + this["OnScreenDisplayTimeLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayCPULevel + { + get + { + return ((int)(this["OnScreenDisplayCPULevel"])); + } + set + { + this["OnScreenDisplayCPULevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayRAMLevel + { + get + { + return ((int)(this["OnScreenDisplayRAMLevel"])); + } + set + { + this["OnScreenDisplayRAMLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayGPULevel + { + get + { + return ((int)(this["OnScreenDisplayGPULevel"])); + } + set + { + this["OnScreenDisplayGPULevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayVRAMLevel + { + get + { + return ((int)(this["OnScreenDisplayVRAMLevel"])); + } + set + { + this["OnScreenDisplayVRAMLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayBatteryLevel + { + get + { + return ((int)(this["OnScreenDisplayBatteryLevel"])); + } + set + { + this["OnScreenDisplayBatteryLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayFPSLevel + { + get + { + return ((int)(this["OnScreenDisplayFPSLevel"])); + } + set + { + this["OnScreenDisplayFPSLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public int OnScreenDisplayBATTLevel + { + get + { + return ((int)(this["OnScreenDisplayBATTLevel"])); + } + set + { + this["OnScreenDisplayBATTLevel"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Time,GPU,CPU,VRAM,RAM,BATT,FPS")] + public string OnScreenDisplayOrder + { + get + { + return ((string)(this["OnScreenDisplayOrder"])); + } + set + { + this["OnScreenDisplayOrder"] = value; + } + } + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool UISounds { - get { + public bool UISounds + { + get + { return ((bool)(this["UISounds"])); } - set { + set + { this["UISounds"] = value; } } @@ -1080,18 +1464,6 @@ public int OnScreenDisplayVRAMLevel { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("2")] - public int OnScreenDisplayBatteryLevel { - get { - return ((int)(this["OnScreenDisplayBatteryLevel"])); - } - set { - this["OnScreenDisplayBatteryLevel"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] @@ -1107,9 +1479,9 @@ public int OnScreenDisplayFPSLevel { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] - public string OnScreenDisplayBATTLevel { + public int OnScreenDisplayBATTLevel { get { - return ((string)(this["OnScreenDisplayBATTLevel"])); + return ((int)(this["OnScreenDisplayBATTLevel"])); } set { this["OnScreenDisplayBATTLevel"] = value; diff --git a/HandheldCompanion/Properties/Settings.settings b/HandheldCompanion/Properties/Settings.settings index b2a9e5754..b1e4ad014 100644 --- a/HandheldCompanion/Properties/Settings.settings +++ b/HandheldCompanion/Properties/Settings.settings @@ -59,12 +59,6 @@ 0 - - 0 - - - 0 - False @@ -78,7 +72,7 @@ 30 - False + True True @@ -177,7 +171,7 @@ True - 3 + 1 1 @@ -266,13 +260,10 @@ 2 - - 2 - 2 - + 2 diff --git a/HandheldCompanion/Resources/device_aya_flip_ds.png b/HandheldCompanion/Resources/device_aya_flip_ds.png new file mode 100644 index 000000000..fcc0ef646 Binary files /dev/null and b/HandheldCompanion/Resources/device_aya_flip_ds.png differ diff --git a/HandheldCompanion/Resources/device_aya_flip_kb.png b/HandheldCompanion/Resources/device_aya_flip_kb.png new file mode 100644 index 000000000..db49adbed Binary files /dev/null and b/HandheldCompanion/Resources/device_aya_flip_kb.png differ diff --git a/HandheldCompanion/Resources/device_onexplayer_x1.png b/HandheldCompanion/Resources/device_onexplayer_x1.png new file mode 100644 index 000000000..e02c87368 Binary files /dev/null and b/HandheldCompanion/Resources/device_onexplayer_x1.png differ diff --git a/HandheldCompanion/Resources/libryzenadj.dll b/HandheldCompanion/Resources/libryzenadj.dll index c45d7a7c1..d32dbe66e 100644 Binary files a/HandheldCompanion/Resources/libryzenadj.dll and b/HandheldCompanion/Resources/libryzenadj.dll differ diff --git a/HandheldCompanion/Styles/Slider.xaml b/HandheldCompanion/Styles/Slider.xaml index f82558de8..19fa489de 100644 --- a/HandheldCompanion/Styles/Slider.xaml +++ b/HandheldCompanion/Styles/Slider.xaml @@ -4,12 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:primitives="http://schemas.inkore.net/lib/ui/wpf/modern"> - - - - - -