2019-10-17 08:17:44 +02:00
|
|
|
|
using LibHac;
|
2020-09-01 22:08:59 +02:00
|
|
|
|
using LibHac.FsSrv;
|
2019-10-17 08:17:44 +02:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2021-07-13 10:19:28 +02:00
|
|
|
|
class IDeviceOperator : DisposableIpcService
|
2019-10-17 08:17:44 +02:00
|
|
|
|
{
|
2021-07-13 10:19:28 +02:00
|
|
|
|
private ReferenceCountedDisposable<LibHac.FsSrv.Sf.IDeviceOperator> _baseOperator;
|
2019-10-17 08:17:44 +02:00
|
|
|
|
|
2021-07-13 10:19:28 +02:00
|
|
|
|
public IDeviceOperator(ReferenceCountedDisposable<LibHac.FsSrv.Sf.IDeviceOperator> baseOperator)
|
2019-10-17 08:17:44 +02:00
|
|
|
|
{
|
|
|
|
|
_baseOperator = baseOperator;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
|
[CommandHipc(0)]
|
2020-03-03 15:07:06 +01:00
|
|
|
|
// IsSdCardInserted() -> b8 is_inserted
|
|
|
|
|
public ResultCode IsSdCardInserted(ServiceCtx context)
|
|
|
|
|
{
|
2021-07-13 10:19:28 +02:00
|
|
|
|
Result result = _baseOperator.Target.IsSdCardInserted(out bool isInserted);
|
2020-03-03 15:07:06 +01:00
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(isInserted);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
|
[CommandHipc(200)]
|
2019-10-17 08:17:44 +02:00
|
|
|
|
// IsGameCardInserted() -> b8 is_inserted
|
|
|
|
|
public ResultCode IsGameCardInserted(ServiceCtx context)
|
|
|
|
|
{
|
2021-07-13 10:19:28 +02:00
|
|
|
|
Result result = _baseOperator.Target.IsGameCardInserted(out bool isInserted);
|
2019-10-17 08:17:44 +02:00
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(isInserted);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-14 00:01:24 +02:00
|
|
|
|
[CommandHipc(202)]
|
2019-10-17 08:17:44 +02:00
|
|
|
|
// GetGameCardHandle() -> u32 gamecard_handle
|
|
|
|
|
public ResultCode GetGameCardHandle(ServiceCtx context)
|
|
|
|
|
{
|
2021-07-13 10:19:28 +02:00
|
|
|
|
Result result = _baseOperator.Target.GetGameCardHandle(out GameCardHandle handle);
|
2019-10-17 08:17:44 +02:00
|
|
|
|
|
|
|
|
|
context.ResponseData.Write(handle.Value);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
2021-07-13 10:19:28 +02:00
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
if (isDisposing)
|
|
|
|
|
{
|
|
|
|
|
_baseOperator?.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-17 08:17:44 +02:00
|
|
|
|
}
|
|
|
|
|
}
|