aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Arp/Ipc/Registrar.cs
blob: 841ab7601d58d70d4a2885dd7738014790913d8b (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
44
45
46
47
48
49
50
51
52
using Ryujinx.Horizon.Common;
using Ryujinx.Horizon.Sdk.Arp;
using Ryujinx.Horizon.Sdk.Arp.Detail;
using Ryujinx.Horizon.Sdk.Ns;
using Ryujinx.Horizon.Sdk.Sf;
using Ryujinx.Horizon.Sdk.Sf.Hipc;
using System;

namespace Ryujinx.Horizon.Arp.Ipc
{
    partial class Registrar : IRegistrar, IServiceObject
    {
        private readonly ApplicationInstance _applicationInstance;

        public Registrar(ApplicationInstance applicationInstance)
        {
            _applicationInstance = applicationInstance;
        }

        [CmifCommand(0)]
        public Result Issue(out ulong applicationInstanceId)
        {
            throw new NotImplementedException();
        }

        [CmifCommand(1)]
        public Result SetApplicationLaunchProperty(ApplicationLaunchProperty applicationLaunchProperty)
        {
            if (_applicationInstance.LaunchProperty != null)
            {
                return ArpResult.DataAlreadyBound;
            }

            _applicationInstance.LaunchProperty = applicationLaunchProperty;

            return Result.Success;
        }

        [CmifCommand(2)]
        public Result SetApplicationControlProperty([Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias | HipcBufferFlags.FixedSize, 0x4000)] in ApplicationControlProperty applicationControlProperty)
        {
            if (_applicationInstance.ControlProperty != null)
            {
                return ArpResult.DataAlreadyBound;
            }

            _applicationInstance.ControlProperty = applicationControlProperty;

            return Result.Success;
        }
    }
}