From 7d0d4f0716a8074d9cd0db359dc42feeb3c397de Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 28 Jul 2025 18:39:38 -0700 Subject: [PATCH] Remove 10 joystick limit in controller selection box (#874) --- src/pc/djui/djui_panel_controls.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c index ddf6dad75..8088580a9 100644 --- a/src/pc/djui/djui_panel_controls.c +++ b/src/pc/djui/djui_panel_controls.c @@ -45,9 +45,8 @@ void djui_panel_controls_create(struct DjuiBase* caller) { #ifdef HAVE_SDL2 int numJoys = SDL_NumJoysticks(); if (numJoys == 0) { numJoys = 1; } - if (numJoys > 10) { numJoys = 10; } - char* gamepadChoices[numJoys]; + char** gamepadChoices = calloc(numJoys, sizeof(char *)); // Get the names of all connected gamepads, if none is provided, use "Unknown" for (int i = 0; i < numJoys; i++) { @@ -90,6 +89,8 @@ void djui_panel_controls_create(struct DjuiBase* caller) { for (int i = 0; i < numJoys; i++) { free(gamepadChoices[i]); } + + free(gamepadChoices); #endif djui_slider_create(body, DLANG(CONTROLS, DEADZONE), &configStickDeadzone, 0, 100, djui_panel_controls_value_change);