Prefer generic overload when type is known (#430)
This commit is contained in:
@@ -23,18 +23,18 @@ namespace Ryujinx.HLE.HOS.Services
|
||||
|
||||
public IpcService(ServerBase server = null)
|
||||
{
|
||||
CmifCommands = typeof(IpcService).Assembly.GetTypes()
|
||||
CmifCommands = GetType().Assembly.GetTypes()
|
||||
.Where(type => type == GetType())
|
||||
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
|
||||
.SelectMany(methodInfo => methodInfo.GetCustomAttributes(typeof(CommandCmifAttribute))
|
||||
.Select(command => (((CommandCmifAttribute)command).Id, methodInfo)))
|
||||
.SelectMany(methodInfo => methodInfo.GetCustomAttributes<CommandCmifAttribute>()
|
||||
.Select(command => (command.Id, methodInfo)))
|
||||
.ToDictionary(command => command.Id, command => command.methodInfo);
|
||||
|
||||
TipcCommands = typeof(IpcService).Assembly.GetTypes()
|
||||
TipcCommands = GetType().Assembly.GetTypes()
|
||||
.Where(type => type == GetType())
|
||||
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
|
||||
.SelectMany(methodInfo => methodInfo.GetCustomAttributes(typeof(CommandTipcAttribute))
|
||||
.Select(command => (((CommandTipcAttribute)command).Id, methodInfo)))
|
||||
.SelectMany(methodInfo => methodInfo.GetCustomAttributes<CommandTipcAttribute>()
|
||||
.Select(command => (command.Id, methodInfo)))
|
||||
.ToDictionary(command => command.Id, command => command.methodInfo);
|
||||
|
||||
Server = server;
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
|
||||
|
||||
private ResultCode ScanInternal(IVirtualMemoryManager memory, ushort channel, ScanFilter scanFilter, ulong bufferPosition, ulong bufferSize, out ulong counter)
|
||||
{
|
||||
ulong networkInfoSize = (ulong)Marshal.SizeOf(typeof(NetworkInfo));
|
||||
ulong networkInfoSize = (ulong)Marshal.SizeOf<NetworkInfo>();
|
||||
ulong maxGames = bufferSize / networkInfoSize;
|
||||
|
||||
MemoryHelper.FillWithZeros(memory, bufferPosition, (int)bufferSize);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm
|
||||
{
|
||||
if (_services.TryGetValue(name, out Type type))
|
||||
{
|
||||
ServiceAttribute serviceAttribute = (ServiceAttribute)type.GetCustomAttributes(typeof(ServiceAttribute)).First(service => ((ServiceAttribute)service).Name == name);
|
||||
ServiceAttribute serviceAttribute = type.GetCustomAttributes<ServiceAttribute>().First(service => service.Name == name);
|
||||
|
||||
IpcService service = GetServiceInstance(type, context, serviceAttribute.Parameter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user