feat: added working controller applet
This commit is contained in:
parent
7fe5035e88
commit
a9854ec30d
@ -127,23 +127,30 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||||||
|
|
||||||
private MultiWaitHolder WaitSignaled()
|
private MultiWaitHolder WaitSignaled()
|
||||||
{
|
{
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
LinkDeferred();
|
while (true)
|
||||||
|
|
||||||
if (_cts.Token.IsCancellationRequested)
|
|
||||||
{
|
{
|
||||||
return null;
|
LinkDeferred();
|
||||||
}
|
|
||||||
|
|
||||||
var selected = _multiWait.WaitAny();
|
if (_cts.Token.IsCancellationRequested)
|
||||||
// Logger.Warning?.Print(LogClass.ServiceAm, $"*** Selected={selected}");
|
{
|
||||||
if (selected != _wakeupHolder)
|
return null;
|
||||||
{
|
}
|
||||||
selected.UnlinkFromMultiWaitHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
return selected;
|
var selected = _multiWait.WaitAny();
|
||||||
|
// Logger.Warning?.Print(LogClass.ServiceAm, $"*** Selected={selected}");
|
||||||
|
if (selected != _wakeupHolder)
|
||||||
|
{
|
||||||
|
selected.UnlinkFromMultiWaitHolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,14 +15,20 @@ namespace Ryujinx.HLE.HOS.Services.BluetoothManager.BtmSystem
|
|||||||
|
|
||||||
public IBtmSystemCore() { }
|
public IBtmSystemCore() { }
|
||||||
|
|
||||||
|
[CommandCmif(0)]
|
||||||
|
// StartGamepadPairing()
|
||||||
|
public ResultCode StartGamepadPairing(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceBtm);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(6)]
|
[CommandCmif(6)]
|
||||||
// IsRadioEnabled() -> b8
|
// IsRadioEnabled() -> b8
|
||||||
public ResultCode IsRadioEnabled(ServiceCtx context)
|
public ResultCode IsRadioEnabled(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.ResponseData.Write(true);
|
context.ResponseData.Write(true);
|
||||||
|
|
||||||
Logger.Stub?.PrintStub(LogClass.ServiceBtm);
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(304)]
|
||||||
|
// EnableAssigningSingleOnSlSrPress()
|
||||||
|
public ResultCode EnableAssigningSingleOnSlSrPress(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(306)]
|
[CommandCmif(306)]
|
||||||
// GetLastActiveNpad() -> nn::hid::NpadIdType
|
// GetLastActiveNpad() -> nn::hid::NpadIdType
|
||||||
@ -183,6 +191,28 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(310)]
|
||||||
|
// GetMaskedSupportedNpadStyleSet
|
||||||
|
public ResultCode GetMaskedSupportedNpadStyleSet(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
||||||
|
context.RequestData.ReadUInt32();
|
||||||
|
|
||||||
|
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
||||||
|
{
|
||||||
|
if (HidUtils.GetNpadIdTypeFromIndex(playerIndex) > NpadIdType.Handheld)
|
||||||
|
{
|
||||||
|
return ResultCode.InvalidNpadIdType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: wrong
|
||||||
|
// context.ResponseData.Write((ulong)context.Device.Hid.Npads.SupportedStyleSets);
|
||||||
|
context.ResponseData.Write((ulong)AppletFooterUiType.JoyDual);
|
||||||
|
context.ResponseData.Write((ulong)0);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(313)] // 9.0.0+
|
[CommandCmif(313)] // 9.0.0+
|
||||||
// GetNpadCaptureButtonAssignment()
|
// GetNpadCaptureButtonAssignment()
|
||||||
@ -202,6 +232,42 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||||||
|
|
||||||
return resultCode;
|
return resultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(315)] // 9.0.0+
|
||||||
|
// GetAppletDetailedUiType(u32) -> u8
|
||||||
|
public ResultCode GetAppletDetailedUiType(ServiceCtx context)
|
||||||
|
{
|
||||||
|
ResultCode resultCode = GetAppletFooterUiTypeImpl(context, out AppletFooterUiType appletFooterUiType);
|
||||||
|
|
||||||
|
context.ResponseData.Write((byte)appletFooterUiType);
|
||||||
|
|
||||||
|
return resultCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CommandCmif(316)]
|
||||||
|
// GetNpadInterfaceType() -> (u32, u8)
|
||||||
|
public ResultCode GetNpadInterfaceType(ServiceCtx context)
|
||||||
|
{
|
||||||
|
context.RequestData.ReadUInt32();
|
||||||
|
foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers())
|
||||||
|
{
|
||||||
|
if (HidUtils.GetNpadIdTypeFromIndex(playerIndex) > NpadIdType.Handheld)
|
||||||
|
{
|
||||||
|
return ResultCode.InvalidNpadIdType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.ResponseData.Write(1);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CommandCmif(318)]
|
||||||
|
// HasBattery(u32) -> bool
|
||||||
|
public ResultCode HasBattery(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
||||||
|
context.ResponseData.Write(true);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(321)]
|
[CommandCmif(321)]
|
||||||
// GetUniquePadsFromNpad(u32) -> (u64, buffer<nn::hid::system::UniquePadId[], 0xa>)
|
// GetUniquePadsFromNpad(u32) -> (u64, buffer<nn::hid::system::UniquePadId[], 0xa>)
|
||||||
@ -336,7 +402,17 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(548)]
|
||||||
|
// GetRegisteredDevices() -> (u64, buffer<nn::hid::system::RegisteredDevice, 0xa>)
|
||||||
|
public ResultCode GetRegisteredDevices(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceHid);
|
||||||
|
context.ResponseData.Write(0L);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[CommandCmif(703)]
|
[CommandCmif(703)]
|
||||||
// GetUniquePadIds() -> (u64, buffer<nn::hid::system::UniquePadId[], 0xa>)
|
// GetUniquePadIds() -> (u64, buffer<nn::hid::system::UniquePadId[], 0xa>)
|
||||||
public ResultCode GetUniquePadIds(ServiceCtx context)
|
public ResultCode GetUniquePadIds(ServiceCtx context)
|
||||||
@ -375,6 +451,13 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(870)]
|
||||||
|
// IsHandheldButtonPressedOnConsoleMode() -> bool
|
||||||
|
public ResultCode IsHandheldButtonPressedOnConsoleMode(ServiceCtx context)
|
||||||
|
{
|
||||||
|
context.ResponseData.Write(true);
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
[CommandCmif(1120)]
|
[CommandCmif(1120)]
|
||||||
// Unknown1120()
|
// Unknown1120()
|
||||||
public ResultCode Unknown1120(ServiceCtx context)
|
public ResultCode Unknown1120(ServiceCtx context)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user