Implement am ICommonStateGetter::SetCpuBoostMode (#743)

- Implement am ICommonStateGetter::SetCpuBoostMode according to the RE:

```
signed __int64 __fastcall nn::ICommonStateGetter::SetCpuBoostModeImpl(__int64 this, unsigned int cpu_boost_mode)
{
  if ( cpu_boost_mode > 1 )
  {
    return 0x3F480LL;
  }

  __int64 v2 = *(_QWORD *)(this + 0x38);
  __int64 v3 = *(_QWORD *)(*(_QWORD *)(v2 + 8) + 0x298LL);

  nnLock((_DWORD *)(v3 + 0x104));

  __int64 v5 = *(_QWORD *)(v2 + 0x18);
  bool unk_bool = *(unsigned __int8 *)(v5 + 0x7C);

  *(_DWORD *)(v5 + 0x80) = cpu_boost_mode;

  if (!unk_bool)
  {
    *(_BYTE *)(v5 + 0x7C) = 1;
  }

  wait_condvar(v3 + 0xA8);
  nnUnlock((_DWORD *)(v3 + 0x104));

  return 0LL;
}
```

- Add enum for apm CpuBoostMode
- Add missing values in apm PerformanceConfiguration with some comments.
This commit is contained in:
Ac_K 2019-08-28 13:02:50 +02:00 committed by Thomas Guillemard
parent 5c44c9600f
commit 6b8fb8a4e3
4 changed files with 50 additions and 15 deletions

View file

@ -10,6 +10,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
private KEvent _displayResolutionChangeEvent;
private Apm.CpuBoostMode _cpuBoostMode = Apm.CpuBoostMode.Disabled;
public ICommonStateGetter(Horizon system)
{
_displayResolutionChangeEvent = new KEvent(system);
@ -116,5 +118,24 @@ namespace Ryujinx.HLE.HOS.Services.Am
return ResultCode.Success;
}
[Command(66)] // 6.0.0+
// SetCpuBoostMode(u32 cpu_boost_mode)
public ResultCode SetCpuBoostMode(ServiceCtx context)
{
uint cpuBoostMode = context.RequestData.ReadUInt32();
if (cpuBoostMode > 1)
{
return ResultCode.CpuBoostModeInvalid;
}
_cpuBoostMode = (Apm.CpuBoostMode)cpuBoostMode;
// NOTE: There is a condition variable after the assignment, probably waiting something with apm:sys service (SetCpuBoostMode call?).
// Since we will probably never support CPU boost things, it's not needed to implement more.
return ResultCode.Success;
}
}
}