make controllerdb

nom del mando trimmed
This commit is contained in:
2026-04-15 16:16:49 +02:00
parent f9b0f64b81
commit 517bc2caa1
2 changed files with 28 additions and 3 deletions

View File

@@ -253,6 +253,19 @@ wasm:
cp build/wasm/$(TARGET_NAME).wasm $(DIST_DIR)/wasm/ cp build/wasm/$(TARGET_NAME).wasm $(DIST_DIR)/wasm/
cp build/wasm/$(TARGET_NAME).data $(DIST_DIR)/wasm/ cp build/wasm/$(TARGET_NAME).data $(DIST_DIR)/wasm/
@echo "Output: $(DIST_DIR)/wasm/" @echo "Output: $(DIST_DIR)/wasm/"
scp $(DIST_DIR)/wasm/$(TARGET_NAME).js $(DIST_DIR)/wasm/$(TARGET_NAME).wasm $(DIST_DIR)/wasm/$(TARGET_NAME).data \
maverick:/home/sergio/gitea/web_jailgames/static/games/coffee-crisis/wasm/
ssh maverick 'cd /home/sergio/gitea/web_jailgames && ./deploy.sh'
@echo "Deployed to maverick"
# ==============================================================================
# DESCARGA DE GAMECONTROLLERDB
# ==============================================================================
controllerdb:
@echo "Descargando gamecontrollerdb.txt..."
curl -fsSL https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt \
-o gamecontrollerdb.txt
@echo "gamecontrollerdb.txt actualizado"
# ============================================================================== # ==============================================================================
# REGLAS ESPECIALES # REGLAS ESPECIALES
@@ -273,10 +286,13 @@ help:
@echo " make windows_release - Crear release para Windows" @echo " make windows_release - Crear release para Windows"
@echo " make linux_release - Crear release para Linux" @echo " make linux_release - Crear release para Linux"
@echo " make macos_release - Crear release para macOS" @echo " make macos_release - Crear release para macOS"
@echo " make wasm - Compilar para WebAssembly (requiere Docker)" @echo " make wasm - Compilar para WebAssembly (requiere Docker) y deploy a maverick"
@echo ""
@echo " Herramientas:"
@echo " make controllerdb - Descargar gamecontrollerdb.txt actualizado"
@echo "" @echo ""
@echo " Otros:" @echo " Otros:"
@echo " make show_version - Mostrar version actual ($(VERSION))" @echo " make show_version - Mostrar version actual ($(VERSION))"
@echo " make help - Mostrar esta ayuda" @echo " make help - Mostrar esta ayuda"
.PHONY: all debug release windows_release macos_release linux_release wasm show_version help .PHONY: all debug release windows_release macos_release linux_release wasm controllerdb show_version help

View File

@@ -155,11 +155,20 @@ bool Input::checkAnyInput(int device, int index) {
return false; return false;
} }
// Construye el nombre visible de un mando // Construye el nombre visible de un mando.
// Recorta des del primer '(' o '[' (per a evitar coses tipus
// "Retroid Controller (vendor: 1001) ...") i talla a 25 caràcters.
std::string Input::buildControllerName(SDL_Gamepad *pad, int padIndex) { std::string Input::buildControllerName(SDL_Gamepad *pad, int padIndex) {
(void)padIndex; (void)padIndex;
const char *padName = SDL_GetGamepadName(pad); const char *padName = SDL_GetGamepadName(pad);
std::string name = padName ? padName : "Unknown"; std::string name = padName ? padName : "Unknown";
const auto pos = name.find_first_of("([");
if (pos != std::string::npos) {
name.erase(pos);
}
while (!name.empty() && name.back() == ' ') {
name.pop_back();
}
if (name.size() > 25) { if (name.size() > 25) {
name.resize(25); name.resize(25);
} }