+static void ModifyGameSpeedIfNeeded(void)
+{
+ if (strEqual(setup.vsync_mode, STR_VSYNC_MODE_OFF) ||
+ setup.game_frame_delay <= MAX_VSYNC_FRAME_DELAY)
+ return;
+
+ char message[100];
+ char *game_speed_text = "Fast";
+ int game_speed_value = 15;
+
+ if (setup.game_speed_extended)
+ {
+ game_speed_text = "60 fps";
+ game_speed_value = 16;
+ }
+
+ sprintf(message, "Game speed set to %s for VSync to work!", game_speed_text);
+
+ // set game speed to existing list value that is fast enough for vsync
+ setup.game_frame_delay = game_speed_value;
+
+ execSetupGame_setGameSpeeds(TRUE);
+
+ Request(message, REQ_CONFIRM);
+}
+
+static void DisableVsyncIfNeeded(void)
+{
+ if (strEqual(setup.vsync_mode, STR_VSYNC_MODE_OFF) ||
+ (setup.game_frame_delay >= MIN_VSYNC_FRAME_DELAY &&
+ setup.game_frame_delay <= MAX_VSYNC_FRAME_DELAY))
+ return;
+
+ // disable vsync for the selected game speed to work
+ setup.vsync_mode = STR_VSYNC_MODE_OFF;
+
+ execSetupGraphics_setVsyncModes(TRUE);
+
+ Request("VSync disabled for this game speed to work!", REQ_CONFIRM);
+}
+