From c3393514e41da3631ecc5ed24b1de4f9ff917ae5 Mon Sep 17 00:00:00 2001 From: univrsal Date: Sun, 11 Aug 2024 09:09:45 +0200 Subject: [PATCH] Gamepads: initialize data after SDL is loaded otherwise the logging in the constructor won't find any gamepads --- src/hook/gamepad_hook_helper.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hook/gamepad_hook_helper.cpp b/src/hook/gamepad_hook_helper.cpp index ec52429c..a9dea6be 100644 --- a/src/hook/gamepad_hook_helper.cpp +++ b/src/hook/gamepad_hook_helper.cpp @@ -80,13 +80,17 @@ void start() */ state = true; - local_gamepads = new gamepads; - if (!WIN32) + if (!WIN32) { sdl_init(); + local_gamepads = new gamepads; + } sdl_poll_thread = std::thread([] { - if (WIN32) + if (WIN32) { sdl_init(); + local_gamepads = new gamepads; + } + local_gamepads->event_loop(); if (WIN32) sdl_deinit();