From 4ee1dff4971dbadd8d920e6247e182b654e3cc6c Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Mon, 14 Oct 2024 15:03:36 -0500 Subject: [PATCH] SDL: Move Mouse to the Input project instead of Headless. --- src/Ryujinx.Headless.SDL2/WindowBase.cs | 1 + .../SDL2Mouse.cs | 5 ++--- .../SDL2MouseDriver.cs | 7 +++---- src/Ryujinx.SDL2.Common/SDL2Driver.cs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) rename src/{Ryujinx.Headless.SDL2 => Ryujinx.Input.SDL2}/SDL2Mouse.cs (96%) rename src/{Ryujinx.Headless.SDL2 => Ryujinx.Input.SDL2}/SDL2MouseDriver.cs (96%) diff --git a/src/Ryujinx.Headless.SDL2/WindowBase.cs b/src/Ryujinx.Headless.SDL2/WindowBase.cs index 8768913f5..039ef10e8 100644 --- a/src/Ryujinx.Headless.SDL2/WindowBase.cs +++ b/src/Ryujinx.Headless.SDL2/WindowBase.cs @@ -10,6 +10,7 @@ using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationPr using Ryujinx.HLE.UI; using Ryujinx.Input; using Ryujinx.Input.HLE; +using Ryujinx.Input.SDL2; using Ryujinx.SDL2.Common; using System; using System.Collections.Concurrent; diff --git a/src/Ryujinx.Headless.SDL2/SDL2Mouse.cs b/src/Ryujinx.Input.SDL2/SDL2Mouse.cs similarity index 96% rename from src/Ryujinx.Headless.SDL2/SDL2Mouse.cs rename to src/Ryujinx.Input.SDL2/SDL2Mouse.cs index de64b4f8f..6dfd75984 100644 --- a/src/Ryujinx.Headless.SDL2/SDL2Mouse.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Mouse.cs @@ -1,12 +1,11 @@ using Ryujinx.Common.Configuration.Hid; -using Ryujinx.Input; using System; using System.Drawing; using System.Numerics; -namespace Ryujinx.Headless.SDL2 +namespace Ryujinx.Input.SDL2 { - class SDL2Mouse : IMouse + public class SDL2Mouse : IMouse { private SDL2MouseDriver _driver; diff --git a/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs b/src/Ryujinx.Input.SDL2/SDL2MouseDriver.cs similarity index 96% rename from src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs rename to src/Ryujinx.Input.SDL2/SDL2MouseDriver.cs index 8983091f5..286164049 100644 --- a/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2MouseDriver.cs @@ -1,6 +1,5 @@ using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; -using Ryujinx.Input; using System; using System.Diagnostics; using System.Drawing; @@ -8,9 +7,9 @@ using System.Numerics; using System.Runtime.CompilerServices; using static SDL2.SDL; -namespace Ryujinx.Headless.SDL2 +namespace Ryujinx.Input.SDL2 { - class SDL2MouseDriver : IGamepadDriver + public class SDL2MouseDriver : IGamepadDriver { private const int CursorHideIdleTime = 5; // seconds @@ -44,7 +43,7 @@ namespace Ryujinx.Headless.SDL2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MouseButton DriverButtonToMouseButton(uint rawButton) { - Debug.Assert(rawButton > 0 && rawButton <= (int)MouseButton.Count); + Debug.Assert(rawButton is > 0 and <= (int)MouseButton.Count); return (MouseButton)(rawButton - 1); } diff --git a/src/Ryujinx.SDL2.Common/SDL2Driver.cs b/src/Ryujinx.SDL2.Common/SDL2Driver.cs index 9827156d0..4d8961335 100644 --- a/src/Ryujinx.SDL2.Common/SDL2Driver.cs +++ b/src/Ryujinx.SDL2.Common/SDL2Driver.cs @@ -143,7 +143,7 @@ namespace Ryujinx.SDL2.Common OnJoystickDisconnected?.Invoke(evnt.cbutton.which); } - else if (evnt.type == SDL_EventType.SDL_WINDOWEVENT || evnt.type == SDL_EventType.SDL_MOUSEBUTTONDOWN || evnt.type == SDL_EventType.SDL_MOUSEBUTTONUP) + else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN or SDL_EventType.SDL_MOUSEBUTTONUP) { if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action handler)) {