ISession.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. namespace Ryujinx.HLE.HOS.Services.Apm
  2. {
  3. abstract class ISession : IpcService
  4. {
  5. public ISession(ServiceCtx context) { }
  6. protected abstract ResultCode SetPerformanceConfiguration(PerformanceMode performanceMode, PerformanceConfiguration performanceConfiguration);
  7. protected abstract ResultCode GetPerformanceConfiguration(PerformanceMode performanceMode, out PerformanceConfiguration performanceConfiguration);
  8. protected abstract void SetCpuOverclockEnabled(bool enabled);
  9. [CommandHipc(0)]
  10. // SetPerformanceConfiguration(nn::apm::PerformanceMode, nn::apm::PerformanceConfiguration)
  11. public ResultCode SetPerformanceConfiguration(ServiceCtx context)
  12. {
  13. PerformanceMode performanceMode = (PerformanceMode)context.RequestData.ReadInt32();
  14. PerformanceConfiguration performanceConfiguration = (PerformanceConfiguration)context.RequestData.ReadInt32();
  15. return SetPerformanceConfiguration(performanceMode, performanceConfiguration);
  16. }
  17. [CommandHipc(1)]
  18. // GetPerformanceConfiguration(nn::apm::PerformanceMode) -> nn::apm::PerformanceConfiguration
  19. public ResultCode GetPerformanceConfiguration(ServiceCtx context)
  20. {
  21. PerformanceMode performanceMode = (PerformanceMode)context.RequestData.ReadInt32();
  22. ResultCode resultCode = GetPerformanceConfiguration(performanceMode, out PerformanceConfiguration performanceConfiguration);
  23. context.ResponseData.Write((uint)performanceConfiguration);
  24. return resultCode;
  25. }
  26. [CommandHipc(2)] // 8.0.0+
  27. // SetCpuOverclockEnabled(bool)
  28. public ResultCode SetCpuOverclockEnabled(ServiceCtx context)
  29. {
  30. bool enabled = context.RequestData.ReadBoolean();
  31. SetCpuOverclockEnabled(enabled);
  32. return ResultCode.Success;
  33. }
  34. }
  35. }