diff --git a/src/Ryujinx.HLE/HOS/Services/IpcService.cs b/src/Ryujinx.HLE/HOS/Services/IpcService.cs index 1fa8d7842..1b95b6712 100644 --- a/src/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/src/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -1,10 +1,8 @@ -using Gommon; using Ryujinx.Common.Logging; using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -23,43 +21,22 @@ namespace Ryujinx.HLE.HOS.Services private int _selfId; private bool _isDomain; - public IpcService(ServerBase server = null, bool registerTipc = false) + public IpcService(ServerBase server = null) { - Stopwatch sw = Stopwatch.StartNew(); - - CmifCommands = GetType() - .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public) + CmifCommands = GetType().Assembly.GetTypes() + .Where(type => type == GetType()) + .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) .SelectMany(methodInfo => methodInfo.GetCustomAttributes() .Select(command => (command.Id, methodInfo))) .ToDictionary(command => command.Id, command => command.methodInfo); - - sw.Stop(); - - Logger.Debug?.Print( - LogClass.Emulation, - $"{CmifCommands.Count} Cmif commands loaded in {sw.ElapsedTicks} ticks ({Stopwatch.Frequency} tps).", - GetType().AsPrettyString() - ); - if (registerTipc) - { - sw.Start(); + TipcCommands = GetType().Assembly.GetTypes() + .Where(type => type == GetType()) + .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) + .SelectMany(methodInfo => methodInfo.GetCustomAttributes() + .Select(command => (command.Id, methodInfo))) + .ToDictionary(command => command.Id, command => command.methodInfo); - TipcCommands = GetType() - .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public) - .SelectMany(methodInfo => methodInfo.GetCustomAttributes() - .Select(command => (command.Id, methodInfo))) - .ToDictionary(command => command.Id, command => command.methodInfo); - - sw.Stop(); - - Logger.Debug?.Print( - LogClass.Emulation, - $"{TipcCommands.Count} Tipc commands loaded in {sw.ElapsedTicks} ticks ({Stopwatch.Frequency} tps).", - GetType().AsPrettyString() - ); - } - Server = server; _parent = this; diff --git a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs index af511af29..6d03d8d05 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs @@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm private bool _isInitialized; - public IUserInterface(KernelContext context, SmRegistry registry) : base(registerTipc: true) + public IUserInterface(KernelContext context, SmRegistry registry) { _commonServer = new ServerBase(context, "CommonServer"); _registry = registry;