IDeviceOperator.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using LibHac;
  2. using LibHac.FsSrv;
  3. namespace Ryujinx.HLE.HOS.Services.Fs
  4. {
  5. class IDeviceOperator : DisposableIpcService
  6. {
  7. private ReferenceCountedDisposable<LibHac.FsSrv.Sf.IDeviceOperator> _baseOperator;
  8. public IDeviceOperator(ReferenceCountedDisposable<LibHac.FsSrv.Sf.IDeviceOperator> baseOperator)
  9. {
  10. _baseOperator = baseOperator;
  11. }
  12. [CommandHipc(0)]
  13. // IsSdCardInserted() -> b8 is_inserted
  14. public ResultCode IsSdCardInserted(ServiceCtx context)
  15. {
  16. Result result = _baseOperator.Target.IsSdCardInserted(out bool isInserted);
  17. context.ResponseData.Write(isInserted);
  18. return (ResultCode)result.Value;
  19. }
  20. [CommandHipc(200)]
  21. // IsGameCardInserted() -> b8 is_inserted
  22. public ResultCode IsGameCardInserted(ServiceCtx context)
  23. {
  24. Result result = _baseOperator.Target.IsGameCardInserted(out bool isInserted);
  25. context.ResponseData.Write(isInserted);
  26. return (ResultCode)result.Value;
  27. }
  28. [CommandHipc(202)]
  29. // GetGameCardHandle() -> u32 gamecard_handle
  30. public ResultCode GetGameCardHandle(ServiceCtx context)
  31. {
  32. Result result = _baseOperator.Target.GetGameCardHandle(out GameCardHandle handle);
  33. context.ResponseData.Write(handle.Value);
  34. return (ResultCode)result.Value;
  35. }
  36. protected override void Dispose(bool isDisposing)
  37. {
  38. if (isDisposing)
  39. {
  40. _baseOperator?.Dispose();
  41. }
  42. }
  43. }
  44. }