|
|
|
@@ -24,6 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
private bool _vibrationPermitted;
|
|
|
|
|
private bool _usbFullKeyControllerEnabled;
|
|
|
|
|
private bool _isFirmwareUpdateAvailableForSixAxisSensor;
|
|
|
|
|
private bool _isSixAxisSensorUnalteredPassthroughEnabled;
|
|
|
|
|
|
|
|
|
|
private HidNpadJoyAssignmentMode _npadJoyAssignmentMode;
|
|
|
|
|
private HidNpadHandheldActivationMode _npadHandheldActivationMode;
|
|
|
|
@@ -336,6 +337,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode StartSixAxisSensor(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
|
|
|
@@ -348,6 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode StopSixAxisSensor(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
|
|
|
@@ -360,6 +363,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode IsSixAxisSensorFusionEnabled(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(_sixAxisSensorFusionEnabled);
|
|
|
|
@@ -373,7 +377,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
// EnableSixAxisSensorFusion(bool Enabled, nn::hid::SixAxisSensorHandle, nn::applet::AppletResourceUserId)
|
|
|
|
|
public ResultCode EnableSixAxisSensorFusion(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
_sixAxisSensorFusionEnabled = context.RequestData.ReadBoolean();
|
|
|
|
|
_sixAxisSensorFusionEnabled = context.RequestData.ReadUInt32() != 0;
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
@@ -387,6 +391,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode SetSixAxisSensorFusionParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
|
|
|
|
|
_sensorFusionParams = new HidSensorFusionParameters
|
|
|
|
|
{
|
|
|
|
@@ -406,6 +411,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode GetSixAxisSensorFusionParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(_sensorFusionParams.RevisePower);
|
|
|
|
@@ -421,6 +427,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode ResetSixAxisSensorFusionParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
_sensorFusionParams.RevisePower = 0;
|
|
|
|
@@ -436,6 +443,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode SetAccelerometerParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
|
|
|
|
|
_accelerometerParams = new HidAccelerometerParameters
|
|
|
|
|
{
|
|
|
|
@@ -455,6 +463,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode GetAccelerometerParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(_accelerometerParams.X);
|
|
|
|
@@ -470,6 +479,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode ResetAccelerometerParameters(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
_accelerometerParams.X = 0;
|
|
|
|
@@ -485,6 +495,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode SetAccelerometerPlayMode(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
_accelerometerPlayMode = context.RequestData.ReadUInt32();
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
@@ -498,6 +509,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode GetAccelerometerPlayMode(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(_accelerometerPlayMode);
|
|
|
|
@@ -512,6 +524,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode ResetAccelerometerPlayMode(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
_accelerometerPlayMode = 0;
|
|
|
|
@@ -539,6 +552,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode GetGyroscopeZeroDriftMode(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write((int)_gyroscopeZeroDriftMode);
|
|
|
|
@@ -553,6 +567,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode ResetGyroscopeZeroDriftMode(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
_gyroscopeZeroDriftMode = HidGyroscopeZeroDriftMode.Standard;
|
|
|
|
@@ -567,6 +582,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode IsSixAxisSensorAtRest(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
bool isAtRest = true;
|
|
|
|
@@ -583,7 +599,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
public ResultCode IsFirmwareUpdateAvailableForSixAxisSensor(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
int sixAxisSensorHandle = context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4;
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(_isFirmwareUpdateAvailableForSixAxisSensor);
|
|
|
|
@@ -593,6 +609,64 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CommandHipc(91)]
|
|
|
|
|
// ActivateGesture(nn::applet::AppletResourceUserId, int Unknown0)
|
|
|
|
|
public ResultCode ActivateGesture(ServiceCtx context)
|
|
|
|
@@ -606,16 +680,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CommandHipc(100)]
|
|
|
|
|
// SetSupportedNpadStyleSet(nn::applet::AppletResourceUserId, nn::hid::NpadStyleTag)
|
|
|
|
|
// SetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId, nn::hid::NpadStyleTag)
|
|
|
|
|
public ResultCode SetSupportedNpadStyleSet(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
ulong pid = context.Request.HandleDesc.PId;
|
|
|
|
|
ControllerType type = (ControllerType)context.RequestData.ReadInt32();
|
|
|
|
|
context.RequestData.BaseStream.Position += 4; // Padding
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
|
|
|
|
appletResourceUserId,
|
|
|
|
|
type
|
|
|
|
|
});
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { pid, appletResourceUserId, type });
|
|
|
|
|
|
|
|
|
|
context.Device.Hid.Npads.SupportedStyleSets = type;
|
|
|
|
|
|
|
|
|
@@ -623,17 +696,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CommandHipc(101)]
|
|
|
|
|
// GetSupportedNpadStyleSet(nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag
|
|
|
|
|
// GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag
|
|
|
|
|
public ResultCode GetSupportedNpadStyleSet(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
ulong pid = context.Request.HandleDesc.PId;
|
|
|
|
|
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
|
|
|
|
|
|
|
|
context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets);
|
|
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new {
|
|
|
|
|
appletResourceUserId,
|
|
|
|
|
context.Device.Hid.Npads.SupportedStyleSets
|
|
|
|
|
});
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, context.Device.Hid.Npads.SupportedStyleSets });
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
@@ -658,7 +729,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{supportedPlayerIds.Length} " + string.Join(",", supportedPlayerIds.ToArray()));
|
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{supportedPlayerIds.Length} Players: " + string.Join(",", supportedPlayerIds.ToArray()));
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|