Clear LED on game close as well

This commit is contained in:
Evan Husted
2025-01-23 21:59:54 -06:00
parent a6dfbe9ec2
commit 344c1a5fef
9 changed files with 43 additions and 14 deletions

View File

@@ -587,6 +587,11 @@ namespace Ryujinx.Ava
return;
}
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
{
gamepad?.ClearLed();
}
_isStopped = true;
Stop();
}

View File

@@ -59,6 +59,8 @@ namespace Ryujinx.Ava.Input
return new AvaloniaKeyboard(this, _keyboardIdentifers[0], LocaleManager.Instance[LocaleKeys.AllKeyboards]);
}
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
protected virtual void Dispose(bool disposing)
{
if (disposing)

View File

@@ -3,6 +3,7 @@ using Avalonia.Controls;
using Avalonia.Input;
using Ryujinx.Input;
using System;
using System.Collections.Generic;
using System.Numerics;
using MouseButton = Ryujinx.Input.MouseButton;
using Size = System.Drawing.Size;
@@ -134,6 +135,8 @@ namespace Ryujinx.Ava.Input
return new AvaloniaMouse(this);
}
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
public void Dispose()
{
if (_isDisposed)

View File

@@ -237,14 +237,9 @@ namespace Ryujinx.Ava.UI.Views.Input
{
base.OnDetachedFromVisualTree(e);
if (DataContext is ControllerInputViewModel vm)
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
{
foreach ((_, string id, _) in vm.ParentModel.Devices.Where(x => x.Type == DeviceType.Controller))
{
IGamepad gamepad = RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepad(id);
gamepad?.ClearLed();
}
gamepad?.ClearLed();
}
_currentAssigner?.Cancel();

View File

@@ -112,14 +112,9 @@ namespace Ryujinx.Ava.UI.Windows
{
HotkeysPage.Dispose();
if (InputPage.InputView.DataContext is InputViewModel vm)
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
{
foreach ((_, string id, _) in vm.Devices.Where(x => x.Type == DeviceType.Controller))
{
IGamepad gamepad = RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepad(id);
gamepad?.ClearLed();
}
gamepad?.ClearLed();
}
InputPage.Dispose();