Clear LED on game close as well
This commit is contained in:
parent
a6dfbe9ec2
commit
344c1a5fef
@ -173,5 +173,16 @@ namespace Ryujinx.Input.SDL2
|
||||
|
||||
return new SDL2Gamepad(gamepadHandle, id);
|
||||
}
|
||||
|
||||
public IEnumerable<IGamepad> GetGamepads()
|
||||
{
|
||||
lock (_gamepadsIds)
|
||||
{
|
||||
foreach (string gamepadId in _gamepadsIds)
|
||||
{
|
||||
yield return GetGamepad(gamepadId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
@ -164,6 +165,8 @@ namespace Ryujinx.Input.SDL2
|
||||
return new SDL2Mouse(this);
|
||||
}
|
||||
|
||||
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Ryujinx.SDL2.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Input.SDL2
|
||||
{
|
||||
@ -51,5 +52,13 @@ namespace Ryujinx.Input.SDL2
|
||||
|
||||
return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards");
|
||||
}
|
||||
|
||||
public IEnumerable<IGamepad> GetGamepads()
|
||||
{
|
||||
foreach (var keyboardId in _keyboardIdentifers)
|
||||
{
|
||||
yield return GetGamepad(keyboardId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Input
|
||||
{
|
||||
@ -33,6 +34,11 @@ namespace Ryujinx.Input
|
||||
/// <param name="id">The unique id of the gamepad</param>
|
||||
/// <returns>An instance of <see cref="IGamepad"/> associated to the gamepad id given or null if not found</returns>
|
||||
IGamepad GetGamepad(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an <see cref="IEnumerable{T}"/> of the connected gamepads.
|
||||
/// </summary>
|
||||
IEnumerable<IGamepad> GetGamepads();
|
||||
|
||||
/// <summary>
|
||||
/// Clear the internal state of the driver.
|
||||
|
@ -587,6 +587,11 @@ namespace Ryujinx.Ava
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
|
||||
{
|
||||
gamepad?.ClearLed();
|
||||
}
|
||||
|
||||
_isStopped = true;
|
||||
Stop();
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user