fix(ui): nom del mando en majuscules a la UI sense modificar el config

VectorText nomes admet ASCII en majuscules; els noms dels mandos (i el
git hash) passaven pel toUpperAscii local del service_menu, pero les
notificacions de hot-plug i el text del CYCLE de la pagina CONTROLS
es mostraven amb el case original. Mou el helper a un utils compartit i
l'aplica a tots els punts de display sense tocar gamepad_name al config.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 20:33:01 +02:00
parent 34be79192c
commit 10a54aef91
3 changed files with 29 additions and 15 deletions
+3 -2
View File
@@ -10,6 +10,7 @@
#include "core/locale/locale.hpp"
#include "core/system/notifier.hpp"
#include "core/utils/string_utils.hpp"
// Singleton
Input* Input::instance = nullptr;
@@ -417,7 +418,7 @@ auto Input::addGamepad(int device_index) -> std::string {
notifier->notifyInfo(localeSubstitute(
Locale::get().text("notification.gamepad_connected"),
"{name}",
name));
Utils::toUpperAscii(name)));
}
return name + " CONNECTED";
@@ -437,7 +438,7 @@ auto Input::removeGamepad(SDL_JoystickID id) -> std::string {
notifier->notifyInfo(localeSubstitute(
Locale::get().text("notification.gamepad_disconnected"),
"{name}",
name));
Utils::toUpperAscii(name)));
}
return name + " DISCONNECTED";
+3 -13
View File
@@ -23,6 +23,7 @@
#include "core/system/notifier.hpp"
#include "core/system/relaunch.hpp"
#include "core/types.hpp"
#include "core/utils/string_utils.hpp"
#include "game/config_yaml.hpp"
#include "project.h"
@@ -57,17 +58,6 @@ namespace {
}
}
// VectorText nomes admet ASCII en majuscules. El git hash sortit de git
// rev-parse es lowercase (a-f), aixi que el passem a uppercase per al
// display sense modificar Project::GIT_HASH.
auto toUpperAscii(const std::string& s) -> std::string {
std::string result = s;
for (char& c : result) {
c = static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
}
return result;
}
// Resol el text del label d'un item: prioritza label_text (literal) sobre
// label_key (locale). Retorna cadena buida si tots dos son buits.
auto resolveLabel(const System::ServiceMenu::Item& item) -> std::string {
@@ -91,7 +81,7 @@ namespace {
if (!pad) {
return Locale::get().text("service_menu.controls_no_pad");
}
return pad->name;
return Utils::toUpperAscii(pad->name);
}
// Index actual del pad assignat dins de la llista de mandos detectats.
@@ -582,7 +572,7 @@ namespace System {
// Versio + hash com a subtitol sota el titol (apagat, mes petit).
// Uppercase del hash perque VectorText nomes admet majuscules.
page.subtitle_provider = [] {
return std::format("V{} - {}", Project::VERSION, toUpperAscii(Project::GIT_HASH));
return std::format("V{} - {}", Project::VERSION, Utils::toUpperAscii(Project::GIT_HASH));
};
page.items = {
// REINICIAR (amb confirmacio).
+23
View File
@@ -0,0 +1,23 @@
// string_utils.hpp - Utilitats genèriques de cadenes
// © 2026 JailDesigner
//
// VectorText només admet ASCII en majúscules; les notificacions, el menú
// de servei i l'overlay de rebind passen els textos dinàmics per aquest
// helper abans de pintar-los.
#pragma once
#include <cctype>
#include <string>
namespace Utils {
inline auto toUpperAscii(const std::string& s) -> std::string {
std::string result = s;
for (char& c : result) {
c = static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
}
return result;
}
} // namespace Utils