2019-10-17 06:17:44 +00:00
|
|
|
|
using LibHac;
|
2021-12-23 16:55:50 +00:00
|
|
|
|
using LibHac.Common;
|
2022-11-23 17:32:35 +00:00
|
|
|
|
|
|
|
|
|
using GameCardHandle = System.UInt32;
|
2019-10-17 06:17:44 +00:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2021-08-12 21:56:24 +00:00
|
|
|
|
class IDeviceOperator : DisposableIpcService
|
2019-10-17 06:17:44 +00:00
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
private SharedRef<LibHac.FsSrv.Sf.IDeviceOperator> _baseOperator;
|
2019-10-17 06:17:44 +00:00
|
|
|
|
|
2021-12-23 16:55:50 +00:00
|
|
|
|
public IDeviceOperator(ref SharedRef<LibHac.FsSrv.Sf.IDeviceOperator> baseOperator)
|
2019-10-17 06:17:44 +00:00
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
_baseOperator = SharedRef<LibHac.FsSrv.Sf.IDeviceOperator>.CreateMove(ref baseOperator);
|
2019-10-17 06:17:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(0)]
|
2020-03-03 14:07:06 +00:00
|
|
|
|
// IsSdCardInserted() -> b8 is_inserted
|
|
|
|
|
public ResultCode IsSdCardInserted(ServiceCtx context)
|
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
Result result = _baseOperator.Get.IsSdCardInserted(out bool isInserted);
|
2020-03-03 14:07:06 +00:00
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(isInserted);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(200)]
|
2019-10-17 06:17:44 +00:00
|
|
|
|
// IsGameCardInserted() -> b8 is_inserted
|
|
|
|
|
public ResultCode IsGameCardInserted(ServiceCtx context)
|
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
Result result = _baseOperator.Get.IsGameCardInserted(out bool isInserted);
|
2019-10-17 06:17:44 +00:00
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(isInserted);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(202)]
|
2019-10-17 06:17:44 +00:00
|
|
|
|
// GetGameCardHandle() -> u32 gamecard_handle
|
|
|
|
|
public ResultCode GetGameCardHandle(ServiceCtx context)
|
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
Result result = _baseOperator.Get.GetGameCardHandle(out GameCardHandle handle);
|
2019-10-17 06:17:44 +00:00
|
|
|
|
|
2022-11-23 17:32:35 +00:00
|
|
|
|
context.ResponseData.Write(handle);
|
2019-10-17 06:17:44 +00:00
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
2021-08-12 21:56:24 +00:00
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
if (isDisposing)
|
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
_baseOperator.Destroy();
|
2021-08-12 21:56:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-17 06:17:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|