diff --git a/lang/Czech.ini b/lang/Czech.ini index e1e6a9b73..fb097b7ed 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -81,6 +81,7 @@ CONTROLS = "OVLADANI" N64_BINDS = "N64 Ovládání" EXTRA_BINDS = "Extra Ovládání" BACKGROUND_GAMEPAD = "Ovladač v pozadí" +DISABLE_GAMEPADS = "Zakažte gamepady" GAMEPAD = "Použít ovladač" DEADZONE = "Deadzone" RUMBLE_STRENGTH = "Síla vibrace" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 22e87a2e8..9d0376408 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -81,6 +81,7 @@ CONTROLS = "CONTROLES" N64_BINDS = "N64 Toetsen" EXTRA_BINDS = "Extra Toetsen" BACKGROUND_GAMEPAD = "Achtergrond Gamepad" +DISABLE_GAMEPADS = "Gamepads uitschakelen" GAMEPAD = "Gamepad" DEADZONE = "Doode-zone" RUMBLE_STRENGTH = "Rommel Kracht" diff --git a/lang/English.ini b/lang/English.ini index 11f332e80..2da41c112 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -81,6 +81,7 @@ CONTROLS = "CONTROLS" N64_BINDS = "N64 Binds" EXTRA_BINDS = "Extra Binds" BACKGROUND_GAMEPAD = "Background Gamepad" +DISABLE_GAMEPADS = "Disable Gamepads" GAMEPAD = "Gamepad" DEADZONE = "Deadzone" RUMBLE_STRENGTH = "Rumble Strength" diff --git a/lang/French.ini b/lang/French.ini index 73e0de5b1..8f1a23959 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -81,6 +81,7 @@ CONTROLS = "CONTRÔLES" N64_BINDS = "Touches N64" EXTRA_BINDS = "Touches Supplémentaires" BACKGROUND_GAMEPAD = "Manette en arrière plan" +DISABLE_GAMEPADS = "Désactiver les manettes de jeu" GAMEPAD = "Manette" DEADZONE = "Zone Morte" RUMBLE_STRENGTH = "Vibrations" diff --git a/lang/German.ini b/lang/German.ini index 143586548..4417d4795 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -81,6 +81,7 @@ CONTROLS = "STEUERUNG" N64_BINDS = "N64-Einstellungen" EXTRA_BINDS = "Zusätzliche Einstellungen" BACKGROUND_GAMEPAD = "Hintergrund-Gamepad" +DISABLE_GAMEPADS = "Gamepads deaktivieren" GAMEPAD = "Gamepad" DEADZONE = "Tote Zone" RUMBLE_STRENGTH = "Vibration-Stärke" diff --git a/lang/Italian.ini b/lang/Italian.ini index b4f326438..0038fc9d8 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -80,6 +80,7 @@ CONTROLS = "CONTROLLI" N64_BINDS = "Comandi N64" EXTRA_BINDS = "Comandi Extra" BACKGROUND_GAMEPAD = "Azione in Background" +DISABLE_GAMEPADS = "Disabilita i gamepad" GAMEPAD = "Controller" DEADZONE = "Zona Morta" RUMBLE_STRENGTH = "Intesità Vibrazione" diff --git a/lang/Polish.ini b/lang/Polish.ini index 72f285a71..37783358d 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -81,6 +81,7 @@ CONTROLS = "STEROWANIE" N64_BINDS = "Przypisania N64" EXTRA_BINDS = "Dodatkowe Przypisania" BACKGROUND_GAMEPAD = "Gamepad w tle" +DISABLE_GAMEPADS = "Wyłącz gamepady" GAMEPAD = "Gamepad" DEADZONE = "Martwa Strefa" RUMBLE_STRENGTH = "Sila Wibracji" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index a26771ea9..1542f2607 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -81,6 +81,7 @@ CONTROLS = "CONTROLES" N64_BINDS = "N64" EXTRA_BINDS = "Outros" BACKGROUND_GAMEPAD = "Controle de fundo" +DISABLE_GAMEPADS = "Desativar gamepads" GAMEPAD = "Controle" DEADZONE = "Deadzone" RUMBLE_STRENGTH = "Força de vibração" diff --git a/lang/Russian.ini b/lang/Russian.ini index 4851328bd..8b8446d10 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -80,6 +80,7 @@ CONTROLS = "CONTROLS" N64_BINDS = "Кнопки N64" EXTRA_BINDS = "Дополнительные кнопки" BACKGROUND_GAMEPAD = "Фоновый ввод" +DISABLE_GAMEPADS = "Отключить геймпады" GAMEPAD = "Геймпад" DEADZONE = "Mёртвая зона" RUMBLE_STRENGTH = "Вибрация" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index e8e32acda..2c5f700f3 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -81,6 +81,7 @@ CONTROLS = "CONTROLES" N64_BINDS = "Botones de N64" EXTRA_BINDS = "Botones Adicionales" BACKGROUND_GAMEPAD = "Mando en segundo plano" +DISABLE_GAMEPADS = "Desactivar gamepads" GAMEPAD = "Mando" DEADZONE = "Zona muerta" RUMBLE_STRENGTH = "Fuerza de vibración" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 03ba1603f..71eca46f5 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -150,6 +150,7 @@ bool configCtxProfiler = false; unsigned int configInterpolationMode = 1; unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = true; +bool configDisableGamepads = false; bool configDebugPrint = false; bool configDebugInfo = false; bool configDebugError = false; @@ -269,6 +270,7 @@ static const struct ConfigOption options[] = { {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, + {.name = "disable_gamepads", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableGamepads}, {.name = "debug_print", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugPrint}, {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, {.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 063f54191..c9cef7eb0 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -64,6 +64,7 @@ extern unsigned int configStickDeadzone; extern unsigned int configRumbleStrength; extern unsigned int configGamepadNumber; extern bool configBackgroundGamepad; +extern bool configDisableGamepads; extern unsigned int configCameraXSens; extern unsigned int configCameraYSens; extern unsigned int configCameraAggr; diff --git a/src/pc/controller/controller_sdl1.c b/src/pc/controller/controller_sdl1.c index 36cf450f0..d49915363 100644 --- a/src/pc/controller/controller_sdl1.c +++ b/src/pc/controller/controller_sdl1.c @@ -168,6 +168,7 @@ static void controller_sdl_read(OSContPad *pad) { last_mouse = (mouse_buttons ^ mouse) & mouse; mouse_buttons = mouse; + if (configDisableGamepads) { return; } if (!sdl_joy) return; SDL_JoystickUpdate(); diff --git a/src/pc/controller/controller_sdl2.c b/src/pc/controller/controller_sdl2.c index 56748f637..7393177fd 100644 --- a/src/pc/controller/controller_sdl2.c +++ b/src/pc/controller/controller_sdl2.c @@ -206,6 +206,7 @@ static void controller_sdl_read(OSContPad *pad) { SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, sBackgroundGamepad ? "1" : "0"); } + if (configDisableGamepads) { return; } SDL_GameControllerUpdate(); diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index f9d7d1f48..568c56131 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -19,6 +19,7 @@ void djui_panel_controls_create(struct DjuiBase* caller) { djui_button_create(body, DLANG(CONTROLS, N64_BINDS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_n64_create); djui_button_create(body, DLANG(CONTROLS, EXTRA_BINDS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_extra_create); djui_checkbox_create(body, DLANG(CONTROLS, BACKGROUND_GAMEPAD), &configBackgroundGamepad, NULL); + djui_checkbox_create(body, DLANG(CONTROLS, DISABLE_GAMEPADS), &configDisableGamepads, NULL); #ifdef HAVE_SDL2 int numJoys = SDL_NumJoysticks(); diff --git a/src/pc/djui/djui_unicode.c b/src/pc/djui/djui_unicode.c index e8eb5ca70..afd52f15d 100644 --- a/src/pc/djui/djui_unicode.c +++ b/src/pc/djui/djui_unicode.c @@ -307,9 +307,6 @@ f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[]) { if (glyph) { if (glyph->width) { // use the custom width - if (font_widths[0] < 1) { - return glyph->width / 32.0f; - } return glyph->width; } if ((u8)glyph->base < (u8)'!') {