From: Holger Schemel Date: Wed, 22 Jun 2022 13:17:19 +0000 (+0200) Subject: fixed synchronization problem when configuring game controller X-Git-Tag: 4.3.3.0~89 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5f29516b5acf64df0acb0efeb20f64c2945fc74b;p=rocksndiamonds.git fixed synchronization problem when configuring game controller This fixes a bug that can happen due to bad initialization of a delay counter (to limit the maximum time spent on handling events), causing it to reach the maximum delay while the screen refresh is also waiting for the video delay. Resetting the counter right after screen update fixes this potential problem. --- diff --git a/src/screens.c b/src/screens.c index b45e9911..533cf4c4 100644 --- a/src/screens.c +++ b/src/screens.c @@ -8630,11 +8630,6 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) { 282, 210, MARKER_AXIS_Y, "righty", }, }; - unsigned int event_frame_delay = 0; - unsigned int event_frame_delay_value = GAME_FRAME_DELAY; - - ResetDelayCounter(&event_frame_delay); - if (!bitmaps_initialized) { controller = LoadCustomImage("joystick/controller.png"); @@ -8766,6 +8761,12 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) screen_initialized = TRUE; + unsigned int event_frame_delay = 0; + unsigned int event_frame_delay_value = GAME_FRAME_DELAY; + + // reset frame delay counter directly after updating screen + ResetDelayCounter(&event_frame_delay); + while (NextValidEvent(&event)) { switch (event.type)