IDeviceOperator.cs 1.6 KB

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