diff --git a/Makefile b/Makefile index e171e4a..20a8115 100644 --- a/Makefile +++ b/Makefile @@ -253,6 +253,19 @@ wasm: cp build/wasm/$(TARGET_NAME).wasm $(DIST_DIR)/wasm/ cp build/wasm/$(TARGET_NAME).data $(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 @@ -273,10 +286,13 @@ help: @echo " make windows_release - Crear release para Windows" @echo " make linux_release - Crear release para Linux" @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 " Otros:" @echo " make show_version - Mostrar version actual ($(VERSION))" @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 diff --git a/source/input.cpp b/source/input.cpp index 327cf46..04a65b2 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -155,11 +155,20 @@ bool Input::checkAnyInput(int device, int index) { 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) { (void)padIndex; const char *padName = SDL_GetGamepadName(pad); 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) { name.resize(25); }