From cb4d0da9109167487be7fbc41403c59c2f0b4c40 Mon Sep 17 00:00:00 2001 From: Surfin Bird Date: Fri, 1 Feb 2019 03:14:15 +0300 Subject: [PATCH] fixes --- AcManager.Controls/Helpers/ControlsPresets.cs | 2 +- AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs | 7 ++++--- AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AcManager.Controls/Helpers/ControlsPresets.cs b/AcManager.Controls/Helpers/ControlsPresets.cs index 412feba37..f97f10c87 100644 --- a/AcManager.Controls/Helpers/ControlsPresets.cs +++ b/AcManager.Controls/Helpers/ControlsPresets.cs @@ -35,7 +35,7 @@ public bool WarnIfChanged { if (Equals(value, WarnIfChanged)) return; _warnIfChanged = value; OnPropertyChanged(); - ValuesStorage.Set(KeyWarnIfChanged, true); + ValuesStorage.Set(KeyWarnIfChanged, value); } } diff --git a/AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs b/AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs index 0914cbe73..fd6d57609 100644 --- a/AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs +++ b/AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs @@ -349,13 +349,13 @@ private void RescanDevices([CanBeNull] IList devices) { if (device.Information.ProductName.Contains(@"FANATEC CSL Elite")) { if (SettingsHolder.Drive.SameControllersKeepFirst) { - newDevices.RemoveAll(y => y.Same(device.Information)); - } else if (newDevices.Any(y => y.Same(device.Information))) { + newDevices.RemoveAll(y => y.Same(device.Information, i)); + } else if (newDevices.Any(y => y.Same(device.Information, i))) { continue; } } - newDevices.Add(Devices.FirstOrDefault(y => y.Same(device.Information)) ?? DirectInputDevice.Create(device, i)); + newDevices.Add(Devices.FirstOrDefault(y => y.Same(device.Information, i)) ?? DirectInputDevice.Create(device, i)); } } @@ -1252,6 +1252,7 @@ public bool AssignKey(Key key) { if (GetWaiting() is KeyboardButtonEntry) { AssignInput(GetKeyboardInputButton(KeyInterop.VirtualKeyFromKey(key))).Forget(); + Save(); return true; } diff --git a/AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs b/AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs index 231e9ed7f..4f1444f46 100644 --- a/AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs +++ b/AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs @@ -28,11 +28,13 @@ public sealed class DirectInputDevice : Displayable, IDirectInputDevice, IDispos public bool Same(IDirectInputDevice other) { return other != null && (Id == other.Id || DisplayName == other.DisplayName || IsController && other.Id == @"0"); + // return other != null && (Id == other.Id || DisplayName == other.DisplayName || IsController && other.Id == @"0") && Index == other.Index; } - public bool Same(DeviceInstance other) { + public bool Same(DeviceInstance other, int index) { return other != null && (Id == GuidToString(other.ProductGuid) || DisplayName == other.InstanceName); - //|| Id == @"0" && DirectInputDeviceUtils.IsController(other.InstanceName) + // return other != null && (Id == GuidToString(other.ProductGuid) || DisplayName == other.InstanceName) && Index == index; + // || Id == @"0" && DirectInputDeviceUtils.IsController(other.InstanceName) } public DirectInputAxle GetAxle(int id) { @@ -132,6 +134,8 @@ public void RefreshDescription() { } DisplayName = displayName ?? FixDisplayName(Device.InstanceName); + // DisplayName += $@" (#{Index + 1})"; + Proc(Axis, axisP); Proc(Buttons, buttonsP); Proc(Povs, povsP);