Requested renames
This commit is contained in:
parent
3a99668b35
commit
a73e0786f1
15 changed files with 58 additions and 62 deletions
|
@ -7,7 +7,7 @@ using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
|||
|
||||
namespace Ryujinx.UI.Helper
|
||||
{
|
||||
public static class ButtonValueHelper
|
||||
public static class ButtonHelper
|
||||
{
|
||||
private static readonly Dictionary<Key, string> _keysMap = new()
|
||||
{
|
||||
|
@ -117,35 +117,35 @@ namespace Ryujinx.UI.Helper
|
|||
{ StickInputId.Unbound, "Unbound" },
|
||||
};
|
||||
|
||||
public static string ToString(ButtonValue buttonValue)
|
||||
public static string ToString(Button button)
|
||||
{
|
||||
string keyString = "";
|
||||
|
||||
if (buttonValue.Type == ButtonValueType.Key)
|
||||
if (button.Type == ButtonType.Key)
|
||||
{
|
||||
var key = buttonValue.AsHidType<Key>();
|
||||
var key = button.AsHidType<Key>();
|
||||
|
||||
if (!_keysMap.TryGetValue(buttonValue.AsHidType<Key>(), out keyString))
|
||||
if (!_keysMap.TryGetValue(button.AsHidType<Key>(), out keyString))
|
||||
{
|
||||
keyString = key.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonValue.Type == ButtonValueType.GamepadButtonInputId)
|
||||
if (button.Type == ButtonType.GamepadButtonInputId)
|
||||
{
|
||||
var gamepadButton = buttonValue.AsHidType<GamepadInputId>();
|
||||
var gamepadButton = button.AsHidType<GamepadInputId>();
|
||||
|
||||
if (!_gamepadInputIdMap.TryGetValue(buttonValue.AsHidType<GamepadInputId>(), out keyString))
|
||||
if (!_gamepadInputIdMap.TryGetValue(button.AsHidType<GamepadInputId>(), out keyString))
|
||||
{
|
||||
keyString = gamepadButton.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonValue.Type == ButtonValueType.StickId)
|
||||
if (button.Type == ButtonType.StickId)
|
||||
{
|
||||
var stickInput = buttonValue.AsHidType<StickInputId>();
|
||||
var stickInput = button.AsHidType<StickInputId>();
|
||||
|
||||
if (!_stickInputIdMap.TryGetValue(buttonValue.AsHidType<StickInputId>(), out keyString))
|
||||
if (!_stickInputIdMap.TryGetValue(button.AsHidType<StickInputId>(), out keyString))
|
||||
{
|
||||
keyString = stickInput.ToString();
|
||||
}
|
|
@ -18,6 +18,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using Button = Ryujinx.Input.Button;
|
||||
using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId;
|
||||
using ConfigStickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
|
@ -894,7 +895,7 @@ namespace Ryujinx.UI.Windows
|
|||
}
|
||||
}
|
||||
|
||||
string pressedButton = ButtonValueHelper.ToString(assigner.GetPressedButton() ?? new ButtonValue(Input.Key.Unknown));
|
||||
string pressedButton = ButtonHelper.ToString(assigner.GetPressedButton() ?? new Button(Input.Key.Unknown));
|
||||
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Ryujinx.Input.Assigner
|
|||
return _gamepad == null || !_gamepad.IsConnected;
|
||||
}
|
||||
|
||||
public ButtonValue? GetPressedButton()
|
||||
public Button? GetPressedButton()
|
||||
{
|
||||
IEnumerable<GamepadButtonInputId> pressedButtons = _detector.GetPressedButtons();
|
||||
|
||||
|
|
|
@ -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();
|
||||
Button? GetPressedButton();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace Ryujinx.Input.Assigner
|
|||
return _keyboardState.IsPressed(Key.Escape);
|
||||
}
|
||||
|
||||
public ButtonValue? GetPressedButton()
|
||||
public Button? GetPressedButton()
|
||||
{
|
||||
ButtonValue? keyPressed = null;
|
||||
Button? keyPressed = null;
|
||||
|
||||
for (Key key = Key.Unknown; key < Key.Count; key++)
|
||||
{
|
||||
|
|
|
@ -2,26 +2,26 @@ using System;
|
|||
|
||||
namespace Ryujinx.Input
|
||||
{
|
||||
public readonly struct ButtonValue
|
||||
public readonly struct Button
|
||||
{
|
||||
public readonly ButtonValueType Type;
|
||||
public readonly ButtonType Type;
|
||||
private readonly uint _rawValue;
|
||||
|
||||
public ButtonValue(Key key)
|
||||
public Button(Key key)
|
||||
{
|
||||
Type = ButtonValueType.Key;
|
||||
Type = ButtonType.Key;
|
||||
_rawValue = (uint)key;
|
||||
}
|
||||
|
||||
public ButtonValue(GamepadButtonInputId gamepad)
|
||||
public Button(GamepadButtonInputId gamepad)
|
||||
{
|
||||
Type = ButtonValueType.GamepadButtonInputId;
|
||||
Type = ButtonType.GamepadButtonInputId;
|
||||
_rawValue = (uint)gamepad;
|
||||
}
|
||||
|
||||
public ButtonValue(StickInputId stick)
|
||||
public Button(StickInputId stick)
|
||||
{
|
||||
Type = ButtonValueType.StickId;
|
||||
Type = ButtonType.StickId;
|
||||
_rawValue = (uint)stick;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Ryujinx.Input
|
||||
{
|
||||
public enum ButtonValueType
|
||||
public enum ButtonType
|
||||
{
|
||||
Key,
|
||||
GamepadButtonInputId,
|
|
@ -12,9 +12,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
internal class ButtonAssignedEventArgs : EventArgs
|
||||
{
|
||||
public ToggleButton Button { get; }
|
||||
public ButtonValue? ButtonValue { get; }
|
||||
public Button? ButtonValue { get; }
|
||||
|
||||
public ButtonAssignedEventArgs(ToggleButton button, ButtonValue? buttonValue)
|
||||
public ButtonAssignedEventArgs(ToggleButton button, Button? buttonValue)
|
||||
{
|
||||
Button = button;
|
||||
ButtonValue = buttonValue;
|
||||
|
@ -75,7 +75,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
ButtonValue? pressedButton = assigner.GetPressedButton();
|
||||
Button? pressedButton = assigner.GetPressedButton();
|
||||
|
||||
if (_shouldUnbind)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
public class ControllerInputConfig : BaseModel
|
||||
public class GamepadInputConfig : BaseModel
|
||||
{
|
||||
public bool EnableCemuHookMotion { get; set; }
|
||||
public string DsuServerHost { get; set; }
|
||||
|
@ -409,7 +409,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
}
|
||||
}
|
||||
|
||||
public ControllerInputConfig(InputConfig config)
|
||||
public GamepadInputConfig(InputConfig config)
|
||||
{
|
||||
if (config != null)
|
||||
{
|
|
@ -3,7 +3,7 @@ using Ryujinx.Common.Configuration.Hid;
|
|||
|
||||
namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
public class HotkeysConfig : BaseModel
|
||||
public class HotkeyConfig : BaseModel
|
||||
{
|
||||
private Key _toggleVsync;
|
||||
public Key ToggleVsync
|
||||
|
@ -104,7 +104,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
}
|
||||
}
|
||||
|
||||
public HotkeysConfig(KeyboardHotkeys config)
|
||||
public HotkeyConfig(KeyboardHotkeys config)
|
||||
{
|
||||
if (config != null)
|
||||
{
|
|
@ -6,8 +6,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
{
|
||||
public class ControllerInputViewModel : BaseModel
|
||||
{
|
||||
private ControllerInputConfig _config;
|
||||
public ControllerInputConfig Config
|
||||
private GamepadInputConfig _config;
|
||||
public GamepadInputConfig Config
|
||||
{
|
||||
get => _config;
|
||||
set
|
||||
|
@ -56,7 +56,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
public InputViewModel parentModel;
|
||||
|
||||
public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config)
|
||||
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
||||
{
|
||||
parentModel = model;
|
||||
model.NotifyChangesEvent += OnParentModelChanged;
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
if (Config is StandardControllerInputConfig controllerInputConfig)
|
||||
{
|
||||
ConfigViewModel = new ControllerInputViewModel(this, new ControllerInputConfig(controllerInputConfig));
|
||||
ConfigViewModel = new ControllerInputViewModel(this, new GamepadInputConfig(controllerInputConfig));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -236,12 +236,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
get => new(_networkInterfaces.Keys);
|
||||
}
|
||||
|
||||
public AvaloniaList<string> MultiplayerModes
|
||||
{
|
||||
get => new(Enum.GetNames<MultiplayerMode>());
|
||||
}
|
||||
|
||||
public HotkeysConfig KeyboardHotkeys { get; set; }
|
||||
public HotkeyConfig KeyboardHotkey { get; set; }
|
||||
|
||||
public int NetworkInterfaceIndex
|
||||
{
|
||||
|
@ -408,7 +403,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
EnableMouse = config.Hid.EnableMouse;
|
||||
|
||||
// Keyboard Hotkeys
|
||||
KeyboardHotkeys = new HotkeysConfig(config.Hid.Hotkeys.Value);
|
||||
KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value);
|
||||
|
||||
// System
|
||||
Region = (int)config.System.Region.Value;
|
||||
|
@ -495,7 +490,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
config.Hid.EnableMouse.Value = EnableMouse;
|
||||
|
||||
// Keyboard Hotkeys
|
||||
config.Hid.Hotkeys.Value = KeyboardHotkeys.GetConfig();
|
||||
config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig();
|
||||
|
||||
// System
|
||||
config.System.Region.Value = (Region)Region;
|
||||
|
|
|
@ -52,55 +52,55 @@
|
|||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysToggleVsyncHotkey}" />
|
||||
<ToggleButton Name="ToggleVsync">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.ToggleVsync, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.ToggleVsync, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysScreenshotHotkey}" />
|
||||
<ToggleButton Name="Screenshot">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.Screenshot, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.Screenshot, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysShowUiHotkey}" />
|
||||
<ToggleButton Name="ShowUI">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.ShowUI, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.ShowUI, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysPauseHotkey}" />
|
||||
<ToggleButton Name="Pause">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.Pause, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.Pause, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysToggleMuteHotkey}" />
|
||||
<ToggleButton Name="ToggleMute">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.ToggleMute, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.ToggleMute, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysResScaleUpHotkey}" />
|
||||
<ToggleButton Name="ResScaleUp">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.ResScaleUp, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.ResScaleUp, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysResScaleDownHotkey}" />
|
||||
<ToggleButton Name="ResScaleDown">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.ResScaleDown, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.ResScaleDown, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysVolumeUpHotkey}" />
|
||||
<ToggleButton Name="VolumeUp">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.VolumeUp, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.VolumeUp, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{locale:Locale SettingsTabHotkeysVolumeDownHotkey}" />
|
||||
<ToggleButton Name="VolumeDown">
|
||||
<TextBlock Text="{Binding KeyboardHotkeys.VolumeDown, Converter={StaticResource Key}}" />
|
||||
<TextBlock Text="{Binding KeyboardHotkey.VolumeDown, Converter={StaticResource Key}}" />
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
|
|
@ -84,31 +84,31 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
switch (button.Name)
|
||||
{
|
||||
case "ToggleVsync":
|
||||
viewModel.KeyboardHotkeys.ToggleVsync = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.ToggleVsync = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "Screenshot":
|
||||
viewModel.KeyboardHotkeys.Screenshot = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.Screenshot = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "ShowUI":
|
||||
viewModel.KeyboardHotkeys.ShowUI = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.ShowUI = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "Pause":
|
||||
viewModel.KeyboardHotkeys.Pause = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.Pause = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "ToggleMute":
|
||||
viewModel.KeyboardHotkeys.ToggleMute = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.ToggleMute = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "ResScaleUp":
|
||||
viewModel.KeyboardHotkeys.ResScaleUp = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.ResScaleUp = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "ResScaleDown":
|
||||
viewModel.KeyboardHotkeys.ResScaleDown = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.ResScaleDown = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "VolumeUp":
|
||||
viewModel.KeyboardHotkeys.VolumeUp = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.VolumeUp = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
case "VolumeDown":
|
||||
viewModel.KeyboardHotkeys.VolumeDown = buttonValue.AsHidType<Key>();
|
||||
viewModel.KeyboardHotkey.VolumeDown = buttonValue.AsHidType<Key>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue