Revert "Ava UI: Input Menu Refactor (#4998)"
This reverts commit 49b37550ca
.
This currently breaks the GTK GUI.
This commit is contained in:
@@ -59,16 +59,16 @@ namespace Ryujinx.Input.Assigner
|
||||
return _gamepad == null || !_gamepad.IsConnected;
|
||||
}
|
||||
|
||||
public ButtonValue? GetPressedButton()
|
||||
public string GetPressedButton()
|
||||
{
|
||||
IEnumerable<GamepadButtonInputId> pressedButtons = _detector.GetPressedButtons();
|
||||
|
||||
if (pressedButtons.Any())
|
||||
{
|
||||
return !_forStick ? new(pressedButtons.First()) : new(((StickInputId)pressedButtons.First()));
|
||||
return !_forStick ? pressedButtons.First().ToString() : ((StickInputId)pressedButtons.First()).ToString();
|
||||
}
|
||||
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
private void CollectButtonStats()
|
||||
|
@@ -31,6 +31,6 @@ namespace Ryujinx.Input.Assigner
|
||||
/// Get the pressed button that was read in <see cref="ReadInput"/> by the button assigner.
|
||||
/// </summary>
|
||||
/// <returns>The pressed button that was read</returns>
|
||||
ButtonValue? GetPressedButton();
|
||||
string GetPressedButton();
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ namespace Ryujinx.Input.Assigner
|
||||
|
||||
public bool HasAnyButtonPressed()
|
||||
{
|
||||
return GetPressedButton() is not null;
|
||||
return GetPressedButton().Length != 0;
|
||||
}
|
||||
|
||||
public bool ShouldCancel()
|
||||
@@ -31,20 +31,20 @@ namespace Ryujinx.Input.Assigner
|
||||
return _keyboardState.IsPressed(Key.Escape);
|
||||
}
|
||||
|
||||
public ButtonValue? GetPressedButton()
|
||||
public string GetPressedButton()
|
||||
{
|
||||
ButtonValue? keyPressed = null;
|
||||
string keyPressed = "";
|
||||
|
||||
for (Key key = Key.Unknown; key < Key.Count; key++)
|
||||
{
|
||||
if (_keyboardState.IsPressed(key))
|
||||
{
|
||||
keyPressed = new(key);
|
||||
keyPressed = key.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return !ShouldCancel() ? keyPressed : null;
|
||||
return !ShouldCancel() ? keyPressed : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,48 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Input
|
||||
{
|
||||
public enum ButtonValueType { Key, GamepadButtonInputId, StickId }
|
||||
|
||||
public readonly struct ButtonValue
|
||||
{
|
||||
private readonly ButtonValueType _type;
|
||||
private readonly uint _rawValue;
|
||||
|
||||
public ButtonValue(Key key)
|
||||
{
|
||||
_type = ButtonValueType.Key;
|
||||
_rawValue = (uint)key;
|
||||
}
|
||||
|
||||
public ButtonValue(GamepadButtonInputId gamepad)
|
||||
{
|
||||
_type = ButtonValueType.GamepadButtonInputId;
|
||||
_rawValue = (uint)gamepad;
|
||||
}
|
||||
|
||||
public ButtonValue(StickInputId stick)
|
||||
{
|
||||
_type = ButtonValueType.StickId;
|
||||
_rawValue = (uint)stick;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Key AsKey()
|
||||
{
|
||||
Debug.Assert(_type == ButtonValueType.Key);
|
||||
return (Common.Configuration.Hid.Key)_rawValue;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Controller.GamepadInputId AsGamepadButtonInputId()
|
||||
{
|
||||
Debug.Assert(_type == ButtonValueType.GamepadButtonInputId);
|
||||
return (Common.Configuration.Hid.Controller.GamepadInputId)_rawValue;
|
||||
}
|
||||
|
||||
public Common.Configuration.Hid.Controller.StickInputId AsGamepadStickId()
|
||||
{
|
||||
Debug.Assert(_type == ButtonValueType.StickId);
|
||||
return (Common.Configuration.Hid.Controller.StickInputId)_rawValue;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user