aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs
blob: 3b06ba8afc72ca65f674dd6b0d4914828f750002 (plain)
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
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging;
using System.Collections.Generic;

namespace Ryujinx.HLE.HOS.Services.Friend
{
    class IFriendService : IpcService
    {
        private Dictionary<int, ServiceProcessRequest> m_Commands;

        public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;

        public IFriendService()
        {
            m_Commands = new Dictionary<int, ServiceProcessRequest>()
            {
                { 10601, DeclareCloseOnlinePlaySession },
                { 10610, UpdateUserPresence            }
            };
        }

        public long DeclareCloseOnlinePlaySession(ServiceCtx Context)
        {
            UserId Uuid = new UserId(
                Context.RequestData.ReadInt64(),
                Context.RequestData.ReadInt64());

            if (Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile))
            {
                Profile.OnlinePlayState = OpenCloseState.Closed;
            }

            return 0;
        }

        public long UpdateUserPresence(ServiceCtx Context)
        {
            UserId Uuid = new UserId(
                Context.RequestData.ReadInt64(),
                Context.RequestData.ReadInt64());

            //TODO.
            Context.Device.Log.PrintStub(LogClass.ServiceFriend, "Stubbed.");

            return 0;
        }
    }
}