From a78ccf88a10ad9c6e4edb9e94622f66e4c3a24f5 Mon Sep 17 00:00:00 2001 From: John Morris Date: Sun, 27 Nov 2022 22:51:44 -0600 Subject: [PATCH] Fix multiple joystick detection Fixes #1843503 --- .../11_Fix-multiple-joystick-detection.patch | 38 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 39 insertions(+) create mode 100644 debian/patches/11_Fix-multiple-joystick-detection.patch diff --git a/debian/patches/11_Fix-multiple-joystick-detection.patch b/debian/patches/11_Fix-multiple-joystick-detection.patch new file mode 100644 index 00000000..05930b07 --- /dev/null +++ b/debian/patches/11_Fix-multiple-joystick-detection.patch @@ -0,0 +1,38 @@ +From 7cdfaf9d44a8a46f93b0d7d531d90d434eb70365 Mon Sep 17 00:00:00 2001 +From: John Morris +Date: Sun, 27 Nov 2022 22:44:43 -0600 +Subject: [PATCH] Fix multiple joystick detection + +Fixes #1843503 +--- + plugins/dfinput/cfg-gtk.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c +index 7b5df6c2..9029b695 100644 +--- a/plugins/dfinput/cfg-gtk.c ++++ b/plugins/dfinput/cfg-gtk.c +@@ -592,6 +592,7 @@ static void PopulateDevList() { + GtkListStore *store; + GtkCellRenderer *renderer; + char buf[256]; ++ SDL_Joystick *js; + + for (i = 0; i < NUM_KEYLIST; i++) { + widget = GTK_WIDGET(gtk_builder_get_object(xml, widgetname_combodev[i])); +@@ -607,9 +608,11 @@ static void PopulateDevList() { + + n = SDL_NumJoysticks(); + for (j = 0; j < n; j++) { +- sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(j)); ++ js = SDL_JoystickOpen(j); ++ sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(js)); + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, buf, -1); ++ SDL_JoystickClose(js); + } + + gtk_combo_box_set_model(GTK_COMBO_BOX(widget), GTK_TREE_MODEL(store)); +-- +2.25.1 + diff --git a/debian/patches/series b/debian/patches/series index 1bc4f9d6..ec1e6eb4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,3 +8,4 @@ 08_reproducible.patch 09_zlib-1.2.9.patch 10_cross.patch +11_Fix-multiple-joystick-detection.patch -- 2.25.1