Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gro-ove committed Feb 1, 2019
1 parent 894f98e commit cb4d0da
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AcManager.Controls/Helpers/ControlsPresets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public bool WarnIfChanged {
if (Equals(value, WarnIfChanged)) return;
_warnIfChanged = value;
OnPropertyChanged();
ValuesStorage.Set(KeyWarnIfChanged, true);
ValuesStorage.Set(KeyWarnIfChanged, value);
}
}

Expand Down
7 changes: 4 additions & 3 deletions AcManager.Tools/Helpers/AcSettings/ControlsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ private void RescanDevices([CanBeNull] IList<Joystick> 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));
}
}

Expand Down Expand Up @@ -1252,6 +1252,7 @@ public bool AssignKey(Key key) {

if (GetWaiting() is KeyboardButtonEntry) {
AssignInput(GetKeyboardInputButton(KeyInterop.VirtualKeyFromKey(key))).Forget();
Save();
return true;
}

Expand Down
8 changes: 6 additions & 2 deletions AcManager.Tools/Helpers/DirectInput/DirectInputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -132,6 +134,8 @@ public void RefreshDescription() {
}

DisplayName = displayName ?? FixDisplayName(Device.InstanceName);
// DisplayName += $@" (#{Index + 1})";

Proc(Axis, axisP);
Proc(Buttons, buttonsP);
Proc(Povs, povsP);
Expand Down

0 comments on commit cb4d0da

Please sign in to comment.