2018-10-17 19:15:50 +02:00
|
|
|
using Ryujinx.Common.Logging;
|
2018-08-17 01:47:36 +02:00
|
|
|
using Ryujinx.HLE.HOS.Ipc;
|
2018-12-18 06:33:36 +01:00
|
|
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
2019-09-19 02:45:11 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
2018-09-21 02:08:35 +02:00
|
|
|
using System;
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Hid
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2019-07-10 17:59:54 +02:00
|
|
|
[Service("hid")]
|
2018-09-19 01:36:43 +02:00
|
|
|
class IHidServer : IpcService
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
private KEvent _xpadIdEvent;
|
|
|
|
private KEvent _palmaOperationCompleteEvent;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
private int _xpadIdEventHandle;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
private bool _sixAxisSensorFusionEnabled;
|
|
|
|
private bool _unintendedHomeButtonInputProtectionEnabled;
|
|
|
|
private bool _vibrationPermitted;
|
|
|
|
private bool _usbFullKeyControllerEnabled;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
private HidNpadJoyAssignmentMode _npadJoyAssignmentMode;
|
|
|
|
private HidNpadHandheldActivationMode _npadHandheldActivationMode;
|
|
|
|
private HidGyroscopeZeroDriftMode _gyroscopeZeroDriftMode;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
private long _npadCommunicationMode;
|
|
|
|
private uint _accelerometerPlayMode;
|
2020-04-20 23:59:59 +02:00
|
|
|
#pragma warning disable CS0649
|
2018-12-06 12:16:24 +01:00
|
|
|
private long _vibrationGcErmCommand;
|
2020-04-20 23:59:59 +02:00
|
|
|
#pragma warning restore CS0649
|
2018-12-06 12:16:24 +01:00
|
|
|
private float _sevenSixAxisSensorFusionStrength;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
private HidSensorFusionParameters _sensorFusionParams;
|
|
|
|
private HidAccelerometerParameters _accelerometerParams;
|
|
|
|
private HidVibrationValue _vibrationValue;
|
2018-08-13 23:31:09 +02:00
|
|
|
|
2019-07-10 17:59:54 +02:00
|
|
|
public IHidServer(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2020-05-04 05:41:29 +02:00
|
|
|
_xpadIdEvent = new KEvent(context.Device.System.KernelContext);
|
|
|
|
_palmaOperationCompleteEvent = new KEvent(context.Device.System.KernelContext);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadJoyAssignmentMode = HidNpadJoyAssignmentMode.Dual;
|
|
|
|
_npadHandheldActivationMode = HidNpadHandheldActivationMode.Dual;
|
|
|
|
_gyroscopeZeroDriftMode = HidGyroscopeZeroDriftMode.Standard;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_sensorFusionParams = new HidSensorFusionParameters();
|
|
|
|
_accelerometerParams = new HidAccelerometerParameters();
|
|
|
|
_vibrationValue = new HidVibrationValue();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
|
|
|
// TODO: signal event at right place
|
2018-12-06 12:16:24 +01:00
|
|
|
_xpadIdEvent.ReadableEvent.Signal();
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(0)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// CreateAppletResource(nn::applet::AppletResourceUserId) -> object<nn::hid::IAppletResource>
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode CreateAppletResource(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem));
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(1)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateDebugPad(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateDebugPad(ServiceCtx context)
|
2018-04-05 00:16:59 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-05 00:16:59 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(11)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateTouchScreen(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateTouchScreen(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-05 00:39:47 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Touchscreen.Active = true;
|
2020-05-05 20:50:53 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-05 00:39:47 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(21)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateMouse(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateMouse(ServiceCtx context)
|
2018-04-05 00:39:47 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Mouse.Active = true;
|
2020-05-05 20:50:53 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(31)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateKeyboard(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateKeyboard(ServiceCtx context)
|
2018-04-05 00:44:02 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-05 00:44:02 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Keyboard.Active = true;
|
2020-05-05 20:50:53 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2020-05-05 20:50:53 +02:00
|
|
|
[Command(32)]
|
|
|
|
// SendKeyboardLockKeyEvent(uint flags, pid)
|
|
|
|
public ResultCode SendKeyboardLockKeyEvent(ServiceCtx context)
|
|
|
|
{
|
|
|
|
uint flags = context.RequestData.ReadUInt32();
|
|
|
|
|
|
|
|
// NOTE: This signal the keyboard driver about lock events.
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { flags });
|
2020-05-05 20:50:53 +02:00
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(40)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// AcquireXpadIdEventHandle(ulong XpadId) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode AcquireXpadIdEventHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long xpadId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
if (context.Process.HandleTable.GenerateHandle(_xpadIdEvent.ReadableEvent, out _xpadIdEventHandle) != KernelResult.Success)
|
2018-09-23 20:11:46 +02:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_xpadIdEventHandle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { xpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(41)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ReleaseXpadIdEventHandle(ulong XpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ReleaseXpadIdEventHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long xpadId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Process.HandleTable.CloseHandle(_xpadIdEventHandle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { xpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(51)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateXpad(nn::hid::BasicXpadId, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateXpad(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int basicXpadId = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, basicXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(55)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetXpadIds() -> long IdsCount, buffer<array<nn::hid::BasicXpadId>, type: 0xa>
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetXpadIds(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
|
|
|
// There is any Xpad, so we return 0 and write nothing inside the type-0xa buffer.
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(0L);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(56)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateJoyXpad(nn::hid::JoyXpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateJoyXpad(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int joyXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { joyXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(58)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetJoyXpadLifoHandle(nn::hid::JoyXpadId) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetJoyXpadLifoHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int joyXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
int handle = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { joyXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(59)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetJoyXpadIds() -> long IdsCount, buffer<array<nn::hid::JoyXpadId>, type: 0xa>
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetJoyXpadIds(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
|
|
|
// There is any JoyXpad, so we return 0 and write nothing inside the type-0xa buffer.
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(0L);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(60)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateSixAxisSensor(nn::hid::BasicXpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int basicXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { basicXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(61)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// DeactivateSixAxisSensor(nn::hid::BasicXpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode DeactivateSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int basicXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { basicXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(62)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetSixAxisSensorLifoHandle(nn::hid::BasicXpadId) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetSixAxisSensorLifoHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int basicXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
int handle = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { basicXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(63)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateJoySixAxisSensor(nn::hid::JoyXpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateJoySixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int joyXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { joyXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(64)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// DeactivateJoySixAxisSensor(nn::hid::JoyXpadId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode DeactivateJoySixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int joyXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { joyXpadId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(65)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetJoySixAxisSensorLifoHandle(nn::hid::JoyXpadId) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetJoySixAxisSensorLifoHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int joyXpadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
int handle = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { joyXpadId });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-05 00:44:02 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(66)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StartSixAxisSensor(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StartSixAxisSensor(ServiceCtx context)
|
2018-03-14 01:26:14 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
2018-03-14 01:26:14 +01:00
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(67)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StopSixAxisSensor(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StopSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-03-14 01:26:14 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-14 01:26:14 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(68)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsSixAxisSensorFusionEnabled(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> bool IsEnabled
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsSixAxisSensorFusionEnabled(ServiceCtx context)
|
2018-04-17 18:40:22 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_sixAxisSensorFusionEnabled);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sixAxisSensorFusionEnabled });
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-17 18:40:22 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(69)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// EnableSixAxisSensorFusion(bool Enabled, nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode EnableSixAxisSensorFusion(ServiceCtx context)
|
2018-08-13 23:31:09 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_sixAxisSensorFusionEnabled = context.RequestData.ReadBoolean();
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-23 20:11:46 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sixAxisSensorFusionEnabled });
|
2018-08-13 23:31:09 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(70)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, float RevisePower, float ReviseRange, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetSixAxisSensorFusionParameters(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_sensorFusionParams = new HidSensorFusionParameters
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
RevisePower = context.RequestData.ReadInt32(),
|
|
|
|
ReviseRange = context.RequestData.ReadInt32()
|
2018-09-21 02:08:35 +02:00
|
|
|
};
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange });
|
2018-08-13 23:31:09 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-08-13 23:31:09 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(71)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> float RevisePower, float ReviseRange)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetSixAxisSensorFusionParameters(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_sensorFusionParams.RevisePower);
|
|
|
|
context.ResponseData.Write(_sensorFusionParams.ReviseRange);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(72)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ResetSixAxisSensorFusionParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ResetSixAxisSensorFusionParameters(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_sensorFusionParams.RevisePower = 0;
|
|
|
|
_sensorFusionParams.ReviseRange = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _sensorFusionParams.RevisePower, _sensorFusionParams.ReviseRange });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(73)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetAccelerometerParameters(nn::hid::SixAxisSensorHandle, float X, float Y, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetAccelerometerParameters(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_accelerometerParams = new HidAccelerometerParameters
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
X = context.RequestData.ReadInt32(),
|
|
|
|
Y = context.RequestData.ReadInt32()
|
2018-09-21 02:08:35 +02:00
|
|
|
};
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(74)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetAccelerometerParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> float X, float Y
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetAccelerometerParameters(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_accelerometerParams.X);
|
|
|
|
context.ResponseData.Write(_accelerometerParams.Y);
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(75)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ResetAccelerometerParameters(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ResetAccelerometerParameters(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_accelerometerParams.X = 0;
|
|
|
|
_accelerometerParams.Y = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerParams.X, _accelerometerParams.Y });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(76)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, uint PlayMode, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetAccelerometerPlayMode(ServiceCtx context)
|
2018-04-17 18:40:22 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
_accelerometerPlayMode = context.RequestData.ReadUInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(77)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> uint PlayMode
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetAccelerometerPlayMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_accelerometerPlayMode);
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode });
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-17 18:40:22 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(78)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ResetAccelerometerPlayMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ResetAccelerometerPlayMode(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_accelerometerPlayMode = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _accelerometerPlayMode });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(79)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetGyroscopeZeroDriftMode(nn::hid::SixAxisSensorHandle, uint GyroscopeZeroDriftMode, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetGyroscopeZeroDriftMode(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
_gyroscopeZeroDriftMode = (HidGyroscopeZeroDriftMode)context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(80)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetGyroscopeZeroDriftMode(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle) -> int GyroscopeZeroDriftMode
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetGyroscopeZeroDriftMode(ServiceCtx context)
|
2018-03-13 22:59:17 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-24 20:57:39 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write((int)_gyroscopeZeroDriftMode);
|
2018-03-13 22:59:17 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-13 22:59:17 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(81)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ResetGyroscopeZeroDriftMode(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ResetGyroscopeZeroDriftMode(ServiceCtx context)
|
2018-03-13 22:59:17 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-24 20:57:39 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_gyroscopeZeroDriftMode = HidGyroscopeZeroDriftMode.Standard;
|
2018-04-05 00:39:47 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _gyroscopeZeroDriftMode });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-13 22:59:17 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(82)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsSixAxisSensorAtRest(nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId) -> bool IsAsRest
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsSixAxisSensorAtRest(ServiceCtx context)
|
2018-09-23 20:11:46 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
bool isAtRest = true;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(isAtRest);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, isAtRest });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(91)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateGesture(nn::applet::AppletResourceUserId, int Unknown0)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateGesture(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
int unknown0 = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(100)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetSupportedNpadStyleSet(nn::applet::AppletResourceUserId, nn::hid::NpadStyleTag)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetSupportedNpadStyleSet(ServiceCtx context)
|
2018-03-13 22:59:17 +01:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
ControllerType type = (ControllerType)context.RequestData.ReadInt32();
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-03-13 22:59:17 +01:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2020-04-03 02:10:02 +02:00
|
|
|
appletResourceUserId,
|
|
|
|
type
|
|
|
|
});
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Npads.SupportedStyleSets = type;
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-13 22:59:17 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(101)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetSupportedNpadStyleSet(nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetSupportedNpadStyleSet(ServiceCtx context)
|
2018-03-13 22:59:17 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2020-04-03 02:10:02 +02:00
|
|
|
appletResourceUserId,
|
|
|
|
context.Device.Hid.Npads.SupportedStyleSets
|
|
|
|
});
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-17 18:40:22 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(102)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array<NpadIdType, 9>)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetSupportedNpadIdType(ServiceCtx context)
|
2018-04-17 18:40:22 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
long arraySize = context.Request.PtrBuff[0].Size / 4;
|
2018-03-13 22:59:17 +01:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
NpadIdType[] supportedPlayerIds = new NpadIdType[arraySize];
|
|
|
|
|
2020-08-23 22:54:11 +02:00
|
|
|
context.Device.Hid.Npads.ClearSupportedPlayers();
|
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
for (int i = 0; i < arraySize; ++i)
|
|
|
|
{
|
2020-08-23 22:54:11 +02:00
|
|
|
NpadIdType id = context.Memory.Read<NpadIdType>((ulong)(context.Request.PtrBuff[0].Position + i * 4));
|
|
|
|
|
|
|
|
if (id >= 0)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Npads.SetSupportedPlayer(HidUtils.GetIndexFromNpadIdType(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
supportedPlayerIds[i] = id;
|
2020-04-03 02:10:02 +02:00
|
|
|
}
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{arraySize} " + string.Join(",", supportedPlayerIds));
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-13 22:59:17 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(103)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateNpad(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateNpad(ServiceCtx context)
|
2018-02-25 19:58:16 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Npads.Active = true;
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
2018-02-25 19:58:16 +01:00
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(104)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// DeactivateNpad(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode DeactivateNpad(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Npads.Active = false;
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-02-25 19:58:16 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 19:58:16 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(106)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context)
|
2018-04-17 18:40:22 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
PlayerIndex npadId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32());
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
long npadStyleSet = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
KEvent evnt = context.Device.Hid.Npads.GetStyleSetUpdateEvent(npadId);
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out int handle) != KernelResult.Success)
|
2018-09-23 20:11:46 +02:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadId, npadStyleSet });
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(107)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode DisconnectNpad(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType });
|
2018-04-17 18:40:22 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-04-17 18:40:22 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(108)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetPlayerLedPattern(uint NpadId) -> ulong LedPattern
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetPlayerLedPattern(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2020-08-23 22:54:11 +02:00
|
|
|
NpadIdType npadId = (NpadIdType)context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-23 22:54:11 +02:00
|
|
|
long ledPattern = HidUtils.GetLedPatternFromNpadId(npadId);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(ledPattern);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { npadId, ledPattern });
|
2018-02-25 05:34:16 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
2018-03-04 04:06:44 +01:00
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(109)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, int Unknown)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateNpadWithRevision(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
int revision = context.RequestData.ReadInt32();
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, revision });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(120)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadJoyHoldType(nn::applet::AppletResourceUserId, long NpadJoyHoldType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyHoldType(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2020-04-03 02:10:02 +02:00
|
|
|
context.Device.Hid.Npads.JoyHold = (NpadJoyHoldType)context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2020-04-03 02:10:02 +02:00
|
|
|
appletResourceUserId,
|
|
|
|
context.Device.Hid.Npads.JoyHold
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(121)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> long NpadJoyHoldType
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetNpadJoyHoldType(ServiceCtx context)
|
2018-03-04 04:06:44 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-04-03 02:10:02 +02:00
|
|
|
context.ResponseData.Write((long)context.Device.Hid.Npads.JoyHold);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2020-04-03 02:10:02 +02:00
|
|
|
appletResourceUserId,
|
|
|
|
context.Device.Hid.Npads.JoyHold
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(122)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadJoyAssignmentModeSingleByDefault(uint HidControllerId, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeSingleByDefault(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
PlayerIndex hidControllerId = (PlayerIndex)context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadJoyAssignmentMode = HidNpadJoyAssignmentMode.Single;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, _npadJoyAssignmentMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(123)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadJoyAssignmentModeSingle(uint HidControllerId, nn::applet::AppletResourceUserId, long HidNpadJoyDeviceType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeSingle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
PlayerIndex hidControllerId = (PlayerIndex)context.RequestData.ReadInt32();
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
HidNpadJoyDeviceType hidNpadJoyDeviceType = (HidNpadJoyDeviceType)context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadJoyAssignmentMode = HidNpadJoyAssignmentMode.Single;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, hidNpadJoyDeviceType, _npadJoyAssignmentMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(124)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadJoyAssignmentModeDual(uint HidControllerId, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeDual(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
PlayerIndex hidControllerId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32());
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadJoyAssignmentMode = HidNpadJoyAssignmentMode.Dual;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, hidControllerId, _npadJoyAssignmentMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(125)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// MergeSingleJoyAsDualJoy(uint SingleJoyId0, uint SingleJoyId1, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long singleJoyId0 = context.RequestData.ReadInt32();
|
|
|
|
long singleJoyId1 = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, singleJoyId0, singleJoyId1 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(126)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StartLrAssignmentMode(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StartLrAssignmentMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(127)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StopLrAssignmentMode(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StopLrAssignmentMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(128)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadHandheldActivationMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
_npadHandheldActivationMode = (HidNpadHandheldActivationMode)context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(129)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetNpadHandheldActivationMode(nn::applet::AppletResourceUserId) -> long HidNpadHandheldActivationMode
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetNpadHandheldActivationMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write((long)_npadHandheldActivationMode);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(130)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SwapNpadAssignment(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int oldNpadAssignment = context.RequestData.ReadInt32();
|
|
|
|
int newNpadAssignment = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(131)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
uint unknown0 = context.RequestData.ReadUInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_unintendedHomeButtonInputProtectionEnabled);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(132)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// EnableUnintendedHomeButtonInputProtection(bool Enable, uint Unknown0, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode EnableUnintendedHomeButtonInputProtection(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_unintendedHomeButtonInputProtectionEnabled = context.RequestData.ReadBoolean();
|
|
|
|
uint unknown0 = context.RequestData.ReadUInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(133)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadJoyAssignmentModeSingleWithDestination(uint HidControllerId, long HidNpadJoyDeviceType, nn::applet::AppletResourceUserId) -> bool Unknown0, uint Unknown1
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-04-03 02:10:02 +02:00
|
|
|
PlayerIndex hidControllerId = (PlayerIndex)context.RequestData.ReadInt32();
|
2018-12-06 12:16:24 +01:00
|
|
|
HidNpadJoyDeviceType hidNpadJoyDeviceType = (HidNpadJoyDeviceType)context.RequestData.ReadInt64();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadJoyAssignmentMode = HidNpadJoyAssignmentMode.Single;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(0); //Unknown0
|
|
|
|
context.ResponseData.Write(0); //Unknown1
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2019-01-11 01:11:46 +01:00
|
|
|
appletResourceUserId,
|
|
|
|
hidControllerId,
|
|
|
|
hidNpadJoyDeviceType,
|
|
|
|
_npadJoyAssignmentMode,
|
|
|
|
Unknown0 = 0,
|
|
|
|
Unknown1 = 0
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(200)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetVibrationDeviceInfo(nn::hid::VibrationDeviceHandle) -> nn::hid::VibrationDeviceInfo
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetVibrationDeviceInfo(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
HidVibrationDeviceValue deviceInfo = new HidVibrationDeviceValue
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
|
|
|
DeviceType = HidVibrationDeviceType.None,
|
|
|
|
Position = HidVibrationDevicePosition.None
|
|
|
|
};
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write((int)deviceInfo.DeviceType);
|
|
|
|
context.ResponseData.Write((int)deviceInfo.Position);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { vibrationDeviceHandle, deviceInfo.DeviceType, deviceInfo.Position });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(201)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SendVibrationValue(nn::hid::VibrationDeviceHandle, nn::hid::VibrationValue, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SendVibrationValue(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_vibrationValue = new HidVibrationValue
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
AmplitudeLow = context.RequestData.ReadSingle(),
|
|
|
|
FrequencyLow = context.RequestData.ReadSingle(),
|
|
|
|
AmplitudeHigh = context.RequestData.ReadSingle(),
|
|
|
|
FrequencyHigh = context.RequestData.ReadSingle()
|
2018-09-21 02:08:35 +02:00
|
|
|
};
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Debug?.PrintStub(LogClass.ServiceHid, new {
|
2019-01-11 01:11:46 +01:00
|
|
|
appletResourceUserId,
|
|
|
|
vibrationDeviceHandle,
|
|
|
|
_vibrationValue.AmplitudeLow,
|
|
|
|
_vibrationValue.FrequencyLow,
|
|
|
|
_vibrationValue.AmplitudeHigh,
|
|
|
|
_vibrationValue.FrequencyHigh
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(202)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetActualVibrationValue(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationValue
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetActualVibrationValue(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_vibrationValue.AmplitudeLow);
|
|
|
|
context.ResponseData.Write(_vibrationValue.FrequencyLow);
|
|
|
|
context.ResponseData.Write(_vibrationValue.AmplitudeHigh);
|
|
|
|
context.ResponseData.Write(_vibrationValue.FrequencyHigh);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
2019-01-11 01:11:46 +01:00
|
|
|
appletResourceUserId,
|
|
|
|
vibrationDeviceHandle,
|
|
|
|
_vibrationValue.AmplitudeLow,
|
|
|
|
_vibrationValue.FrequencyLow,
|
|
|
|
_vibrationValue.AmplitudeHigh,
|
|
|
|
_vibrationValue.FrequencyHigh
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(203)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// CreateActiveVibrationDeviceList() -> object<nn::hid::IActiveVibrationDeviceList>
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode CreateActiveVibrationDeviceList(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
MakeObject(context, new IActiveApplicationDeviceList());
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(204)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// PermitVibration(bool Enable)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode PermitVibration(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_vibrationPermitted = context.RequestData.ReadBoolean();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { _vibrationPermitted });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(205)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsVibrationPermitted() -> bool IsEnabled
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsVibrationPermitted(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_vibrationPermitted);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { _vibrationPermitted });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(206)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SendVibrationValues(nn::applet::AppletResourceUserId, buffer<array<nn::hid::VibrationDeviceHandle>, type: 9>, buffer<array<nn::hid::VibrationValue>, type: 9>)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SendVibrationValues(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-05-04 00:54:50 +02:00
|
|
|
byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size];
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-05-04 00:54:50 +02:00
|
|
|
context.Memory.Read((ulong)context.Request.PtrBuff[0].Position, vibrationDeviceHandleBuffer);
|
|
|
|
|
|
|
|
byte[] vibrationValueBuffer = new byte[context.Request.PtrBuff[1].Size];
|
|
|
|
|
|
|
|
context.Memory.Read((ulong)context.Request.PtrBuff[1].Position, vibrationValueBuffer);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// TODO: Read all handles and values from buffer.
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Debug?.PrintStub(LogClass.ServiceHid, new {
|
2019-01-11 01:11:46 +01:00
|
|
|
appletResourceUserId,
|
|
|
|
VibrationDeviceHandleBufferLength = vibrationDeviceHandleBuffer.Length,
|
|
|
|
VibrationValueBufferLength = vibrationValueBuffer.Length
|
|
|
|
});
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(207)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// SendVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::hid::VibrationGcErmCommand, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SendVibrationGcErmCommand(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
|
|
|
long vibrationGcErmCommand = context.RequestData.ReadInt64();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, vibrationGcErmCommand });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(208)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetActualVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationGcErmCommand
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetActualVibrationGcErmCommand(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_vibrationGcErmCommand);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, _vibrationGcErmCommand });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(209)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// BeginPermitVibrationSession(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode BeginPermitVibrationSession(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(210)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// EndPermitVibrationSession()
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode EndPermitVibrationSession(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(300)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateConsoleSixAxisSensor(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateConsoleSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(301)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StartConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StartConsoleSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-23 20:11:46 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(302)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// StopConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StopConsoleSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int consoleSixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(303)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ActivateSevenSixAxisSensor(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateSevenSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(304)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// StartSevenSixAxisSensor(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StartSevenSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(305)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// StopSevenSixAxisSensor(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode StopSevenSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(306)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// InitializeSevenSixAxisSensor(array<nn::sf::NativeHandle>, ulong Counter0, array<nn::sf::NativeHandle>, ulong Counter1, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode InitializeSevenSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
long counter0 = context.RequestData.ReadInt64();
|
|
|
|
long counter1 = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
// TODO: Determine if array<nn::sf::NativeHandle> is a buffer or not...
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, counter0, counter1 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(307)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// FinalizeSevenSixAxisSensor(nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode FinalizeSevenSixAxisSensor(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
2018-12-18 06:33:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(308)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetSevenSixAxisSensorFusionStrength(float Strength, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetSevenSixAxisSensorFusionStrength(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(309)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetSevenSixAxisSensorFusionStrength(nn::applet::AppletResourceUserId) -> float Strength
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetSevenSixAxisSensorFusionStrength(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_sevenSixAxisSensorFusionStrength);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(400)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsUsbFullKeyControllerEnabled() -> bool IsEnabled
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsUsbFullKeyControllerEnabled(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_usbFullKeyControllerEnabled);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { _usbFullKeyControllerEnabled });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(401)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// EnableUsbFullKeyController(bool Enable)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode EnableUsbFullKeyController(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_usbFullKeyControllerEnabled = context.RequestData.ReadBoolean();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { _usbFullKeyControllerEnabled });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(402)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// IsUsbFullKeyControllerConnected(uint Unknown0) -> bool Connected
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode IsUsbFullKeyControllerConnected(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int unknown0 = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(true); //FullKeyController is always connected ?
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { unknown0, Connected = true });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(403)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// HasBattery(uint NpadId) -> bool HasBattery
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode HasBattery(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int npadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(true); //Npad always got a battery ?
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { npadId, HasBattery = true });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(404)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// HasLeftRightBattery(uint NpadId) -> bool HasLeftBattery, bool HasRightBattery
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode HasLeftRightBattery(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int npadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(true); //Npad always got a left battery ?
|
|
|
|
context.ResponseData.Write(true); //Npad always got a right battery ?
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { npadId, HasLeftBattery = true, HasRightBattery = true });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(405)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetNpadInterfaceType(uint NpadId) -> uchar InterfaceType
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetNpadInterfaceType(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int npadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write((byte)0);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { npadId, NpadInterfaceType = 0 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(406)] // 4.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetNpadLeftRightInterfaceType(uint NpadId) -> uchar LeftInterfaceType, uchar RightInterfaceType
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetNpadLeftRightInterfaceType(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int npadId = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write((byte)0);
|
|
|
|
context.ResponseData.Write((byte)0);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { npadId, LeftInterfaceType = 0, RightInterfaceType = 0 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(500)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetPalmaConnectionHandle(uint Unknown0, nn::applet::AppletResourceUserId) -> nn::hid::PalmaConnectionHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetPalmaConnectionHandle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int unknown0 = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = 0;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(palmaConnectionHandle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId , unknown0, palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(501)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// InitializePalma(nn::hid::PalmaConnectionHandle)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode InitializePalma(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(502)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// AcquirePalmaOperationCompleteEvent(nn::hid::PalmaConnectionHandle) -> nn::sf::NativeHandle
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode AcquirePalmaOperationCompleteEvent(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
if (context.Process.HandleTable.GenerateHandle(_palmaOperationCompleteEvent.ReadableEvent, out int handle) != KernelResult.Success)
|
2018-09-23 20:11:46 +02:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(503)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetPalmaOperationInfo(nn::hid::PalmaConnectionHandle) -> long Unknown0, buffer<Unknown>
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetPalmaOperationInfo(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
long unknown0 = 0; //Counter?
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(unknown0);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(504)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// PlayPalmaActivity(nn::hid::PalmaConnectionHandle, ulong Unknown0)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode PlayPalmaActivity(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
|
|
|
long unknown0 = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(505)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetPalmaFrModeType(nn::hid::PalmaConnectionHandle, ulong FrModeType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetPalmaFrModeType(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
|
|
|
long frModeType = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, frModeType });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(506)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ReadPalmaStep(nn::hid::PalmaConnectionHandle)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ReadPalmaStep(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(507)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// EnablePalmaStep(nn::hid::PalmaConnectionHandle, bool Enable)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode EnablePalmaStep(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
|
|
|
bool enabledPalmaStep = context.RequestData.ReadBoolean();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, enabledPalmaStep });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(508)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ResetPalmaStep(nn::hid::PalmaConnectionHandle)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ResetPalmaStep(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(509)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ReadPalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ReadPalmaApplicationSection(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
|
|
|
long unknown0 = context.RequestData.ReadInt64();
|
|
|
|
long unknown1 = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(510)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// WritePalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1, nn::hid::PalmaApplicationSectionAccessBuffer)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode WritePalmaApplicationSection(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
|
|
|
long unknown0 = context.RequestData.ReadInt64();
|
|
|
|
long unknown1 = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
// nn::hid::PalmaApplicationSectionAccessBuffer cast is unknown
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
_palmaOperationCompleteEvent.ReadableEvent.Signal();
|
2018-11-20 01:01:36 +01:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(511)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// ReadPalmaUniqueCode(nn::hid::PalmaConnectionHandle)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ReadPalmaUniqueCode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(512)] // 5.0.0+
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetPalmaUniqueCodeInvalid(nn::hid::PalmaConnectionHandle)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetPalmaUniqueCodeInvalid(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
int palmaConnectionHandle = context.RequestData.ReadInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
Implement Bluetooth, Btm, Hid and Nsd services and calls. (#761)
- Implement `btdrv` service (IBluetoothDriver).
Implement call `InitializeBluetoothLe` for initialize events of `bt` service according to RE.
- Implement `bt` service (IBluetoothUser).
Implement call `RegisterBleEvent` according to RE.
- Add a placeholder for the `btm` service (close #750).
- Implement `btm:u` service (IBtmUser) (close #751).
Implement call `GetCore` according to RE (close #752).
- Implement `IBtmUserCore` and calls `AcquireBleScanEvent`, `AcquireBleConnectionEvent`, `AcquireBleServiceDiscoveryEvent` and `AcquireBleMtuConfigEvent` according to RE.
- Implement `SetPalmaBoostMode` in `IHidServer` according to RE.
- Add stub for `SetIsPalmaAllConnectable` in `IHidServer` because we will not support Palma devices soon.
- Implement `nsd:a` and `nsd:u` service (IManager) (close #755).
Implement call `ResolveEx` according to RE (close #756).
Implement calls `GetSettingName`, `GetEnvironmentIdentifier`, `GetDeviceId`, `DeleteSettings`, `Resolve`, `ReadSaveDataFromFsForTest`, `WriteSaveDataToFsForTest` and `DeleteSaveDataOfFsForTest` according to RE.
2019-09-06 16:58:50 +02:00
|
|
|
[Command(522)] // 5.1.0+
|
|
|
|
// SetIsPalmaAllConnectable(nn::applet::AppletResourceUserId, bool, pid)
|
|
|
|
public ResultCode SetIsPalmaAllConnectable(ServiceCtx context)
|
|
|
|
{
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
long unknownBool = context.RequestData.ReadInt64();
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknownBool });
|
Implement Bluetooth, Btm, Hid and Nsd services and calls. (#761)
- Implement `btdrv` service (IBluetoothDriver).
Implement call `InitializeBluetoothLe` for initialize events of `bt` service according to RE.
- Implement `bt` service (IBluetoothUser).
Implement call `RegisterBleEvent` according to RE.
- Add a placeholder for the `btm` service (close #750).
- Implement `btm:u` service (IBtmUser) (close #751).
Implement call `GetCore` according to RE (close #752).
- Implement `IBtmUserCore` and calls `AcquireBleScanEvent`, `AcquireBleConnectionEvent`, `AcquireBleServiceDiscoveryEvent` and `AcquireBleMtuConfigEvent` according to RE.
- Implement `SetPalmaBoostMode` in `IHidServer` according to RE.
- Add stub for `SetIsPalmaAllConnectable` in `IHidServer` because we will not support Palma devices soon.
- Implement `nsd:a` and `nsd:u` service (IManager) (close #755).
Implement call `ResolveEx` according to RE (close #756).
Implement calls `GetSettingName`, `GetEnvironmentIdentifier`, `GetDeviceId`, `DeleteSettings`, `Resolve`, `ReadSaveDataFromFsForTest`, `WriteSaveDataToFsForTest` and `DeleteSaveDataOfFsForTest` according to RE.
2019-09-06 16:58:50 +02:00
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Command(525)] // 5.1.0+
|
|
|
|
// SetPalmaBoostMode(bool)
|
|
|
|
public ResultCode SetPalmaBoostMode(ServiceCtx context)
|
|
|
|
{
|
|
|
|
// NOTE: Stubbed in system module.
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(1000)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// SetNpadCommunicationMode(long CommunicationMode, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadCommunicationMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_npadCommunicationMode = context.RequestData.ReadInt64();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadCommunicationMode });
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(1001)]
|
2018-09-21 02:08:35 +02:00
|
|
|
// GetNpadCommunicationMode() -> long CommunicationMode
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetNpadCommunicationMode(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
context.ResponseData.Write(_npadCommunicationMode);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { _npadCommunicationMode });
|
2018-04-17 02:24:42 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-03-04 04:06:44 +01:00
|
|
|
}
|
2020-09-20 06:32:58 +02:00
|
|
|
|
|
|
|
[Command(1002)] // 9.0.0+
|
|
|
|
// SetTouchScreenConfiguration(nn::hid::TouchScreenConfigurationForNx, nn::applet::AppletResourceUserId)
|
|
|
|
public ResultCode SetTouchScreenConfiguration(ServiceCtx context)
|
|
|
|
{
|
|
|
|
long touchScreenConfigurationForNx = context.RequestData.ReadInt64();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, touchScreenConfigurationForNx });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
2018-04-17 18:40:22 +02:00
|
|
|
}
|