Просмотр исходного кода

ui: Fixes GetShrinkedGamepadName (#2444)

There is a wrong condition in `GetShrinkedGamepadName` which throw an oob if the controller name is equal to the checked value. It's now fixed and shoud closes #2442 .
Ac_K 4 лет назад
Родитель
Сommit
a6c2b5d6ec
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      Ryujinx/Ui/Windows/ControllerWindow.cs

+ 4 - 4
Ryujinx/Ui/Windows/ControllerWindow.cs

@@ -231,12 +231,12 @@ namespace Ryujinx.Ui.Windows
 
 
         private static string GetShrinkedGamepadName(string str)
         private static string GetShrinkedGamepadName(string str)
         {
         {
-            const string ShrinkChars = "..";
-            const int MaxSize = 52;
+            const string ShrinkChars = "...";
+            const int MaxSize = 50;
 
 
-            if (str.Length > MaxSize - ShrinkChars.Length)
+            if (str.Length > MaxSize)
             {
             {
-                return str.Substring(0, MaxSize) + ShrinkChars;
+                return str.Substring(0, MaxSize - ShrinkChars.Length) + ShrinkChars;
             }
             }
 
 
             return str;
             return str;