aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Apm/IManager.cs
blob: 83215befacf5bb6690f10fe7de376d505dbedf16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace Ryujinx.HLE.HOS.Services.Apm
{
    abstract class IManager : IpcService
    {
        public IManager(ServiceCtx context) { }

        protected abstract ResultCode OpenSession(out SessionServer sessionServer);
        protected abstract PerformanceMode GetPerformanceMode();
        protected abstract bool IsCpuOverclockEnabled();

        [CommandCmif(0)]
        // OpenSession() -> object<nn::apm::ISession>
        public ResultCode OpenSession(ServiceCtx context)
        {
            ResultCode resultCode = OpenSession(out SessionServer sessionServer);

            if (resultCode == ResultCode.Success)
            {
                MakeObject(context, sessionServer);
            }

            return resultCode;
        }

        [CommandCmif(1)]
        // GetPerformanceMode() -> nn::apm::PerformanceMode
        public ResultCode GetPerformanceMode(ServiceCtx context)
        {
            context.ResponseData.Write((uint)GetPerformanceMode());

            return ResultCode.Success;
        }

        [CommandCmif(6)] // 7.0.0+
        // IsCpuOverclockEnabled() -> bool
        public ResultCode IsCpuOverclockEnabled(ServiceCtx context)
        {
            context.ResponseData.Write(IsCpuOverclockEnabled());

            return ResultCode.Success;
        }
    }
}