Implement IHid fix from alula/qlaunch
Co-authored-by: Alula <6276139+alula@users.noreply.github.com>
This commit is contained in:
parent
7f27b791f8
commit
e2a5e69f4c
@ -35,6 +35,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new();
|
||||
public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new();
|
||||
|
||||
internal PlayerIndex LastActiveNpad { get; set; }
|
||||
|
||||
public NpadDevices(Switch device, bool active = true) : base(device, active)
|
||||
{
|
||||
@ -384,6 +386,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
return;
|
||||
}
|
||||
|
||||
LastActiveNpad = state.PlayerId;
|
||||
|
||||
ref RingLifo<NpadCommonState> lifo = ref GetCommonStateLifo(ref currentNpad);
|
||||
|
||||
NpadCommonState newState = new()
|
||||
@ -639,5 +643,20 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
|
||||
return rumbleQueue;
|
||||
}
|
||||
|
||||
public NpadIdType GetLastActiveNpadId()
|
||||
{
|
||||
return LastActiveNpad switch {
|
||||
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,
|
||||
_ => NpadIdType.Handheld,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,15 +24,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
// GetLastActiveNpad(u32) -> u8, u8
|
||||
public ResultCode GetLastActiveNpad(ServiceCtx context)
|
||||
{
|
||||
// TODO: RequestData seems to have garbage data, reading an extra uint seems to fix the issue.
|
||||
context.RequestData.ReadUInt32();
|
||||
context.ResponseData.Write((byte)context.Device.Hid.Npads.GetLastActiveNpadId());
|
||||
|
||||
ResultCode resultCode = GetAppletFooterUiTypeImpl(context, out AppletFooterUiType appletFooterUiType);
|
||||
|
||||
context.ResponseData.Write((byte)appletFooterUiType);
|
||||
context.ResponseData.Write((byte)0);
|
||||
|
||||
return resultCode;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[CommandCmif(307)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user