Overlay system

This commit is contained in:
Barış Hamil 2025-06-21 00:17:10 +03:00
parent 3be20385ed
commit 069a703f22
13 changed files with 1088 additions and 19 deletions

View file

@ -1480,22 +1480,23 @@ namespace Ryujinx.Ava.Systems
private void ShowControllerOverlay(List<InputConfig> inputConfigs)
{
Dispatcher.UIThread.InvokeAsync(() =>
try
{
try
// Show overlay through the GPU context window directly
if (Device?.Gpu?.Window != null)
{
// Access the overlay through the MainWindow via the ViewModel
if (_viewModel?.Window?.ControllerOverlay != null)
{
int duration = ConfigurationState.Instance.ControllerOverlayInputCycleDuration.Value;
_viewModel.Window.ControllerOverlay.ShowControllerBindings(inputConfigs, duration);
}
int duration = ConfigurationState.Instance.ControllerOverlayInputCycleDuration.Value;
Device.Gpu.Window.ShowControllerBindings(inputConfigs, duration);
}
catch (Exception ex)
else
{
Logger.Error?.Print(LogClass.Application, $"Failed to show controller overlay: {ex.Message}");
Logger.Warning?.Print(LogClass.Application, "AppHost: Cannot show overlay - Device.Gpu.Window is null");
}
});
}
catch (Exception ex)
{
Logger.Error?.Print(LogClass.Application, $"Failed to show controller overlay: {ex.Message}");
}
}
private KeyboardHotkeyState GetHotkeyState()

View file

@ -1703,11 +1703,22 @@ namespace Ryujinx.Ava.UI.ViewModels
? 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)
// Debug: Log what we're getting
Logger.Info?.Print(LogClass.UI, $"MainWindowViewModel: Found {inputConfigs?.Count ?? 0} input configs");
if (inputConfigs != null)
{
int duration = ConfigurationState.Instance.ControllerOverlayGameStartDuration.Value;
Window.ControllerOverlay.ShowControllerBindings(inputConfigs, duration);
foreach (var config in inputConfigs)
{
Logger.Info?.Print(LogClass.UI, $" Config: Player {config.PlayerIndex}, Backend {config.Backend}, Name '{config.Name}', Type {config.ControllerType}");
}
}
// Always show overlay - if no configs, it will show test data
int duration = ConfigurationState.Instance.ControllerOverlayGameStartDuration.Value;
// Show overlay through the GPU context window directly
if (AppHost?.Device?.Gpu?.Window != null)
{
AppHost.Device.Gpu.Window.ShowControllerBindings(inputConfigs, duration);
}
}
catch (Exception ex)

View file

@ -180,9 +180,6 @@
Grid.Row="2" />
</Grid>
<!-- Controller Overlay -->
<overlayControls:ControllerOverlay
Name="ControllerOverlay"
ZIndex="2000" />
</Grid>
</window:StyleableAppWindow>