From 58c2dc4ac46fe2daf456ab401ae40f6cd313dff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Hamil?= Date: Wed, 25 Jun 2025 20:23:43 +0300 Subject: [PATCH 1/2] Overlays: FlipY fix --- src/Ryujinx.Graphics.Gpu/Window.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Window.cs b/src/Ryujinx.Graphics.Gpu/Window.cs index 6bcedd2b7..d82f66836 100644 --- a/src/Ryujinx.Graphics.Gpu/Window.cs +++ b/src/Ryujinx.Graphics.Gpu/Window.cs @@ -213,7 +213,7 @@ namespace Ryujinx.Graphics.Gpu texture.SynchronizeMemory(); // Add overlays by modifying texture data directly - AddOverlaysToTexture(texture); + AddOverlaysToTexture(texture, pt.Crop); ImageCrop crop = new( (int)(pt.Crop.Left * texture.ScaleFactor), @@ -264,7 +264,8 @@ namespace Ryujinx.Graphics.Gpu /// Add overlays to the texture using SkiaSharp /// /// The texture to modify - private void AddOverlaysToTexture(Image.Texture texture) + /// The crop information containing flip flags + private void AddOverlaysToTexture(Image.Texture texture, ImageCrop crop) { try { @@ -314,9 +315,9 @@ namespace Ryujinx.Graphics.Gpu // Create canvas for drawing overlays using var canvas = new SKCanvas(bitmap); - // On Linux with OpenGL, we need to flip the Y-axis because OpenGL uses bottom-left origin - // while SkiaSharp uses top-left origin - if (OperatingSystem.IsLinux()) + // Flip Y-axis if the game/texture requires it + // Some games have textures that are already flipped, while others need flipping + if (crop.FlipY) { canvas.Scale(1, -1); canvas.Translate(0, -height); From 154f0564224d8ad87596c40ab5da6f514bb21b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Hamil?= Date: Wed, 25 Jun 2025 20:24:37 +0300 Subject: [PATCH 2/2] ControllerOverlay: truncate names from middle instead of end, (due to index identifier usually being on end) --- src/Ryujinx/UI/Overlay/ControllerOverlay.cs | 42 +++++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx/UI/Overlay/ControllerOverlay.cs b/src/Ryujinx/UI/Overlay/ControllerOverlay.cs index e8ea8a547..7e6ae6758 100644 --- a/src/Ryujinx/UI/Overlay/ControllerOverlay.cs +++ b/src/Ryujinx/UI/Overlay/ControllerOverlay.cs @@ -16,7 +16,6 @@ namespace Ryujinx.UI.Overlay { private const float OverlayWidth = 400; private const float Padding = 24; - private const float Spacing = 16; private const float PlayerSpacing = 12; private const float PlayerRowHeight = 32; @@ -120,7 +119,7 @@ namespace Ryujinx.UI.Overlay if (playerBindings.ContainsKey(playerIndex)) { var controllers = playerBindings[playerIndex]; - var controllerNames = controllers.Select(c => GetControllerDisplayName(c)).ToList(); + var controllerNames = GetUniqueControllerDisplayNames(controllers); var controllerTextElement = new TextElement(Padding + 56, rowY + 2, string.Join(", ", controllerNames), PlayerTextSize, new SKColor(144, 238, 144)) // LightGreen { @@ -169,6 +168,37 @@ namespace Ryujinx.UI.Overlay }; } + private List GetUniqueControllerDisplayNames(List controllers) + { + var nameGroups = new Dictionary>(); + var displayNames = new List(); + + // First pass: get base names and group them + for (int i = 0; i < controllers.Count; i++) + { + string baseName = GetControllerDisplayName(controllers[i]); + + if (!nameGroups.ContainsKey(baseName)) + { + nameGroups[baseName] = new List(); + } + nameGroups[baseName].Add(i); + displayNames.Add(baseName); + } + + // Second pass: add numbering for duplicates + foreach (var group in nameGroups.Where(g => g.Value.Count > 1)) + { + for (int i = 0; i < group.Value.Count; i++) + { + int index = group.Value[i]; + displayNames[index] = $"{group.Key} #{i + 1}"; + } + } + + return displayNames; + } + private string GetControllerDisplayName(OriginalInputConfig config) { if (string.IsNullOrEmpty(config.Name)) @@ -181,11 +211,15 @@ namespace Ryujinx.UI.Overlay }; } - // Truncate long controller names + // Truncate long controller names from the middle string name = config.Name; if (name.Length > 25) { - name = name.Substring(0, 22) + "..."; + int keepLength = 22; // Total characters to keep (excluding "...") + int leftLength = (keepLength + 1) / 2; // Round up for left side + int rightLength = keepLength / 2; // Round down for right side + + name = name.Substring(0, leftLength) + "..." + name.Substring(name.Length - rightLength); } return name;