AppletManager.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Ryujinx.HLE.HOS.Applets.Browser;
  2. using Ryujinx.HLE.HOS.Services.Am.AppletAE;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.HLE.HOS.Applets
  6. {
  7. static class AppletManager
  8. {
  9. private static Dictionary<AppletId, Type> _appletMapping;
  10. static AppletManager()
  11. {
  12. _appletMapping = new Dictionary<AppletId, Type>
  13. {
  14. { AppletId.PlayerSelect, typeof(PlayerSelectApplet) },
  15. { AppletId.Controller, typeof(ControllerApplet) },
  16. { AppletId.SoftwareKeyboard, typeof(SoftwareKeyboardApplet) },
  17. { AppletId.LibAppletWeb, typeof(BrowserApplet) },
  18. { AppletId.LibAppletShop, typeof(BrowserApplet) },
  19. { AppletId.LibAppletOff, typeof(BrowserApplet) }
  20. };
  21. }
  22. public static IApplet Create(AppletId applet, Horizon system)
  23. {
  24. if (_appletMapping.TryGetValue(applet, out Type appletClass))
  25. {
  26. return (IApplet)Activator.CreateInstance(appletClass, system);
  27. }
  28. throw new NotImplementedException($"{applet} applet is not implemented.");
  29. }
  30. }
  31. }