mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 02:53:04 +00:00
Progress
This commit is contained in:
parent
818467012c
commit
9520575f8a
5 changed files with 110 additions and 216 deletions
|
@ -152,61 +152,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(102)]
|
|
||||||
// SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array<NpadIdType, 9>)
|
|
||||||
public ResultCode SetSupportedNpadIdType(ServiceCtx context)
|
|
||||||
{
|
|
||||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
#pragma warning restore IDE0059
|
|
||||||
ulong arrayPosition = context.Request.PtrBuff[0].Position;
|
|
||||||
ulong arraySize = context.Request.PtrBuff[0].Size;
|
|
||||||
|
|
||||||
ReadOnlySpan<NpadIdType> supportedPlayerIds = MemoryMarshal.Cast<byte, NpadIdType>(context.Memory.GetSpan(arrayPosition, (int)arraySize));
|
|
||||||
|
|
||||||
context.Device.Hid.Npads.ClearSupportedPlayers();
|
|
||||||
|
|
||||||
for (int i = 0; i < supportedPlayerIds.Length; ++i)
|
|
||||||
{
|
|
||||||
if (HidUtils.IsValidNpadIdType(supportedPlayerIds[i]))
|
|
||||||
{
|
|
||||||
context.Device.Hid.Npads.SetSupportedPlayer(HidUtils.GetIndexFromNpadIdType(supportedPlayerIds[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{supportedPlayerIds.Length} Players: " + string.Join(",", supportedPlayerIds.ToArray()));
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(103)]
|
[CommandCmif(103)]
|
||||||
// ActivateNpad(nn::applet::AppletResourceUserId)
|
// ActivateNpad(nn::applet::AppletResourceUserId)
|
||||||
public ResultCode ActivateNpad(ServiceCtx context)
|
public ResultCode ActivateNpad(ServiceCtx context)
|
||||||
|
@ -214,18 +159,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
return ActiveNpadImpl(context);
|
return ActiveNpadImpl(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(104)]
|
|
||||||
// DeactivateNpad(nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode DeactivateNpad(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
context.Device.Hid.Npads.Active = false;
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(106)]
|
[CommandCmif(106)]
|
||||||
// AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle
|
// AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle
|
||||||
public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context)
|
public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context)
|
||||||
|
@ -250,44 +183,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(107)]
|
|
||||||
// DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType)
|
|
||||||
public ResultCode DisconnectNpad(ServiceCtx context)
|
|
||||||
{
|
|
||||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32();
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(108)]
|
|
||||||
// GetPlayerLedPattern(u32 npad_id) -> u64 led_pattern
|
|
||||||
public ResultCode GetPlayerLedPattern(ServiceCtx context)
|
|
||||||
{
|
|
||||||
NpadIdType npadId = (NpadIdType)context.RequestData.ReadUInt32();
|
|
||||||
|
|
||||||
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 InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"),
|
|
||||||
};
|
|
||||||
|
|
||||||
context.ResponseData.Write(ledPattern);
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(109)] // 5.0.0+
|
[CommandCmif(109)] // 5.0.0+
|
||||||
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, ulong revision)
|
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, ulong revision)
|
||||||
public ResultCode ActivateNpadWithRevision(ServiceCtx context)
|
public ResultCode ActivateNpadWithRevision(ServiceCtx context)
|
||||||
|
@ -435,82 +330,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(125)]
|
|
||||||
// MergeSingleJoyAsDualJoy(uint npadIdType0, uint npadIdType1, nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context)
|
|
||||||
{
|
|
||||||
NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32();
|
|
||||||
NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32();
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
if (HidUtils.IsValidNpadIdType(npadIdType0) && HidUtils.IsValidNpadIdType(npadIdType1))
|
|
||||||
{
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType0, npadIdType1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(126)]
|
|
||||||
// StartLrAssignmentMode(nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode StartLrAssignmentMode(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(127)]
|
|
||||||
// StopLrAssignmentMode(nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode StopLrAssignmentMode(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(128)]
|
|
||||||
// SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode)
|
|
||||||
public ResultCode SetNpadHandheldActivationMode(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
_npadHandheldActivationMode = (NpadHandheldActivationMode)context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(129)]
|
|
||||||
// GetNpadHandheldActivationMode(nn::applet::AppletResourceUserId) -> long HidNpadHandheldActivationMode
|
|
||||||
public ResultCode GetNpadHandheldActivationMode(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
context.ResponseData.Write((long)_npadHandheldActivationMode);
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(130)]
|
|
||||||
// SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId)
|
|
||||||
public ResultCode SwapNpadAssignment(ServiceCtx context)
|
|
||||||
{
|
|
||||||
int oldNpadAssignment = context.RequestData.ReadInt32();
|
|
||||||
int newNpadAssignment = context.RequestData.ReadInt32();
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment });
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CommandCmif(131)]
|
[CommandCmif(131)]
|
||||||
// IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled
|
// IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled
|
||||||
public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context)
|
public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context)
|
||||||
|
|
|
@ -449,17 +449,21 @@ namespace Ryujinx.Horizon.Hid
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(84)]
|
[CmifCommand(84)]
|
||||||
public Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, [ClientProcessId] ulong pid)
|
public Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorUnalteredPassthrough, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
_isSixAxisSensorUnalteredPassthroughEnabled = sixAxisSensorUnalteredPassthrough;
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _isSixAxisSensorUnalteredPassthroughEnabled });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(85)]
|
[CmifCommand(85)]
|
||||||
public Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, [ClientProcessId] ulong pid)
|
public Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool sixAxisSensorUnalteredPassthrough, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
sixAxisSensorUnalteredPassthrough = _isSixAxisSensorUnalteredPassthroughEnabled;
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -529,9 +533,19 @@ namespace Ryujinx.Horizon.Hid
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(102)]
|
[CmifCommand(102)]
|
||||||
public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<uint> arg1, [ClientProcessId] ulong pid)
|
public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<NpadIdType> npadIds, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Npads.ClearSupportedPlayers();
|
||||||
|
|
||||||
|
for (int i = 0; i < npadIds.Length; i++)
|
||||||
|
{
|
||||||
|
if (IsValidNpadIdType(npadIds[i]))
|
||||||
|
{
|
||||||
|
Npads.SetSupportedPlayer(GetIndexFromNpadIdType(npadIds[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{npadIds.Length} Players: " + string.Join(",", npadIds.ToArray()));
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +561,8 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(104)]
|
[CmifCommand(104)]
|
||||||
public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Npads.Active = false;
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -561,17 +576,30 @@ namespace Ryujinx.Horizon.Hid
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(107)]
|
[CmifCommand(107)]
|
||||||
public Result DisconnectNpad(AppletResourceUserId appletResourceUserId, uint arg1, [ClientProcessId] ulong pid)
|
public Result DisconnectNpad(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(108)]
|
[CmifCommand(108)]
|
||||||
public Result GetPlayerLedPattern(out ulong arg0, uint arg1)
|
public Result GetPlayerLedPattern(out ulong ledPattern, NpadIdType npadId)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
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 InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"),
|
||||||
|
};
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -617,17 +645,23 @@ namespace Ryujinx.Horizon.Hid
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(124)]
|
[CmifCommand(124)]
|
||||||
public Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, uint arg1, [ClientProcessId] ulong pid)
|
public Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
if (IsValidNpadIdType(npadIdType))
|
||||||
|
{
|
||||||
|
// context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Dual;
|
||||||
|
}
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(125)]
|
[CmifCommand(125)]
|
||||||
public Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, [ClientProcessId] ulong pid)
|
public Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType0, NpadIdType npadIdType1, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
if (IsValidNpadIdType(npadIdType0) && IsValidNpadIdType(npadIdType1))
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType0, npadIdType1 });
|
||||||
|
}
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +669,7 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(126)]
|
[CmifCommand(126)]
|
||||||
public Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -643,31 +677,35 @@ namespace Ryujinx.Horizon.Hid
|
||||||
[CmifCommand(127)]
|
[CmifCommand(127)]
|
||||||
public Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
public Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(128)]
|
[CmifCommand(128)]
|
||||||
public Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, long arg1, [ClientProcessId] ulong pid)
|
public Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, NpadHandheldActivationMode npadHandheldActivationMode, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
_npadHandheldActivationMode = npadHandheldActivationMode;
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(129)]
|
[CmifCommand(129)]
|
||||||
public Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out long arg1, [ClientProcessId] ulong pid)
|
public Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out NpadHandheldActivationMode npadHandheldActivationMode, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
npadHandheldActivationMode = _npadHandheldActivationMode;
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(130)]
|
[CmifCommand(130)]
|
||||||
public Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, [ClientProcessId] ulong pid)
|
public Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint oldNpadAssignment, uint newNpadAssignment, [ClientProcessId] ulong pid)
|
||||||
{
|
{
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment });
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
@ -1348,6 +1386,42 @@ namespace Ryujinx.Horizon.Hid
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlayerIndex GetIndexFromNpadIdType(NpadIdType npadIdType)
|
||||||
|
=> npadIdType switch
|
||||||
|
{
|
||||||
|
#pragma warning disable IDE0055 // Disable formatting
|
||||||
|
NpadIdType.Player1 => PlayerIndex.Player1,
|
||||||
|
NpadIdType.Player2 => PlayerIndex.Player2,
|
||||||
|
NpadIdType.Player3 => PlayerIndex.Player3,
|
||||||
|
NpadIdType.Player4 => PlayerIndex.Player4,
|
||||||
|
NpadIdType.Player5 => PlayerIndex.Player5,
|
||||||
|
NpadIdType.Player6 => PlayerIndex.Player6,
|
||||||
|
NpadIdType.Player7 => PlayerIndex.Player7,
|
||||||
|
NpadIdType.Player8 => PlayerIndex.Player8,
|
||||||
|
NpadIdType.Handheld => PlayerIndex.Handheld,
|
||||||
|
NpadIdType.Unknown => PlayerIndex.Unknown,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(npadIdType)),
|
||||||
|
#pragma warning restore IDE0055
|
||||||
|
};
|
||||||
|
|
||||||
|
public static NpadIdType GetNpadIdTypeFromIndex(PlayerIndex index)
|
||||||
|
=> index switch
|
||||||
|
{
|
||||||
|
#pragma warning disable IDE0055 // Disable formatting
|
||||||
|
PlayerIndex.Player1 => NpadIdType.Player1,
|
||||||
|
PlayerIndex.Player2 => NpadIdType.Player2,
|
||||||
|
PlayerIndex.Player3 => NpadIdType.Player3,
|
||||||
|
PlayerIndex.Player4 => NpadIdType.Player4,
|
||||||
|
PlayerIndex.Player5 => NpadIdType.Player5,
|
||||||
|
PlayerIndex.Player6 => NpadIdType.Player6,
|
||||||
|
PlayerIndex.Player7 => NpadIdType.Player7,
|
||||||
|
PlayerIndex.Player8 => NpadIdType.Player8,
|
||||||
|
PlayerIndex.Handheld => NpadIdType.Handheld,
|
||||||
|
PlayerIndex.Unknown => NpadIdType.Unknown,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(index)),
|
||||||
|
#pragma warning restore IDE0055
|
||||||
|
};
|
||||||
|
|
||||||
private static bool IsValidNpadIdType(NpadIdType npadIdType)
|
private static bool IsValidNpadIdType(NpadIdType npadIdType)
|
||||||
{
|
{
|
||||||
return (npadIdType >= NpadIdType.Player1 && npadIdType <= NpadIdType.Player8) ||
|
return (npadIdType >= NpadIdType.Player1 && npadIdType <= NpadIdType.Player8) ||
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
using Ryujinx.Horizon.Sdk.Applet;
|
using Ryujinx.Horizon.Sdk.Applet;
|
||||||
|
using Ryujinx.Horizon.Sdk.Hid.Npad;
|
||||||
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
using Ryujinx.Horizon.Sdk.Hid.SixAxis;
|
||||||
using Ryujinx.Horizon.Sdk.Hid.Vibration;
|
using Ryujinx.Horizon.Sdk.Hid.Vibration;
|
||||||
using Ryujinx.Horizon.Sdk.Sf;
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
@ -46,8 +47,8 @@ namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
Result ResetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result ResetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
Result IsSixAxisSensorAtRest(out bool isAtRest, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result IsSixAxisSensorAtRest(out bool isAtRest, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
Result IsFirmwareUpdateAvailableForSixAxisSensor(out bool isFirmwareUpdateAvailableForSixAxisSensor, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result IsFirmwareUpdateAvailableForSixAxisSensor(out bool isFirmwareUpdateAvailableForSixAxisSensor, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, ulong pid);
|
Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorUnalteredPassthrough, ulong pid);
|
||||||
Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool sixAxisSensorUnalteredPassthrough, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
Result StoreSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, in SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, ulong pid);
|
Result StoreSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, in SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, ulong pid);
|
||||||
Result LoadSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, out SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result LoadSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, out SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
Result GetSixAxisSensorIcInformation(AppletResourceUserId appletResourceUserId, out SixAxisSensorIcInformation sixAxisSensorIcInformation, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
Result GetSixAxisSensorIcInformation(AppletResourceUserId appletResourceUserId, out SixAxisSensorIcInformation sixAxisSensorIcInformation, SixAxisSensorHandle sixAxisSensorHandle, ulong pid);
|
||||||
|
@ -55,24 +56,24 @@ namespace Ryujinx.Horizon.Sdk.Hid
|
||||||
Result ActivateGesture(AppletResourceUserId appletResourceUserId, int unknown, ulong pid);
|
Result ActivateGesture(AppletResourceUserId appletResourceUserId, int unknown, ulong pid);
|
||||||
Result SetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, NpadStyleTag supportedStyleSets, ulong pid);
|
Result SetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, NpadStyleTag supportedStyleSets, ulong pid);
|
||||||
Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, ulong pid);
|
Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, ulong pid);
|
||||||
Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan<uint> arg1, ulong pid);
|
Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan<NpadIdType> npadIds, ulong pid);
|
||||||
Result ActivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
Result ActivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
Result DeactivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
Result DeactivateNpad(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
Result AcquireNpadStyleSetUpdateEventHandle(AppletResourceUserId appletResourceUserId, out int arg1, uint arg2, ulong arg3, ulong pid);
|
Result AcquireNpadStyleSetUpdateEventHandle(AppletResourceUserId appletResourceUserId, out int arg1, uint arg2, ulong arg3, ulong pid);
|
||||||
Result DisconnectNpad(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
|
Result DisconnectNpad(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid);
|
||||||
Result GetPlayerLedPattern(out ulong arg0, uint arg1);
|
Result GetPlayerLedPattern(out ulong ledPattern, NpadIdType npadId);
|
||||||
Result ActivateNpadWithRevision(AppletResourceUserId appletResourceUserId, int arg1, ulong pid);
|
Result ActivateNpadWithRevision(AppletResourceUserId appletResourceUserId, int arg1, ulong pid);
|
||||||
Result SetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
|
Result SetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
|
||||||
Result GetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
|
Result GetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
|
||||||
Result SetNpadJoyAssignmentModeSingleByDefault(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
|
Result SetNpadJoyAssignmentModeSingleByDefault(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
|
||||||
Result SetNpadJoyAssignmentModeSingle(AppletResourceUserId appletResourceUserId, uint arg1, long arg2, ulong pid);
|
Result SetNpadJoyAssignmentModeSingle(AppletResourceUserId appletResourceUserId, uint arg1, long arg2, ulong pid);
|
||||||
Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid);
|
Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid);
|
||||||
Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid);
|
Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType0, NpadIdType npadIdType1, ulong pid);
|
||||||
Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid);
|
||||||
Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, long arg1, ulong pid);
|
Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, NpadHandheldActivationMode npadHandheldActivationMode, ulong pid);
|
||||||
Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid);
|
Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out NpadHandheldActivationMode npadHandheldActivationMode, ulong pid);
|
||||||
Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid);
|
Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint oldNpadAssignment, uint newNpadAssignment, ulong pid);
|
||||||
Result IsUnintendedHomeButtonInputProtectionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, uint arg2, ulong pid);
|
Result IsUnintendedHomeButtonInputProtectionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, uint arg2, ulong pid);
|
||||||
Result EnableUnintendedHomeButtonInputProtection(AppletResourceUserId appletResourceUserId, uint arg1, bool arg2, ulong pid);
|
Result EnableUnintendedHomeButtonInputProtection(AppletResourceUserId appletResourceUserId, uint arg1, bool arg2, ulong pid);
|
||||||
Result SetNpadJoyAssignmentModeSingleWithDestination(out bool arg0, out uint arg1, AppletResourceUserId appletResourceUserId, uint arg3, long arg4, ulong pid);
|
Result SetNpadJoyAssignmentModeSingleWithDestination(out bool arg0, out uint arg1, AppletResourceUserId appletResourceUserId, uint arg3, long arg4, ulong pid);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadHandheldActivationMode
|
public enum NpadHandheldActivationMode : long
|
||||||
{
|
{
|
||||||
Dual,
|
Dual,
|
||||||
Single,
|
Single,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
namespace Ryujinx.Horizon.Sdk.Hid.Npad
|
||||||
{
|
{
|
||||||
public enum NpadIdType
|
public enum NpadIdType : uint
|
||||||
{
|
{
|
||||||
Player1 = 0,
|
Player1 = 0,
|
||||||
Player2 = 1,
|
Player2 = 1,
|
||||||
|
|
Loading…
Reference in a new issue