From fe941e46fb38d58ae36ecc3db6c4a3dcbbf7428c Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 20 Jul 2024 18:09:12 +0100 Subject: [PATCH] Move some stuff over --- src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs | 4 +- src/Ryujinx.HLE/HOS/Horizon.cs | 20 ++----- src/Ryujinx.HLE/Switch.cs | 3 -- src/Ryujinx.Headless.SDL2/WindowBase.cs | 4 +- src/Ryujinx.Horizon/Hid/HidIpcServer.cs | 2 +- src/Ryujinx.Horizon/Hid/HidServer.cs | 52 +++++++------------ src/Ryujinx.Horizon/HorizonStatic.cs | 4 ++ src/Ryujinx.Horizon/Sdk/Hid/Hid.cs | 2 +- src/Ryujinx.Input/HLE/NpadManager.cs | 21 ++++---- src/Ryujinx.Input/HLE/TouchScreenManager.cs | 16 ++---- src/Ryujinx/AppHost.cs | 6 +-- .../UI/Applet/ControllerAppletDialog.axaml.cs | 10 ++-- 12 files changed, 55 insertions(+), 89 deletions(-) diff --git a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs index 0e636792db..df345cbabf 100644 --- a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs +++ b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs @@ -7,6 +7,7 @@ using Ryujinx.Common.Utilities; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL.Multithreading; using Ryujinx.Graphics.Gpu; +using Ryujinx.Horizon; using Ryujinx.Input; using Ryujinx.Input.GTK3; using Ryujinx.Input.HLE; @@ -368,7 +369,6 @@ namespace Ryujinx.UI } NpadManager.Initialize(device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse); - TouchScreenManager.Initialize(device); } private unsafe void Renderer_ScreenCaptured(object sender, ScreenCaptureImageInfo e) @@ -733,7 +733,7 @@ namespace Ryujinx.UI TouchScreenManager.Update(false); } - Device.Hid.DebugPad.Update(); + HorizonStatic.Hid.DebugPad.Update(); return true; } diff --git a/src/Ryujinx.HLE/HOS/Horizon.cs b/src/Ryujinx.HLE/HOS/Horizon.cs index 64b08e3093..4d94cd84f2 100644 --- a/src/Ryujinx.HLE/HOS/Horizon.cs +++ b/src/Ryujinx.HLE/HOS/Horizon.cs @@ -41,7 +41,6 @@ namespace Ryujinx.HLE.HOS public class Horizon : IDisposable { - internal const int HidSize = 0x40000; internal const int FontSize = 0x1100000; internal const int IirsSize = 0x8000; internal const int TimeSize = 0x1000; @@ -68,7 +67,6 @@ namespace Ryujinx.HLE.HOS internal ServerBase SmServer { get; private set; } internal ServerBase BsdServer { get; private set; } internal ServerBase FsServer { get; private set; } - internal ServerBase HidServer { get; private set; } internal ServerBase NvDrvServer { get; private set; } internal ServerBase TimeServer { get; private set; } internal ServerBase ViServer { get; private set; } @@ -76,7 +74,6 @@ namespace Ryujinx.HLE.HOS internal ServerBase ViServerS { get; private set; } internal ServerBase LdnServer { get; private set; } - internal KSharedMemory HidSharedMem { get; private set; } internal KSharedMemory FontSharedMem { get; private set; } internal KSharedMemory IirsSharedMem { get; private set; } @@ -101,7 +98,6 @@ namespace Ryujinx.HLE.HOS public int GlobalAccessLogMode { get; set; } - internal SharedMemoryStorage HidStorage { get; private set; } internal NvHostSyncpt HostSyncpoint { get; private set; } @@ -134,33 +130,26 @@ namespace Ryujinx.HLE.HOS // region used that is used is Application, so we can use the other ones for anything. KMemoryRegionManager region = KernelContext.MemoryManager.MemoryRegions[(int)MemoryRegion.NvServices]; - ulong hidPa = region.Address; - ulong fontPa = region.Address + HidSize; - ulong iirsPa = region.Address + HidSize + FontSize; - ulong timePa = region.Address + HidSize + FontSize + IirsSize; - ulong appletCaptureBufferPa = region.Address + HidSize + FontSize + IirsSize + TimeSize; + ulong fontPa = region.Address; + ulong iirsPa = region.Address + FontSize; + ulong timePa = region.Address + FontSize + IirsSize; + ulong appletCaptureBufferPa = region.Address + FontSize + IirsSize + TimeSize; - KPageList hidPageList = new(); KPageList fontPageList = new(); KPageList iirsPageList = new(); KPageList timePageList = new(); KPageList appletCaptureBufferPageList = new(); - hidPageList.AddRange(hidPa, HidSize / KPageTableBase.PageSize); fontPageList.AddRange(fontPa, FontSize / KPageTableBase.PageSize); iirsPageList.AddRange(iirsPa, IirsSize / KPageTableBase.PageSize); timePageList.AddRange(timePa, TimeSize / KPageTableBase.PageSize); appletCaptureBufferPageList.AddRange(appletCaptureBufferPa, AppletCaptureBufferSize / KPageTableBase.PageSize); - var hidStorage = new SharedMemoryStorage(KernelContext, hidPageList); var fontStorage = new SharedMemoryStorage(KernelContext, fontPageList); var iirsStorage = new SharedMemoryStorage(KernelContext, iirsPageList); var timeStorage = new SharedMemoryStorage(KernelContext, timePageList); var appletCaptureBufferStorage = new SharedMemoryStorage(KernelContext, appletCaptureBufferPageList); - HidStorage = hidStorage; - - HidSharedMem = new KSharedMemory(KernelContext, hidStorage, 0, 0, KMemoryPermission.Read); FontSharedMem = new KSharedMemory(KernelContext, fontStorage, 0, 0, KMemoryPermission.Read); IirsSharedMem = new KSharedMemory(KernelContext, iirsStorage, 0, 0, KMemoryPermission.Read); @@ -247,7 +236,6 @@ namespace Ryujinx.HLE.HOS BsdServer = new ServerBase(KernelContext, "BsdServer"); FsServer = new ServerBase(KernelContext, "FsServer"); - HidServer = new ServerBase(KernelContext, "HidServer"); NvDrvServer = new ServerBase(KernelContext, "NvservicesServer"); TimeServer = new ServerBase(KernelContext, "TimeServer"); ViServer = new ServerBase(KernelContext, "ViServerU"); diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index 7cbfed039f..9c1f644f1c 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -5,7 +5,6 @@ using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; using Ryujinx.HLE.HOS.Services.Apm; -using Ryujinx.HLE.HOS.Services.Hid; using Ryujinx.HLE.Loaders.Processes; using Ryujinx.HLE.UI; using Ryujinx.Horizon.Sdk.Hid; @@ -24,7 +23,6 @@ namespace Ryujinx.HLE public HOS.Horizon System { get; } public ProcessLoader Processes { get; } public PerformanceStatistics Statistics { get; } - public Hid Hid { get; } public TamperMachine TamperMachine { get; } public IHostUIHandler UIHandler { get; } @@ -52,7 +50,6 @@ namespace Ryujinx.HLE Gpu = new GpuContext(Configuration.GpuRenderer); System = new HOS.Horizon(this); Statistics = new PerformanceStatistics(); - Hid = new Hid(this, System.HidStorage); Processes = new ProcessLoader(this); TamperMachine = new TamperMachine(); diff --git a/src/Ryujinx.Headless.SDL2/WindowBase.cs b/src/Ryujinx.Headless.SDL2/WindowBase.cs index 8768913f5a..1739d01b53 100644 --- a/src/Ryujinx.Headless.SDL2/WindowBase.cs +++ b/src/Ryujinx.Headless.SDL2/WindowBase.cs @@ -8,6 +8,7 @@ using Ryujinx.Graphics.OpenGL; using Ryujinx.HLE.HOS.Applets; using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types; using Ryujinx.HLE.UI; +using Ryujinx.Horizon; using Ryujinx.Input; using Ryujinx.Input.HLE; using Ryujinx.SDL2.Common; @@ -125,7 +126,6 @@ namespace Ryujinx.Headless.SDL2 Renderer = renderer; NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse); - TouchScreenManager.Initialize(device); } private void SetWindowIcon() @@ -423,7 +423,7 @@ namespace Ryujinx.Headless.SDL2 TouchScreenManager.Update(false); } - Device.Hid.DebugPad.Update(); + HorizonStatic.Hid.DebugPad.Update(); // TODO: Replace this with MouseDriver.CheckIdle() when mouse motion events are received on every supported platform. MouseDriver.UpdatePosition(); diff --git a/src/Ryujinx.Horizon/Hid/HidIpcServer.cs b/src/Ryujinx.Horizon/Hid/HidIpcServer.cs index 84c85b3d70..b262002292 100644 --- a/src/Ryujinx.Horizon/Hid/HidIpcServer.cs +++ b/src/Ryujinx.Horizon/Hid/HidIpcServer.cs @@ -27,7 +27,7 @@ namespace Ryujinx.Horizon.Hid _serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _options, MaxSessionsCount); - // _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid"), MaxSessionsCount); + _serverManager.RegisterObjectForServer(new HidServer(), ServiceName.Encode("hid"), MaxSessionsCount); // _serverManager.RegisterObjectForServer(, ServiceName.Encode("hidbus"), MaxSessionsCount); // _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:sys"), MaxSessionsCount); // _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:dbg"), MaxSessionsCount); diff --git a/src/Ryujinx.Horizon/Hid/HidServer.cs b/src/Ryujinx.Horizon/Hid/HidServer.cs index 5af6241b02..1c3818a018 100644 --- a/src/Ryujinx.Horizon/Hid/HidServer.cs +++ b/src/Ryujinx.Horizon/Hid/HidServer.cs @@ -16,14 +16,6 @@ namespace Ryujinx.Horizon.Hid { partial class HidServer : IHidServer { - internal const int SharedMemEntryCount = 17; - - public DebugPadDevice DebugPad; - public TouchDevice Touchscreen; - public MouseDevice Mouse; - public KeyboardDevice Keyboard; - public NpadDevices Npads; - private SystemEventType _xpadIdEvent; private SystemEventType _palmaOperationCompleteEvent; @@ -48,12 +40,6 @@ namespace Ryujinx.Horizon.Hid public HidServer() { - DebugPad = new DebugPadDevice(true); - Touchscreen = new TouchDevice(true); - Mouse = new MouseDevice(false); - Keyboard = new KeyboardDevice(false); - Npads = new NpadDevices(true); - Os.CreateSystemEvent(out _xpadIdEvent, EventClearMode.ManualClear, interProcess: true); Os.SignalSystemEvent(ref _xpadIdEvent); // TODO: signal event at right place @@ -83,9 +69,9 @@ namespace Ryujinx.Horizon.Hid { // Initialize entries to avoid issues with some games. - for (int i = 0; i < SharedMemEntryCount; i++) + for (int i = 0; i < HorizonStatic.Hid.SharedMemEntryCount; i++) { - DebugPad.Update(); + HorizonStatic.Hid.DebugPad.Update(); } Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); @@ -96,13 +82,13 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(11)] public Result ActivateTouchScreen(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Touchscreen.Active = true; + HorizonStatic.Hid.Touchscreen.Active = true; // Initialize entries to avoid issues with some games. - for (int i = 0; i < SharedMemEntryCount; i++) + for (int i = 0; i < HorizonStatic.Hid.SharedMemEntryCount; i++) { - Touchscreen.Update(); + HorizonStatic.Hid.Touchscreen.Update(); } Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); @@ -113,13 +99,13 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(21)] public Result ActivateMouse(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Mouse.Active = true; + HorizonStatic.Hid.Mouse.Active = true; // Initialize entries to avoid issues with some games. - for (int i = 0; i < SharedMemEntryCount; i++) + for (int i = 0; i < HorizonStatic.Hid.SharedMemEntryCount; i++) { - Mouse.Update(0, 0); + HorizonStatic.Hid.Mouse.Update(0, 0); } Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); @@ -130,7 +116,7 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(31)] public Result ActivateKeyboard(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Keyboard.Active = true; + HorizonStatic.Hid.Keyboard.Active = true; // Initialize entries to avoid issues with some games. @@ -139,9 +125,9 @@ namespace Ryujinx.Horizon.Hid Keys = new ulong[4], }; - for (int i = 0; i < SharedMemEntryCount; i++) + for (int i = 0; i < HorizonStatic.Hid.SharedMemEntryCount; i++) { - Keyboard.Update(emptyInput); + HorizonStatic.Hid.Keyboard.Update(emptyInput); } Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); @@ -530,7 +516,7 @@ namespace Ryujinx.Horizon.Hid { Logger.Stub?.PrintStub(LogClass.ServiceHid, new { pid, appletResourceUserId, supportedStyleSets }); - Npads.SupportedStyleSets = supportedStyleSets; + HorizonStatic.Hid.Npads.SupportedStyleSets = supportedStyleSets; return Result.Success; } @@ -538,9 +524,9 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(101)] public Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, [ClientProcessId] ulong pid) { - supportedStyleSets = Npads.SupportedStyleSets; + supportedStyleSets = HorizonStatic.Hid.Npads.SupportedStyleSets; - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, Npads.SupportedStyleSets }); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, HorizonStatic.Hid.Npads.SupportedStyleSets }); return Result.Success; } @@ -548,13 +534,13 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(102)] public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan npadIds, [ClientProcessId] ulong pid) { - Npads.ClearSupportedPlayers(); + HorizonStatic.Hid.Npads.ClearSupportedPlayers(); for (int i = 0; i < npadIds.Length; i++) { if (IsValidNpadIdType(npadIds[i])) { - Npads.SetSupportedPlayer(GetIndexFromNpadIdType(npadIds[i])); + HorizonStatic.Hid.Npads.SetSupportedPlayer(GetIndexFromNpadIdType(npadIds[i])); } } @@ -574,7 +560,7 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(104)] public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Npads.Active = false; + HorizonStatic.Hid.Npads.Active = false; Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); return Result.Success; @@ -839,7 +825,7 @@ namespace Ryujinx.Horizon.Hid [vibrationDeviceHandle.Position] = vibrationValue, }; - Npads.UpdateRumbleQueue(vibrationDeviceHandle.PlayerId, dualVibrationValues); + HorizonStatic.Hid.Npads.UpdateRumbleQueue(vibrationDeviceHandle.PlayerId, dualVibrationValues); return Result.Success; } @@ -847,7 +833,7 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(202)] public Result GetActualVibrationValue(out VibrationValue vibrationValue, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, [ClientProcessId] ulong pid) { - vibrationValue = Npads.GetLastVibrationValue(vibrationDeviceHandle.PlayerId, vibrationDeviceHandle.Position); + vibrationValue = HorizonStatic.Hid.Npads.GetLastVibrationValue(vibrationDeviceHandle.PlayerId, vibrationDeviceHandle.Position); return Result.Success; } diff --git a/src/Ryujinx.Horizon/HorizonStatic.cs b/src/Ryujinx.Horizon/HorizonStatic.cs index 305d54bd1a..a89c78f69e 100644 --- a/src/Ryujinx.Horizon/HorizonStatic.cs +++ b/src/Ryujinx.Horizon/HorizonStatic.cs @@ -6,6 +6,9 @@ namespace Ryujinx.Horizon { public static class HorizonStatic { + [ThreadStatic] + private static Sdk.Hid.Hid _hid; + [ThreadStatic] private static HorizonOptions _options; @@ -21,6 +24,7 @@ namespace Ryujinx.Horizon [ThreadStatic] private static int _threadHandle; + public static Sdk.Hid.Hid Hid => _hid; public static HorizonOptions Options => _options; public static ISyscallApi Syscall => _syscall; public static IVirtualMemoryManager AddressSpace => _addressSpace; diff --git a/src/Ryujinx.Horizon/Sdk/Hid/Hid.cs b/src/Ryujinx.Horizon/Sdk/Hid/Hid.cs index 0032c7918a..4a901fa19b 100644 --- a/src/Ryujinx.Horizon/Sdk/Hid/Hid.cs +++ b/src/Ryujinx.Horizon/Sdk/Hid/Hid.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Horizon.Sdk.Hid internal ref SharedMemory SharedMemory => ref _storage.GetRef(0); - internal const int SharedMemEntryCount = 17; + internal readonly int SharedMemEntryCount = 17; public DebugPadDevice DebugPad; public TouchDevice Touchscreen; diff --git a/src/Ryujinx.Input/HLE/NpadManager.cs b/src/Ryujinx.Input/HLE/NpadManager.cs index 2c61c24352..7838e7fb56 100644 --- a/src/Ryujinx.Input/HLE/NpadManager.cs +++ b/src/Ryujinx.Input/HLE/NpadManager.cs @@ -1,9 +1,10 @@ using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Configuration.Hid.Keyboard; -using Ryujinx.HLE.HOS.Services.Hid; +using Ryujinx.Horizon; using Ryujinx.Horizon.Sdk.Hid; using Ryujinx.Horizon.Sdk.Hid.HidDevices; +using Ryujinx.Horizon.Sdk.Hid.Npad; using Ryujinx.Horizon.Sdk.Hid.SixAxis; using System; using System.Collections.Generic; @@ -66,7 +67,7 @@ namespace Ryujinx.Input.HLE } } - _device.Hid.RefreshInputConfig(validInputs); + HorizonStatic.Hid.RefreshInputConfig(validInputs); } } @@ -169,7 +170,7 @@ namespace Ryujinx.Input.HLE _enableKeyboard = enableKeyboard; _enableMouse = enableMouse; - _device.Hid.RefreshInputConfig(validInputs); + HorizonStatic.Hid.RefreshInputConfig(validInputs); } } @@ -228,11 +229,11 @@ namespace Ryujinx.Input.HLE controller.UpdateUserConfiguration(inputConfig); controller.Update(); - controller.UpdateRumble(_device.Hid.Npads.GetRumbleQueue(playerIndex)); + controller.UpdateRumble(HorizonStatic.Hid.Npads.GetRumbleQueue((NpadIdType)playerIndex)); inputState = controller.GetHLEInputState(); - inputState.Buttons |= _device.Hid.UpdateStickButtons(inputState.LStick, inputState.RStick); + inputState.Buttons |= HorizonStatic.Hid.UpdateStickButtons(inputState.LStick, inputState.RStick); isJoyconPair = inputConfig.ControllerType == ControllerType.JoyconPair; @@ -265,12 +266,12 @@ namespace Ryujinx.Input.HLE hleKeyboardInput = NpadController.GetHLEKeyboardInput(_keyboardDriver); } - _device.Hid.Npads.Update(hleInputStates); - _device.Hid.Npads.UpdateSixAxis(hleMotionStates); + HorizonStatic.Hid.Npads.Update(hleInputStates); + HorizonStatic.Hid.Npads.UpdateSixAxis(hleMotionStates); if (hleKeyboardInput.HasValue) { - _device.Hid.Keyboard.Update(hleKeyboardInput.Value); + HorizonStatic.Hid.Keyboard.Update(hleKeyboardInput.Value); } if (_enableMouse) @@ -308,11 +309,11 @@ namespace Ryujinx.Input.HLE var 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); + HorizonStatic.Hid.Mouse.Update((int)position.X, (int)position.Y, buttons, (int)mouseInput.Scroll.X, (int)mouseInput.Scroll.Y, true); } else { - _device.Hid.Mouse.Update(0, 0); + HorizonStatic.Hid.Mouse.Update(0, 0); } _device.TamperMachine.UpdateInput(hleInputStates); diff --git a/src/Ryujinx.Input/HLE/TouchScreenManager.cs b/src/Ryujinx.Input/HLE/TouchScreenManager.cs index 8eca633387..44bcd546af 100644 --- a/src/Ryujinx.Input/HLE/TouchScreenManager.cs +++ b/src/Ryujinx.Input/HLE/TouchScreenManager.cs @@ -1,7 +1,6 @@ using Ryujinx.HLE; -using Ryujinx.HLE.HOS.Services.Hid; +using Ryujinx.Horizon; using Ryujinx.Horizon.Sdk.Hid; -using Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen; using System; namespace Ryujinx.Input.HLE @@ -9,7 +8,6 @@ namespace Ryujinx.Input.HLE public class TouchScreenManager : IDisposable { private readonly IMouse _mouse; - private Switch _device; private bool _wasClicking; public TouchScreenManager(IMouse mouse) @@ -17,11 +15,6 @@ namespace Ryujinx.Input.HLE _mouse = mouse; } - public void Initialize(Switch device) - { - _device = device; - } - public bool Update(bool isFocused, bool isClicking = false, float aspectRatio = 0) { if (!isFocused || (!_wasClicking && !isClicking)) @@ -45,13 +38,12 @@ namespace Ryujinx.Input.HLE Angle = 90, }; - _device.Hid.Touchscreen.Update(currentPoint); - + HorizonStatic.Hid.Touchscreen.Update(currentPoint); } _wasClicking = false; - _device.Hid.Touchscreen.Update(); + HorizonStatic.Hid.Touchscreen.Update(); return false; } @@ -85,7 +77,7 @@ namespace Ryujinx.Input.HLE Angle = 90, }; - _device.Hid.Touchscreen.Update(currentPoint); + HorizonStatic.Hid.Touchscreen.Update(currentPoint); _wasClicking = isClicking; diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 8c643f3402..817ab001dd 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -33,6 +33,7 @@ using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; using Ryujinx.HLE.HOS.Services.Account.Acc; using Ryujinx.HLE.HOS.SystemState; +using Ryujinx.Horizon; using Ryujinx.Input; using Ryujinx.Input.HLE; using Ryujinx.UI.App.Common; @@ -422,7 +423,6 @@ namespace Ryujinx.Ava DisplaySleep.Prevent(); NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse); - TouchScreenManager.Initialize(Device); _viewModel.IsGameRunning = true; @@ -1233,10 +1233,10 @@ namespace Ryujinx.Ava if (!hasTouch) { - Device.Hid.Touchscreen.Update(); + HorizonStatic.Hid.Touchscreen.Update(); } - Device.Hid.DebugPad.Update(); + HorizonStatic.Hid.DebugPad.Update(); return true; } diff --git a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs index d69e5e48d0..4e89293d0b 100644 --- a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs +++ b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml.cs @@ -8,9 +8,7 @@ using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.Windows; using Ryujinx.Common; using Ryujinx.HLE.HOS.Applets; -using Ryujinx.HLE.HOS.Services.Hid; using Ryujinx.Horizon.Sdk.Hid.Npad; -using System; using System.Linq; using System.Threading.Tasks; @@ -48,10 +46,10 @@ namespace Ryujinx.Ava.UI.Applet PlayerCount = $"{args.PlayerCountMin} - {args.PlayerCountMax}"; } - SupportsProController = (args.SupportedStyles & ControllerType.ProController) != 0; - SupportsLeftJoycon = (args.SupportedStyles & ControllerType.JoyconLeft) != 0; - SupportsRightJoycon = (args.SupportedStyles & ControllerType.JoyconRight) != 0; - SupportsJoyconPair = (args.SupportedStyles & ControllerType.JoyconPair) != 0; + SupportsProController = (args.SupportedStyles & NpadStyleIndex.FullKey) != 0; + SupportsLeftJoycon = (args.SupportedStyles & NpadStyleIndex.JoyLeft) != 0; + SupportsRightJoycon = (args.SupportedStyles & NpadStyleIndex.JoyRight) != 0; + SupportsJoyconPair = (args.SupportedStyles & NpadStyleIndex.JoyDual) != 0; IsDocked = args.IsDocked;