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);
|
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.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@ -164,6 +165,8 @@ namespace Ryujinx.Input.SDL2
|
|||||||
return new SDL2Mouse(this);
|
return new SDL2Mouse(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_isDisposed)
|
if (_isDisposed)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.Input.SDL2
|
namespace Ryujinx.Input.SDL2
|
||||||
{
|
{
|
||||||
@ -51,5 +52,13 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards");
|
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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.Input
|
namespace Ryujinx.Input
|
||||||
{
|
{
|
||||||
@ -34,6 +35,11 @@ namespace Ryujinx.Input
|
|||||||
/// <returns>An instance of <see cref="IGamepad"/> associated to the gamepad id given or null if not found</returns>
|
/// <returns>An instance of <see cref="IGamepad"/> associated to the gamepad id given or null if not found</returns>
|
||||||
IGamepad GetGamepad(string id);
|
IGamepad GetGamepad(string id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an <see cref="IEnumerable{T}"/> of the connected gamepads.
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<IGamepad> GetGamepads();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clear the internal state of the driver.
|
/// Clear the internal state of the driver.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -587,6 +587,11 @@ namespace Ryujinx.Ava
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
|
||||||
|
{
|
||||||
|
gamepad?.ClearLed();
|
||||||
|
}
|
||||||
|
|
||||||
_isStopped = true;
|
_isStopped = true;
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ namespace Ryujinx.Ava.Input
|
|||||||
return new AvaloniaKeyboard(this, _keyboardIdentifers[0], LocaleManager.Instance[LocaleKeys.AllKeyboards]);
|
return new AvaloniaKeyboard(this, _keyboardIdentifers[0], LocaleManager.Instance[LocaleKeys.AllKeyboards]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
|
@ -3,6 +3,7 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MouseButton = Ryujinx.Input.MouseButton;
|
using MouseButton = Ryujinx.Input.MouseButton;
|
||||||
using Size = System.Drawing.Size;
|
using Size = System.Drawing.Size;
|
||||||
@ -134,6 +135,8 @@ namespace Ryujinx.Ava.Input
|
|||||||
return new AvaloniaMouse(this);
|
return new AvaloniaMouse(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_isDisposed)
|
if (_isDisposed)
|
||||||
|
@ -237,15 +237,10 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||||||
{
|
{
|
||||||
base.OnDetachedFromVisualTree(e);
|
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();
|
_currentAssigner?.Cancel();
|
||||||
_currentAssigner = null;
|
_currentAssigner = null;
|
||||||
|
@ -112,15 +112,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
{
|
{
|
||||||
HotkeysPage.Dispose();
|
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();
|
InputPage.Dispose();
|
||||||
base.OnClosing(e);
|
base.OnClosing(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user