Add option to disable gamepads and remove leftover code

This commit is contained in:
Agent X 2024-01-07 20:55:39 -05:00
parent 9c9c868027
commit 2740a6f761
16 changed files with 16 additions and 3 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -80,6 +80,7 @@ CONTROLS = "CONTROLS"
N64_BINDS = "Кнопки N64"
EXTRA_BINDS = "Дополнительные кнопки"
BACKGROUND_GAMEPAD = "Фоновый ввод"
DISABLE_GAMEPADS = "Отключить геймпады"
GAMEPAD = "Геймпад"
DEADZONE = "Mёртвая зона"
RUMBLE_STRENGTH = "Вибрация"

View File

@ -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"

View File

@ -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},

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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)'!') {