Merge fe941e46fb
into d86249cb0a
This commit is contained in:
commit
1270e759c7
146 changed files with 2727 additions and 2005 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;
|
||||||
|
@ -365,7 +366,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)
|
||||||
|
@ -738,7 +738,7 @@ namespace Ryujinx.UI
|
||||||
TouchScreenManager.Update(false);
|
TouchScreenManager.Update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Device.Hid.DebugPad.Update();
|
HorizonStatic.Hid.DebugPad.Update();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Applets
|
namespace Ryujinx.HLE.HOS.Applets
|
||||||
|
|
|
@ -3,7 +3,6 @@ using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
|
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
|
||||||
using Ryujinx.HLE.UI;
|
using Ryujinx.HLE.UI;
|
||||||
using Ryujinx.HLE.UI.Input;
|
using Ryujinx.HLE.UI.Input;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public abstract class BaseDevice
|
|
||||||
{
|
|
||||||
protected readonly Switch _device;
|
|
||||||
public bool Active;
|
|
||||||
|
|
||||||
public BaseDevice(Switch device, bool active)
|
|
||||||
{
|
|
||||||
_device = device;
|
|
||||||
Active = active;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public struct ControllerConfig
|
|
||||||
{
|
|
||||||
public PlayerIndex Player;
|
|
||||||
public ControllerType Type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||||
|
@ -39,12 +40,5 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(index)),
|
_ => throw new ArgumentOutOfRangeException(nameof(index)),
|
||||||
#pragma warning restore IDE0055
|
#pragma warning restore IDE0055
|
||||||
};
|
};
|
||||||
|
|
||||||
public static bool IsValidNpadIdType(NpadIdType npadIdType)
|
|
||||||
{
|
|
||||||
return (npadIdType >= NpadIdType.Player1 && npadIdType <= NpadIdType.Player8) ||
|
|
||||||
npadIdType == NpadIdType.Handheld ||
|
|
||||||
npadIdType == NpadIdType.Unknown;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public enum NpadHandheldActivationMode
|
|
||||||
{
|
|
||||||
Dual,
|
|
||||||
Single,
|
|
||||||
None,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public struct VibrationDeviceHandle
|
|
||||||
{
|
|
||||||
public byte DeviceType;
|
|
||||||
public byte PlayerId;
|
|
||||||
public byte Position;
|
|
||||||
public byte Reserved;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public enum VibrationDevicePosition
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Left,
|
|
||||||
Right,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public enum VibrationDeviceType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
LinearResonantActuator,
|
|
||||||
GcErm,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
public struct VibrationDeviceValue
|
|
||||||
{
|
|
||||||
public VibrationDeviceType DeviceType;
|
|
||||||
public VibrationDevicePosition Position;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,240 +0,0 @@
|
||||||
using Ryujinx.Common;
|
|
||||||
using Ryujinx.Common.Logging;
|
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Irs.Types;
|
|
||||||
using Ryujinx.Horizon.Common;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|
||||||
{
|
|
||||||
[Service("irs")]
|
|
||||||
class IIrSensorServer : IpcService
|
|
||||||
{
|
|
||||||
private int _irsensorSharedMemoryHandle = 0;
|
|
||||||
|
|
||||||
public IIrSensorServer(ServiceCtx context) { }
|
|
||||||
|
|
||||||
[CommandCmif(302)]
|
|
||||||
// ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
|
||||||
public ResultCode ActivateIrsensor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
|
|
||||||
// NOTE: This seems to initialize the shared memory for irs service.
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(303)]
|
|
||||||
// DeactivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
|
||||||
public ResultCode DeactivateIrsensor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
|
|
||||||
// NOTE: This seems to deinitialize the shared memory for irs service.
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(304)]
|
|
||||||
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy>
|
|
||||||
public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context)
|
|
||||||
{
|
|
||||||
// NOTE: Shared memory should use the appletResourceUserId.
|
|
||||||
// ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
|
|
||||||
if (_irsensorSharedMemoryHandle == 0)
|
|
||||||
{
|
|
||||||
if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _irsensorSharedMemoryHandle) != Result.Success)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Out of handles!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle);
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(305)]
|
|
||||||
// StopImageProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode StopImageProcessor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(306)]
|
|
||||||
// RunMomentProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedMomentProcessorConfig)
|
|
||||||
public ResultCode RunMomentProcessor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
var packedMomentProcessorConfig = context.RequestData.ReadStruct<PackedMomentProcessorConfig>();
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, packedMomentProcessorConfig.ExposureTime });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(307)]
|
|
||||||
// RunClusteringProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedClusteringProcessorConfig)
|
|
||||||
public ResultCode RunClusteringProcessor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
var packedClusteringProcessorConfig = context.RequestData.ReadStruct<PackedClusteringProcessorConfig>();
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, packedClusteringProcessorConfig.ExposureTime });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(308)]
|
|
||||||
// RunImageTransferProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedImageTransferProcessorConfig, u64 TransferMemorySize, TransferMemoryHandle)
|
|
||||||
public ResultCode RunImageTransferProcessor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
var packedImageTransferProcessorConfig = context.RequestData.ReadStruct<PackedImageTransferProcessorConfig>();
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
// TODO: Handle the Transfer Memory.
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, packedImageTransferProcessorConfig.ExposureTime });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(309)]
|
|
||||||
// GetImageTransferProcessorState(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode GetImageTransferProcessorState(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
|
|
||||||
// ulong imageTransferBufferAddress = context.Request.ReceiveBuff[0].Position;
|
|
||||||
ulong imageTransferBufferSize = context.Request.ReceiveBuff[0].Size;
|
|
||||||
|
|
||||||
if (imageTransferBufferSize == 0)
|
|
||||||
{
|
|
||||||
return ResultCode.InvalidBufferSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
|
||||||
|
|
||||||
// TODO: Uses the buffer to copy the JoyCon IR data (by using a JoyCon driver) and update the following struct.
|
|
||||||
context.ResponseData.WriteStruct(new ImageTransferProcessorState()
|
|
||||||
{
|
|
||||||
SamplingNumber = 0,
|
|
||||||
AmbientNoiseLevel = 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(310)]
|
|
||||||
// RunTeraPluginProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedTeraPluginProcessorConfig)
|
|
||||||
public ResultCode RunTeraPluginProcessor(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>();
|
|
||||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
|
||||||
var packedTeraPluginProcessorConfig = context.RequestData.ReadStruct<PackedTeraPluginProcessorConfig>();
|
|
||||||
|
|
||||||
CheckCameraHandle(irCameraHandle);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, packedTeraPluginProcessorConfig.RequiredMcuVersion });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(311)]
|
|
||||||
// GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle
|
|
||||||
public ResultCode GetNpadIrCameraHandle(ServiceCtx context)
|
|
||||||
{
|
|
||||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
|
||||||
|
|
||||||
if (npadIdType > NpadIdType.Player8 &&
|
|
||||||
npadIdType != NpadIdType.Unknown &&
|
|
||||||
npadIdType != NpadIdType.Handheld)
|
|
||||||
{
|
|
||||||
return ResultCode.NpadIdOutOfRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerIndex irCameraHandle = HidUtils.GetIndexFromNpadIdType(npadIdType);
|
|
||||||
|
|
||||||
context.ResponseData.Write((int)irCameraHandle);
|
|
||||||
|
|
||||||
// NOTE: If the irCameraHandle pointer is null this error is returned, Doesn't occur in our case.
|
|
||||||
// return ResultCode.HandlePointerIsNull;
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(314)] // 3.0.0+
|
|
||||||
// CheckFirmwareVersion(nn::irsensor::IrCameraHandle, nn::irsensor::PackedMcuVersion, nn::applet::AppletResourceUserId, pid)
|
|
||||||
public ResultCode CheckFirmwareVersion(ServiceCtx context)
|
|
||||||
{
|
|
||||||
int irCameraHandle = context.RequestData.ReadInt32();
|
|
||||||
short packedMcuVersionMajor = context.RequestData.ReadInt16();
|
|
||||||
short packedMcuVersionMinor = context.RequestData.ReadInt16();
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle, packedMcuVersionMajor, packedMcuVersionMinor });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(318)] // 4.0.0+
|
|
||||||
// StopImageProcessorAsync(nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, pid)
|
|
||||||
public ResultCode StopImageProcessorAsync(ServiceCtx context)
|
|
||||||
{
|
|
||||||
int irCameraHandle = context.RequestData.ReadInt32();
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(319)] // 4.0.0+
|
|
||||||
// ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid)
|
|
||||||
public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
long packedFunctionLevel = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResultCode CheckCameraHandle(IrCameraHandle irCameraHandle)
|
|
||||||
{
|
|
||||||
if (irCameraHandle.DeviceType == 1 || (PlayerIndex)irCameraHandle.PlayerNumber >= PlayerIndex.Unknown)
|
|
||||||
{
|
|
||||||
return ResultCode.InvalidCameraHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|
||||||
{
|
|
||||||
[Service("irs:sys")]
|
|
||||||
class IIrSensorSystemServer : IpcService
|
|
||||||
{
|
|
||||||
public IIrSensorSystemServer(ServiceCtx context) { }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|
||||||
{
|
|
||||||
public enum ResultCode
|
|
||||||
{
|
|
||||||
ModuleId = 205,
|
|
||||||
ErrorCodeShift = 9,
|
|
||||||
|
|
||||||
Success = 0,
|
|
||||||
|
|
||||||
InvalidCameraHandle = (204 << ErrorCodeShift) | ModuleId,
|
|
||||||
InvalidBufferSize = (207 << ErrorCodeShift) | ModuleId,
|
|
||||||
HandlePointerIsNull = (212 << ErrorCodeShift) | ModuleId,
|
|
||||||
NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
|
||||||
[Flags]
|
|
||||||
public enum ControllerType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
ProController = 1 << 0,
|
|
||||||
Handheld = 1 << 1,
|
|
||||||
JoyconPair = 1 << 2,
|
|
||||||
JoyconLeft = 1 << 3,
|
|
||||||
JoyconRight = 1 << 4,
|
|
||||||
Invalid = 1 << 5,
|
|
||||||
Pokeball = 1 << 6,
|
|
||||||
SystemExternal = 1 << 29,
|
|
||||||
System = 1 << 30,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,6 +7,7 @@ using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
||||||
using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
|
using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager
|
namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using Ryujinx.HLE.HOS.Tamper.Operations;
|
using Ryujinx.HLE.HOS.Tamper.Operations;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Tamper
|
namespace Ryujinx.HLE.HOS.Tamper
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Tamper
|
namespace Ryujinx.HLE.HOS.Tamper
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,8 @@ using Ryujinx.HLE.HOS.Kernel;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using Ryujinx.HLE.HOS.Tamper;
|
using Ryujinx.HLE.HOS.Tamper;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -5,9 +5,9 @@ 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.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
@ -23,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; }
|
||||||
|
|
||||||
|
@ -51,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();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.UI.Input
|
namespace Ryujinx.HLE.UI.Input
|
||||||
{
|
{
|
||||||
delegate void NpadButtonHandler(int npadIndex, NpadButton button);
|
delegate void NpadButtonHandler(int npadIndex, NpadButton button);
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.UI.Input
|
namespace Ryujinx.HLE.UI.Input
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -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();
|
||||||
|
|
47
src/Ryujinx.Horizon/Hid/HidIpcServer.cs
Normal file
47
src/Ryujinx.Horizon/Hid/HidIpcServer.cs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sm;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Hid
|
||||||
|
{
|
||||||
|
class HidIpcServer
|
||||||
|
{
|
||||||
|
// TODO: RE These values
|
||||||
|
private const int MaxSessionsCount = 30;
|
||||||
|
|
||||||
|
private const int PointerBufferSize = 0xB40;
|
||||||
|
private const int MaxDomains = 0;
|
||||||
|
private const int MaxDomainObjects = 0;
|
||||||
|
private const int MaxPortsCount = 1;
|
||||||
|
|
||||||
|
private static readonly ManagerOptions _options = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
|
||||||
|
|
||||||
|
private SmApi _sm;
|
||||||
|
private ServerManager _serverManager;
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
HeapAllocator allocator = new();
|
||||||
|
|
||||||
|
_sm = new SmApi();
|
||||||
|
_sm.Initialize().AbortOnFailure();
|
||||||
|
|
||||||
|
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _options, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ServiceRequests()
|
||||||
|
{
|
||||||
|
_serverManager.ServiceRequests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Shutdown()
|
||||||
|
{
|
||||||
|
_serverManager.Dispose();
|
||||||
|
_sm.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
src/Ryujinx.Horizon/Hid/HidMain.cs
Normal file
17
src/Ryujinx.Horizon/Hid/HidMain.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
namespace Ryujinx.Horizon.Hid
|
||||||
|
{
|
||||||
|
class HidMain : IService
|
||||||
|
{
|
||||||
|
public static void Main(ServiceTable serviceTable)
|
||||||
|
{
|
||||||
|
HidIpcServer ipcServer = new();
|
||||||
|
|
||||||
|
ipcServer.Initialize();
|
||||||
|
|
||||||
|
serviceTable.SignalServiceReady();
|
||||||
|
|
||||||
|
ipcServer.ServiceRequests();
|
||||||
|
ipcServer.Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
src/Ryujinx.Horizon/Hid/HidResult.cs
Normal file
14
src/Ryujinx.Horizon/Hid/HidResult.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Hid
|
||||||
|
{
|
||||||
|
class HidResult
|
||||||
|
{
|
||||||
|
private const int ModuleId = 202;
|
||||||
|
|
||||||
|
public static Result InvalidNpadDeviceType => new Result(ModuleId, 122);
|
||||||
|
public static Result InvalidNpadIdType => new Result(ModuleId, 123);
|
||||||
|
public static Result InvalidDeviceIndex => new Result(ModuleId, 124);
|
||||||
|
public static Result InvalidBufferSize => new Result(ModuleId, 131);
|
||||||
|
}
|
||||||
|
}
|
1440
src/Ryujinx.Horizon/Hid/HidServer.cs
Normal file
1440
src/Ryujinx.Horizon/Hid/HidServer.cs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||||
|
|
233
src/Ryujinx.Horizon/Irs/IrSensorServer.cs
Normal file
233
src/Ryujinx.Horizon/Irs/IrSensorServer.cs
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
using Ryujinx.Horizon.Sdk.Irs;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Irs
|
||||||
|
{
|
||||||
|
class IrSensorServer : IIrSensorServer
|
||||||
|
{
|
||||||
|
[CmifCommand(302)]
|
||||||
|
public Result ActivateIrsensor(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
// NOTE: This seems to initialize the shared memory for irs service.
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(303)]
|
||||||
|
public Result DeactivateIrsensor(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
// NOTE: This seems to deinitialize the shared memory for irs service.
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(304)]
|
||||||
|
public Result GetIrsensorSharedMemoryHandle([CopyHandle] out int arg0, AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
// NOTE: Shared memory should use the appletResourceUserId.
|
||||||
|
// TODO: Update when HorizonStatic has support for CreateSharedMemory
|
||||||
|
|
||||||
|
arg0 = 0;
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(305)]
|
||||||
|
public Result StopImageProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(306)]
|
||||||
|
public Result RunMomentProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedMomentProcessorConfig config, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.ExposureTime });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(307)]
|
||||||
|
public Result RunClusteringProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedClusteringProcessorConfig config, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.ExposureTime });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(308)]
|
||||||
|
public Result RunImageTransferProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedImageTransferProcessorConfig config, [CopyHandle] int arg3, ulong arg4, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
// TODO: Handle the Transfer Memory.
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.ExposureTime });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(309)]
|
||||||
|
public Result GetImageTransferProcessorState(AppletResourceUserId appletResourceUserId, out ImageTransferProcessorState imageTransferProcessorState, [Buffer(HipcBufferFlags.Out | HipcBufferFlags.MapAlias)] Span<byte> imageTransferBuffer, IrCameraHandle irCameraHandle, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
// TODO: Uses the buffer to copy the JoyCon IR data (by using a JoyCon driver) and update the following struct.
|
||||||
|
imageTransferProcessorState = new ImageTransferProcessorState
|
||||||
|
{
|
||||||
|
SamplingNumber = 0,
|
||||||
|
AmbientNoiseLevel = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if (imageTransferBuffer.Length == 0)
|
||||||
|
{
|
||||||
|
// InvalidBufferSize
|
||||||
|
return new Result(207);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(310)]
|
||||||
|
public Result RunTeraPluginProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedTeraPluginProcessorConfig config, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.RequiredMcuVersion });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(311)]
|
||||||
|
public Result GetNpadIrCameraHandle(out IrCameraHandle irCameraHandle, NpadIdType npadIdType)
|
||||||
|
{
|
||||||
|
if (npadIdType > NpadIdType.Player8 &&
|
||||||
|
npadIdType != NpadIdType.Unknown &&
|
||||||
|
npadIdType != NpadIdType.Handheld)
|
||||||
|
{
|
||||||
|
// NpadIdOutOfRange
|
||||||
|
irCameraHandle = new IrCameraHandle();
|
||||||
|
return new Result(709);
|
||||||
|
}
|
||||||
|
|
||||||
|
irCameraHandle = new IrCameraHandle
|
||||||
|
{
|
||||||
|
PlayerNumber = (byte)npadIdType
|
||||||
|
};
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { npadIdType });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(312)]
|
||||||
|
public Result RunPointingProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedPointingProcessorConfig config, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.RequiredMcuVersion });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(313)]
|
||||||
|
public Result SuspendImageProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(314)]
|
||||||
|
public Result CheckFirmwareVersion(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedMcuVersion mcuVersion, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, mcuVersion });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(315)]
|
||||||
|
public Result SetFunctionLevel(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedFunctionLevel functionLevel, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, functionLevel.IrSensorFunctionLevel });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(316)]
|
||||||
|
public Result RunImageTransferExProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedImageTransferProcessorExConfig config, int arg3, ulong arg4, ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.ExposureTime, arg3, arg4 });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(317)]
|
||||||
|
public Result RunIrLedProcessor(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, PackedIrLedProcessorConfig config, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType, config.RequiredMcuVersion });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(318)]
|
||||||
|
public Result StopImageProcessorAsync(AppletResourceUserId appletResourceUserId, IrCameraHandle irCameraHandle, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
CheckCameraHandle(irCameraHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, irCameraHandle.PlayerNumber, irCameraHandle.DeviceType });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(319)]
|
||||||
|
public Result ActivateIrsensorWithFunctionLevel(AppletResourceUserId appletResourceUserId, PackedFunctionLevel functionLevel, [ClientProcessId] ulong pid)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, functionLevel.IrSensorFunctionLevel });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Result CheckCameraHandle(IrCameraHandle irCameraHandle)
|
||||||
|
{
|
||||||
|
if (irCameraHandle.DeviceType == 1 || (PlayerIndex)irCameraHandle.PlayerNumber >= PlayerIndex.Unknown)
|
||||||
|
{
|
||||||
|
// InvalidCameraHandle
|
||||||
|
return new Result(204);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
src/Ryujinx.Horizon/Irs/IrSensorSystemServer.cs
Normal file
43
src/Ryujinx.Horizon/Irs/IrSensorSystemServer.cs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Irs;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Irs
|
||||||
|
{
|
||||||
|
class IrSensorSystemServer : IIrSensorSystemServer
|
||||||
|
{
|
||||||
|
[CmifCommand(500)]
|
||||||
|
public Result SetAppletResourceUserId(AppletResourceUserId appletResourceUserId)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(501)]
|
||||||
|
public Result RegisterAppletResourceUserId(AppletResourceUserId appletResourceUserId, bool arg1)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, arg1 });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(502)]
|
||||||
|
public Result UnregisterAppletResourceUserId(AppletResourceUserId appletResourceUserId)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(503)]
|
||||||
|
public Result EnableAppletToGetInput(AppletResourceUserId appletResourceUserId, bool arg1)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId.Id, arg1 });
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
src/Ryujinx.Horizon/Irs/IrsIpcServer.cs
Normal file
45
src/Ryujinx.Horizon/Irs/IrsIpcServer.cs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sm;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Irs
|
||||||
|
{
|
||||||
|
class IrsIpcServer
|
||||||
|
{
|
||||||
|
// TODO: RE These values
|
||||||
|
private const int MaxSessionsCount = 30;
|
||||||
|
|
||||||
|
private const int PointerBufferSize = 0xB40;
|
||||||
|
private const int MaxDomains = 0;
|
||||||
|
private const int MaxDomainObjects = 0;
|
||||||
|
private const int MaxPortsCount = 1;
|
||||||
|
|
||||||
|
private static readonly ManagerOptions _options = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
|
||||||
|
|
||||||
|
private SmApi _sm;
|
||||||
|
private ServerManager _serverManager;
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
HeapAllocator allocator = new();
|
||||||
|
|
||||||
|
_sm = new SmApi();
|
||||||
|
_sm.Initialize().AbortOnFailure();
|
||||||
|
|
||||||
|
_serverManager = new ServerManager(allocator, _sm, MaxPortsCount, _options, MaxSessionsCount);
|
||||||
|
|
||||||
|
_serverManager.RegisterObjectForServer(new IrSensorServer(), ServiceName.Encode("irs"), MaxSessionsCount);
|
||||||
|
_serverManager.RegisterObjectForServer(new IrSensorSystemServer(), ServiceName.Encode("irs:sys"), MaxSessionsCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ServiceRequests()
|
||||||
|
{
|
||||||
|
_serverManager.ServiceRequests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Shutdown()
|
||||||
|
{
|
||||||
|
_serverManager.Dispose();
|
||||||
|
_sm.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
src/Ryujinx.Horizon/Irs/IrsMain.cs
Normal file
17
src/Ryujinx.Horizon/Irs/IrsMain.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
namespace Ryujinx.Horizon.Irs
|
||||||
|
{
|
||||||
|
class IrsMain : IService
|
||||||
|
{
|
||||||
|
public static void Main(ServiceTable serviceTable)
|
||||||
|
{
|
||||||
|
IrsIpcServer ipcServer = new();
|
||||||
|
|
||||||
|
ipcServer.Initialize();
|
||||||
|
|
||||||
|
serviceTable.SignalServiceReady();
|
||||||
|
|
||||||
|
ipcServer.ServiceRequests();
|
||||||
|
ipcServer.Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
src/Ryujinx.Horizon/Sdk/Hid/Address.cs
Normal file
10
src/Ryujinx.Horizon/Sdk/Hid/Address.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x6)]
|
||||||
|
struct Address
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum AppletFooterUiType : byte
|
enum AppletFooterUiType : byte
|
10
src/Ryujinx.Horizon/Sdk/Hid/ControllerConfig.cs
Normal file
10
src/Ryujinx.Horizon/Sdk/Hid/ControllerConfig.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
public struct ControllerConfig
|
||||||
|
{
|
||||||
|
public PlayerIndex Player;
|
||||||
|
public NpadStyleTag Type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
public struct GamepadInput
|
public struct GamepadInput
|
||||||
{
|
{
|
|
@ -1,29 +1,22 @@
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.HLE.Exceptions;
|
using Ryujinx.Horizon.Sdk.Hid.HidDevices;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using PlayerIndex = Ryujinx.Horizon.Sdk.Hid.Npad.PlayerIndex;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
public class Hid
|
public class Hid
|
||||||
{
|
{
|
||||||
private readonly Switch _device;
|
internal const int HidSize = 0x40000;
|
||||||
|
|
||||||
private readonly SharedMemoryStorage _storage;
|
private readonly SharedMemoryStorage _storage;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -46,12 +39,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
CheckTypeSizeOrThrow<RingLifo<MouseState>>(0x350);
|
CheckTypeSizeOrThrow<RingLifo<MouseState>>(0x350);
|
||||||
CheckTypeSizeOrThrow<RingLifo<KeyboardState>>(0x3D8);
|
CheckTypeSizeOrThrow<RingLifo<KeyboardState>>(0x3D8);
|
||||||
CheckTypeSizeOrThrow<Array10<NpadState>>(0x32000);
|
CheckTypeSizeOrThrow<Array10<NpadState>>(0x32000);
|
||||||
CheckTypeSizeOrThrow<SharedMemory>(Horizon.HidSize);
|
CheckTypeSizeOrThrow<SharedMemory>(HidSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Hid(in Switch device, SharedMemoryStorage storage)
|
internal Hid(SharedMemoryStorage storage)
|
||||||
{
|
{
|
||||||
_device = device;
|
|
||||||
_storage = storage;
|
_storage = storage;
|
||||||
|
|
||||||
SharedMemory = SharedMemory.Create();
|
SharedMemory = SharedMemory.Create();
|
||||||
|
@ -61,11 +53,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
|
||||||
private void InitDevices()
|
private void InitDevices()
|
||||||
{
|
{
|
||||||
DebugPad = new DebugPadDevice(_device, true);
|
DebugPad = new DebugPadDevice(true);
|
||||||
Touchscreen = new TouchDevice(_device, true);
|
Touchscreen = new TouchDevice(true);
|
||||||
Mouse = new MouseDevice(_device, false);
|
Mouse = new MouseDevice(false);
|
||||||
Keyboard = new KeyboardDevice(_device, false);
|
Keyboard = new KeyboardDevice(false);
|
||||||
Npads = new NpadDevices(_device, true);
|
Npads = new NpadDevices(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshInputConfig(List<InputConfig> inputConfig)
|
public void RefreshInputConfig(List<InputConfig> inputConfig)
|
||||||
|
@ -75,10 +67,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
for (int i = 0; i < npadConfig.Length; ++i)
|
for (int i = 0; i < npadConfig.Length; ++i)
|
||||||
{
|
{
|
||||||
npadConfig[i].Player = (PlayerIndex)inputConfig[i].PlayerIndex;
|
npadConfig[i].Player = (PlayerIndex)inputConfig[i].PlayerIndex;
|
||||||
npadConfig[i].Type = (ControllerType)inputConfig[i].ControllerType;
|
npadConfig[i].Type = inputConfig[i].ControllerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
_device.Hid.Npads.Configure(npadConfig);
|
Npads.Configure(npadConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControllerKeys UpdateStickButtons(JoystickPosition leftStick, JoystickPosition rightStick)
|
public ControllerKeys UpdateStickButtons(JoystickPosition leftStick, JoystickPosition rightStick)
|
12
src/Ryujinx.Horizon/Sdk/Hid/HidDevices/BaseDevice.cs
Normal file
12
src/Ryujinx.Horizon/Sdk/Hid/HidDevices/BaseDevice.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
|
{
|
||||||
|
public abstract class BaseDevice
|
||||||
|
{
|
||||||
|
public bool Active;
|
||||||
|
|
||||||
|
public BaseDevice(bool active)
|
||||||
|
{
|
||||||
|
Active = active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,8 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
{
|
||||||
public class DebugPadDevice : BaseDevice
|
public class DebugPadDevice : BaseDevice
|
||||||
{
|
{
|
||||||
public DebugPadDevice(Switch device, bool active) : base(device, active) { }
|
public DebugPadDevice(bool active) : base(active) { }
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
|
@ -1,12 +1,10 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
{
|
{
|
||||||
public class KeyboardDevice : BaseDevice
|
public class KeyboardDevice : BaseDevice
|
||||||
{
|
{
|
||||||
public KeyboardDevice(Switch device, bool active) : base(device, active) { }
|
public KeyboardDevice(bool active) : base(active) { }
|
||||||
|
|
||||||
public void Update(KeyboardInput keyState)
|
public void Update(KeyboardInput keyState)
|
||||||
{
|
{
|
|
@ -1,11 +1,8 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
||||||
{
|
{
|
||||||
public class MouseDevice : BaseDevice
|
public class MouseDevice : BaseDevice
|
||||||
{
|
{
|
||||||
public MouseDevice(Switch device, bool active) : base(device, active) { }
|
public MouseDevice(bool active) : base(active) { }
|
||||||
|
|
||||||
public void Update(int mouseX, int mouseY, uint buttons = 0, int scrollX = 0, int scrollY = 0, bool connected = false)
|
public void Update(int mouseX, int mouseY, uint buttons = 0, int scrollX = 0, int scrollY = 0, bool connected = false)
|
||||||
{
|
{
|
|
@ -1,15 +1,15 @@
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
using Ryujinx.Horizon.Sdk.Hid.Vibration;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
using Ryujinx.Horizon.Sdk.OsTypes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
{
|
{
|
||||||
public class NpadDevices : BaseDevice
|
public class NpadDevices : BaseDevice
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
private long _lastNotifyTimestamp;
|
private long _lastNotifyTimestamp;
|
||||||
|
|
||||||
public const int MaxControllers = 9; // Players 1-8 and Handheld
|
public const int MaxControllers = 9; // Players 1-8 and Handheld
|
||||||
private ControllerType[] _configuredTypes;
|
private NpadStyleTag[] _configuredTypes;
|
||||||
private readonly KEvent[] _styleSetUpdateEvents;
|
private readonly Event[] _styleSetUpdateEvents;
|
||||||
private readonly bool[] _supportedPlayers;
|
private readonly bool[] _supportedPlayers;
|
||||||
private VibrationValue _neutralVibrationValue = new()
|
private VibrationValue _neutralVibrationValue = new()
|
||||||
{
|
{
|
||||||
|
@ -31,26 +31,26 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
|
||||||
internal NpadJoyHoldType JoyHold { get; set; }
|
internal NpadJoyHoldType JoyHold { get; set; }
|
||||||
internal bool SixAxisActive = false; // TODO: link to hidserver when implemented
|
internal bool SixAxisActive = false; // TODO: link to hidserver when implemented
|
||||||
internal ControllerType SupportedStyleSets { get; set; }
|
internal NpadStyleTag SupportedStyleSets { get; set; }
|
||||||
|
|
||||||
public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new();
|
public Dictionary<NpadIdType, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new();
|
||||||
public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new();
|
public Dictionary<NpadIdType, (VibrationValue, VibrationValue)> LastVibrationValues = new();
|
||||||
|
|
||||||
public NpadDevices(Switch device, bool active = true) : base(device, active)
|
public NpadDevices(bool active = true) : base(active)
|
||||||
{
|
{
|
||||||
_configuredTypes = new ControllerType[MaxControllers];
|
_configuredTypes = new NpadStyleTag[MaxControllers];
|
||||||
|
|
||||||
SupportedStyleSets = ControllerType.Handheld | ControllerType.JoyconPair |
|
SupportedStyleSets = NpadStyleTag.Handheld | NpadStyleTag.JoyDual |
|
||||||
ControllerType.JoyconLeft | ControllerType.JoyconRight |
|
NpadStyleTag.JoyLeft | NpadStyleTag.JoyRight |
|
||||||
ControllerType.ProController;
|
NpadStyleTag.FullKey;
|
||||||
|
|
||||||
_supportedPlayers = new bool[MaxControllers];
|
_supportedPlayers = new bool[MaxControllers];
|
||||||
_supportedPlayers.AsSpan().Fill(true);
|
_supportedPlayers.AsSpan().Fill(true);
|
||||||
|
|
||||||
_styleSetUpdateEvents = new KEvent[MaxControllers];
|
_styleSetUpdateEvents = new Event[MaxControllers];
|
||||||
for (int i = 0; i < _styleSetUpdateEvents.Length; ++i)
|
for (int i = 0; i < _styleSetUpdateEvents.Length; ++i)
|
||||||
{
|
{
|
||||||
_styleSetUpdateEvents[i] = new KEvent(_device.System.KernelContext);
|
_styleSetUpdateEvents[i] = new Event(_device.System.KernelContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
_activeCount = 0;
|
_activeCount = 0;
|
||||||
|
@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
JoyHold = NpadJoyHoldType.Vertical;
|
JoyHold = NpadJoyHoldType.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal ref KEvent GetStyleSetUpdateEvent(PlayerIndex player)
|
internal ref Event GetStyleSetUpdateEvent(PlayerIndex player)
|
||||||
{
|
{
|
||||||
return ref _styleSetUpdateEvents[(int)player];
|
return ref _styleSetUpdateEvents[(int)player];
|
||||||
}
|
}
|
||||||
|
@ -89,23 +89,23 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Validate(int playerMin, int playerMax, ControllerType acceptedTypes, out int configuredCount, out PlayerIndex primaryIndex)
|
public bool Validate(int playerMin, int playerMax, NpadStyleTag acceptedTypes, out int configuredCount, out PlayerIndex primaryIndex)
|
||||||
{
|
{
|
||||||
primaryIndex = PlayerIndex.Unknown;
|
primaryIndex = PlayerIndex.Unknown;
|
||||||
configuredCount = 0;
|
configuredCount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < MaxControllers; ++i)
|
for (int i = 0; i < MaxControllers; ++i)
|
||||||
{
|
{
|
||||||
ControllerType npad = _configuredTypes[i];
|
NpadStyleTag npad = _configuredTypes[i];
|
||||||
|
|
||||||
if (npad == ControllerType.Handheld && _device.System.State.DockedMode)
|
if (npad == NpadStyleTag.Handheld && _device.System.State.DockedMode)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerType currentType = (ControllerType)_device.Hid.SharedMemory.Npads[i].InternalState.StyleSet;
|
NpadStyleTag currentType = (NpadStyleTag)_device.Hid.SharedMemory.Npads[i].InternalState.StyleSet;
|
||||||
|
|
||||||
if (currentType != ControllerType.None && (npad & acceptedTypes) != 0 && _supportedPlayers[i])
|
if (currentType != NpadStyleTag.None && (npad & acceptedTypes) != 0 && _supportedPlayers[i])
|
||||||
{
|
{
|
||||||
configuredCount++;
|
configuredCount++;
|
||||||
if (primaryIndex == PlayerIndex.Unknown)
|
if (primaryIndex == PlayerIndex.Unknown)
|
||||||
|
@ -125,19 +125,19 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
|
||||||
public void Configure(params ControllerConfig[] configs)
|
public void Configure(params ControllerConfig[] configs)
|
||||||
{
|
{
|
||||||
_configuredTypes = new ControllerType[MaxControllers];
|
_configuredTypes = new NpadStyleTag[MaxControllers];
|
||||||
|
|
||||||
for (int i = 0; i < configs.Length; ++i)
|
for (int i = 0; i < configs.Length; ++i)
|
||||||
{
|
{
|
||||||
PlayerIndex player = configs[i].Player;
|
PlayerIndex player = configs[i].Player;
|
||||||
ControllerType controllerType = configs[i].Type;
|
NpadStyleTag controllerType = configs[i].Type;
|
||||||
|
|
||||||
if (player > PlayerIndex.Handheld)
|
if (player > PlayerIndex.Handheld)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Player must be Player1-8 or Handheld");
|
throw new InvalidOperationException("Player must be Player1-8 or Handheld");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controllerType == ControllerType.Handheld)
|
if (controllerType == NpadStyleTag.Handheld)
|
||||||
{
|
{
|
||||||
player = PlayerIndex.Handheld;
|
player = PlayerIndex.Handheld;
|
||||||
}
|
}
|
||||||
|
@ -178,28 +178,28 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
// Remap/Init if necessary
|
// Remap/Init if necessary
|
||||||
for (int i = 0; i < MaxControllers; ++i)
|
for (int i = 0; i < MaxControllers; ++i)
|
||||||
{
|
{
|
||||||
ControllerType config = _configuredTypes[i];
|
NpadStyleTag config = _configuredTypes[i];
|
||||||
|
|
||||||
// Remove Handheld config when Docked
|
// Remove Handheld config when Docked
|
||||||
if (config == ControllerType.Handheld && _device.System.State.DockedMode)
|
if (config == NpadStyleTag.Handheld && _device.System.State.DockedMode)
|
||||||
{
|
{
|
||||||
config = ControllerType.None;
|
config = NpadStyleTag.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-remap ProController and JoyconPair
|
// Auto-remap ProController and JoyconPair
|
||||||
if (config == ControllerType.JoyconPair && (SupportedStyleSets & ControllerType.JoyconPair) == 0 && (SupportedStyleSets & ControllerType.ProController) != 0)
|
if (config == NpadStyleTag.JoyDual && (SupportedStyleSets & NpadStyleTag.JoyDual) == 0 && (SupportedStyleSets & NpadStyleTag.FullKey) != 0)
|
||||||
{
|
{
|
||||||
config = ControllerType.ProController;
|
config = NpadStyleTag.FullKey;
|
||||||
}
|
}
|
||||||
else if (config == ControllerType.ProController && (SupportedStyleSets & ControllerType.ProController) == 0 && (SupportedStyleSets & ControllerType.JoyconPair) != 0)
|
else if (config == NpadStyleTag.FullKey && (SupportedStyleSets & NpadStyleTag.FullKey) == 0 && (SupportedStyleSets & NpadStyleTag.JoyDual) != 0)
|
||||||
{
|
{
|
||||||
config = ControllerType.JoyconPair;
|
config = NpadStyleTag.JoyDual;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check StyleSet and PlayerSet
|
// Check StyleSet and PlayerSet
|
||||||
if ((config & SupportedStyleSets) == 0 || !_supportedPlayers[i])
|
if ((config & SupportedStyleSets) == 0 || !_supportedPlayers[i])
|
||||||
{
|
{
|
||||||
config = ControllerType.None;
|
config = NpadStyleTag.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupNpad((PlayerIndex)i, config);
|
SetupNpad((PlayerIndex)i, config);
|
||||||
|
@ -212,11 +212,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupNpad(PlayerIndex player, ControllerType type)
|
private void SetupNpad(PlayerIndex player, NpadStyleTag type)
|
||||||
{
|
{
|
||||||
ref NpadInternalState controller = ref _device.Hid.SharedMemory.Npads[(int)player].InternalState;
|
ref NpadInternalState controller = ref _device.Hid.SharedMemory.Npads[(int)player].InternalState;
|
||||||
|
|
||||||
ControllerType oldType = (ControllerType)controller.StyleSet;
|
NpadStyleTag oldType = controller.StyleSet;
|
||||||
|
|
||||||
if (oldType == type)
|
if (oldType == type)
|
||||||
{
|
{
|
||||||
|
@ -225,7 +225,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
|
||||||
controller = NpadInternalState.Create(); // Reset it
|
controller = NpadInternalState.Create(); // Reset it
|
||||||
|
|
||||||
if (type == ControllerType.None)
|
if (type == NpadStyleTag.None)
|
||||||
{
|
{
|
||||||
_styleSetUpdateEvents[(int)player].ReadableEvent.Signal(); // Signal disconnect
|
_styleSetUpdateEvents[(int)player].ReadableEvent.Signal(); // Signal disconnect
|
||||||
_activeCount--;
|
_activeCount--;
|
||||||
|
@ -255,7 +255,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
#pragma warning disable IDE0055 // Disable formatting
|
#pragma warning disable IDE0055 // Disable formatting
|
||||||
case ControllerType.ProController:
|
case NpadStyleTag.FullKey:
|
||||||
controller.StyleSet = NpadStyleTag.FullKey;
|
controller.StyleSet = NpadStyleTag.FullKey;
|
||||||
controller.DeviceType = DeviceType.FullKey;
|
controller.DeviceType = DeviceType.FullKey;
|
||||||
controller.SystemProperties |= NpadSystemProperties.IsAbxyButtonOriented |
|
controller.SystemProperties |= NpadSystemProperties.IsAbxyButtonOriented |
|
||||||
|
@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
NpadSystemProperties.IsMinusAvailable;
|
NpadSystemProperties.IsMinusAvailable;
|
||||||
controller.AppletFooterUiType = AppletFooterUiType.SwitchProController;
|
controller.AppletFooterUiType = AppletFooterUiType.SwitchProController;
|
||||||
break;
|
break;
|
||||||
case ControllerType.Handheld:
|
case NpadStyleTag.Handheld:
|
||||||
controller.StyleSet = NpadStyleTag.Handheld;
|
controller.StyleSet = NpadStyleTag.Handheld;
|
||||||
controller.DeviceType = DeviceType.HandheldLeft |
|
controller.DeviceType = DeviceType.HandheldLeft |
|
||||||
DeviceType.HandheldRight;
|
DeviceType.HandheldRight;
|
||||||
|
@ -272,7 +272,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
NpadSystemProperties.IsMinusAvailable;
|
NpadSystemProperties.IsMinusAvailable;
|
||||||
controller.AppletFooterUiType = AppletFooterUiType.HandheldJoyConLeftJoyConRight;
|
controller.AppletFooterUiType = AppletFooterUiType.HandheldJoyConLeftJoyConRight;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconPair:
|
case NpadStyleTag.JoyDual:
|
||||||
controller.StyleSet = NpadStyleTag.JoyDual;
|
controller.StyleSet = NpadStyleTag.JoyDual;
|
||||||
controller.DeviceType = DeviceType.JoyLeft |
|
controller.DeviceType = DeviceType.JoyLeft |
|
||||||
DeviceType.JoyRight;
|
DeviceType.JoyRight;
|
||||||
|
@ -281,7 +281,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
NpadSystemProperties.IsMinusAvailable;
|
NpadSystemProperties.IsMinusAvailable;
|
||||||
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDual : AppletFooterUiType.HandheldJoyConLeftJoyConRight;
|
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDual : AppletFooterUiType.HandheldJoyConLeftJoyConRight;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconLeft:
|
case NpadStyleTag.JoyLeft:
|
||||||
controller.StyleSet = NpadStyleTag.JoyLeft;
|
controller.StyleSet = NpadStyleTag.JoyLeft;
|
||||||
controller.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
controller.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
||||||
controller.DeviceType = DeviceType.JoyLeft;
|
controller.DeviceType = DeviceType.JoyLeft;
|
||||||
|
@ -289,7 +289,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
NpadSystemProperties.IsMinusAvailable;
|
NpadSystemProperties.IsMinusAvailable;
|
||||||
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDualLeftOnly : AppletFooterUiType.HandheldJoyConLeftOnly;
|
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDualLeftOnly : AppletFooterUiType.HandheldJoyConLeftOnly;
|
||||||
break;
|
break;
|
||||||
case ControllerType.JoyconRight:
|
case NpadStyleTag.JoyRight:
|
||||||
controller.StyleSet = NpadStyleTag.JoyRight;
|
controller.StyleSet = NpadStyleTag.JoyRight;
|
||||||
controller.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
controller.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
||||||
controller.DeviceType = DeviceType.JoyRight;
|
controller.DeviceType = DeviceType.JoyRight;
|
||||||
|
@ -297,7 +297,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
NpadSystemProperties.IsPlusAvailable;
|
NpadSystemProperties.IsPlusAvailable;
|
||||||
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDualRightOnly : AppletFooterUiType.HandheldJoyConRightOnly;
|
controller.AppletFooterUiType = _device.System.State.DockedMode ? AppletFooterUiType.JoyDualRightOnly : AppletFooterUiType.HandheldJoyConRightOnly;
|
||||||
break;
|
break;
|
||||||
case ControllerType.Pokeball:
|
case NpadStyleTag.Palma:
|
||||||
controller.StyleSet = NpadStyleTag.Palma;
|
controller.StyleSet = NpadStyleTag.Palma;
|
||||||
controller.DeviceType = DeviceType.Palma;
|
controller.DeviceType = DeviceType.Palma;
|
||||||
controller.AppletFooterUiType = AppletFooterUiType.None;
|
controller.AppletFooterUiType = AppletFooterUiType.None;
|
||||||
|
@ -596,7 +596,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
WriteNewSixInputEntry(ref currentNpad.JoyRightSixAxisSensor, ref newState);
|
WriteNewSixInputEntry(ref currentNpad.JoyRightSixAxisSensor, ref newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateRumbleQueue(PlayerIndex index, Dictionary<byte, VibrationValue> dualVibrationValues)
|
public void UpdateRumbleQueue(NpadIdType index, Dictionary<byte, VibrationValue> dualVibrationValues)
|
||||||
{
|
{
|
||||||
if (RumbleQueues.TryGetValue(index, out ConcurrentQueue<(VibrationValue, VibrationValue)> currentQueue))
|
if (RumbleQueues.TryGetValue(index, out ConcurrentQueue<(VibrationValue, VibrationValue)> currentQueue))
|
||||||
{
|
{
|
||||||
|
@ -619,7 +619,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public VibrationValue GetLastVibrationValue(PlayerIndex index, byte position)
|
public VibrationValue GetLastVibrationValue(NpadIdType index, byte position)
|
||||||
{
|
{
|
||||||
if (!LastVibrationValues.TryGetValue(index, out (VibrationValue, VibrationValue) dualVibrationValue))
|
if (!LastVibrationValues.TryGetValue(index, out (VibrationValue, VibrationValue) dualVibrationValue))
|
||||||
{
|
{
|
||||||
|
@ -629,7 +629,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
return (position == 0) ? dualVibrationValue.Item1 : dualVibrationValue.Item2;
|
return (position == 0) ? dualVibrationValue.Item1 : dualVibrationValue.Item2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentQueue<(VibrationValue, VibrationValue)> GetRumbleQueue(PlayerIndex index)
|
public ConcurrentQueue<(VibrationValue, VibrationValue)> GetRumbleQueue(NpadIdType index)
|
||||||
{
|
{
|
||||||
if (!RumbleQueues.TryGetValue(index, out ConcurrentQueue<(VibrationValue, VibrationValue)> rumbleQueue))
|
if (!RumbleQueues.TryGetValue(index, out ConcurrentQueue<(VibrationValue, VibrationValue)> rumbleQueue))
|
||||||
{
|
{
|
|
@ -1,12 +1,10 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.HidDevices
|
||||||
{
|
{
|
||||||
public class TouchDevice : BaseDevice
|
public class TouchDevice : BaseDevice
|
||||||
{
|
{
|
||||||
public TouchDevice(Switch device, bool active) : base(device, active) { }
|
public TouchDevice(bool active) : base(active) { }
|
||||||
|
|
||||||
public void Update(params TouchPoint[] points)
|
public void Update(params TouchPoint[] points)
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct HidVector
|
struct HidVector
|
||||||
{
|
{
|
128
src/Ryujinx.Horizon/Sdk/Hid/IHidDebugServer.cs
Normal file
128
src/Ryujinx.Horizon/Sdk/Hid/IHidDebugServer.cs
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
interface IHidDebugServer : IServiceObject
|
||||||
|
{
|
||||||
|
// Result DeactivateDebugPad();
|
||||||
|
// Result SetDebugPadAutoPilotState(DebugPadAutoPilotState arg0);
|
||||||
|
// Result UnsetDebugPadAutoPilotState();
|
||||||
|
// Result DeactivateTouchScreen();
|
||||||
|
// Result SetTouchScreenAutoPilotState(ReadOnlySpan<TouchState> arg0);
|
||||||
|
// Result UnsetTouchScreenAutoPilotState();
|
||||||
|
// Result GetTouchScreenConfiguration(out TouchScreenConfigurationForNx arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result ProcessTouchScreenAutoTune();
|
||||||
|
// Result ForceStopTouchScreenManagement();
|
||||||
|
// Result ForceRestartTouchScreenManagement(AppletResourceUserId arg0, int arg1, ulong pid);
|
||||||
|
// Result IsTouchScreenManaged(out bool arg0);
|
||||||
|
// Result DeactivateMouse();
|
||||||
|
// Result SetMouseAutoPilotState(MouseAutoPilotState arg0);
|
||||||
|
// Result UnsetMouseAutoPilotState();
|
||||||
|
// Result DeactivateKeyboard();
|
||||||
|
// Result SetKeyboardAutoPilotState(KeyboardAutoPilotState arg0);
|
||||||
|
// Result UnsetKeyboardAutoPilotState();
|
||||||
|
// Result DeactivateXpad(BasicXpadId arg0);
|
||||||
|
// Result ClearNpadSystemCommonPolicy(AppletResourceUserId arg0, ulong pid);
|
||||||
|
// Result DeactivateNpad(AppletResourceUserId arg0, ulong pid);
|
||||||
|
// Result ForceDisconnectNpad(uint arg0);
|
||||||
|
// Result DeactivateGesture();
|
||||||
|
// Result DeactivateHomeButton();
|
||||||
|
// Result SetHomeButtonAutoPilotState(HomeButtonAutoPilotState arg0);
|
||||||
|
// Result UnsetHomeButtonAutoPilotState();
|
||||||
|
// Result DeactivateSleepButton();
|
||||||
|
// Result SetSleepButtonAutoPilotState(SleepButtonAutoPilotState arg0);
|
||||||
|
// Result UnsetSleepButtonAutoPilotState();
|
||||||
|
// Result DeactivateCaptureButton();
|
||||||
|
// Result SetCaptureButtonAutoPilotState(CaptureButtonAutoPilotState arg0);
|
||||||
|
// Result UnsetCaptureButtonAutoPilotState();
|
||||||
|
// Result SetShiftAccelerometerCalibrationValue(SixAxisSensorHandle arg0, AppletResourceUserId arg1, float arg2, float arg3, ulong pid);
|
||||||
|
// Result GetShiftAccelerometerCalibrationValue(out float arg0, out float arg1, SixAxisSensorHandle arg2, AppletResourceUserId arg3, ulong pid);
|
||||||
|
// Result SetShiftGyroscopeCalibrationValue(SixAxisSensorHandle arg0, AppletResourceUserId arg1, float arg2, float arg3, ulong pid);
|
||||||
|
// Result GetShiftGyroscopeCalibrationValue(out float arg0, out float arg1, SixAxisSensorHandle arg2, AppletResourceUserId arg3, ulong pid);
|
||||||
|
// Result DeactivateConsoleSixAxisSensor();
|
||||||
|
// Result GetConsoleSixAxisSensorSamplingFrequency(out long arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result DeactivateSevenSixAxisSensor();
|
||||||
|
// Result GetConsoleSixAxisSensorCountStates(out int arg0, Span<ConsoleSixAxisSensorCountState> arg1, AppletResourceUserId arg2, ulong pid);
|
||||||
|
// Result GetAccelerometerFsr(out AccelerometerFsr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result SetAccelerometerFsr(AccelerometerFsr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result GetAccelerometerOdr(out AccelerometerOdr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result SetAccelerometerOdr(AccelerometerOdr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result GetGyroscopeFsr(out GyroscopeFsr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result SetGyroscopeFsr(GyroscopeFsr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result GetGyroscopeOdr(out GyroscopeOdr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result SetGyroscopeOdr(GyroscopeOdr arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result GetWhoAmI(out WhoAmIValue arg0, AppletResourceUserId arg1, ulong pid);
|
||||||
|
// Result ActivateFirmwareUpdate();
|
||||||
|
// Result DeactivateFirmwareUpdate();
|
||||||
|
// Result StartFirmwareUpdate(UniquePadId arg0);
|
||||||
|
// Result GetFirmwareUpdateStage(out long arg0, out long arg1);
|
||||||
|
// Result GetFirmwareVersion(out FirmwareVersion arg0, uint arg1, DeviceType arg2);
|
||||||
|
// Result GetDestinationFirmwareVersion(out FirmwareVersion arg0, uint arg1, DeviceType arg2);
|
||||||
|
// Result DiscardFirmwareInfoCacheForRevert();
|
||||||
|
// Result StartFirmwareUpdateForRevert(UniquePadId arg0);
|
||||||
|
// Result GetAvailableFirmwareVersionForRevert(out FirmwareVersion arg0, UniquePadId arg1);
|
||||||
|
// Result IsFirmwareUpdatingDevice(out bool arg0, UniquePadId arg1);
|
||||||
|
// Result StartFirmwareUpdateIndividual(out FirmwareUpdateDeviceHandle arg0, UniquePadId arg1, long arg2, int arg3, ulong arg4);
|
||||||
|
// Result SetUsbFirmwareForceUpdateEnabled(bool arg0);
|
||||||
|
// Result SetAllKuinaDevicesToFirmwareUpdateMode();
|
||||||
|
// Result UpdateControllerColor(Unorm8x4 arg0, Unorm8x4 arg1, UniquePadId arg2);
|
||||||
|
// Result ConnectUsbPadsAsync();
|
||||||
|
// Result DisconnectUsbPadsAsync();
|
||||||
|
// Result UpdateDesignInfo(Unorm8x4 arg0, Unorm8x4 arg1, Unorm8x4 arg2, Unorm8x4 arg3, uint arg4, UniquePadId arg5);
|
||||||
|
// Result GetUniquePadDriverState(out PadRawState arg0, UniquePadId arg1);
|
||||||
|
// Result GetSixAxisSensorDriverStates(out long arg0, Span<SixAxisSensorState> arg1, UniquePadId arg2);
|
||||||
|
// Result GetRxPacketHistory(out JoyConFormatPacketRxHistory arg0, UniquePadId arg1);
|
||||||
|
// Result AcquireOperationEventHandle(out int arg0, UniquePadId arg1);
|
||||||
|
// Result ReadSerialFlash(uint arg0, int arg1, ulong arg2, UniquePadId arg3);
|
||||||
|
// Result WriteSerialFlash(uint arg0, int arg1, ulong arg2, ulong arg3, UniquePadId arg4);
|
||||||
|
// Result GetOperationResult(UniquePadId arg0);
|
||||||
|
// Result EnableShipmentMode(UniquePadId arg0);
|
||||||
|
// Result ClearPairingInfo(UniquePadId arg0);
|
||||||
|
// Result GetUniquePadDeviceTypeSetInternal(out DeviceType arg0, UniquePadId arg1);
|
||||||
|
// Result EnableAnalogStickPower(bool arg0, UniquePadId arg1);
|
||||||
|
// Result RequestKuinaUartClockCal(UniquePadId arg0);
|
||||||
|
// Result GetKuinaUartClockCal(out byte arg0, UniquePadId arg1);
|
||||||
|
// Result SetKuinaUartClockTrim(UniquePadId arg0, byte arg1);
|
||||||
|
// Result KuinaLoopbackTest(UniquePadId arg0);
|
||||||
|
// Result RequestBatteryVoltage(UniquePadId arg0);
|
||||||
|
// Result GetBatteryVoltage(out ushort arg0, UniquePadId arg1);
|
||||||
|
// Result GetUniquePadPowerInfo(out PowerInfo arg0, UniquePadId arg1);
|
||||||
|
// Result RebootUniquePad(UniquePadId arg0);
|
||||||
|
// Result RequestKuinaFirmwareVersion(UniquePadId arg0);
|
||||||
|
// Result GetKuinaFirmwareVersion(out UsbFirmwareVersion arg0, UniquePadId arg1);
|
||||||
|
// Result GetVidPid(out ushort arg0, out ushort arg1, UniquePadId arg2);
|
||||||
|
// Result GetAnalogStickCalibrationValue(out AnalogStickCalibrationValue arg0, UniquePadId arg1, AnalogStickDeviceType arg2);
|
||||||
|
// Result GetUniquePadIdsFull(out int arg0, Span<UniquePadId> arg1);
|
||||||
|
// Result ConnectUniquePad(UniquePadId arg0);
|
||||||
|
// Result IsVirtual(out bool arg0, out bool arg1, UniquePadId arg2);
|
||||||
|
// Result GetAnalogStickModuleParam(out AnalogStickModuleParam arg0, UniquePadId arg1, AnalogStickDeviceType arg2);
|
||||||
|
// Result UnsetAllAutoPilotVirtualPadState();
|
||||||
|
// Result AttachHdlsWorkBuffer(out HdlsSessionId arg0, int arg1, ulong arg2);
|
||||||
|
// Result ReleaseHdlsWorkBuffer(HdlsSessionId arg0);
|
||||||
|
// Result DumpHdlsNpadAssignmentState(HdlsSessionId arg0);
|
||||||
|
// Result DumpHdlsStates(HdlsSessionId arg0);
|
||||||
|
// Result ApplyHdlsNpadAssignmentState(HdlsSessionId arg0, bool arg1);
|
||||||
|
// Result ApplyHdlsStateList(HdlsSessionId arg0);
|
||||||
|
// Result AttachHdlsVirtualDevice(out HdlsHandle arg0, HdlsDeviceInfo arg1);
|
||||||
|
// Result DetachHdlsVirtualDevice(HdlsHandle arg0);
|
||||||
|
// Result SetHdlsState(HdlsHandle arg0, HdlsState arg1);
|
||||||
|
// Result AddRegisteredDevice(RegisteredDevice arg0);
|
||||||
|
// Result DisableExternalMcuOnNxDevice(bool arg0);
|
||||||
|
// Result DisableRailDeviceFiltering(bool arg0);
|
||||||
|
// Result EnableWiredPairing(bool arg0);
|
||||||
|
// Result EnableShipmentModeAutoClear(bool arg0);
|
||||||
|
// Result SetRailEnabled(bool arg0);
|
||||||
|
// Result SetFactoryInt(bool arg0, UniquePadId arg1);
|
||||||
|
// Result IsFactoryBootEnabled(out bool arg0, UniquePadId arg1);
|
||||||
|
// Result SetAnalogStickModelDataTemporarily(AnalogStickModelData arg0, UniquePadId arg1, int arg2);
|
||||||
|
// Result GetAnalogStickModelData(out AnalogStickModelData arg0, out bool arg1, UniquePadId arg2, int arg3);
|
||||||
|
// Result ResetAnalogStickModelData(UniquePadId arg0, int arg1);
|
||||||
|
// Result ConvertPadState(out PadState arg0, PadState arg1, UniquePadId arg2);
|
||||||
|
// Result AddButtonPlayData(ButtonPlayData arg0, UniquePadId arg1);
|
||||||
|
// Result StartButtonPlayData(UniquePadId arg0);
|
||||||
|
// Result StopButtonPlayData(UniquePadId arg0);
|
||||||
|
// Result DeactivateDigitizer();
|
||||||
|
// Result SetDigitizerAutoPilotState(DigitizerAutoPilotState arg0);
|
||||||
|
// Result UnsetDigitizerAutoPilotState();
|
||||||
|
}
|
||||||
|
}
|
150
src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs
Normal file
150
src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Vibration;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
interface IHidServer : IServiceObject
|
||||||
|
{
|
||||||
|
Result CreateAppletResource(out IAppletResource arg0, AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ActivateDebugPad(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ActivateTouchScreen(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ActivateMouse(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ActivateKeyboard(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result SendKeyboardLockKeyEvent(AppletResourceUserId appletResourceUserId, KeyboardLockKeyEvent keyboardLockKeyEvent, ulong pid);
|
||||||
|
Result AcquireXpadIdEventHandle(out int handle, ulong xpadId);
|
||||||
|
Result ReleaseXpadIdEventHandle(ulong xpadId);
|
||||||
|
Result ActivateXpad(AppletResourceUserId appletResourceUserId, uint basicXpadId, ulong pid);
|
||||||
|
Result GetXpadIds(out long idCount, Span<uint> basicXpadIds);
|
||||||
|
Result ActivateJoyXpad(uint joyXpadId);
|
||||||
|
Result GetJoyXpadLifoHandle(out int arg0, uint joyXpadId);
|
||||||
|
Result GetJoyXpadIds(out long idCount, Span<uint> joyXpadIds);
|
||||||
|
Result ActivateSixAxisSensor(uint basicXpadId);
|
||||||
|
Result DeactivateSixAxisSensor(uint basicXpadId);
|
||||||
|
Result GetSixAxisSensorLifoHandle(out int arg0, uint basicXpadId);
|
||||||
|
Result ActivateJoySixAxisSensor(uint joyXpadId);
|
||||||
|
Result DeactivateJoySixAxisSensor(uint joyXpadId);
|
||||||
|
Result GetJoySixAxisSensorLifoHandle(out int arg0, uint joyXpadId);
|
||||||
|
Result StartSixAxisSensor(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result StopSixAxisSensor(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result IsSixAxisSensorFusionEnabled(out bool sixAxisSensorFusionEnabled, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result EnableSixAxisSensorFusion(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorFusionEnabled, ulong pid);
|
||||||
|
Result SetSixAxisSensorFusionParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, float revisePower, float reviseRange, ulong pid);
|
||||||
|
Result GetSixAxisSensorFusionParameters(out float revisePower, out float reviseRange, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ResetSixAxisSensorFusionParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result SetAccelerometerParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, float x, float y, ulong pid);
|
||||||
|
Result GetAccelerometerParameters(out float x, out float y, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ResetAccelerometerParameters(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result SetAccelerometerPlayMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, uint accelerometerPlayMode, ulong pid);
|
||||||
|
Result GetAccelerometerPlayMode(out uint accelerometerPlayMode, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ResetAccelerometerPlayMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result SetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, GyroscopeZeroDriftMode gyroscopeZeroDriftMode, ulong pid);
|
||||||
|
Result GetGyroscopeZeroDriftMode(out GyroscopeZeroDriftMode gyroscopeZeroDriftMode, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ResetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result IsSixAxisSensorAtRest(out bool isAtRest, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result IsFirmwareUpdateAvailableForSixAxisSensor(out bool isFirmwareUpdateAvailableForSixAxisSensor, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorUnalteredPassthrough, ulong pid);
|
||||||
|
Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool sixAxisSensorUnalteredPassthrough, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result StoreSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, in SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, ulong pid);
|
||||||
|
Result LoadSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, out SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result GetSixAxisSensorIcInformation(AppletResourceUserId appletResourceUserId, out SixAxisSensorIcInformation sixAxisSensorIcInformation, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ResetIsSixAxisSensorDeviceNewlyAssigned(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
Result ActivateGesture(AppletResourceUserId appletResourceUserId, int unknown, ulong pid);
|
||||||
|
Result SetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, NpadStyleTag supportedStyleSets, ulong pid);
|
||||||
|
Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, ulong pid);
|
||||||
|
Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan<NpadIdType> npadIds, ulong pid);
|
||||||
|
Result ActivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result DeactivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result AcquireNpadStyleSetUpdateEventHandle(AppletResourceUserId appletResourceUserId, out int arg1, uint arg2, ulong arg3, ulong pid);
|
||||||
|
Result DisconnectNpad(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid);
|
||||||
|
Result GetPlayerLedPattern(out ulong ledPattern, NpadIdType npadId);
|
||||||
|
Result ActivateNpadWithRevision(AppletResourceUserId appletResourceUserId, int arg1, ulong pid);
|
||||||
|
Result SetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
|
||||||
|
Result GetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
|
||||||
|
Result SetNpadJoyAssignmentModeSingleByDefault(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
|
||||||
|
Result SetNpadJoyAssignmentModeSingle(AppletResourceUserId appletResourceUserId, uint arg1, long arg2, ulong pid);
|
||||||
|
Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid);
|
||||||
|
Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType0, NpadIdType npadIdType1, ulong pid);
|
||||||
|
Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, NpadHandheldActivationMode npadHandheldActivationMode, ulong pid);
|
||||||
|
Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out NpadHandheldActivationMode npadHandheldActivationMode, ulong pid);
|
||||||
|
Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint oldNpadAssignment, uint newNpadAssignment, ulong pid);
|
||||||
|
Result IsUnintendedHomeButtonInputProtectionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, uint arg2, ulong pid);
|
||||||
|
Result EnableUnintendedHomeButtonInputProtection(AppletResourceUserId appletResourceUserId, uint arg1, bool arg2, ulong pid);
|
||||||
|
Result SetNpadJoyAssignmentModeSingleWithDestination(out bool arg0, out uint arg1, AppletResourceUserId appletResourceUserId, uint arg3, long arg4, ulong pid);
|
||||||
|
Result SetNpadAnalogStickUseCenterClamp(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
|
||||||
|
Result SetNpadCaptureButtonAssignment(AppletResourceUserId appletResourceUserId, NpadStyleTag arg1, NpadButton arg2, ulong pid);
|
||||||
|
Result ClearNpadCaptureButtonAssignment(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result GetVibrationDeviceInfo(out VibrationDeviceInfoForIpc vibrationDeviceInfoForIpc, VibrationDeviceHandle vibrationDeviceHandle);
|
||||||
|
Result SendVibrationValue(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, VibrationValue vibrationValue, ulong pid);
|
||||||
|
Result GetActualVibrationValue(out VibrationValue vibrationValue, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
|
||||||
|
Result CreateActiveVibrationDeviceList(out IActiveVibrationDeviceList arg0);
|
||||||
|
Result PermitVibration(bool vibrationPermitted);
|
||||||
|
Result IsVibrationPermitted(out bool vibrationPermitted);
|
||||||
|
Result SendVibrationValues(AppletResourceUserId appletResourceUserId, ReadOnlySpan<VibrationDeviceHandle> vibrationDeviceHandles, ReadOnlySpan<VibrationValue> vibrationValues);
|
||||||
|
Result SendVibrationGcErmCommand(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, VibrationGcErmCommand vibrationGcErmCommand, ulong pid);
|
||||||
|
Result GetActualVibrationGcErmCommand(out VibrationGcErmCommand vibrationGcErmCommand, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
|
||||||
|
Result BeginPermitVibrationSession(AppletResourceUserId appletResourceUserId);
|
||||||
|
Result EndPermitVibrationSession();
|
||||||
|
Result IsVibrationDeviceMounted(out bool isVibrationDeviceMounted, AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, ulong pid);
|
||||||
|
Result SendVibrationValueInBool(AppletResourceUserId appletResourceUserId, VibrationDeviceHandle vibrationDeviceHandle, bool arg2, ulong pid);
|
||||||
|
Result ActivateConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result StartConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ConsoleSixAxisSensorHandle consoleSixAxisSensorHandle, ulong pid);
|
||||||
|
Result StopConsoleSixAxisSensor(AppletResourceUserId appletResourceUserId, ConsoleSixAxisSensorHandle consoleSixAxisSensorHandle, ulong pid);
|
||||||
|
Result ActivateSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result StartSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result StopSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result InitializeSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, int nativeHandle0, ulong counter0, int nativeHandle1, ulong counter1, ulong pid);
|
||||||
|
Result FinalizeSevenSixAxisSensor(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result SetSevenSixAxisSensorFusionStrength(AppletResourceUserId appletResourceUserId, float sevenSixAxisSensorFusionStrength, ulong pid);
|
||||||
|
Result GetSevenSixAxisSensorFusionStrength(out float sevenSixSensorFusionStrength, AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ResetSevenSixAxisSensorTimestamp(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result IsUsbFullKeyControllerEnabled(out bool isUsbFullKeyControllerEnabled);
|
||||||
|
Result EnableUsbFullKeyController(bool usbFullKeyControllerEnabled);
|
||||||
|
Result IsUsbFullKeyControllerConnected(out bool isConnected, uint unknown);
|
||||||
|
Result HasBattery(out bool hasBattery, uint npadId);
|
||||||
|
Result HasLeftRightBattery(out bool hasLeftBattery, out bool hasRightBattery, uint npadId);
|
||||||
|
Result GetNpadInterfaceType(out byte npadInterfaceType, uint npadId);
|
||||||
|
Result GetNpadLeftRightInterfaceType(out byte leftInterfaceType, out byte rightInterfaceType, uint npadId);
|
||||||
|
Result GetPalmaConnectionHandle(out PalmaConnectionHandle palmaConnectionHandle, uint unknown, AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result InitializePalma(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result AcquirePalmaOperationCompleteEvent(out int handle, PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result GetPalmaOperationInfo(out ulong unknown, Span<byte> arg1, PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result PlayPalmaActivity(PalmaConnectionHandle palmaConnectionHandle, ulong unknown);
|
||||||
|
Result SetPalmaFrModeType(PalmaConnectionHandle palmaConnectionHandle, ulong frModeType);
|
||||||
|
Result ReadPalmaStep(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result EnablePalmaStep(PalmaConnectionHandle palmaConnectionHandle, bool enabledPalmaStep);
|
||||||
|
Result ResetPalmaStep(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result ReadPalmaApplicationSection(PalmaConnectionHandle palmaConnectionHandle, ulong unknown0, ulong unknown1);
|
||||||
|
Result WritePalmaApplicationSection(PalmaConnectionHandle palmaConnectionHandle, ulong unknown0, ulong unknown1, in PalmaApplicationSectionAccessBuffer palmaApplicationSectionAccessBuffer);
|
||||||
|
Result ReadPalmaUniqueCode(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result SetPalmaUniqueCodeInvalid(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result WritePalmaActivityEntry(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ulong arg2, ulong arg3, ulong arg4);
|
||||||
|
Result WritePalmaRgbLedPatternEntry(PalmaConnectionHandle palmaConnectionHandle, ulong arg1, ReadOnlySpan<byte> arg2);
|
||||||
|
Result WritePalmaWaveEntry(PalmaConnectionHandle palmaConnectionHandle, PalmaWaveSet palmaWaveSet, ulong arg2, int arg3, ulong arg4, ulong arg5);
|
||||||
|
Result SetPalmaDataBaseIdentificationVersion(PalmaConnectionHandle palmaConnectionHandle, int arg1);
|
||||||
|
Result GetPalmaDataBaseIdentificationVersion(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result SuspendPalmaFeature(PalmaConnectionHandle palmaConnectionHandle, PalmaFeature palmaFeature);
|
||||||
|
Result GetPalmaOperationResult(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result ReadPalmaPlayLog(PalmaConnectionHandle palmaConnectionHandle, ushort arg1);
|
||||||
|
Result ResetPalmaPlayLog(PalmaConnectionHandle palmaConnectionHandle, ushort arg1);
|
||||||
|
Result SetIsPalmaAllConnectable(AppletResourceUserId appletResourceUserId, bool unknownBool, ulong pid);
|
||||||
|
Result SetIsPalmaPairedConnectable(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
|
||||||
|
Result PairPalma(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result SetPalmaBoostMode(bool arg0);
|
||||||
|
Result CancelWritePalmaWaveEntry(PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result EnablePalmaBoostMode(AppletResourceUserId appletResourceUserId, bool arg1, ulong pid);
|
||||||
|
Result GetPalmaBluetoothAddress(out Address arg0, PalmaConnectionHandle palmaConnectionHandle);
|
||||||
|
Result SetDisallowedPalmaConnection(AppletResourceUserId appletResourceUserId, ReadOnlySpan<Address> arg1, ulong pid);
|
||||||
|
Result SetNpadCommunicationMode(AppletResourceUserId appletResourceUserId, long npadCommunicationMode, ulong pid);
|
||||||
|
Result GetNpadCommunicationMode(out long npadCommunicationMode);
|
||||||
|
Result SetTouchScreenConfiguration(AppletResourceUserId appletResourceUserId, TouchScreenConfigurationForNx touchScreenConfigurationForNx, ulong pid);
|
||||||
|
Result IsFirmwareUpdateNeededForNotification(out bool isFirmwareUpdateNeededForNotification, int unknown, AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
Result ActivateDigitizer(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
|
}
|
||||||
|
}
|
25
src/Ryujinx.Horizon/Sdk/Hid/IHidbusServer.cs
Normal file
25
src/Ryujinx.Horizon/Sdk/Hid/IHidbusServer.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
interface IHidbusServer : IServiceObject
|
||||||
|
{
|
||||||
|
Result GetBusHandle(out BusHandle handle, out bool hasHandle, uint npadIdType, ulong busType, AppletResourceUserId resourceUserId);
|
||||||
|
Result IsExternalDeviceConnected(out bool isAttached, BusHandle handle);
|
||||||
|
Result Initialize(BusHandle handle, AppletResourceUserId resourceUserId);
|
||||||
|
Result Finalize(BusHandle handle, AppletResourceUserId resourceUserId);
|
||||||
|
Result EnableExternalDevice(BusHandle handle, bool isEnabled, ulong version, AppletResourceUserId resourceUserId);
|
||||||
|
Result GetExternalDeviceId(out uint deviceId, BusHandle handle);
|
||||||
|
Result SendCommandAsync(ReadOnlySpan<byte> buffer, BusHandle handle);
|
||||||
|
Result GetSendCommandAsyncResult(out uint outSize, Span<byte> buffer, BusHandle handle);
|
||||||
|
Result SetEventForSendCommandAsyncResult(out int eventHandle, BusHandle handle);
|
||||||
|
Result GetSharedMemoryHandle(out int sharedMemoryHandle);
|
||||||
|
Result EnableJoyPollingReceiveMode(ReadOnlySpan<byte> buffer, int transferMemoryHandle, uint size, uint joyPollingMode, BusHandle handle);
|
||||||
|
Result DisableJoyPollingReceiveMode(BusHandle handle);
|
||||||
|
Result SetStatusManagerType(uint statusManagerType);
|
||||||
|
}
|
||||||
|
}
|
13
src/Ryujinx.Horizon/Sdk/Hid/IHidbusSystemServer.cs
Normal file
13
src/Ryujinx.Horizon/Sdk/Hid/IHidbusSystemServer.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
interface IHidbusSystemServer : IServiceObject
|
||||||
|
{
|
||||||
|
Result SetAppletResourceUserId(AppletResourceUserId resourceUserId);
|
||||||
|
Result RegisterAppletResourceUserId(AppletResourceUserId resourceUserId, int arg1);
|
||||||
|
Result UnregisterAppletResourceUserId(AppletResourceUserId resourceUserId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
public struct JoystickPosition
|
public struct JoystickPosition
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
public struct KeyboardInput
|
public struct KeyboardInput
|
||||||
{
|
{
|
18
src/Ryujinx.Horizon/Sdk/Hid/KeyboardLockKeyEvent.cs
Normal file
18
src/Ryujinx.Horizon/Sdk/Hid/KeyboardLockKeyEvent.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
enum KeyboardLockKeyEvent
|
||||||
|
{
|
||||||
|
NumLockOn = 1 << 0,
|
||||||
|
NumLockOff = 1 << 1,
|
||||||
|
NumLockToggle = 1 << 2,
|
||||||
|
CapsLockOn = 1 << 3,
|
||||||
|
CapsLockOff = 1 << 4,
|
||||||
|
CapsLockToggle = 1 << 5,
|
||||||
|
ScrollLockOn = 1 << 6,
|
||||||
|
ScrollLockOff = 1 << 7,
|
||||||
|
ScrollLockToggle = 1 << 8
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct BusHandle
|
struct BusHandle
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum BusType : long
|
public enum BusType : long
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum ControllerKeys : long
|
public enum ControllerKeys : long
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadColor : uint
|
public enum NpadColor : uint
|
||||||
{
|
{
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
|
{
|
||||||
|
public enum NpadHandheldActivationMode : long
|
||||||
|
{
|
||||||
|
Dual,
|
||||||
|
Single,
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadIdType
|
public enum NpadIdType : uint
|
||||||
{
|
{
|
||||||
Player1 = 0,
|
Player1 = 0,
|
||||||
Player2 = 1,
|
Player2 = 1,
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadJoyDeviceType
|
public enum NpadJoyDeviceType
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
enum NpadJoyHoldType
|
enum NpadJoyHoldType
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadStyleIndex : byte
|
public enum NpadStyleIndex : byte
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum PlayerIndex
|
public enum PlayerIndex
|
||||||
{
|
{
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x100)]
|
||||||
|
struct PalmaApplicationSectionAccessBuffer
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
src/Ryujinx.Horizon/Sdk/Hid/PalmaConnectionHandle.cs
Normal file
10
src/Ryujinx.Horizon/Sdk/Hid/PalmaConnectionHandle.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
|
||||||
|
struct PalmaConnectionHandle
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
13
src/Ryujinx.Horizon/Sdk/Hid/PalmaFeature.cs
Normal file
13
src/Ryujinx.Horizon/Sdk/Hid/PalmaFeature.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
enum PalmaFeature
|
||||||
|
{
|
||||||
|
FrMode = 1 << 0,
|
||||||
|
RumbleFeedback = 1 << 1,
|
||||||
|
Step = 1 << 2,
|
||||||
|
MuteSwitch = 1 << 3
|
||||||
|
}
|
||||||
|
}
|
9
src/Ryujinx.Horizon/Sdk/Hid/PalmaWaveSet.cs
Normal file
9
src/Ryujinx.Horizon/Sdk/Hid/PalmaWaveSet.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
enum PalmaWaveSet : ulong
|
||||||
|
{
|
||||||
|
Small = 0,
|
||||||
|
Medium = 1,
|
||||||
|
Large = 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct AnalogStickState
|
struct AnalogStickState
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct AtomicStorage<T> where T : unmanaged, ISampledDataStruct
|
struct AtomicStorage<T> where T : unmanaged, ISampledDataStruct
|
||||||
{
|
{
|
|
@ -0,0 +1,8 @@
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
|
{
|
||||||
|
interface IAppletResource : IServiceObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a "marker interface" to add some compile-time safety to a convention-based optimization.
|
/// This is a "marker interface" to add some compile-time safety to a convention-based optimization.
|
||||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
||||||
{
|
{
|
||||||
return sampledDataStruct switch
|
return sampledDataStruct switch
|
||||||
{
|
{
|
||||||
Npad.SixAxisSensorState _ => sizeof(ulong),
|
SixAxisSensorState _ => sizeof(ulong),
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct RingLifo<T> where T : unmanaged, ISampledDataStruct
|
struct RingLifo<T> where T : unmanaged, ISampledDataStruct
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum DebugPadAttribute : uint
|
enum DebugPadAttribute : uint
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum DebugPadButton : uint
|
enum DebugPadButton : uint
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct DebugPadState : ISampledDataStruct
|
struct DebugPadState : ISampledDataStruct
|
|
@ -1,6 +1,6 @@
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct KeyboardKey
|
struct KeyboardKey
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum KeyboardKeyShift
|
enum KeyboardKeyShift
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum KeyboardModifier : ulong
|
enum KeyboardModifier : ulong
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct KeyboardState : ISampledDataStruct
|
struct KeyboardState : ISampledDataStruct
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum MouseAttribute : uint
|
enum MouseAttribute : uint
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum MouseButton : uint
|
enum MouseButton : uint
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct MouseState : ISampledDataStruct
|
struct MouseState : ISampledDataStruct
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum DeviceType
|
enum DeviceType
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum NpadAttribute : uint
|
enum NpadAttribute : uint
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum NpadBatteryLevel
|
enum NpadBatteryLevel
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum NpadButton : ulong
|
enum NpadButton : ulong
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum NpadColorAttribute : uint
|
enum NpadColorAttribute : uint
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct NpadCommonState : ISampledDataStruct
|
struct NpadCommonState : ISampledDataStruct
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct NpadFullKeyColorState
|
struct NpadFullKeyColorState
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct NpadGcTriggerState : ISampledDataStruct
|
struct NpadGcTriggerState : ISampledDataStruct
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct NpadInternalState
|
struct NpadInternalState
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum NpadJoyAssignmentMode : uint
|
enum NpadJoyAssignmentMode : uint
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
struct NpadJoyColorState
|
struct NpadJoyColorState
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum NpadLarkType : uint
|
enum NpadLarkType : uint
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
enum NpadLuciaType
|
enum NpadLuciaType
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x5000)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x5000)]
|
||||||
struct NpadState
|
struct NpadState
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue