mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 08:56:24 +02:00
Extended hotkeys to player1-8 + h, localized the overlay
This commit is contained in:
parent
0afc910f39
commit
72752d2c4b
16 changed files with 338 additions and 79 deletions
|
@ -33,6 +33,7 @@ using Ryujinx.Common.Utilities;
|
|||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.GAL.Multithreading;
|
||||
using Ryujinx.Graphics.Gpu;
|
||||
using Ryujinx.Graphics.Gpu.Overlay;
|
||||
using Ryujinx.Graphics.OpenGL;
|
||||
using Ryujinx.Graphics.Vulkan;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
|
@ -129,6 +130,7 @@ namespace Ryujinx.Ava.Systems
|
|||
private readonly bool _isFirmwareTitle;
|
||||
|
||||
private readonly Lock _lockObject = new();
|
||||
private ControllerOverlay _controllerOverlay;
|
||||
|
||||
public event EventHandler AppExit;
|
||||
public event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
|
||||
|
@ -932,6 +934,18 @@ namespace Ryujinx.Ava.Systems
|
|||
_viewModel.UiHandler
|
||||
)
|
||||
);
|
||||
|
||||
// Initialize controller overlay with localization
|
||||
var localization = new ControllerOverlayLocalization
|
||||
{
|
||||
TitleText = LocaleManager.Instance[LocaleKeys.ControllerOverlayTitle],
|
||||
NoControllerText = LocaleManager.Instance[LocaleKeys.ControllerOverlayNoController],
|
||||
KeyboardText = LocaleManager.Instance[LocaleKeys.ControllerOverlayKeyboard],
|
||||
ControllerText = LocaleManager.Instance[LocaleKeys.ControllerOverlayController],
|
||||
UnknownText = LocaleManager.Instance[LocaleKeys.ControllerOverlayUnknown]
|
||||
};
|
||||
_controllerOverlay = new ControllerOverlay(localization);
|
||||
Device.Gpu.Window.AddOverlay(_controllerOverlay);
|
||||
}
|
||||
|
||||
private static IHardwareDeviceDriver InitializeAudio()
|
||||
|
@ -1350,6 +1364,21 @@ namespace Ryujinx.Ava.Systems
|
|||
case KeyboardHotkeyState.CycleInputDevicePlayer4:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Player4);
|
||||
break;
|
||||
case KeyboardHotkeyState.CycleInputDevicePlayer5:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Player5);
|
||||
break;
|
||||
case KeyboardHotkeyState.CycleInputDevicePlayer6:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Player6);
|
||||
break;
|
||||
case KeyboardHotkeyState.CycleInputDevicePlayer7:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Player7);
|
||||
break;
|
||||
case KeyboardHotkeyState.CycleInputDevicePlayer8:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Player8);
|
||||
break;
|
||||
case KeyboardHotkeyState.CycleInputDeviceHandheld:
|
||||
CycleInputDevice(HLE.HOS.Services.Hid.PlayerIndex.Handheld);
|
||||
break;
|
||||
case KeyboardHotkeyState.None:
|
||||
(_keyboardInterface as AvaloniaKeyboard).Clear();
|
||||
break;
|
||||
|
@ -1458,7 +1487,7 @@ namespace Ryujinx.Ava.Systems
|
|||
NpadManager.ReloadConfiguration(currentConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
|
||||
// Show controller overlay
|
||||
ShowControllerOverlay(currentConfig);
|
||||
ShowControllerOverlay(currentConfig, ConfigurationState.Instance.ControllerOverlayInputCycleDuration.Value);
|
||||
}
|
||||
|
||||
private InputConfig CreateDefaultInputConfig((DeviceType Type, string Id, string Name) device, PlayerIndex playerIndex)
|
||||
|
@ -1476,21 +1505,17 @@ namespace Ryujinx.Ava.Systems
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ShowControllerOverlay(List<InputConfig> inputConfigs)
|
||||
public void ShowControllerOverlay(List<InputConfig> inputConfigs, int duration)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Show overlay through the GPU context window directly
|
||||
if (Device?.Gpu?.Window != null)
|
||||
if (_controllerOverlay != null)
|
||||
{
|
||||
int duration = ConfigurationState.Instance.ControllerOverlayInputCycleDuration.Value;
|
||||
Device.Gpu.Window.ShowControllerBindings(inputConfigs, duration);
|
||||
_controllerOverlay.ShowControllerBindings(inputConfigs, duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Application, "AppHost: Cannot show overlay - Device.Gpu.Window is null");
|
||||
Logger.Warning?.Print(LogClass.Application, "AppHost: Cannot show overlay - ControllerOverlay is null");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1567,6 +1592,26 @@ namespace Ryujinx.Ava.Systems
|
|||
{
|
||||
state = KeyboardHotkeyState.CycleInputDevicePlayer4;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.CycleInputDevicePlayer5))
|
||||
{
|
||||
state = KeyboardHotkeyState.CycleInputDevicePlayer5;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.CycleInputDevicePlayer6))
|
||||
{
|
||||
state = KeyboardHotkeyState.CycleInputDevicePlayer6;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.CycleInputDevicePlayer7))
|
||||
{
|
||||
state = KeyboardHotkeyState.CycleInputDevicePlayer7;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.CycleInputDevicePlayer8))
|
||||
{
|
||||
state = KeyboardHotkeyState.CycleInputDevicePlayer8;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.CycleInputDeviceHandheld))
|
||||
{
|
||||
state = KeyboardHotkeyState.CycleInputDeviceHandheld;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue