forked from MeloNX/MeloNX
make applet manager reflection free
This commit is contained in:
parent
af712754ce
commit
1f717a101e
@ -8,27 +8,24 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||
{
|
||||
static class AppletManager
|
||||
{
|
||||
private static readonly Dictionary<AppletId, Type> _appletMapping;
|
||||
|
||||
static AppletManager()
|
||||
{
|
||||
_appletMapping = new Dictionary<AppletId, Type>
|
||||
{
|
||||
{ AppletId.Error, typeof(ErrorApplet) },
|
||||
{ AppletId.PlayerSelect, typeof(PlayerSelectApplet) },
|
||||
{ AppletId.Controller, typeof(ControllerApplet) },
|
||||
{ AppletId.SoftwareKeyboard, typeof(SoftwareKeyboardApplet) },
|
||||
{ AppletId.LibAppletWeb, typeof(BrowserApplet) },
|
||||
{ AppletId.LibAppletShop, typeof(BrowserApplet) },
|
||||
{ AppletId.LibAppletOff, typeof(BrowserApplet) },
|
||||
};
|
||||
}
|
||||
|
||||
public static IApplet Create(AppletId applet, Horizon system)
|
||||
{
|
||||
if (_appletMapping.TryGetValue(applet, out Type appletClass))
|
||||
switch (applet)
|
||||
{
|
||||
return (IApplet)Activator.CreateInstance(appletClass, system);
|
||||
case AppletId.Controller:
|
||||
return new ControllerApplet(system);
|
||||
case AppletId.Error:
|
||||
return new ErrorApplet(system);
|
||||
case AppletId.PlayerSelect:
|
||||
return new PlayerSelectApplet(system);
|
||||
case AppletId.SoftwareKeyboard:
|
||||
return new SoftwareKeyboardApplet(system);
|
||||
case AppletId.LibAppletWeb:
|
||||
return new BrowserApplet(system);
|
||||
case AppletId.LibAppletShop:
|
||||
return new BrowserApplet(system);
|
||||
case AppletId.LibAppletOff:
|
||||
return new BrowserApplet(system);
|
||||
}
|
||||
|
||||
throw new NotImplementedException($"{applet} applet is not implemented.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user