mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-25 00:55:46 +00:00
333651d346
- 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.
128 lines
No EOL
4.7 KiB
C#
128 lines
No EOL
4.7 KiB
C#
using Ryujinx.Common.Logging;
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Btm
|
|
{
|
|
class IBtmUserCore : IpcService
|
|
{
|
|
public KEvent _bleScanEvent;
|
|
public int _bleScanEventHandle;
|
|
|
|
public KEvent _bleConnectionEvent;
|
|
public int _bleConnectionEventHandle;
|
|
|
|
public KEvent _bleServiceDiscoveryEvent;
|
|
public int _bleServiceDiscoveryEventHandle;
|
|
|
|
public KEvent _bleMtuConfigEvent;
|
|
public int _bleMtuConfigEventHandle;
|
|
|
|
public IBtmUserCore() { }
|
|
|
|
[Command(0)] // 5.0.0+
|
|
// AcquireBleScanEvent() -> (byte<1>, handle<copy>)
|
|
public ResultCode AcquireBleScanEvent(ServiceCtx context)
|
|
{
|
|
KernelResult result = KernelResult.Success;
|
|
|
|
if (_bleScanEventHandle == 0)
|
|
{
|
|
_bleScanEvent = new KEvent(context.Device.System);
|
|
|
|
result = context.Process.HandleTable.GenerateHandle(_bleScanEvent.ReadableEvent, out _bleScanEventHandle);
|
|
|
|
if (result != KernelResult.Success)
|
|
{
|
|
// NOTE: We use a Logging instead of an exception because the call return a boolean if succeed or not.
|
|
Logger.PrintError(LogClass.ServiceBsd, "Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_bleScanEventHandle);
|
|
|
|
context.ResponseData.Write(result == KernelResult.Success ? 1 : 0);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(17)] // 5.0.0+
|
|
// AcquireBleConnectionEvent() -> (byte<1>, handle<copy>)
|
|
public ResultCode AcquireBleConnectionEvent(ServiceCtx context)
|
|
{
|
|
KernelResult result = KernelResult.Success;
|
|
|
|
if (_bleConnectionEventHandle == 0)
|
|
{
|
|
_bleConnectionEvent = new KEvent(context.Device.System);
|
|
|
|
result = context.Process.HandleTable.GenerateHandle(_bleConnectionEvent.ReadableEvent, out _bleConnectionEventHandle);
|
|
|
|
if (result != KernelResult.Success)
|
|
{
|
|
// NOTE: We use a Logging instead of an exception because the call return a boolean if succeed or not.
|
|
Logger.PrintError(LogClass.ServiceBsd, "Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_bleConnectionEventHandle);
|
|
|
|
context.ResponseData.Write(result == KernelResult.Success ? 1 : 0);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(26)] // 5.0.0+
|
|
// AcquireBleServiceDiscoveryEvent() -> (byte<1>, handle<copy>)
|
|
public ResultCode AcquireBleServiceDiscoveryEvent(ServiceCtx context)
|
|
{
|
|
KernelResult result = KernelResult.Success;
|
|
|
|
if (_bleServiceDiscoveryEventHandle == 0)
|
|
{
|
|
_bleServiceDiscoveryEvent = new KEvent(context.Device.System);
|
|
|
|
result = context.Process.HandleTable.GenerateHandle(_bleServiceDiscoveryEvent.ReadableEvent, out _bleServiceDiscoveryEventHandle);
|
|
|
|
if (result != KernelResult.Success)
|
|
{
|
|
// NOTE: We use a Logging instead of an exception because the call return a boolean if succeed or not.
|
|
Logger.PrintError(LogClass.ServiceBsd, "Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_bleServiceDiscoveryEventHandle);
|
|
|
|
context.ResponseData.Write(result == KernelResult.Success ? 1 : 0);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(33)] // 5.0.0+
|
|
// AcquireBleMtuConfigEvent() -> (byte<1>, handle<copy>)
|
|
public ResultCode AcquireBleMtuConfigEvent(ServiceCtx context)
|
|
{
|
|
KernelResult result = KernelResult.Success;
|
|
|
|
if (_bleMtuConfigEventHandle == 0)
|
|
{
|
|
_bleMtuConfigEvent = new KEvent(context.Device.System);
|
|
|
|
result = context.Process.HandleTable.GenerateHandle(_bleMtuConfigEvent.ReadableEvent, out _bleMtuConfigEventHandle);
|
|
|
|
if (result != KernelResult.Success)
|
|
{
|
|
// NOTE: We use a Logging instead of an exception because the call return a boolean if succeed or not.
|
|
Logger.PrintError(LogClass.ServiceBsd, "Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_bleMtuConfigEventHandle);
|
|
|
|
context.ResponseData.Write(result == KernelResult.Success ? 1 : 0);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |