aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Applets/AppletManager.cs
blob: e7314540481b08340a62f660de101be0e22b5ee4 (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
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
using System;
using System.Collections.Generic;

namespace Ryujinx.HLE.HOS.Applets
{
    static class AppletManager
    {
        private static Dictionary<AppletId, Type> _appletMapping;

        static AppletManager()
        {
            _appletMapping = new Dictionary<AppletId, Type>
            {
                { AppletId.PlayerSelect,     typeof(PlayerSelectApplet)     },
                { AppletId.SoftwareKeyboard, typeof(SoftwareKeyboardApplet) }
            };
        }

        public static IApplet Create(AppletId applet, Horizon system)
        {
            if (_appletMapping.TryGetValue(applet, out Type appletClass))
            {
                return (IApplet)Activator.CreateInstance(appletClass, system);
            }

            throw new NotImplementedException($"{applet} applet is not implemented.");
        }
    }
}