mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-01 00:20:15 +00:00
Move some stuff over
This commit is contained in:
parent
fa87a224c6
commit
fe941e46fb
12 changed files with 55 additions and 89 deletions
|
@ -7,6 +7,7 @@ using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.GAL.Multithreading;
|
using Ryujinx.Graphics.GAL.Multithreading;
|
||||||
using Ryujinx.Graphics.Gpu;
|
using Ryujinx.Graphics.Gpu;
|
||||||
|
using Ryujinx.Horizon;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.GTK3;
|
using Ryujinx.Input.GTK3;
|
||||||
using Ryujinx.Input.HLE;
|
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);
|
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)
|
private unsafe void Renderer_ScreenCaptured(object sender, ScreenCaptureImageInfo e)
|
||||||
|
@ -733,7 +733,7 @@ namespace Ryujinx.UI
|
||||||
TouchScreenManager.Update(false);
|
TouchScreenManager.Update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Device.Hid.DebugPad.Update();
|
HorizonStatic.Hid.DebugPad.Update();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
public class Horizon : IDisposable
|
public class Horizon : IDisposable
|
||||||
{
|
{
|
||||||
internal const int HidSize = 0x40000;
|
|
||||||
internal const int FontSize = 0x1100000;
|
internal const int FontSize = 0x1100000;
|
||||||
internal const int IirsSize = 0x8000;
|
internal const int IirsSize = 0x8000;
|
||||||
internal const int TimeSize = 0x1000;
|
internal const int TimeSize = 0x1000;
|
||||||
|
@ -68,7 +67,6 @@ namespace Ryujinx.HLE.HOS
|
||||||
internal ServerBase SmServer { get; private set; }
|
internal ServerBase SmServer { get; private set; }
|
||||||
internal ServerBase BsdServer { get; private set; }
|
internal ServerBase BsdServer { get; private set; }
|
||||||
internal ServerBase FsServer { get; private set; }
|
internal ServerBase FsServer { get; private set; }
|
||||||
internal ServerBase HidServer { get; private set; }
|
|
||||||
internal ServerBase NvDrvServer { get; private set; }
|
internal ServerBase NvDrvServer { get; private set; }
|
||||||
internal ServerBase TimeServer { get; private set; }
|
internal ServerBase TimeServer { get; private set; }
|
||||||
internal ServerBase ViServer { 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 ViServerS { get; private set; }
|
||||||
internal ServerBase LdnServer { get; private set; }
|
internal ServerBase LdnServer { get; private set; }
|
||||||
|
|
||||||
internal KSharedMemory HidSharedMem { get; private set; }
|
|
||||||
internal KSharedMemory FontSharedMem { get; private set; }
|
internal KSharedMemory FontSharedMem { get; private set; }
|
||||||
internal KSharedMemory IirsSharedMem { get; private set; }
|
internal KSharedMemory IirsSharedMem { get; private set; }
|
||||||
|
|
||||||
|
@ -101,7 +98,6 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
public int GlobalAccessLogMode { get; set; }
|
public int GlobalAccessLogMode { get; set; }
|
||||||
|
|
||||||
internal SharedMemoryStorage HidStorage { get; private set; }
|
|
||||||
|
|
||||||
internal NvHostSyncpt HostSyncpoint { 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.
|
// region used that is used is Application, so we can use the other ones for anything.
|
||||||
KMemoryRegionManager region = KernelContext.MemoryManager.MemoryRegions[(int)MemoryRegion.NvServices];
|
KMemoryRegionManager region = KernelContext.MemoryManager.MemoryRegions[(int)MemoryRegion.NvServices];
|
||||||
|
|
||||||
ulong hidPa = region.Address;
|
ulong fontPa = region.Address;
|
||||||
ulong fontPa = region.Address + HidSize;
|
ulong iirsPa = region.Address + FontSize;
|
||||||
ulong iirsPa = region.Address + HidSize + FontSize;
|
ulong timePa = region.Address + FontSize + IirsSize;
|
||||||
ulong timePa = region.Address + HidSize + FontSize + IirsSize;
|
ulong appletCaptureBufferPa = region.Address + FontSize + IirsSize + TimeSize;
|
||||||
ulong appletCaptureBufferPa = region.Address + HidSize + FontSize + IirsSize + TimeSize;
|
|
||||||
|
|
||||||
KPageList hidPageList = new();
|
|
||||||
KPageList fontPageList = new();
|
KPageList fontPageList = new();
|
||||||
KPageList iirsPageList = new();
|
KPageList iirsPageList = new();
|
||||||
KPageList timePageList = new();
|
KPageList timePageList = new();
|
||||||
KPageList appletCaptureBufferPageList = new();
|
KPageList appletCaptureBufferPageList = new();
|
||||||
|
|
||||||
hidPageList.AddRange(hidPa, HidSize / KPageTableBase.PageSize);
|
|
||||||
fontPageList.AddRange(fontPa, FontSize / KPageTableBase.PageSize);
|
fontPageList.AddRange(fontPa, FontSize / KPageTableBase.PageSize);
|
||||||
iirsPageList.AddRange(iirsPa, IirsSize / KPageTableBase.PageSize);
|
iirsPageList.AddRange(iirsPa, IirsSize / KPageTableBase.PageSize);
|
||||||
timePageList.AddRange(timePa, TimeSize / KPageTableBase.PageSize);
|
timePageList.AddRange(timePa, TimeSize / KPageTableBase.PageSize);
|
||||||
appletCaptureBufferPageList.AddRange(appletCaptureBufferPa, AppletCaptureBufferSize / KPageTableBase.PageSize);
|
appletCaptureBufferPageList.AddRange(appletCaptureBufferPa, AppletCaptureBufferSize / KPageTableBase.PageSize);
|
||||||
|
|
||||||
var hidStorage = new SharedMemoryStorage(KernelContext, hidPageList);
|
|
||||||
var fontStorage = new SharedMemoryStorage(KernelContext, fontPageList);
|
var fontStorage = new SharedMemoryStorage(KernelContext, fontPageList);
|
||||||
var iirsStorage = new SharedMemoryStorage(KernelContext, iirsPageList);
|
var iirsStorage = new SharedMemoryStorage(KernelContext, iirsPageList);
|
||||||
var timeStorage = new SharedMemoryStorage(KernelContext, timePageList);
|
var timeStorage = new SharedMemoryStorage(KernelContext, timePageList);
|
||||||
var appletCaptureBufferStorage = new SharedMemoryStorage(KernelContext, appletCaptureBufferPageList);
|
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);
|
FontSharedMem = new KSharedMemory(KernelContext, fontStorage, 0, 0, KMemoryPermission.Read);
|
||||||
IirsSharedMem = new KSharedMemory(KernelContext, iirsStorage, 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");
|
BsdServer = new ServerBase(KernelContext, "BsdServer");
|
||||||
FsServer = new ServerBase(KernelContext, "FsServer");
|
FsServer = new ServerBase(KernelContext, "FsServer");
|
||||||
HidServer = new ServerBase(KernelContext, "HidServer");
|
|
||||||
NvDrvServer = new ServerBase(KernelContext, "NvservicesServer");
|
NvDrvServer = new ServerBase(KernelContext, "NvservicesServer");
|
||||||
TimeServer = new ServerBase(KernelContext, "TimeServer");
|
TimeServer = new ServerBase(KernelContext, "TimeServer");
|
||||||
ViServer = new ServerBase(KernelContext, "ViServerU");
|
ViServer = new ServerBase(KernelContext, "ViServerU");
|
||||||
|
|
|
@ -5,7 +5,6 @@ using Ryujinx.Graphics.Gpu;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.HLE.HOS.Services.Apm;
|
using Ryujinx.HLE.HOS.Services.Apm;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
|
||||||
using Ryujinx.HLE.Loaders.Processes;
|
using Ryujinx.HLE.Loaders.Processes;
|
||||||
using Ryujinx.HLE.UI;
|
using Ryujinx.HLE.UI;
|
||||||
using Ryujinx.Horizon.Sdk.Hid;
|
using Ryujinx.Horizon.Sdk.Hid;
|
||||||
|
@ -24,7 +23,6 @@ namespace Ryujinx.HLE
|
||||||
public HOS.Horizon System { get; }
|
public HOS.Horizon System { get; }
|
||||||
public ProcessLoader Processes { get; }
|
public ProcessLoader Processes { get; }
|
||||||
public PerformanceStatistics Statistics { get; }
|
public PerformanceStatistics Statistics { get; }
|
||||||
public Hid Hid { get; }
|
|
||||||
public TamperMachine TamperMachine { get; }
|
public TamperMachine TamperMachine { get; }
|
||||||
public IHostUIHandler UIHandler { get; }
|
public IHostUIHandler UIHandler { get; }
|
||||||
|
|
||||||
|
@ -52,7 +50,6 @@ namespace Ryujinx.HLE
|
||||||
Gpu = new GpuContext(Configuration.GpuRenderer);
|
Gpu = new GpuContext(Configuration.GpuRenderer);
|
||||||
System = new HOS.Horizon(this);
|
System = new HOS.Horizon(this);
|
||||||
Statistics = new PerformanceStatistics();
|
Statistics = new PerformanceStatistics();
|
||||||
Hid = new Hid(this, System.HidStorage);
|
|
||||||
Processes = new ProcessLoader(this);
|
Processes = new ProcessLoader(this);
|
||||||
TamperMachine = new TamperMachine();
|
TamperMachine = new TamperMachine();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Ryujinx.Graphics.OpenGL;
|
||||||
using Ryujinx.HLE.HOS.Applets;
|
using Ryujinx.HLE.HOS.Applets;
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
|
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
|
||||||
using Ryujinx.HLE.UI;
|
using Ryujinx.HLE.UI;
|
||||||
|
using Ryujinx.Horizon;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
|
@ -125,7 +126,6 @@ namespace Ryujinx.Headless.SDL2
|
||||||
Renderer = renderer;
|
Renderer = renderer;
|
||||||
|
|
||||||
NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse);
|
NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse);
|
||||||
TouchScreenManager.Initialize(device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetWindowIcon()
|
private void SetWindowIcon()
|
||||||
|
@ -423,7 +423,7 @@ namespace Ryujinx.Headless.SDL2
|
||||||
TouchScreenManager.Update(false);
|
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.
|
// TODO: Replace this with MouseDriver.CheckIdle() when mouse motion events are received on every supported platform.
|
||||||
MouseDriver.UpdatePosition();
|
MouseDriver.UpdatePosition();
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
|
|
||||||
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _options, MaxSessionsCount);
|
_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("hidbus"), MaxSessionsCount);
|
||||||
// _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:sys"), MaxSessionsCount);
|
// _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:sys"), MaxSessionsCount);
|
||||||
// _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:dbg"), MaxSessionsCount);
|
// _serverManager.RegisterObjectForServer(, ServiceName.Encode("hid:dbg"), MaxSessionsCount);
|
||||||
|
|
|
@ -16,14 +16,6 @@ namespace Ryujinx.Horizon.Hid
|
||||||
{
|
{
|
||||||
partial class HidServer : IHidServer
|
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 _xpadIdEvent;
|
||||||
private SystemEventType _palmaOperationCompleteEvent;
|
private SystemEventType _palmaOperationCompleteEvent;
|
||||||
|
|
||||||
|
@ -48,12 +40,6 @@ namespace Ryujinx.Horizon.Hid
|
||||||
|
|
||||||
public HidServer()
|
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.CreateSystemEvent(out _xpadIdEvent, EventClearMode.ManualClear, interProcess: true);
|
||||||
Os.SignalSystemEvent(ref _xpadIdEvent); // TODO: signal event at right place
|
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.
|
// 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 });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
@ -96,13 +82,13 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(11)]
|
[CmifCommand(11)]
|
||||||
public Result ActivateTouchScreen(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result ActivateTouchScreen(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Touchscreen.Active = true;
|
HorizonStatic.Hid.Touchscreen.Active = true;
|
||||||
|
|
||||||
// Initialize entries to avoid issues with some games.
|
// 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 });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
@ -113,13 +99,13 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(21)]
|
[CmifCommand(21)]
|
||||||
public Result ActivateMouse(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result ActivateMouse(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Mouse.Active = true;
|
HorizonStatic.Hid.Mouse.Active = true;
|
||||||
|
|
||||||
// Initialize entries to avoid issues with some games.
|
// 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 });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
@ -130,7 +116,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(31)]
|
[CmifCommand(31)]
|
||||||
public Result ActivateKeyboard(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result ActivateKeyboard(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Keyboard.Active = true;
|
HorizonStatic.Hid.Keyboard.Active = true;
|
||||||
|
|
||||||
// Initialize entries to avoid issues with some games.
|
// Initialize entries to avoid issues with some games.
|
||||||
|
|
||||||
|
@ -139,9 +125,9 @@ namespace Ryujinx.Horizon.Hid
|
||||||
Keys = new ulong[4],
|
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 });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
@ -530,7 +516,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { pid, appletResourceUserId, supportedStyleSets });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { pid, appletResourceUserId, supportedStyleSets });
|
||||||
|
|
||||||
Npads.SupportedStyleSets = supportedStyleSets;
|
HorizonStatic.Hid.Npads.SupportedStyleSets = supportedStyleSets;
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -538,9 +524,9 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(101)]
|
[CmifCommand(101)]
|
||||||
public Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, [ClientProcessId] ulong pid)
|
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;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -548,13 +534,13 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(102)]
|
[CmifCommand(102)]
|
||||||
public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<NpadIdType> npadIds, [ClientProcessId] ulong pid)
|
public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<NpadIdType> npadIds, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Npads.ClearSupportedPlayers();
|
HorizonStatic.Hid.Npads.ClearSupportedPlayers();
|
||||||
|
|
||||||
for (int i = 0; i < npadIds.Length; i++)
|
for (int i = 0; i < npadIds.Length; i++)
|
||||||
{
|
{
|
||||||
if (IsValidNpadIdType(npadIds[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)]
|
[CmifCommand(104)]
|
||||||
public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Npads.Active = false;
|
HorizonStatic.Hid.Npads.Active = false;
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
@ -839,7 +825,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[vibrationDeviceHandle.Position] = vibrationValue,
|
[vibrationDeviceHandle.Position] = vibrationValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
Npads.UpdateRumbleQueue(vibrationDeviceHandle.PlayerId, dualVibrationValues);
|
HorizonStatic.Hid.Npads.UpdateRumbleQueue(vibrationDeviceHandle.PlayerId, dualVibrationValues);
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -847,7 +833,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(202)]
|
[CmifCommand(202)]
|
||||||
public Result GetActualVibrationValue(out VibrationValue vibrationValue, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, [ClientProcessId] ulong pid)
|
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;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@ namespace Ryujinx.Horizon
|
||||||
{
|
{
|
||||||
public static class HorizonStatic
|
public static class HorizonStatic
|
||||||
{
|
{
|
||||||
|
[ThreadStatic]
|
||||||
|
private static Sdk.Hid.Hid _hid;
|
||||||
|
|
||||||
[ThreadStatic]
|
[ThreadStatic]
|
||||||
private static HorizonOptions _options;
|
private static HorizonOptions _options;
|
||||||
|
|
||||||
|
@ -21,6 +24,7 @@ namespace Ryujinx.Horizon
|
||||||
[ThreadStatic]
|
[ThreadStatic]
|
||||||
private static int _threadHandle;
|
private static int _threadHandle;
|
||||||
|
|
||||||
|
public static Sdk.Hid.Hid Hid => _hid;
|
||||||
public static HorizonOptions Options => _options;
|
public static HorizonOptions Options => _options;
|
||||||
public static ISyscallApi Syscall => _syscall;
|
public static ISyscallApi Syscall => _syscall;
|
||||||
public static IVirtualMemoryManager AddressSpace => _addressSpace;
|
public static IVirtualMemoryManager AddressSpace => _addressSpace;
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
|
||||||
internal ref SharedMemory SharedMemory => ref _storage.GetRef<SharedMemory>(0);
|
internal ref SharedMemory SharedMemory => ref _storage.GetRef<SharedMemory>(0);
|
||||||
|
|
||||||
internal const int SharedMemEntryCount = 17;
|
internal readonly int SharedMemEntryCount = 17;
|
||||||
|
|
||||||
public DebugPadDevice DebugPad;
|
public DebugPadDevice DebugPad;
|
||||||
public TouchDevice Touchscreen;
|
public TouchDevice Touchscreen;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
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;
|
||||||
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
|
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
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;
|
_enableKeyboard = enableKeyboard;
|
||||||
_enableMouse = enableMouse;
|
_enableMouse = enableMouse;
|
||||||
|
|
||||||
_device.Hid.RefreshInputConfig(validInputs);
|
HorizonStatic.Hid.RefreshInputConfig(validInputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +229,11 @@ namespace Ryujinx.Input.HLE
|
||||||
|
|
||||||
controller.UpdateUserConfiguration(inputConfig);
|
controller.UpdateUserConfiguration(inputConfig);
|
||||||
controller.Update();
|
controller.Update();
|
||||||
controller.UpdateRumble(_device.Hid.Npads.GetRumbleQueue(playerIndex));
|
controller.UpdateRumble(HorizonStatic.Hid.Npads.GetRumbleQueue((NpadIdType)playerIndex));
|
||||||
|
|
||||||
inputState = controller.GetHLEInputState();
|
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;
|
isJoyconPair = inputConfig.ControllerType == ControllerType.JoyconPair;
|
||||||
|
|
||||||
|
@ -265,12 +266,12 @@ namespace Ryujinx.Input.HLE
|
||||||
hleKeyboardInput = NpadController.GetHLEKeyboardInput(_keyboardDriver);
|
hleKeyboardInput = NpadController.GetHLEKeyboardInput(_keyboardDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
_device.Hid.Npads.Update(hleInputStates);
|
HorizonStatic.Hid.Npads.Update(hleInputStates);
|
||||||
_device.Hid.Npads.UpdateSixAxis(hleMotionStates);
|
HorizonStatic.Hid.Npads.UpdateSixAxis(hleMotionStates);
|
||||||
|
|
||||||
if (hleKeyboardInput.HasValue)
|
if (hleKeyboardInput.HasValue)
|
||||||
{
|
{
|
||||||
_device.Hid.Keyboard.Update(hleKeyboardInput.Value);
|
HorizonStatic.Hid.Keyboard.Update(hleKeyboardInput.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_enableMouse)
|
if (_enableMouse)
|
||||||
|
@ -308,11 +309,11 @@ namespace Ryujinx.Input.HLE
|
||||||
|
|
||||||
var position = IMouse.GetScreenPosition(mouseInput.Position, mouse.ClientSize, aspectRatio);
|
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
|
else
|
||||||
{
|
{
|
||||||
_device.Hid.Mouse.Update(0, 0);
|
HorizonStatic.Hid.Mouse.Update(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_device.TamperMachine.UpdateInput(hleInputStates);
|
_device.TamperMachine.UpdateInput(hleInputStates);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.Horizon;
|
||||||
using Ryujinx.Horizon.Sdk.Hid;
|
using Ryujinx.Horizon.Sdk.Hid;
|
||||||
using Ryujinx.Horizon.Sdk.Hid.SharedMemory.TouchScreen;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Input.HLE
|
namespace Ryujinx.Input.HLE
|
||||||
|
@ -9,7 +8,6 @@ namespace Ryujinx.Input.HLE
|
||||||
public class TouchScreenManager : IDisposable
|
public class TouchScreenManager : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IMouse _mouse;
|
private readonly IMouse _mouse;
|
||||||
private Switch _device;
|
|
||||||
private bool _wasClicking;
|
private bool _wasClicking;
|
||||||
|
|
||||||
public TouchScreenManager(IMouse mouse)
|
public TouchScreenManager(IMouse mouse)
|
||||||
|
@ -17,11 +15,6 @@ namespace Ryujinx.Input.HLE
|
||||||
_mouse = mouse;
|
_mouse = mouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(Switch device)
|
|
||||||
{
|
|
||||||
_device = device;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(bool isFocused, bool isClicking = false, float aspectRatio = 0)
|
public bool Update(bool isFocused, bool isClicking = false, float aspectRatio = 0)
|
||||||
{
|
{
|
||||||
if (!isFocused || (!_wasClicking && !isClicking))
|
if (!isFocused || (!_wasClicking && !isClicking))
|
||||||
|
@ -45,13 +38,12 @@ namespace Ryujinx.Input.HLE
|
||||||
Angle = 90,
|
Angle = 90,
|
||||||
};
|
};
|
||||||
|
|
||||||
_device.Hid.Touchscreen.Update(currentPoint);
|
HorizonStatic.Hid.Touchscreen.Update(currentPoint);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_wasClicking = false;
|
_wasClicking = false;
|
||||||
|
|
||||||
_device.Hid.Touchscreen.Update();
|
HorizonStatic.Hid.Touchscreen.Update();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +77,7 @@ namespace Ryujinx.Input.HLE
|
||||||
Angle = 90,
|
Angle = 90,
|
||||||
};
|
};
|
||||||
|
|
||||||
_device.Hid.Touchscreen.Update(currentPoint);
|
HorizonStatic.Hid.Touchscreen.Update(currentPoint);
|
||||||
|
|
||||||
_wasClicking = isClicking;
|
_wasClicking = isClicking;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
|
using Ryujinx.Horizon;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.UI.App.Common;
|
using Ryujinx.UI.App.Common;
|
||||||
|
@ -422,7 +423,6 @@ namespace Ryujinx.Ava
|
||||||
DisplaySleep.Prevent();
|
DisplaySleep.Prevent();
|
||||||
|
|
||||||
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||||
TouchScreenManager.Initialize(Device);
|
|
||||||
|
|
||||||
_viewModel.IsGameRunning = true;
|
_viewModel.IsGameRunning = true;
|
||||||
|
|
||||||
|
@ -1233,10 +1233,10 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
if (!hasTouch)
|
if (!hasTouch)
|
||||||
{
|
{
|
||||||
Device.Hid.Touchscreen.Update();
|
HorizonStatic.Hid.Touchscreen.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Device.Hid.DebugPad.Update();
|
HorizonStatic.Hid.DebugPad.Update();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,7 @@ using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.HLE.HOS.Applets;
|
using Ryujinx.HLE.HOS.Applets;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
|
||||||
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -48,10 +46,10 @@ namespace Ryujinx.Ava.UI.Applet
|
||||||
PlayerCount = $"{args.PlayerCountMin} - {args.PlayerCountMax}";
|
PlayerCount = $"{args.PlayerCountMin} - {args.PlayerCountMax}";
|
||||||
}
|
}
|
||||||
|
|
||||||
SupportsProController = (args.SupportedStyles & ControllerType.ProController) != 0;
|
SupportsProController = (args.SupportedStyles & NpadStyleIndex.FullKey) != 0;
|
||||||
SupportsLeftJoycon = (args.SupportedStyles & ControllerType.JoyconLeft) != 0;
|
SupportsLeftJoycon = (args.SupportedStyles & NpadStyleIndex.JoyLeft) != 0;
|
||||||
SupportsRightJoycon = (args.SupportedStyles & ControllerType.JoyconRight) != 0;
|
SupportsRightJoycon = (args.SupportedStyles & NpadStyleIndex.JoyRight) != 0;
|
||||||
SupportsJoyconPair = (args.SupportedStyles & ControllerType.JoyconPair) != 0;
|
SupportsJoyconPair = (args.SupportedStyles & NpadStyleIndex.JoyDual) != 0;
|
||||||
|
|
||||||
IsDocked = args.IsDocked;
|
IsDocked = args.IsDocked;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue