Flush internal driver state before unblocking input updates
This commit is contained in:
parent
2edd862433
commit
b33a5f9877
5 changed files with 20 additions and 2 deletions
|
@ -81,6 +81,11 @@ namespace Ryujinx.Input.GTK3
|
||||||
return _pressedKeys.Contains(nativeKey);
|
return _pressedKeys.Contains(nativeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Flush()
|
||||||
|
{
|
||||||
|
_pressedKeys.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public IGamepad GetGamepad(string id)
|
public IGamepad GetGamepad(string id)
|
||||||
{
|
{
|
||||||
if (!_keyboardIdentifers[0].Equals(id))
|
if (!_keyboardIdentifers[0].Equals(id))
|
||||||
|
|
|
@ -174,6 +174,11 @@ namespace Ryujinx.Input.HLE
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
|
foreach (InputConfig inputConfig in _inputConfig)
|
||||||
|
{
|
||||||
|
_controllers[(int)inputConfig.PlayerIndex].GamepadDriver.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
_blockInputUpdates = false;
|
_blockInputUpdates = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Ryujinx.Input
|
namespace Ryujinx.Input
|
||||||
{
|
{
|
||||||
|
@ -33,5 +34,12 @@ namespace Ryujinx.Input
|
||||||
/// <param name="id">The unique id of the gamepad</param>
|
/// <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>
|
/// <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>
|
||||||
|
/// Flush the internal state of the driver.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Does nothing by default.</remarks>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
void Flush() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ namespace Ryujinx.Ava.Input
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_driver?.ResetKeys();
|
_driver?.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Ryujinx.Ava.Input
|
||||||
return _pressedKeys.Contains(nativeKey);
|
return _pressedKeys.Contains(nativeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetKeys()
|
public void Flush()
|
||||||
{
|
{
|
||||||
_pressedKeys.Clear();
|
_pressedKeys.Clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue