Compare commits

...

6 commits

Author SHA1 Message Date
Tartifless
055e54fb5b Merge branch 'master' into 'master'
sdl2 guid, remove the CRC bytes (4 first characters) and replace with 0000 when creating guid

See merge request ryubing/ryujinx!2
2025-03-23 11:23:04 +00:00
GreemDev
e7d3f39c1b HLE: Damnit Greem, those were supposed to be debug.
OOPSIE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2025-03-23 04:16:23 -05:00
GreemDev
2f064064ca HLE: Slightly speed up IpcService creation
This is not a crazy speedup, we're talking fractions of a millisecond here (I had to measure in ticks; 10000000 ticks per second)

- TIPC commands are opted-into for registration since they are only used for IUserInterface, but were still attempted to be initialized for every service which spent needless time.

- Directly use GetType() instead of accessing all exported types, and Where()ing for equivalency to GetType(). This causes the logic for registration to be a lot faster.
2025-03-23 04:14:31 -05:00
GreemDev
86c2f261af Graphics: Save shaders to a lowercase title ID folder.
I think this got reverted in the metal revert commit.
2025-03-22 22:39:03 -05:00
Tartifless
cb154e979b Merge branch ryujinx:master into master 2025-03-17 17:50:51 +00:00
Tartifless
f5b6c872d7 Update file SDL2GamepadDriver.cs 2025-03-13 16:55:31 +00:00
4 changed files with 40 additions and 14 deletions

View file

@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
private static string GetDiskCachePath()
{
return GraphicsConfig.EnableShaderCache && GraphicsConfig.TitleId != null
? Path.Combine(AppDataManager.GamesDirPath, GraphicsConfig.TitleId, "cache", "shader")
? Path.Combine(AppDataManager.GamesDirPath, GraphicsConfig.TitleId.ToLower(), "cache", "shader")
: null;
}

View file

@ -1,8 +1,10 @@
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;
@ -21,22 +23,43 @@ namespace Ryujinx.HLE.HOS.Services
private int _selfId;
private bool _isDomain;
public IpcService(ServerBase server = null)
public IpcService(ServerBase server = null, bool registerTipc = false)
{
CmifCommands = GetType().Assembly.GetTypes()
.Where(type => type == GetType())
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
Stopwatch sw = Stopwatch.StartNew();
CmifCommands = GetType()
.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)
.SelectMany(methodInfo => methodInfo.GetCustomAttributes<CommandCmifAttribute>()
.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()
);
TipcCommands = GetType().Assembly.GetTypes()
.Where(type => type == GetType())
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
.SelectMany(methodInfo => methodInfo.GetCustomAttributes<CommandTipcAttribute>()
.Select(command => (command.Id, methodInfo)))
.ToDictionary(command => command.Id, command => command.methodInfo);
if (registerTipc)
{
sw.Start();
TipcCommands = GetType()
.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)
.SelectMany(methodInfo => methodInfo.GetCustomAttributes<CommandTipcAttribute>()
.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;

View file

@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm
private bool _isInitialized;
public IUserInterface(KernelContext context, SmRegistry registry)
public IUserInterface(KernelContext context, SmRegistry registry) : base(registerTipc: true)
{
_commonServer = new ServerBase(context, "CommonServer");
_registry = registry;

View file

@ -57,16 +57,19 @@ namespace Ryujinx.Input.SDL2
return null;
}
// Remove the first 4 char of the guid (CRC part) to make it stable
string guidString = "0000" + guid.ToString().Substring(4);
string id;
lock (_lock)
{
int guidIndex = 0;
id = guidIndex + "-" + guid;
id = guidIndex + "-" + guidString;
while (_gamepadsIds.Contains(id))
{
id = (++guidIndex) + "-" + guid;
id = (++guidIndex) + "-" + guidString;
}
}