aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs
blob: 932e5b0d60be26f265a67cbdd0a9f4533f0a0a2f (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;

namespace Ryujinx.HLE.HOS.Services.Mm
{
    class IRequest : IpcService
    {
        private Dictionary<int, ServiceProcessRequest> _commands;

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

        public IRequest()
        {
            _commands = new Dictionary<int, ServiceProcessRequest>()
            {
                { 0, InitializeOld },
                { 1, FinalizeOld   },
                { 2, SetAndWaitOld },
                { 3, GetOld        },
                { 4, Initialize    },
                { 5, Finalize      },
                { 6, SetAndWait    },
                { 7, Get           }
            };
        }

        // InitializeOld(u32, u32, u32)
        public long InitializeOld(ServiceCtx context)
        {
            int unknown0 = context.RequestData.ReadInt32();
            int unknown1 = context.RequestData.ReadInt32();
            int unknown2 = context.RequestData.ReadInt32();

            Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 });

            return 0;
        }

        // FinalizeOld(u32)
        public long FinalizeOld(ServiceCtx context)
        {
            context.Device.Gpu.UninitializeVideoDecoder();

            Logger.PrintStub(LogClass.ServiceMm);

            return 0;
        }

        // SetAndWaitOld(u32, u32, u32)
        public long SetAndWaitOld(ServiceCtx context)
        {
            int unknown0 = context.RequestData.ReadInt32();
            int unknown1 = context.RequestData.ReadInt32();
            int unknown2 = context.RequestData.ReadInt32();

            Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 });
            return 0;
        }

        // GetOld(u32) -> u32
        public long GetOld(ServiceCtx context)
        {
            int unknown0 = context.RequestData.ReadInt32();

            Logger.PrintStub(LogClass.ServiceMm, new { unknown0 });

            context.ResponseData.Write(0);

            return 0;
        }

        // Initialize()
        public long Initialize(ServiceCtx context)
        {
            Logger.PrintStub(LogClass.ServiceMm);

            return 0;
        }

        // Finalize(u32)
        public long Finalize(ServiceCtx context)
        {
            context.Device.Gpu.UninitializeVideoDecoder();

            Logger.PrintStub(LogClass.ServiceMm);

            return 0;
        }

        // SetAndWait(u32, u32, u32)
        public long SetAndWait(ServiceCtx context)
        {
            int unknown0 = context.RequestData.ReadInt32();
            int unknown1 = context.RequestData.ReadInt32();
            int unknown2 = context.RequestData.ReadInt32();

            Logger.PrintStub(LogClass.ServiceMm, new { unknown0, unknown1, unknown2 });

            return 0;
        }

        // Get(u32) -> u32
        public long Get(ServiceCtx context)
        {
            int unknown0 = context.RequestData.ReadInt32();

            Logger.PrintStub(LogClass.ServiceMm, new { unknown0 });

            context.ResponseData.Write(0);

            return 0;
        }
    }
}