From 6f04ff6252edaf65f4860cfeb5bf08ba6aa189d7 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 6 Mar 2021 19:56:54 -0500 Subject: [PATCH] partly fix #2656, I guess. This was a shortcoming in the architecture that allowed the joypad API developers to make a mistake. There will be other fallout from that, but this is the minimal fix. --- src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs index 0cb771c5db..1a1f175e52 100644 --- a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs @@ -68,6 +68,18 @@ namespace BizHawk.Client.Common var buttonToSet = controller == null ? button : $"P{controller} {button}"; if (state == null) _inputManager.ButtonOverrideAdapter.UnSet(buttonToSet); else _inputManager.ButtonOverrideAdapter.SetButton(buttonToSet, state.Value); + + //"Overrides" is a gross line of code in that flushes overrides into the current controller. + //That's not really the way it was meant to work which was that it should pull all its values through the filters before ever using them. + //Of course the code that does that is in the main loop and the lua API wouldnt know how to do it. + //I regret the whole hotkey filter chain OOP soup approach. Anyway, the code that + + //in a crude, CRUDE, *CRUDE* approximation of what the main loop does, we need to pull the physical input again before it's freshly overridded + //but really, everything the main loop does needs to be done here again. + //I'm not doing that now. + _inputManager.ActiveController.LatchFromPhysical(_inputManager.ControllerInputCoalescer); + + //and here's where the overrides managed by this API are pushed in _inputManager.ActiveController.Overrides(_inputManager.ButtonOverrideAdapter); } catch