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í" N64_BINDS = "N64 Ovládání"
EXTRA_BINDS = "Extra Ovládání" EXTRA_BINDS = "Extra Ovládání"
BACKGROUND_GAMEPAD = "Ovladač v pozadí" BACKGROUND_GAMEPAD = "Ovladač v pozadí"
DISABLE_GAMEPADS = "Zakažte gamepady"
GAMEPAD = "Použít ovladač" GAMEPAD = "Použít ovladač"
DEADZONE = "Deadzone" DEADZONE = "Deadzone"
RUMBLE_STRENGTH = "Síla vibrace" RUMBLE_STRENGTH = "Síla vibrace"

View file

@ -81,6 +81,7 @@ CONTROLS = "CONTROLES"
N64_BINDS = "N64 Toetsen" N64_BINDS = "N64 Toetsen"
EXTRA_BINDS = "Extra Toetsen" EXTRA_BINDS = "Extra Toetsen"
BACKGROUND_GAMEPAD = "Achtergrond Gamepad" BACKGROUND_GAMEPAD = "Achtergrond Gamepad"
DISABLE_GAMEPADS = "Gamepads uitschakelen"
GAMEPAD = "Gamepad" GAMEPAD = "Gamepad"
DEADZONE = "Doode-zone" DEADZONE = "Doode-zone"
RUMBLE_STRENGTH = "Rommel Kracht" RUMBLE_STRENGTH = "Rommel Kracht"

View file

@ -81,6 +81,7 @@ CONTROLS = "CONTROLS"
N64_BINDS = "N64 Binds" N64_BINDS = "N64 Binds"
EXTRA_BINDS = "Extra Binds" EXTRA_BINDS = "Extra Binds"
BACKGROUND_GAMEPAD = "Background Gamepad" BACKGROUND_GAMEPAD = "Background Gamepad"
DISABLE_GAMEPADS = "Disable Gamepads"
GAMEPAD = "Gamepad" GAMEPAD = "Gamepad"
DEADZONE = "Deadzone" DEADZONE = "Deadzone"
RUMBLE_STRENGTH = "Rumble Strength" RUMBLE_STRENGTH = "Rumble Strength"

View file

@ -81,6 +81,7 @@ CONTROLS = "CONTRÔLES"
N64_BINDS = "Touches N64" N64_BINDS = "Touches N64"
EXTRA_BINDS = "Touches Supplémentaires" EXTRA_BINDS = "Touches Supplémentaires"
BACKGROUND_GAMEPAD = "Manette en arrière plan" BACKGROUND_GAMEPAD = "Manette en arrière plan"
DISABLE_GAMEPADS = "Désactiver les manettes de jeu"
GAMEPAD = "Manette" GAMEPAD = "Manette"
DEADZONE = "Zone Morte" DEADZONE = "Zone Morte"
RUMBLE_STRENGTH = "Vibrations" RUMBLE_STRENGTH = "Vibrations"

View file

@ -81,6 +81,7 @@ CONTROLS = "STEUERUNG"
N64_BINDS = "N64-Einstellungen" N64_BINDS = "N64-Einstellungen"
EXTRA_BINDS = "Zusätzliche Einstellungen" EXTRA_BINDS = "Zusätzliche Einstellungen"
BACKGROUND_GAMEPAD = "Hintergrund-Gamepad" BACKGROUND_GAMEPAD = "Hintergrund-Gamepad"
DISABLE_GAMEPADS = "Gamepads deaktivieren"
GAMEPAD = "Gamepad" GAMEPAD = "Gamepad"
DEADZONE = "Tote Zone" DEADZONE = "Tote Zone"
RUMBLE_STRENGTH = "Vibration-Stärke" RUMBLE_STRENGTH = "Vibration-Stärke"

View file

@ -80,6 +80,7 @@ CONTROLS = "CONTROLLI"
N64_BINDS = "Comandi N64" N64_BINDS = "Comandi N64"
EXTRA_BINDS = "Comandi Extra" EXTRA_BINDS = "Comandi Extra"
BACKGROUND_GAMEPAD = "Azione in Background" BACKGROUND_GAMEPAD = "Azione in Background"
DISABLE_GAMEPADS = "Disabilita i gamepad"
GAMEPAD = "Controller" GAMEPAD = "Controller"
DEADZONE = "Zona Morta" DEADZONE = "Zona Morta"
RUMBLE_STRENGTH = "Intesità Vibrazione" RUMBLE_STRENGTH = "Intesità Vibrazione"

View file

@ -81,6 +81,7 @@ CONTROLS = "STEROWANIE"
N64_BINDS = "Przypisania N64" N64_BINDS = "Przypisania N64"
EXTRA_BINDS = "Dodatkowe Przypisania" EXTRA_BINDS = "Dodatkowe Przypisania"
BACKGROUND_GAMEPAD = "Gamepad w tle" BACKGROUND_GAMEPAD = "Gamepad w tle"
DISABLE_GAMEPADS = "Wyłącz gamepady"
GAMEPAD = "Gamepad" GAMEPAD = "Gamepad"
DEADZONE = "Martwa Strefa" DEADZONE = "Martwa Strefa"
RUMBLE_STRENGTH = "Sila Wibracji" RUMBLE_STRENGTH = "Sila Wibracji"

View file

@ -81,6 +81,7 @@ CONTROLS = "CONTROLES"
N64_BINDS = "N64" N64_BINDS = "N64"
EXTRA_BINDS = "Outros" EXTRA_BINDS = "Outros"
BACKGROUND_GAMEPAD = "Controle de fundo" BACKGROUND_GAMEPAD = "Controle de fundo"
DISABLE_GAMEPADS = "Desativar gamepads"
GAMEPAD = "Controle" GAMEPAD = "Controle"
DEADZONE = "Deadzone" DEADZONE = "Deadzone"
RUMBLE_STRENGTH = "Força de vibração" RUMBLE_STRENGTH = "Força de vibração"

View file

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

View file

@ -81,6 +81,7 @@ CONTROLS = "CONTROLES"
N64_BINDS = "Botones de N64" N64_BINDS = "Botones de N64"
EXTRA_BINDS = "Botones Adicionales" EXTRA_BINDS = "Botones Adicionales"
BACKGROUND_GAMEPAD = "Mando en segundo plano" BACKGROUND_GAMEPAD = "Mando en segundo plano"
DISABLE_GAMEPADS = "Desactivar gamepads"
GAMEPAD = "Mando" GAMEPAD = "Mando"
DEADZONE = "Zona muerta" DEADZONE = "Zona muerta"
RUMBLE_STRENGTH = "Fuerza de vibración" RUMBLE_STRENGTH = "Fuerza de vibración"

View file

@ -150,6 +150,7 @@ bool configCtxProfiler = false;
unsigned int configInterpolationMode = 1; unsigned int configInterpolationMode = 1;
unsigned int configGamepadNumber = 0; unsigned int configGamepadNumber = 0;
bool configBackgroundGamepad = true; bool configBackgroundGamepad = true;
bool configDisableGamepads = false;
bool configDebugPrint = false; bool configDebugPrint = false;
bool configDebugInfo = false; bool configDebugInfo = false;
bool configDebugError = false; bool configDebugError = false;
@ -269,6 +270,7 @@ static const struct ConfigOption options[] = {
{.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode},
{.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber},
{.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, {.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_print", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugPrint},
{.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo},
{.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, {.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 configRumbleStrength;
extern unsigned int configGamepadNumber; extern unsigned int configGamepadNumber;
extern bool configBackgroundGamepad; extern bool configBackgroundGamepad;
extern bool configDisableGamepads;
extern unsigned int configCameraXSens; extern unsigned int configCameraXSens;
extern unsigned int configCameraYSens; extern unsigned int configCameraYSens;
extern unsigned int configCameraAggr; extern unsigned int configCameraAggr;

View file

@ -168,6 +168,7 @@ static void controller_sdl_read(OSContPad *pad) {
last_mouse = (mouse_buttons ^ mouse) & mouse; last_mouse = (mouse_buttons ^ mouse) & mouse;
mouse_buttons = mouse; mouse_buttons = mouse;
if (configDisableGamepads) { return; }
if (!sdl_joy) return; if (!sdl_joy) return;
SDL_JoystickUpdate(); 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"); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, sBackgroundGamepad ? "1" : "0");
} }
if (configDisableGamepads) { return; }
SDL_GameControllerUpdate(); 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, 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_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, BACKGROUND_GAMEPAD), &configBackgroundGamepad, NULL);
djui_checkbox_create(body, DLANG(CONTROLS, DISABLE_GAMEPADS), &configDisableGamepads, NULL);
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
int numJoys = SDL_NumJoysticks(); 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) {
if (glyph->width) { if (glyph->width) {
// use the custom width // use the custom width
if (font_widths[0] < 1) {
return glyph->width / 32.0f;
}
return glyph->width; return glyph->width;
} }
if ((u8)glyph->base < (u8)'!') { if ((u8)glyph->base < (u8)'!') {