2021-08-05 00:39:40 +02:00
|
|
|
using Ryujinx.Common;
|
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.Threading;
|
2019-09-19 02:45:11 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
2021-05-02 22:01:30 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
2022-05-08 00:28:54 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
2023-01-04 23:15:45 +01:00
|
|
|
using Ryujinx.Horizon.Common;
|
2018-09-21 02:08:35 +02:00
|
|
|
using System;
|
2021-04-26 10:44:20 +02:00
|
|
|
using System.Collections.Generic;
|
2021-04-24 12:16:01 +02:00
|
|
|
using System.Runtime.InteropServices;
|
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;
|
2021-06-19 13:53:18 +02:00
|
|
|
private bool _isFirmwareUpdateAvailableForSixAxisSensor;
|
2022-02-18 02:00:06 +01:00
|
|
|
private bool _isSixAxisSensorUnalteredPassthroughEnabled;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
private NpadHandheldActivationMode _npadHandheldActivationMode;
|
|
|
|
private GyroscopeZeroDriftMode _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
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
private SensorFusionParameters _sensorFusionParams;
|
|
|
|
private AccelerometerParameters _accelerometerParams;
|
2018-08-13 23:31:09 +02:00
|
|
|
|
2020-12-02 13:14:44 +01:00
|
|
|
public IHidServer(ServiceCtx context) : base(context.Device.System.HidServer)
|
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
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
_npadHandheldActivationMode = NpadHandheldActivationMode.Dual;
|
|
|
|
_gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.Standard;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-06-19 13:53:18 +02:00
|
|
|
_isFirmwareUpdateAvailableForSixAxisSensor = false;
|
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
_sensorFusionParams = new SensorFusionParameters();
|
|
|
|
_accelerometerParams = new AccelerometerParameters();
|
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();
|
2023-01-04 23:15:45 +01:00
|
|
|
|
2022-01-23 12:24:55 +01:00
|
|
|
_vibrationPermitted = true;
|
2018-02-25 05:34:16 +01:00
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-26 10:44:20 +02:00
|
|
|
// Initialize entries to avoid issues with some games.
|
|
|
|
|
|
|
|
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
|
|
|
{
|
|
|
|
context.Device.Hid.DebugPad.Update();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-26 10:44:20 +02:00
|
|
|
// Initialize entries to avoid issues with some games.
|
|
|
|
|
|
|
|
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Touchscreen.Update();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-26 10:44:20 +02:00
|
|
|
// Initialize entries to avoid issues with some games.
|
|
|
|
|
|
|
|
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Mouse.Update(0, 0);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-26 10:44:20 +02:00
|
|
|
// Initialize entries to avoid issues with some games.
|
|
|
|
|
|
|
|
KeyboardInput emptyInput = new KeyboardInput();
|
2021-05-02 22:01:30 +02:00
|
|
|
emptyInput.Keys = new ulong[4];
|
2021-04-26 10:44:20 +02:00
|
|
|
|
|
|
|
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Keyboard.Update(emptyInput);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(32)]
|
2020-05-05 20:50:53 +02:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2023-01-04 23:15:45 +01:00
|
|
|
if (context.Process.HandleTable.GenerateHandle(_xpadIdEvent.ReadableEvent, out _xpadIdEventHandle) != Result.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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
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 });
|
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
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
_sixAxisSensorFusionEnabled = context.RequestData.ReadUInt32() != 0;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
_sensorFusionParams = new SensorFusionParameters
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
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(_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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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();
|
2022-02-18 02:00:06 +01:00
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
_accelerometerParams = new AccelerometerParameters
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
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(_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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
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(_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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
2022-05-08 00:28:54 +02:00
|
|
|
_gyroscopeZeroDriftMode = (GyroscopeZeroDriftMode)context.RequestData.ReadInt32();
|
2022-02-18 02:00:06 +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, _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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-04-24 20:57:39 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
_gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
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
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-06-19 13:53:18 +02:00
|
|
|
[CommandHipc(83)] // 6.0.0+
|
|
|
|
// IsFirmwareUpdateAvailableForSixAxisSensor(nn::hid::AppletResourceUserId, nn::hid::SixAxisSensorHandle, pid) -> bool UpdateAvailable
|
|
|
|
public ResultCode IsFirmwareUpdateAvailableForSixAxisSensor(ServiceCtx context)
|
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2021-06-19 13:53:18 +02:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
context.ResponseData.Write(_isFirmwareUpdateAvailableForSixAxisSensor);
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _isFirmwareUpdateAvailableForSixAxisSensor });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2022-02-18 02:00:06 +01:00
|
|
|
[CommandHipc(84)] // 13.0.0+
|
|
|
|
// EnableSixAxisSensorUnalteredPassthrough(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle, u8 enabled)
|
|
|
|
public ResultCode EnableSixAxisSensorUnalteredPassthrough(ServiceCtx context)
|
|
|
|
{
|
|
|
|
_isSixAxisSensorUnalteredPassthroughEnabled = context.RequestData.ReadUInt32() != 0;
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _isSixAxisSensorUnalteredPassthroughEnabled });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CommandHipc(85)] // 13.0.0+
|
|
|
|
// IsSixAxisSensorUnalteredPassthroughEnabled(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle) -> u8 enabled
|
|
|
|
public ResultCode IsSixAxisSensorUnalteredPassthroughEnabled(ServiceCtx context)
|
|
|
|
{
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
context.ResponseData.Write(_isSixAxisSensorUnalteredPassthroughEnabled);
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CommandHipc(87)] // 13.0.0+
|
|
|
|
// LoadSixAxisSensorCalibrationParameter(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle, u64 unknown)
|
|
|
|
public ResultCode LoadSixAxisSensorCalibrationParameter(ServiceCtx context)
|
|
|
|
{
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
// TODO: CalibrationParameter have to be determined.
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CommandHipc(88)] // 13.0.0+
|
|
|
|
// GetSixAxisSensorIcInformation(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle) -> u64 unknown
|
|
|
|
public ResultCode GetSixAxisSensorIcInformation(ServiceCtx context)
|
|
|
|
{
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
// TODO: IcInformation have to be determined.
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(100)]
|
2022-02-18 02:00:06 +01:00
|
|
|
// SetSupportedNpadStyleSet(pid, 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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
ulong pid = context.Request.HandleDesc.PId;
|
2020-04-03 02:10:02 +02:00
|
|
|
ControllerType type = (ControllerType)context.RequestData.ReadInt32();
|
2022-02-18 02:00:06 +01:00
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-03-13 22:59:17 +01:00
|
|
|
|
2022-02-18 02:00:06 +01:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { pid, 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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(101)]
|
2022-02-18 02:00:06 +01:00
|
|
|
// GetSupportedNpadStyleSet(pid, 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
|
|
|
{
|
2022-02-18 02:00:06 +01:00
|
|
|
ulong pid = context.Request.HandleDesc.PId;
|
|
|
|
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
|
|
|
|
2022-02-18 02:00:06 +01:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { 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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2021-12-29 14:49:10 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
ulong arrayPosition = context.Request.PtrBuff[0].Position;
|
|
|
|
ulong arraySize = context.Request.PtrBuff[0].Size;
|
2018-03-13 22:59:17 +01:00
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
ReadOnlySpan<NpadIdType> supportedPlayerIds = MemoryMarshal.Cast<byte, NpadIdType>(context.Memory.GetSpan(arrayPosition, (int)arraySize));
|
2020-04-03 02:10:02 +02:00
|
|
|
|
2020-08-23 22:54:11 +02:00
|
|
|
context.Device.Hid.Npads.ClearSupportedPlayers();
|
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
for (int i = 0; i < supportedPlayerIds.Length; ++i)
|
2020-04-03 02:10:02 +02:00
|
|
|
{
|
2021-04-24 12:16:01 +02:00
|
|
|
if (supportedPlayerIds[i] >= 0)
|
2020-08-23 22:54:11 +02:00
|
|
|
{
|
2021-04-24 12:16:01 +02:00
|
|
|
context.Device.Hid.Npads.SetSupportedPlayer(HidUtils.GetIndexFromNpadIdType(supportedPlayerIds[i]));
|
2020-08-23 22:54:11 +02:00
|
|
|
}
|
2020-04-03 02:10:02 +02:00
|
|
|
}
|
|
|
|
|
2022-02-18 02:00:06 +01:00
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{supportedPlayerIds.Length} Players: " + string.Join(",", supportedPlayerIds.ToArray()));
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2021-12-29 14:49:10 +01:00
|
|
|
return ActiveNpadImpl(context);
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
2018-02-25 19:58:16 +01:00
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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);
|
2023-01-04 23:15:45 +01:00
|
|
|
if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out int handle) != Result.Success)
|
2018-09-23 20:11:46 +02:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-04-07 20:43:14 +02:00
|
|
|
// Games expect this event to be signaled after calling this function
|
|
|
|
evnt.ReadableEvent.Signal();
|
|
|
|
|
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
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(108)]
|
2021-06-23 22:52:55 +02:00
|
|
|
// GetPlayerLedPattern(u32 npad_id) -> u64 led_pattern
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetPlayerLedPattern(ServiceCtx context)
|
2018-02-25 05:34:16 +01:00
|
|
|
{
|
2021-06-23 22:52:55 +02:00
|
|
|
NpadIdType npadId = (NpadIdType)context.RequestData.ReadUInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-06-23 22:52:55 +02:00
|
|
|
ulong ledPattern = npadId switch
|
|
|
|
{
|
|
|
|
NpadIdType.Player1 => 0b0001,
|
|
|
|
NpadIdType.Player2 => 0b0011,
|
|
|
|
NpadIdType.Player3 => 0b0111,
|
|
|
|
NpadIdType.Player4 => 0b1111,
|
|
|
|
NpadIdType.Player5 => 0b1001,
|
|
|
|
NpadIdType.Player6 => 0b0101,
|
|
|
|
NpadIdType.Player7 => 0b1101,
|
|
|
|
NpadIdType.Player8 => 0b0110,
|
|
|
|
NpadIdType.Unknown => 0b0000,
|
|
|
|
NpadIdType.Handheld => 0b0000,
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(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
|
|
|
|
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
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(109)] // 5.0.0+
|
2021-12-29 14:49:10 +01:00
|
|
|
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, ulong revision)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode ActivateNpadWithRevision(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2021-12-29 14:49:10 +01:00
|
|
|
ulong revision = context.RequestData.ReadUInt64();
|
|
|
|
|
|
|
|
return ActiveNpadImpl(context, revision);
|
|
|
|
}
|
|
|
|
|
|
|
|
private ResultCode ActiveNpadImpl(ServiceCtx context, ulong revision = 0)
|
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-12-29 14:49:10 +01:00
|
|
|
context.Device.Hid.Npads.Active = true;
|
|
|
|
|
2021-04-26 10:44:20 +02:00
|
|
|
// Initialize entries to avoid issues with some games.
|
|
|
|
|
|
|
|
List<GamepadInput> emptyGamepadInputs = new List<GamepadInput>();
|
|
|
|
List<SixAxisInput> emptySixAxisInputs = new List<SixAxisInput>();
|
|
|
|
|
|
|
|
for (int player = 0; player < NpadDevices.MaxControllers; player++)
|
|
|
|
{
|
|
|
|
GamepadInput gamepadInput = new GamepadInput();
|
|
|
|
SixAxisInput sixaxisInput = new SixAxisInput();
|
|
|
|
|
|
|
|
gamepadInput.PlayerId = (PlayerIndex)player;
|
|
|
|
sixaxisInput.PlayerId = (PlayerIndex)player;
|
|
|
|
|
|
|
|
sixaxisInput.Orientation = new float[9];
|
|
|
|
|
|
|
|
emptyGamepadInputs.Add(gamepadInput);
|
|
|
|
emptySixAxisInputs.Add(sixaxisInput);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Npads.Update(emptyGamepadInputs);
|
|
|
|
context.Device.Hid.Npads.UpdateSixAxis(emptySixAxisInputs);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(120)]
|
2021-06-23 22:52:55 +02:00
|
|
|
// SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong 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();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-06-23 22:52:55 +02:00
|
|
|
NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64();
|
|
|
|
|
|
|
|
if (npadJoyHoldType > NpadJoyHoldType.Horizontal)
|
|
|
|
{
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(npadJoyHoldType));
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
|
|
|
{
|
|
|
|
if (HidUtils.GetNpadIdTypeFromIndex(playerIndex) > NpadIdType.Handheld)
|
|
|
|
{
|
|
|
|
return ResultCode.InvalidNpadIdType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
context.Device.Hid.Npads.JoyHold = npadJoyHoldType;
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(121)]
|
2021-06-23 22:52:55 +02:00
|
|
|
// GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong 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
|
|
|
|
2021-06-23 22:52:55 +02:00
|
|
|
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
|
|
|
{
|
|
|
|
if (HidUtils.GetNpadIdTypeFromIndex(playerIndex) > NpadIdType.Handheld)
|
|
|
|
{
|
|
|
|
return ResultCode.InvalidNpadIdType;
|
|
|
|
}
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-06-23 22:52:55 +02:00
|
|
|
context.ResponseData.Write((ulong)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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (HidUtils.IsValidNpadIdType(npadIdType))
|
|
|
|
{
|
|
|
|
context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(123)]
|
2022-05-08 00:28:54 +02:00
|
|
|
// SetNpadJoyAssignmentModeSingle(uint npadIdType, nn::applet::AppletResourceUserId, uint npadJoyDeviceType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeSingle(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
NpadJoyDeviceType npadJoyDeviceType = (NpadJoyDeviceType)context.RequestData.ReadUInt32();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (HidUtils.IsValidNpadIdType(npadIdType))
|
|
|
|
{
|
|
|
|
SetNpadJoyAssignmentModeSingleWithDestinationImpl(context, npadIdType, appletResourceUserId, npadJoyDeviceType, out _, out _);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(124)]
|
2022-05-08 00:28:54 +02:00
|
|
|
// SetNpadJoyAssignmentModeDual(uint npadIdType, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeDual(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (HidUtils.IsValidNpadIdType(npadIdType))
|
|
|
|
{
|
|
|
|
context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Dual;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(125)]
|
2022-05-08 00:28:54 +02:00
|
|
|
// MergeSingleJoyAsDualJoy(uint npadIdType0, uint npadIdType1, nn::applet::AppletResourceUserId)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32();
|
|
|
|
NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (HidUtils.IsValidNpadIdType(npadIdType0) && HidUtils.IsValidNpadIdType(npadIdType1))
|
|
|
|
{
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType0, npadIdType1 });
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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();
|
2022-05-08 00:28:54 +02:00
|
|
|
_npadHandheldActivationMode = (NpadHandheldActivationMode)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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2021-12-29 14:49:10 +01:00
|
|
|
uint unknown0 = context.RequestData.ReadUInt32();
|
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(_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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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();
|
2021-12-29 14:49:10 +01:00
|
|
|
uint unknown0 = context.RequestData.ReadUInt32();
|
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, 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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(133)] // 5.0.0+
|
2022-05-08 00:28:54 +02:00
|
|
|
// SetNpadJoyAssignmentModeSingleWithDestination(uint npadIdType, uint npadJoyDeviceType, nn::applet::AppletResourceUserId) -> bool npadIdTypeIsSet, uint npadIdTypeSet
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
|
|
|
NpadJoyDeviceType npadJoyDeviceType = (NpadJoyDeviceType)context.RequestData.ReadInt32();
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (HidUtils.IsValidNpadIdType(npadIdType))
|
|
|
|
{
|
|
|
|
SetNpadJoyAssignmentModeSingleWithDestinationImpl(context, npadIdType, appletResourceUserId, npadJoyDeviceType, out NpadIdType npadIdTypeSet, out bool npadIdTypeIsSet);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (npadIdTypeIsSet)
|
|
|
|
{
|
|
|
|
context.ResponseData.Write(npadIdTypeIsSet);
|
|
|
|
context.ResponseData.Write((uint)npadIdTypeSet);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
private void SetNpadJoyAssignmentModeSingleWithDestinationImpl(ServiceCtx context, NpadIdType npadIdType, long appletResourceUserId, NpadJoyDeviceType npadJoyDeviceType, out NpadIdType npadIdTypeSet, out bool npadIdTypeIsSet)
|
|
|
|
{
|
|
|
|
npadIdTypeSet = default;
|
|
|
|
npadIdTypeIsSet = false;
|
|
|
|
|
|
|
|
context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Single;
|
|
|
|
|
|
|
|
// TODO: Service seems to use the npadJoyDeviceType to find the nearest other Npad available and merge them to dual.
|
|
|
|
// If one is found, it returns the npadIdType of the other Npad and a bool.
|
|
|
|
// If not, it returns nothing.
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDeviceHandle deviceHandle = context.RequestData.ReadStruct<VibrationDeviceHandle>();
|
|
|
|
NpadStyleIndex deviceType = (NpadStyleIndex)deviceHandle.DeviceType;
|
|
|
|
NpadIdType npadIdType = (NpadIdType)deviceHandle.PlayerId;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-08-05 00:39:40 +02:00
|
|
|
if (deviceType < NpadStyleIndex.System || deviceType >= NpadStyleIndex.FullKey)
|
2018-09-21 02:08:35 +02:00
|
|
|
{
|
2021-08-05 00:39:40 +02:00
|
|
|
if (npadIdType >= (NpadIdType.Player8 + 1) && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown)
|
|
|
|
{
|
|
|
|
return ResultCode.InvalidNpadIdType;
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-08-05 00:39:40 +02:00
|
|
|
if (deviceHandle.Position > 1)
|
|
|
|
{
|
|
|
|
return ResultCode.InvalidDeviceIndex;
|
|
|
|
}
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDeviceType vibrationDeviceType = VibrationDeviceType.None;
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (Enum.IsDefined(deviceType))
|
2021-08-05 00:39:40 +02:00
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
vibrationDeviceType = VibrationDeviceType.LinearResonantActuator;
|
2021-08-05 00:39:40 +02:00
|
|
|
}
|
|
|
|
else if ((uint)deviceType == 8)
|
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
vibrationDeviceType = VibrationDeviceType.GcErm;
|
2021-08-05 00:39:40 +02:00
|
|
|
}
|
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDevicePosition vibrationDevicePosition = VibrationDevicePosition.None;
|
2021-08-05 00:39:40 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
if (vibrationDeviceType == VibrationDeviceType.LinearResonantActuator)
|
2021-08-05 00:39:40 +02:00
|
|
|
{
|
|
|
|
if (deviceHandle.Position == 0)
|
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
vibrationDevicePosition = VibrationDevicePosition.Left;
|
2021-08-05 00:39:40 +02:00
|
|
|
}
|
|
|
|
else if (deviceHandle.Position == 1)
|
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
vibrationDevicePosition = VibrationDevicePosition.Right;
|
2021-08-05 00:39:40 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(deviceHandle.Position));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDeviceValue deviceInfo = new VibrationDeviceValue
|
2021-08-05 00:39:40 +02:00
|
|
|
{
|
|
|
|
DeviceType = vibrationDeviceType,
|
|
|
|
Position = vibrationDevicePosition
|
|
|
|
};
|
|
|
|
|
|
|
|
context.ResponseData.WriteStruct(deviceInfo);
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultCode.InvalidNpadDeviceType;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle
|
2021-08-05 00:39:40 +02:00
|
|
|
{
|
|
|
|
DeviceType = context.RequestData.ReadByte(),
|
2021-12-29 14:49:10 +01:00
|
|
|
PlayerId = context.RequestData.ReadByte(),
|
|
|
|
Position = context.RequestData.ReadByte(),
|
|
|
|
Reserved = context.RequestData.ReadByte()
|
2021-08-05 00:39:40 +02:00
|
|
|
};
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationValue vibrationValue = new VibrationValue
|
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
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>();
|
2021-08-05 00:39:40 +02:00
|
|
|
|
|
|
|
dualVibrationValues[deviceHandle.Position] = vibrationValue;
|
|
|
|
|
|
|
|
context.Device.Hid.Npads.UpdateRumbleQueue((PlayerIndex)deviceHandle.PlayerId, dualVibrationValues);
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle
|
2021-08-05 00:39:40 +02:00
|
|
|
{
|
|
|
|
DeviceType = context.RequestData.ReadByte(),
|
2021-12-29 14:49:10 +01:00
|
|
|
PlayerId = context.RequestData.ReadByte(),
|
|
|
|
Position = context.RequestData.ReadByte(),
|
|
|
|
Reserved = context.RequestData.ReadByte()
|
2021-08-05 00:39:40 +02:00
|
|
|
};
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-08-05 00:39:40 +02: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
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-09-21 02:08:35 +02:00
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
context.Memory.Read(context.Request.PtrBuff[0].Position, vibrationDeviceHandleBuffer);
|
2020-05-04 00:54:50 +02:00
|
|
|
|
|
|
|
byte[] vibrationValueBuffer = new byte[context.Request.PtrBuff[1].Size];
|
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
context.Memory.Read(context.Request.PtrBuff[1].Position, vibrationValueBuffer);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2022-05-08 00:28:54 +02:00
|
|
|
Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer);
|
|
|
|
Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer);
|
2018-09-21 02:08:35 +02:00
|
|
|
|
2021-08-05 00:39:40 +02:00
|
|
|
if (!deviceHandles.IsEmpty && vibrationValues.Length == deviceHandles.Length)
|
|
|
|
{
|
2022-05-08 00:28:54 +02:00
|
|
|
Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>();
|
2021-08-05 00:39:40 +02:00
|
|
|
PlayerIndex currentIndex = (PlayerIndex)deviceHandles[0].PlayerId;
|
|
|
|
|
|
|
|
for (int deviceCounter = 0; deviceCounter < deviceHandles.Length; deviceCounter++)
|
|
|
|
{
|
|
|
|
PlayerIndex index = (PlayerIndex)deviceHandles[deviceCounter].PlayerId;
|
|
|
|
byte position = deviceHandles[deviceCounter].Position;
|
|
|
|
|
|
|
|
if (index != currentIndex || dualVibrationValues.Count == 2)
|
|
|
|
{
|
|
|
|
context.Device.Hid.Npads.UpdateRumbleQueue(currentIndex, dualVibrationValues);
|
2022-05-08 00:28:54 +02:00
|
|
|
dualVibrationValues = new Dictionary<byte, VibrationValue>();
|
2021-08-05 00:39:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dualVibrationValues[position] = vibrationValues[deviceCounter];
|
|
|
|
currentIndex = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
context.Device.Hid.Npads.UpdateRumbleQueue(currentIndex, dualVibrationValues);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-06-23 22:52:55 +02:00
|
|
|
[CommandHipc(211)] // 7.0.0+
|
|
|
|
// IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId)
|
|
|
|
public ResultCode IsVibrationDeviceMounted(ServiceCtx context)
|
|
|
|
{
|
|
|
|
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
// NOTE: Service use vibrationDeviceHandle to get the PlayerIndex.
|
|
|
|
// And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown)
|
|
|
|
|
|
|
|
context.ResponseData.Write(true);
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(310)] // 6.0.0+
|
am/lbl/hid/pctl: Enabled VR Rendering (#1688)
* am/lbl/hid/pctl: Enabled VR Rendering
This PR enable VR rendering on games which support it through the Toy-Con VR Goggles.
Please remember Ryujinx currently don't support console SixAxis sensor and for now, in some games, the view can't be moved.
Everything is implemented accordingly to RE:
- am: ICommonStateGetter: SetVrModeEnabled, BeginVrModeEx, EndVrModeEx.
- lbl: ILblController: SetBrightnessReflectionDelayLevel, GetBrightnessReflectionDelayLevel, SetCurrentAmbientLightSensorMapping, GetCurrentAmbientLightSensorMapping, SetCurrentBrightnessSettingForVrMode, GetCurrentBrightnessSettingForVrMode, EnableVrMode, DisableVrMode, IsVrModeEnabled.
- pctl: IParentalControlService: ConfirmStereoVisionPermission, ConfirmStereoVisionRestrictionConfigurable, GetStereoVisionRestriction, SetStereoVisionRestriction, ResetConfirmedStereoVisionPermission, IsStereoVisionPermitted.
- hid: IHidServer: ResetSevenSixAxisSensorTimestamp is stubbed because we don't support console SixAxisSensor for now.
Maybe we could add a setting later to enable or disable VR. But I think it's fine to keep this always available since you have to enable it in games.
* Fix permission flag check
* Address gdkchan feedback
2020-11-15 22:30:20 +01:00
|
|
|
// ResetSevenSixAxisSensorTimestamp(pid, nn::applet::AppletResourceUserId)
|
|
|
|
public ResultCode ResetSevenSixAxisSensorTimestamp(ServiceCtx context)
|
|
|
|
{
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2023-01-04 23:15:45 +01:00
|
|
|
if (context.Process.HandleTable.GenerateHandle(_palmaOperationCompleteEvent.ReadableEvent, out int handle) != Result.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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(522)] // 5.1.0+
|
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
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(525)] // 5.1.0+
|
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
|
|
|
// SetPalmaBoostMode(bool)
|
|
|
|
public ResultCode SetPalmaBoostMode(ServiceCtx context)
|
|
|
|
{
|
|
|
|
// NOTE: Stubbed in system module.
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
}
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(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
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
[CommandHipc(1002)] // 9.0.0+
|
2020-09-20 06:32:58 +02:00
|
|
|
// 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
|
|
|
}
|