See merge request ryubing/ryujinx!202
This commit is contained in:
LotP 2025-10-30 20:55:58 -05:00
parent ab7aeee67b
commit 92b61f9d73
43 changed files with 686 additions and 315 deletions

View file

@ -1,8 +1,10 @@
using Ryujinx.Common;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Common.Configuration.Hid.Keyboard;
using Ryujinx.HLE.HOS.Services.Hid;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@ -18,6 +20,7 @@ namespace Ryujinx.Input.HLE
{
public class NpadManager : IDisposable
{
private static readonly ObjectPool<List<SixAxisInput>> _hleMotionStatesPool = new (() => new List<SixAxisInput>(NpadDevices.MaxControllers));
private readonly CemuHookClient _cemuHookClient;
private readonly Lock _lock = new();
@ -215,7 +218,7 @@ namespace Ryujinx.Input.HLE
lock (_lock)
{
List<GamepadInput> hleInputStates = [];
List<SixAxisInput> hleMotionStates = new(NpadDevices.MaxControllers);
List<SixAxisInput> hleMotionStates = _hleMotionStatesPool.Allocate();
KeyboardInput? hleKeyboardInput = null;
@ -317,6 +320,8 @@ namespace Ryujinx.Input.HLE
Vector2 position = IMouse.GetScreenPosition(mouseInput.Position, mouse.ClientSize, aspectRatio);
_device.Hid.Mouse.Update((int)position.X, (int)position.Y, buttons, (int)mouseInput.Scroll.X, (int)mouseInput.Scroll.Y, true);
ArrayPool<bool>.Shared.Return(mouseInput.ButtonState);
}
else
{
@ -324,6 +329,8 @@ namespace Ryujinx.Input.HLE
}
_device.TamperMachine.UpdateInput(hleInputStates);
_hleMotionStatesPool.Release(hleMotionStates);
}
}