From 1ffc0435b3acfe25d1834cd90e7edb814e93294f Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 1 Apr 2021 09:22:06 +1000 Subject: [PATCH] Remove haptics from ControllerDefinitionMerger (fixes #2690) --- .../ControllerDefinitionMerger.cs | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs b/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs index a6378109a0..2bdab39d50 100644 --- a/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs +++ b/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; namespace BizHawk.Emulation.Common { @@ -33,7 +32,6 @@ namespace BizHawk.Emulation.Common foreach (var def in controllers) { Dictionary buttonAxisRemaps = new(); - Dictionary feedbackRemaps = new(); foreach (string s in def.BoolButtons) { @@ -49,15 +47,8 @@ namespace BizHawk.Emulation.Common buttonAxisRemaps[kvp.Key] = r; } - foreach (var s in def.HapticsChannels) - { - string r = Allocate(s, ref plr, ref playerNext); - ret.HapticsChannels.Add(r); - feedbackRemaps[s] = r; - } - plr = playerNext; - unmergers.Add(new ControlDefUnMerger(buttonAxisRemaps, feedbackRemaps)); + unmergers.Add(new ControlDefUnMerger(buttonAxisRemaps)); } return ret; @@ -68,22 +59,16 @@ namespace BizHawk.Emulation.Common { private class DummyController : IController { - /// private readonly IReadOnlyDictionary _buttonAxisRemaps; - /// - private readonly IReadOnlyDictionary _feedbackRemaps; - private readonly IController _src; public DummyController( IController src, - IReadOnlyDictionary buttonAxisRemaps, - IReadOnlyDictionary feedbackRemaps) + IReadOnlyDictionary buttonAxisRemaps) { _src = src; _buttonAxisRemaps = buttonAxisRemaps; - _feedbackRemaps = feedbackRemaps; } /// always @@ -99,28 +84,18 @@ namespace BizHawk.Emulation.Common return _src.AxisValue(_buttonAxisRemaps[name]); } - public IReadOnlyCollection<(string Name, int Strength)> GetHapticsSnapshot() - => _src.GetHapticsSnapshot() - .Select(hapticsEntry => (_feedbackRemaps.First(kvpRemap => kvpRemap.Value == hapticsEntry.Name).Value, hapticsEntry.Strength)) // reverse lookup - .ToArray(); + public IReadOnlyCollection<(string Name, int Strength)> GetHapticsSnapshot() => Array.Empty<(string, int)>(); - public void SetHapticChannelStrength(string name, int strength) => _src.SetHapticChannelStrength(_feedbackRemaps[name], strength); + public void SetHapticChannelStrength(string name, int strength) {} } - /// these need to be separate because it's expected that "P1 Left" will appear in both private readonly IReadOnlyDictionary _buttonAxisRemaps; - /// - private readonly IReadOnlyDictionary _feedbackRemaps; - - public ControlDefUnMerger( - IReadOnlyDictionary buttonAxisRemaps, - IReadOnlyDictionary feedbackRemaps) + public ControlDefUnMerger(IReadOnlyDictionary buttonAxisRemaps) { _buttonAxisRemaps = buttonAxisRemaps; - _feedbackRemaps = feedbackRemaps; } - public IController UnMerge(IController c) => new DummyController(c, _buttonAxisRemaps, _feedbackRemaps); + public IController UnMerge(IController c) => new DummyController(c, _buttonAxisRemaps); } }