aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE
diff options
context:
space:
mode:
authorEmmanuel Hansen <emmausssss@gmail.com>2024-08-31 14:39:26 +0000
committerGitHub <noreply@github.com>2024-08-31 11:39:26 -0300
commit2c5c0392f9ff80a3907bbf376a13f797ebbc12cc (patch)
tree66eac1cb8ec09aae5196520cad19ab8ee6aba241 /src/Ryujinx.HLE
parente0acde04bb032fd056904b909b3fd00c1a6fb996 (diff)
Make HLE project AOT friendly (#7085)
* add hle service generator remove usage of reflection in device state * remove rd.xml generation * make applet manager reflection free * fix typos * fix encoding * fix style report * remove rogue generator reference * remove double assignment
Diffstat (limited to 'src/Ryujinx.HLE')
-rw-r--r--src/Ryujinx.HLE/HOS/Applets/AppletManager.cs33
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs7
-rw-r--r--src/Ryujinx.HLE/Ryujinx.HLE.csproj1
3 files changed, 19 insertions, 22 deletions
diff --git a/src/Ryujinx.HLE/HOS/Applets/AppletManager.cs b/src/Ryujinx.HLE/HOS/Applets/AppletManager.cs
index 30300f1b..3c34d5c7 100644
--- a/src/Ryujinx.HLE/HOS/Applets/AppletManager.cs
+++ b/src/Ryujinx.HLE/HOS/Applets/AppletManager.cs
@@ -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.");
diff --git a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
index 3dc82035..7a90c664 100644
--- a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
@@ -2,6 +2,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Kernel.Ipc;
+using Ryujinx.HLE.HOS.Services.Apm;
using Ryujinx.Horizon.Common;
using System;
using System.Collections.Generic;
@@ -12,7 +13,7 @@ using System.Text;
namespace Ryujinx.HLE.HOS.Services.Sm
{
- class IUserInterface : IpcService
+ partial class IUserInterface : IpcService
{
private static readonly Dictionary<string, Type> _services;
@@ -95,9 +96,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm
{
ServiceAttribute serviceAttribute = (ServiceAttribute)type.GetCustomAttributes(typeof(ServiceAttribute)).First(service => ((ServiceAttribute)service).Name == name);
- IpcService service = serviceAttribute.Parameter != null
- ? (IpcService)Activator.CreateInstance(type, context, serviceAttribute.Parameter)
- : (IpcService)Activator.CreateInstance(type, context);
+ IpcService service = GetServiceInstance(type, context, serviceAttribute.Parameter);
service.TrySetServer(_commonServer);
service.Server.AddSessionObj(session.ServerSession, service);
diff --git a/src/Ryujinx.HLE/Ryujinx.HLE.csproj b/src/Ryujinx.HLE/Ryujinx.HLE.csproj
index 83a11d4e..a7bb3cd7 100644
--- a/src/Ryujinx.HLE/Ryujinx.HLE.csproj
+++ b/src/Ryujinx.HLE/Ryujinx.HLE.csproj
@@ -12,6 +12,7 @@
<ProjectReference Include="..\Ryujinx.Graphics.Host1x\Ryujinx.Graphics.Host1x.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Nvdec\Ryujinx.Graphics.Nvdec.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics.Vic\Ryujinx.Graphics.Vic.csproj" />
+ <ProjectReference Include="..\Ryujinx.HLE.Generators\Ryujinx.HLE.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\Ryujinx.Horizon.Common\Ryujinx.Horizon.Common.csproj" />
<ProjectReference Include="..\Ryujinx.Horizon.Kernel.Generators\Ryujinx.Horizon.Kernel.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\Ryujinx.Horizon\Ryujinx.Horizon.csproj" />