mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 06:46:24 +02:00
Controller overlay showing which player is bound to which controller
This commit is contained in:
parent
74a9b94227
commit
8765dc9901
3 changed files with 243 additions and 0 deletions
|
@ -32,6 +32,7 @@ using Ryujinx.Ava.UI.Windows;
|
|||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.UI;
|
||||
|
@ -1690,11 +1691,37 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
SetMainContent(RendererHostControl);
|
||||
|
||||
RendererHostControl.Focus();
|
||||
|
||||
// Show controller overlay
|
||||
ShowControllerOverlay();
|
||||
});
|
||||
|
||||
public static void UpdateGameMetadata(string titleId, TimeSpan playTime)
|
||||
=> ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => appMetadata.UpdatePostGame(playTime));
|
||||
|
||||
private void ShowControllerOverlay()
|
||||
{
|
||||
try
|
||||
{
|
||||
var inputConfigs = ConfigurationState.Instance.System.UseInputGlobalConfig.Value && Program.UseExtraConfig
|
||||
? ConfigurationState.InstanceExtra.Hid.InputConfig.Value
|
||||
: ConfigurationState.Instance.Hid.InputConfig.Value;
|
||||
|
||||
// Only show overlay if there are actual controller configurations for players 1-4
|
||||
if (inputConfigs?.Any(c => c.PlayerIndex <= PlayerIndex.Player4) == true)
|
||||
{
|
||||
var overlay = new Windows.ControllerOverlayWindow(Window);
|
||||
overlay.ShowControllerBindings(inputConfigs);
|
||||
overlay.Show();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Log the error but don't let it crash the game launch
|
||||
Logger.Error?.Print(LogClass.UI, $"Failed to show controller overlay: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshFirmwareStatus()
|
||||
{
|
||||
SystemVersion version = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue