Controller overlay showing which player is bound to which controller

This commit is contained in:
Barış Hamil 2025-06-20 17:44:51 +03:00 committed by GreemDev
parent 74a9b94227
commit 8765dc9901
3 changed files with 243 additions and 0 deletions

View file

@ -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;