Fix build

This commit is contained in:
CasualPokePlayer 2025-02-22 09:38:33 -08:00
parent 2f39991b44
commit e1ea8a3371
11 changed files with 30 additions and 25 deletions

View File

@ -3,7 +3,7 @@
namespace BizHawk.Bizware.Input
{
[Flags]
public enum HostInputFocus
public enum HostInputType
{
None = 0,
Mouse = 1,

View File

@ -20,7 +20,7 @@ namespace BizHawk.Bizware.Input
void PreprocessHostGamepads();
void ProcessHostGamepads(Action<string?, bool, HostInputFocus> handleButton, Action<string?, int> handleAxis);
void ProcessHostGamepads(Action<string?, bool, HostInputType> handleButton, Action<string?, int> handleAxis);
IEnumerable<KeyEvent> ProcessHostKeyboards();

View File

@ -31,7 +31,7 @@ namespace BizHawk.Bizware.Input
public abstract void PreprocessHostGamepads();
public abstract void ProcessHostGamepads(Action<string?, bool, HostInputFocus> handleButton, Action<string?, int> handleAxis);
public abstract void ProcessHostGamepads(Action<string?, bool, HostInputType> handleButton, Action<string?, int> handleAxis);
public virtual IEnumerable<KeyEvent> ProcessHostKeyboards()
{

View File

@ -148,7 +148,7 @@ namespace BizHawk.Bizware.Input
DoSDLEventLoop();
}
public override void ProcessHostGamepads(Action<string?, bool, HostInputFocus> handleButton, Action<string?, int> handleAxis)
public override void ProcessHostGamepads(Action<string?, bool, HostInputType> handleButton, Action<string?, int> handleAxis)
{
if (!_isInit) return;
@ -156,7 +156,7 @@ namespace BizHawk.Bizware.Input
{
foreach (var (ButtonName, GetIsPressed) in pad.ButtonGetters)
{
handleButton(pad.InputNamePrefix + ButtonName, GetIsPressed(), HostInputFocus.Pad);
handleButton(pad.InputNamePrefix + ButtonName, GetIsPressed(), HostInputType.Pad);
}
foreach (var (axisID, f) in pad.GetAxes())

View File

@ -1,5 +1,7 @@
using System.Collections.Generic;
using BizHawk.Bizware.Input;
namespace BizHawk.Client.Common
{
/// <summary>for querying host input</summary>

View File

@ -13,7 +13,7 @@ namespace BizHawk.Client.Common
public LogicalButton LogicalButton;
public HostInputFocus Source;
public HostInputType Source;
public override string ToString() => $"{EventType}:{LogicalButton}";
}

View File

@ -18,10 +18,10 @@ namespace BizHawk.Client.EmuHawk
/// Why is this receiving a control, but actually using it as a Form (where the WantingMouseFocus is checked?)
/// Because later we might change it to work off the control, specifically, if a control is supplied (normally actually a Form will be supplied)
/// </summary>
public void ControlInputFocus(Control c, HostInputFocus types, bool wants)
public void ControlInputFocus(Control c, HostInputType types, bool wants)
{
if (types.HasFlag(HostInputFocus.Mouse) && wants) _wantingMouseFocus.Add(c);
if (types.HasFlag(HostInputFocus.Mouse) && !wants) _wantingMouseFocus.Remove(c);
if (types.HasFlag(HostInputType.Mouse) && wants) _wantingMouseFocus.Add(c);
if (types.HasFlag(HostInputType.Mouse) && !wants) _wantingMouseFocus.Remove(c);
}
private readonly HashSet<Control> _wantingMouseFocus = new HashSet<Control>();
@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk
["Shift"] = "LeftShift",
};
private void HandleButton(string button, bool newState, HostInputFocus source)
private void HandleButton(string button, bool newState, HostInputType source)
{
if (!(_currentConfig.MergeLAndRModifierKeys && ModifierKeyPreMap.TryGetValue(button, out var button1))) button1 = button;
var modIndex = _currentConfig.ModifierKeysEffective.IndexOf(button1);
@ -135,7 +135,7 @@ namespace BizHawk.Client.EmuHawk
private void HandleAxis(string axis, int newValue)
{
if (ShouldSwallow(MainFormInputAllowedCallback(false), HostInputFocus.Pad))
if (ShouldSwallow(MainFormInputAllowedCallback(false), HostInputType.Pad))
return;
if (_trackDeltas)
@ -208,7 +208,7 @@ namespace BizHawk.Client.EmuHawk
//analyze keys
foreach (var ke in keyEvents)
{
HandleButton(DistinctKeyNameOverrides.GetName(ke.Key), ke.Pressed, HostInputFocus.Keyboard);
HandleButton(DistinctKeyNameOverrides.GetName(ke.Key), ke.Pressed, HostInputType.Keyboard);
}
lock (_axisValues)
@ -234,11 +234,11 @@ namespace BizHawk.Client.EmuHawk
_axisValues["WMouse Y"] = mousePos.Y;
var mouseBtns = Control.MouseButtons;
HandleButton("WMouse L", (mouseBtns & MouseButtons.Left) != 0, HostInputFocus.Mouse);
HandleButton("WMouse M", (mouseBtns & MouseButtons.Middle) != 0, HostInputFocus.Mouse);
HandleButton("WMouse R", (mouseBtns & MouseButtons.Right) != 0, HostInputFocus.Mouse);
HandleButton("WMouse 1", (mouseBtns & MouseButtons.XButton1) != 0, HostInputFocus.Mouse);
HandleButton("WMouse 2", (mouseBtns & MouseButtons.XButton2) != 0, HostInputFocus.Mouse);
HandleButton("WMouse L", (mouseBtns & MouseButtons.Left) != 0, HostInputType.Mouse);
HandleButton("WMouse M", (mouseBtns & MouseButtons.Middle) != 0, HostInputType.Mouse);
HandleButton("WMouse R", (mouseBtns & MouseButtons.Right) != 0, HostInputType.Mouse);
HandleButton("WMouse 1", (mouseBtns & MouseButtons.XButton1) != 0, HostInputType.Mouse);
HandleButton("WMouse 2", (mouseBtns & MouseButtons.XButton2) != 0, HostInputType.Mouse);
// raw (relative) mouse input
_axisValues["RMouse X"] = mouseDeltaX;
@ -282,9 +282,9 @@ namespace BizHawk.Client.EmuHawk
}
}
private static bool ShouldSwallow(AllowInput allowInput, HostInputFocus inputFocus)
private static bool ShouldSwallow(AllowInput allowInput, HostInputType inputFocus)
{
return allowInput == AllowInput.None || (allowInput == AllowInput.OnlyController && inputFocus != HostInputFocus.Pad);
return allowInput == AllowInput.None || (allowInput == AllowInput.OnlyController && inputFocus != HostInputType.Pad);
}
public void StartListeningForAxisEvents()

View File

@ -1164,12 +1164,12 @@ namespace BizHawk.Client.EmuHawk
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Input.Instance.ControlInputFocus(this, HostInputFocus.Mouse, true);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, true);
}
protected override void OnDeactivate(EventArgs e)
{
Input.Instance.ControlInputFocus(this, HostInputFocus.Mouse, false);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, false);
base.OnDeactivate(e);
}

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using BizHawk.Bizware.Input;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Common.CollectionExtensions;
@ -58,13 +59,13 @@ namespace BizHawk.Client.EmuHawk
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Input.Instance.ControlInputFocus(this, ClientInputFocus.Mouse, true);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, true);
}
protected override void OnDeactivate(EventArgs e)
{
base.OnDeactivate(e);
Input.Instance.ControlInputFocus(this, ClientInputFocus.Mouse, false);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, false);
}
private void ControllerConfig_Load(object sender, EventArgs e)

View File

@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Windows.Forms;
using BizHawk.Bizware.Input;
using BizHawk.Client.Common;
using BizHawk.Common.StringExtensions;
using BizHawk.WinForms.Controls;

View File

@ -3,6 +3,7 @@ using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Bizware.Input;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Common.CollectionExtensions;
@ -25,13 +26,13 @@ namespace BizHawk.Client.EmuHawk
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Input.Instance.ControlInputFocus(this, ClientInputFocus.Mouse, true);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, true);
}
protected override void OnDeactivate(EventArgs e)
{
base.OnDeactivate(e);
Input.Instance.ControlInputFocus(this, ClientInputFocus.Mouse, false);
Input.Instance.ControlInputFocus(this, HostInputType.Mouse, false);
}
private void HotkeyConfig_Load(object sender, EventArgs e)