mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-25 06:45:49 +00:00
2365ddfc36
* Delete old HLE.Input * Add new HLE Input. git shows Hid.cs as modified because of the same name. It is new. * Change HID Service * Change Ryujinx UI to reflect new Input * Add basic ControllerApplet * Add DebugPad Should fix Kirby Star Allies * Address Ac_K's comments * Moved all of HLE.Input to Services.Hid * Separated all structs and enums each to a file * Removed vars * Made some naming changes to align with switchbrew * Added official joycon colors As an aside, fixed a mistake in touchscreen headers and added checks to important SharedMem structs at init time. * Further address Ac_K's comments * Addressed gdkchan's and some more Ac_K's comments * Address AcK's review comments * Address AcK's second review comments * Replace missed Marshal.SizeOf and address gdkchan's comments
90 lines
No EOL
3.2 KiB
C#
90 lines
No EOL
3.2 KiB
C#
using Ryujinx.Common.Logging;
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
|
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|
{
|
|
[Service("irs")]
|
|
class IIrSensorServer : IpcService
|
|
{
|
|
private int _irsensorSharedMemoryHandle = 0;
|
|
|
|
public IIrSensorServer(ServiceCtx context) { }
|
|
|
|
[Command(302)]
|
|
// ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
|
public ResultCode ActivateIrsensor(ServiceCtx context)
|
|
{
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(303)]
|
|
// DeactivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
|
public ResultCode DeactivateIrsensor(ServiceCtx context)
|
|
{
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(304)]
|
|
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy>
|
|
public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context)
|
|
{
|
|
if (_irsensorSharedMemoryHandle == 0)
|
|
{
|
|
if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _irsensorSharedMemoryHandle) != KernelResult.Success)
|
|
{
|
|
throw new InvalidOperationException("Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(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;
|
|
}
|
|
|
|
[Command(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.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |