mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-13 19:10:19 +00:00
addressed review
This commit is contained in:
parent
8eee0ef41e
commit
78b54fcf16
9 changed files with 131 additions and 146 deletions
|
@ -554,5 +554,7 @@
|
||||||
"SettingsTabHotkeysPauseHotkey": "Pause:",
|
"SettingsTabHotkeysPauseHotkey": "Pause:",
|
||||||
"SettingsTabHotkeysToggleMuteHotkey": "Mute:",
|
"SettingsTabHotkeysToggleMuteHotkey": "Mute:",
|
||||||
"ControllerMotionTitle": "Motion Control Settings",
|
"ControllerMotionTitle": "Motion Control Settings",
|
||||||
"ControllerRumbleTitle": "Rumble Settings"
|
"ControllerRumbleTitle": "Rumble Settings",
|
||||||
|
"SettingsSelectThemeFileDialogTitle" : "Select Theme File",
|
||||||
|
"SettingsXamlThemeFile" : "Xaml Theme File"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Ui.Controls;
|
using Ryujinx.Ava.Ui.Controls;
|
||||||
using Ryujinx.Ava.Ui.Windows;
|
using Ryujinx.Ava.Ui.Windows;
|
||||||
|
@ -57,8 +58,15 @@ namespace Ryujinx.Ava.Ui.Applet
|
||||||
|
|
||||||
bool opened = false;
|
bool opened = false;
|
||||||
|
|
||||||
UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent, title, message, "",
|
UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent,
|
||||||
LocaleManager.Instance["DialogOpenSettingsWindow"], "", "Close", 0xF4A3, deferEvent,
|
title,
|
||||||
|
message,
|
||||||
|
"",
|
||||||
|
LocaleManager.Instance["DialogOpenSettingsWindow"],
|
||||||
|
"",
|
||||||
|
LocaleManager.Instance["SettingsButtonClose"],
|
||||||
|
(int)Symbol.Important,
|
||||||
|
deferEvent,
|
||||||
async (window) =>
|
async (window) =>
|
||||||
{
|
{
|
||||||
if (opened)
|
if (opened)
|
||||||
|
|
|
@ -12,6 +12,18 @@ namespace Ryujinx.Ava.Ui.Controls
|
||||||
{
|
{
|
||||||
public class ButtonKeyAssigner
|
public class ButtonKeyAssigner
|
||||||
{
|
{
|
||||||
|
public class ButtonAssignedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public ToggleButton Button { get; }
|
||||||
|
public bool IsAssigned { get; }
|
||||||
|
|
||||||
|
public ButtonAssignedEventArgs(ToggleButton button, bool isAssigned)
|
||||||
|
{
|
||||||
|
Button = button;
|
||||||
|
IsAssigned = isAssigned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ToggleButton ToggledButton { get; set; }
|
public ToggleButton ToggledButton { get; set; }
|
||||||
|
|
||||||
private bool _isWaitingForInput;
|
private bool _isWaitingForInput;
|
||||||
|
@ -67,21 +79,14 @@ namespace Ryujinx.Ava.Ui.Controls
|
||||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
string pressedButton = assigner.GetPressedButton();
|
string pressedButton = assigner.GetPressedButton();
|
||||||
|
|
||||||
if (_shouldUnbind)
|
if (_shouldUnbind)
|
||||||
{
|
{
|
||||||
try
|
SetButtonText(ToggledButton, "Unbound");
|
||||||
{
|
|
||||||
SetButtonText(ToggledButton, "Unbound");
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
else if (pressedButton != "")
|
else if (pressedButton != "")
|
||||||
{
|
{
|
||||||
try
|
SetButtonText(ToggledButton, pressedButton);
|
||||||
{
|
|
||||||
SetButtonText(ToggledButton, pressedButton);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_shouldUnbind = false;
|
_shouldUnbind = false;
|
||||||
|
@ -109,17 +114,5 @@ namespace Ryujinx.Ava.Ui.Controls
|
||||||
ToggledButton.IsChecked = false;
|
ToggledButton.IsChecked = false;
|
||||||
_shouldUnbind = shouldUnbind;
|
_shouldUnbind = shouldUnbind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ButtonAssignedEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public ToggleButton Button { get; }
|
|
||||||
public bool IsAssigned { get; }
|
|
||||||
|
|
||||||
public ButtonAssignedEventArgs(ToggleButton button, bool isAssigned)
|
|
||||||
{
|
|
||||||
Button = button;
|
|
||||||
IsAssigned = isAssigned;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Ryujinx.Ava.Input;
|
||||||
using Ryujinx.Ava.Ui.Controls;
|
using Ryujinx.Ava.Ui.Controls;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
using Ryujinx.Ava.Ui.Windows;
|
using Ryujinx.Ava.Ui.Windows;
|
||||||
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
|
@ -33,14 +34,19 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
public class ControllerSettingsViewModel : BaseModel, IDisposable
|
public class ControllerSettingsViewModel : BaseModel, IDisposable
|
||||||
{
|
{
|
||||||
|
private const string Disabled = "disabled";
|
||||||
|
private const string ProControllerResource = "Ryujinx.Ui.Common/Resources/Controller_ProCon.svg";
|
||||||
|
private const string JoyConPairResource = "Ryujinx.Ui.Common/Resources/Controller_JoyConPair.svg";
|
||||||
|
private const string JoyConLeftResource = "Ryujinx.Ui.Common/Resources/Controller_JoyConLeft.svg";
|
||||||
|
private const string JoyConRightResource = "Ryujinx.Ui.Common/Resources/Controller_JoyConRight.svg";
|
||||||
|
private const string KeyboardString = "keyboard";
|
||||||
|
private const string ControllerString = "controller";
|
||||||
private readonly MainWindow _mainWindow;
|
private readonly MainWindow _mainWindow;
|
||||||
|
|
||||||
private PlayerIndex _playerId;
|
private PlayerIndex _playerId;
|
||||||
private int _controller;
|
private int _controller;
|
||||||
private string _controllerImage;
|
private string _controllerImage;
|
||||||
private int _device;
|
private int _device;
|
||||||
|
|
||||||
private InputConfig _inputConfig;
|
|
||||||
private object _configuration;
|
private object _configuration;
|
||||||
private string _profileName;
|
private string _profileName;
|
||||||
private bool _isLoaded;
|
private bool _isLoaded;
|
||||||
|
@ -125,20 +131,20 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
switch (controller)
|
switch (controller)
|
||||||
{
|
{
|
||||||
case ControllerType.Handheld:
|
case ControllerType.Handheld:
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_JoyConPair.svg";
|
ControllerImage = JoyConPairResource;
|
||||||
break;
|
break;
|
||||||
case ControllerType.ProController:
|
case ControllerType.ProController:
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_ProCon.svg";
|
ControllerImage = ProControllerResource;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconPair:
|
case ControllerType.JoyconPair:
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_JoyConPair.svg";
|
ControllerImage = JoyConPairResource;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconLeft:
|
case ControllerType.JoyconLeft:
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_JoyConLeft.svg";
|
ControllerImage = JoyConLeftResource;
|
||||||
IsRight = false;
|
IsRight = false;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconRight:
|
case ControllerType.JoyconRight:
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_JoyConRight.svg";
|
ControllerImage = JoyConRightResource;
|
||||||
IsLeft = false;
|
IsLeft = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +180,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
SvgSource source = new SvgSource();
|
SvgSource source = new SvgSource();
|
||||||
|
|
||||||
source.Load(Assembly.GetAssembly(typeof(ConfigurationState)).GetManifestResourceStream(_controllerImage));
|
source.Load(EmbeddedResources.GetStream(_controllerImage));
|
||||||
|
|
||||||
image.Source = source;
|
image.Source = source;
|
||||||
}
|
}
|
||||||
|
@ -207,16 +213,14 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
|
|
||||||
string selected = Devices[_device].Id;
|
string selected = Devices[_device].Id;
|
||||||
|
|
||||||
if (selected == "disable")
|
if (selected != Disabled)
|
||||||
{
|
{
|
||||||
return;
|
LoadControllers();
|
||||||
}
|
|
||||||
|
|
||||||
LoadControllers();
|
if (_isLoaded)
|
||||||
|
{
|
||||||
if (_isLoaded)
|
LoadConfiguration(LoadDefaultConfiguration());
|
||||||
{
|
}
|
||||||
LoadConfiguration(LoadDefaultConfiguration());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
|
@ -224,11 +228,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputConfig Config
|
public InputConfig Config { get; set; }
|
||||||
{
|
|
||||||
get => _inputConfig;
|
|
||||||
set => _inputConfig = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ControllerSettingsViewModel(UserControl owner) : this()
|
public ControllerSettingsViewModel(UserControl owner) : this()
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
ProfilesList = new AvaloniaList<string>();
|
ProfilesList = new AvaloniaList<string>();
|
||||||
DeviceList = new AvaloniaList<string>();
|
DeviceList = new AvaloniaList<string>();
|
||||||
|
|
||||||
ControllerImage = "Ryujinx.Ui.Common.Resources.Controller_ProCon.svg";
|
ControllerImage = ProControllerResource;
|
||||||
|
|
||||||
PlayerIndexes.Add(new(PlayerIndex.Player1, LocaleManager.Instance["ControllerSettingsPlayer1"]));
|
PlayerIndexes.Add(new(PlayerIndex.Player1, LocaleManager.Instance["ControllerSettingsPlayer1"]));
|
||||||
PlayerIndexes.Add(new(PlayerIndex.Player2, LocaleManager.Instance["ControllerSettingsPlayer2"]));
|
PlayerIndexes.Add(new(PlayerIndex.Player2, LocaleManager.Instance["ControllerSettingsPlayer2"]));
|
||||||
|
@ -282,14 +282,14 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
Config = inputConfig ?? ConfigurationState.Instance.Hid.InputConfig.Value.Find(inputConfig => inputConfig.PlayerIndex == _playerId);
|
Config = inputConfig ?? ConfigurationState.Instance.Hid.InputConfig.Value.Find(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||||
|
|
||||||
if (Config is StandardKeyboardInputConfig)
|
if (Config is StandardKeyboardInputConfig keyboardInputConfig)
|
||||||
{
|
{
|
||||||
Configuration = new InputConfiguration<Key, ConfigStickInputId>(Config as StandardKeyboardInputConfig);
|
Configuration = new InputConfiguration<Key, ConfigStickInputId>(keyboardInputConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config is StandardControllerInputConfig)
|
if (Config is StandardControllerInputConfig controllerInputConfig)
|
||||||
{
|
{
|
||||||
Configuration = new InputConfiguration<ConfigGamepadInputId, ConfigStickInputId>(Config as StandardControllerInputConfig);
|
Configuration = new InputConfiguration<ConfigGamepadInputId, ConfigStickInputId>(controllerInputConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,12 +305,12 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
|
|
||||||
if (Config is StandardKeyboardInputConfig)
|
if (Config is StandardKeyboardInputConfig)
|
||||||
{
|
{
|
||||||
ident = "keyboard";
|
ident = KeyboardString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config is StandardControllerInputConfig)
|
if (Config is StandardControllerInputConfig)
|
||||||
{
|
{
|
||||||
ident = "controller";
|
ident = ControllerString;
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = Devices.FirstOrDefault(x => x.Id == $"{ident}/{Config.Id}");
|
var item = Devices.FirstOrDefault(x => x.Id == $"{ident}/{Config.Id}");
|
||||||
|
@ -345,12 +345,12 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
string id = GetCurrentGamepadId();
|
string id = GetCurrentGamepadId();
|
||||||
string selected = Devices[Device].Id;
|
string selected = Devices[Device].Id;
|
||||||
|
|
||||||
if (selected == "disabled")
|
if (selected == Disabled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected.StartsWith("keyboard"))
|
if (selected.StartsWith(KeyboardString))
|
||||||
{
|
{
|
||||||
if (_mainWindow.InputManager.KeyboardDriver is AvaloniaKeyboardDriver)
|
if (_mainWindow.InputManager.KeyboardDriver is AvaloniaKeyboardDriver)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +393,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
|
|
||||||
string selected = Devices[Device].Id;
|
string selected = Devices[Device].Id;
|
||||||
|
|
||||||
if (selected == null || selected == "disabled")
|
if (selected == null || selected == Disabled)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -429,14 +429,14 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetShrinkedGamepadName(string str)
|
private static string GetShortGamepadName(string str)
|
||||||
{
|
{
|
||||||
const string ShrinkChars = "...";
|
const string Ellipsis = "...";
|
||||||
const int MaxSize = 50;
|
const int MaxSize = 50;
|
||||||
|
|
||||||
if (str.Length > MaxSize)
|
if (str.Length > MaxSize)
|
||||||
{
|
{
|
||||||
return str.Substring(0, MaxSize - ShrinkChars.Length) + ShrinkChars;
|
return str.Substring(0, MaxSize - Ellipsis.Length) + Ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
@ -448,29 +448,25 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
Devices.Clear();
|
Devices.Clear();
|
||||||
DeviceList.Clear();
|
DeviceList.Clear();
|
||||||
Devices.Add(("disabled", LocaleManager.Instance["ControllerSettingsDeviceDisabled"]));
|
Devices.Add((Disabled, LocaleManager.Instance["ControllerSettingsDeviceDisabled"]));
|
||||||
|
|
||||||
foreach (string id in _mainWindow.InputManager.KeyboardDriver.GamepadsIds)
|
foreach (string id in _mainWindow.InputManager.KeyboardDriver.GamepadsIds)
|
||||||
{
|
{
|
||||||
IGamepad gamepad = _mainWindow.InputManager.KeyboardDriver.GetGamepad(id);
|
using IGamepad gamepad = _mainWindow.InputManager.KeyboardDriver.GetGamepad(id);
|
||||||
|
|
||||||
if (gamepad != null)
|
if (gamepad != null)
|
||||||
{
|
{
|
||||||
Devices.Add(($"keyboard/{id}", $"{GetShrinkedGamepadName(gamepad.Name)} ({id})"));
|
Devices.Add(($"keyboard/{id}", $"{GetShortGamepadName(gamepad.Name)} ({id})"));
|
||||||
|
|
||||||
gamepad.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string id in _mainWindow.InputManager.GamepadDriver.GamepadsIds)
|
foreach (string id in _mainWindow.InputManager.GamepadDriver.GamepadsIds)
|
||||||
{
|
{
|
||||||
IGamepad gamepad = _mainWindow.InputManager.GamepadDriver.GetGamepad(id);
|
using IGamepad gamepad = _mainWindow.InputManager.GamepadDriver.GetGamepad(id);
|
||||||
|
|
||||||
if (gamepad != null)
|
if (gamepad != null)
|
||||||
{
|
{
|
||||||
Devices.Add(($"controller/{id}", $"{GetShrinkedGamepadName(gamepad.Name)} ({id})"));
|
Devices.Add(($"controller/{id}", $"{GetShortGamepadName(gamepad.Name)} ({id})"));
|
||||||
|
|
||||||
gamepad.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,13 +480,13 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
string path = AppDataManager.ProfilesDirPath;
|
string path = AppDataManager.ProfilesDirPath;
|
||||||
string selected = Devices[Device == -1 ? 0 : Device].Id;
|
string selected = Devices[Device == -1 ? 0 : Device].Id;
|
||||||
|
|
||||||
if (selected.StartsWith("keyboard"))
|
if (selected.StartsWith(KeyboardString))
|
||||||
{
|
{
|
||||||
path = Path.Combine(path, "keyboard");
|
path = Path.Combine(path, KeyboardString);
|
||||||
}
|
}
|
||||||
else if (selected.StartsWith("controller"))
|
else if (selected.StartsWith(ControllerString))
|
||||||
{
|
{
|
||||||
path = Path.Combine(path, "controller");
|
path = Path.Combine(path, ControllerString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@ -522,7 +518,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
|
|
||||||
public InputConfig LoadDefaultConfiguration()
|
public InputConfig LoadDefaultConfiguration()
|
||||||
{
|
{
|
||||||
string activeDevice = "disabled";
|
string activeDevice = Disabled;
|
||||||
|
|
||||||
if (Devices.Count > 0 && Device < Devices.Count && Device >= 0)
|
if (Devices.Count > 0 && Device < Devices.Count && Device >= 0)
|
||||||
{
|
{
|
||||||
|
@ -530,7 +526,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
InputConfig config;
|
InputConfig config;
|
||||||
if (activeDevice.StartsWith("keyboard"))
|
if (activeDevice.StartsWith(KeyboardString))
|
||||||
{
|
{
|
||||||
string id = activeDevice.Split("/")[1];
|
string id = activeDevice.Split("/")[1];
|
||||||
|
|
||||||
|
@ -540,19 +536,18 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
Backend = InputBackendType.WindowKeyboard,
|
Backend = InputBackendType.WindowKeyboard,
|
||||||
Id = id,
|
Id = id,
|
||||||
ControllerType = ControllerType.ProController,
|
ControllerType = ControllerType.ProController,
|
||||||
LeftJoycon =
|
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||||
new LeftJoyconCommonConfig<Key>
|
{
|
||||||
{
|
DpadUp = Key.Up,
|
||||||
DpadUp = Key.Up,
|
DpadDown = Key.Down,
|
||||||
DpadDown = Key.Down,
|
DpadLeft = Key.Left,
|
||||||
DpadLeft = Key.Left,
|
DpadRight = Key.Right,
|
||||||
DpadRight = Key.Right,
|
ButtonMinus = Key.Minus,
|
||||||
ButtonMinus = Key.Minus,
|
ButtonL = Key.E,
|
||||||
ButtonL = Key.E,
|
ButtonZl = Key.Q,
|
||||||
ButtonZl = Key.Q,
|
ButtonSl = Key.Unbound,
|
||||||
ButtonSl = Key.Unbound,
|
ButtonSr = Key.Unbound
|
||||||
ButtonSr = Key.Unbound
|
},
|
||||||
},
|
|
||||||
LeftJoyconStick =
|
LeftJoyconStick =
|
||||||
new JoyconConfigKeyboardStick<Key>
|
new JoyconConfigKeyboardStick<Key>
|
||||||
{
|
{
|
||||||
|
@ -584,7 +579,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (activeDevice.StartsWith("controller"))
|
else if (activeDevice.StartsWith(ControllerString))
|
||||||
{
|
{
|
||||||
bool isNintendoStyle = Devices.ToList().Find(x => x.Id == activeDevice).Name.Contains("Nintendo");
|
bool isNintendoStyle = Devices.ToList().Find(x => x.Id == activeDevice).Name.Contains("Nintendo");
|
||||||
|
|
||||||
|
@ -601,40 +596,37 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
RangeLeft = 1.0f,
|
RangeLeft = 1.0f,
|
||||||
RangeRight = 1.0f,
|
RangeRight = 1.0f,
|
||||||
TriggerThreshold = 0.5f,
|
TriggerThreshold = 0.5f,
|
||||||
LeftJoycon =
|
LeftJoycon = new LeftJoyconCommonConfig<ConfigGamepadInputId>
|
||||||
new LeftJoyconCommonConfig<ConfigGamepadInputId>
|
{
|
||||||
{
|
DpadUp = ConfigGamepadInputId.DpadUp,
|
||||||
DpadUp = ConfigGamepadInputId.DpadUp,
|
DpadDown = ConfigGamepadInputId.DpadDown,
|
||||||
DpadDown = ConfigGamepadInputId.DpadDown,
|
DpadLeft = ConfigGamepadInputId.DpadLeft,
|
||||||
DpadLeft = ConfigGamepadInputId.DpadLeft,
|
DpadRight = ConfigGamepadInputId.DpadRight,
|
||||||
DpadRight = ConfigGamepadInputId.DpadRight,
|
ButtonMinus = ConfigGamepadInputId.Minus,
|
||||||
ButtonMinus = ConfigGamepadInputId.Minus,
|
ButtonL = ConfigGamepadInputId.LeftShoulder,
|
||||||
ButtonL = ConfigGamepadInputId.LeftShoulder,
|
ButtonZl = ConfigGamepadInputId.LeftTrigger,
|
||||||
ButtonZl = ConfigGamepadInputId.LeftTrigger,
|
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
ButtonSr = ConfigGamepadInputId.Unbound
|
||||||
ButtonSr = ConfigGamepadInputId.Unbound
|
},
|
||||||
},
|
LeftJoyconStick = new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
||||||
LeftJoyconStick =
|
{
|
||||||
new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
Joystick = ConfigStickInputId.Left,
|
||||||
{
|
StickButton = ConfigGamepadInputId.LeftStick,
|
||||||
Joystick = ConfigStickInputId.Left,
|
InvertStickX = false,
|
||||||
StickButton = ConfigGamepadInputId.LeftStick,
|
InvertStickY = false
|
||||||
InvertStickX = false,
|
},
|
||||||
InvertStickY = false
|
RightJoycon = new RightJoyconCommonConfig<ConfigGamepadInputId>
|
||||||
},
|
{
|
||||||
RightJoycon =
|
ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B,
|
||||||
new RightJoyconCommonConfig<ConfigGamepadInputId>
|
ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A,
|
||||||
{
|
ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y,
|
||||||
ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B,
|
ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X,
|
||||||
ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A,
|
ButtonPlus = ConfigGamepadInputId.Plus,
|
||||||
ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y,
|
ButtonR = ConfigGamepadInputId.RightShoulder,
|
||||||
ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X,
|
ButtonZr = ConfigGamepadInputId.RightTrigger,
|
||||||
ButtonPlus = ConfigGamepadInputId.Plus,
|
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||||
ButtonR = ConfigGamepadInputId.RightShoulder,
|
ButtonSr = ConfigGamepadInputId.Unbound
|
||||||
ButtonZr = ConfigGamepadInputId.RightTrigger,
|
},
|
||||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
|
||||||
ButtonSr = ConfigGamepadInputId.Unbound
|
|
||||||
},
|
|
||||||
RightJoyconStick = new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
RightJoyconStick = new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
||||||
{
|
{
|
||||||
Joystick = ConfigStickInputId.Right,
|
Joystick = ConfigStickInputId.Right,
|
||||||
|
@ -751,15 +743,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool validFileName = true;
|
bool validFileName = ProfileName.IndexOfAny(Path.GetInvalidFileNameChars()) == -1;
|
||||||
|
|
||||||
foreach (char invalidChar in Path.GetInvalidFileNameChars())
|
|
||||||
{
|
|
||||||
if (ProfileName.Contains(invalidChar))
|
|
||||||
{
|
|
||||||
validFileName = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (validFileName)
|
if (validFileName)
|
||||||
{
|
{
|
||||||
|
@ -837,7 +821,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
string selected = Devices[Device].Id;
|
string selected = Devices[Device].Id;
|
||||||
|
|
||||||
if (selected.StartsWith("keyboard"))
|
if (selected.StartsWith(KeyboardString))
|
||||||
{
|
{
|
||||||
var inputConfig = Configuration as InputConfiguration<Key, ConfigStickInputId>;
|
var inputConfig = Configuration as InputConfiguration<Key, ConfigStickInputId>;
|
||||||
inputConfig.Id = selected.Split("/")[1];
|
inputConfig.Id = selected.Split("/")[1];
|
||||||
|
@ -854,7 +838,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
config.ControllerType = Controllers[_controller].Type;
|
config.ControllerType = Controllers[_controller].Type;
|
||||||
config.PlayerIndex = _playerId;
|
config.PlayerIndex = _playerId;
|
||||||
|
|
||||||
int i = newConfig.FindIndex(x => x.PlayerIndex == this.PlayerId);
|
int i = newConfig.FindIndex(x => x.PlayerIndex == PlayerId);
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
newConfig.Add(config);
|
newConfig.Add(config);
|
||||||
|
@ -865,10 +849,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mainWindow.AppHost != null)
|
_mainWindow.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||||
{
|
|
||||||
_mainWindow.AppHost.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Atomically replace and signal input change.
|
// Atomically replace and signal input change.
|
||||||
// NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event.
|
// NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event.
|
||||||
|
|
|
@ -837,7 +837,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
|
|
||||||
public void LoadConfigurableHotKeys()
|
public void LoadConfigurableHotKeys()
|
||||||
{
|
{
|
||||||
if(AvaloniaMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUi, out var showUiKey))
|
if (AvaloniaMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUi, out var showUiKey))
|
||||||
{
|
{
|
||||||
ShowUiKey = new KeyGesture(showUiKey, KeyModifiers.None);
|
ShowUiKey = new KeyGesture(showUiKey, KeyModifiers.None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
_resolutionScale = value;
|
_resolutionScale = value;
|
||||||
|
|
||||||
OnPropertyChanged(nameof(CustomResolutionScale));
|
OnPropertyChanged(nameof(CustomResolutionScale));
|
||||||
OnPropertyChanged(nameof(IsResolutionScaleActive));
|
OnPropertyChanged(nameof(IsCustomResolutionScaleActive));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int GraphicsBackendMultithreadingIndex
|
public int GraphicsBackendMultithreadingIndex
|
||||||
|
@ -115,7 +115,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
public bool IsSoundIoEnabled { get; set; }
|
public bool IsSoundIoEnabled { get; set; }
|
||||||
public bool IsSDL2Enabled { get; set; }
|
public bool IsSDL2Enabled { get; set; }
|
||||||
public bool EnableCustomTheme { get; set; }
|
public bool EnableCustomTheme { get; set; }
|
||||||
public bool IsResolutionScaleActive => _resolutionScale == 0;
|
public bool IsCustomResolutionScaleActive => _resolutionScale == 0;
|
||||||
|
|
||||||
public string TimeZone { get; set; }
|
public string TimeZone { get; set; }
|
||||||
public string ShaderDumpPath { get; set; }
|
public string ShaderDumpPath { get; set; }
|
||||||
|
@ -231,11 +231,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
||||||
{
|
{
|
||||||
var dialog = new OpenFileDialog()
|
var dialog = new OpenFileDialog()
|
||||||
{
|
{
|
||||||
Title = "Select Theme File",
|
Title = LocaleManager.Instance["SettingsSelectThemeFileDialogTitle"],
|
||||||
AllowMultiple = false
|
AllowMultiple = false
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog.Filters.Add(new FileDialogFilter() { Extensions = { "xaml" }, Name = "Xaml Theme File" });
|
dialog.Filters.Add(new FileDialogFilter() { Extensions = { "xaml" }, Name = LocaleManager.Instance["SettingsXamlThemeFile"] });
|
||||||
|
|
||||||
var file = await dialog.ShowAsync(_owner);
|
var file = await dialog.ShowAsync(_owner);
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||||
|
|
||||||
return assigner;
|
return assigner;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Unchecked(object sender, RoutedEventArgs e)
|
private void Button_Unchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_currentAssigner?.Cancel();
|
_currentAssigner?.Cancel();
|
||||||
|
|
|
@ -574,7 +574,7 @@
|
||||||
LargeChange="1"
|
LargeChange="1"
|
||||||
SimpleNumberFormat="F2"
|
SimpleNumberFormat="F2"
|
||||||
SpinButtonPlacementMode="Inline"
|
SpinButtonPlacementMode="Inline"
|
||||||
IsVisible="{Binding IsResolutionScaleActive}"
|
IsVisible="{Binding IsCustomResolutionScaleActive}"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
Minimum="0.1"
|
Minimum="0.1"
|
||||||
Value="{Binding CustomResolutionScale}" />
|
Value="{Binding CustomResolutionScale}" />
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace Ryujinx.Ui.Windows
|
||||||
_gtk3KeyboardDriver.Dispose();
|
_gtk3KeyboardDriver.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetShrinkedGamepadName(string str)
|
private static string GetShortGamepadName(string str)
|
||||||
{
|
{
|
||||||
const string ShrinkChars = "...";
|
const string ShrinkChars = "...";
|
||||||
const int MaxSize = 50;
|
const int MaxSize = 50;
|
||||||
|
@ -264,7 +264,7 @@ namespace Ryujinx.Ui.Windows
|
||||||
|
|
||||||
if (gamepad != null)
|
if (gamepad != null)
|
||||||
{
|
{
|
||||||
_inputDevice.Append($"keyboard/{id}", GetShrinkedGamepadName($"{gamepad.Name} ({id})"));
|
_inputDevice.Append($"keyboard/{id}", GetShortGamepadName($"{gamepad.Name} ({id})"));
|
||||||
|
|
||||||
gamepad.Dispose();
|
gamepad.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ namespace Ryujinx.Ui.Windows
|
||||||
|
|
||||||
if (gamepad != null)
|
if (gamepad != null)
|
||||||
{
|
{
|
||||||
_inputDevice.Append($"controller/{id}", GetShrinkedGamepadName($"{gamepad.Name} ({id})"));
|
_inputDevice.Append($"controller/{id}", GetShortGamepadName($"{gamepad.Name} ({id})"));
|
||||||
|
|
||||||
gamepad.Dispose();
|
gamepad.Dispose();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue