#define SETUP_MODE_CHOOSE_WINDOW_SIZE 19
#define SETUP_MODE_CHOOSE_SCALING_TYPE 20
#define SETUP_MODE_CHOOSE_RENDERING 21
-#define SETUP_MODE_CHOOSE_GRAPHICS 22
-#define SETUP_MODE_CHOOSE_SOUNDS 23
-#define SETUP_MODE_CHOOSE_MUSIC 24
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 25
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 26
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 27
-#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28
-#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29
-#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30
-#define SETUP_MODE_CHOOSE_TRANSPARENCY 31
-#define SETUP_MODE_CHOOSE_GRID_XSIZE_0 32
-#define SETUP_MODE_CHOOSE_GRID_YSIZE_0 33
-#define SETUP_MODE_CHOOSE_GRID_XSIZE_1 34
-#define SETUP_MODE_CHOOSE_GRID_YSIZE_1 35
-#define SETUP_MODE_CONFIG_VIRT_BUTTONS 36
-
-#define MAX_SETUP_MODES 37
+#define SETUP_MODE_CHOOSE_VSYNC 22
+#define SETUP_MODE_CHOOSE_GRAPHICS 23
+#define SETUP_MODE_CHOOSE_SOUNDS 24
+#define SETUP_MODE_CHOOSE_MUSIC 25
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 26
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 27
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 28
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 29
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 30
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE 31
+#define SETUP_MODE_CHOOSE_TRANSPARENCY 32
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_0 33
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_0 34
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_1 35
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_1 36
+#define SETUP_MODE_CONFIG_VIRT_BUTTONS 37
+
+#define MAX_SETUP_MODES 38
#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
#define STR_SETUP_CHOOSE_WINDOW_SIZE "Window Scaling"
#define STR_SETUP_CHOOSE_SCALING_TYPE "Anti-Aliasing"
#define STR_SETUP_CHOOSE_RENDERING "Rendering Mode"
+#define STR_SETUP_CHOOSE_VSYNC "VSync Mode"
#define STR_SETUP_CHOOSE_VOLUME_SIMPLE "Sound Volume"
#define STR_SETUP_CHOOSE_VOLUME_LOOPS "Loops Volume"
#define STR_SETUP_CHOOSE_VOLUME_MUSIC "Music Volume"
static TreeInfo *rendering_modes = NULL;
static TreeInfo *rendering_mode_current = NULL;
+static TreeInfo *vsync_modes = NULL;
+static TreeInfo *vsync_mode_current = NULL;
+
static TreeInfo *scroll_delays = NULL;
static TreeInfo *scroll_delay_current = NULL;
{ NULL, NULL },
};
+static struct
+{
+ char *value;
+ char *text;
+} vsync_modes_list[] =
+{
+ { STR_VSYNC_MODE_OFF, "Off" },
+ { STR_VSYNC_MODE_NORMAL, "Normal" },
+ { STR_VSYNC_MODE_ADAPTIVE, "Adaptive" },
+
+ { NULL, NULL },
+};
+
static struct
{
int value;
execSetupGame();
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE ||
- setup_mode == SETUP_MODE_CHOOSE_RENDERING)
+ setup_mode == SETUP_MODE_CHOOSE_RENDERING ||
+ setup_mode == SETUP_MODE_CHOOSE_VSYNC)
execSetupGraphics();
else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE ||
setup_mode == SETUP_MODE_CHOOSE_VOLUME_LOOPS ||
execSetupGame();
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE ||
- setup_mode == SETUP_MODE_CHOOSE_RENDERING)
+ setup_mode == SETUP_MODE_CHOOSE_RENDERING ||
+ setup_mode == SETUP_MODE_CHOOSE_VSYNC)
execSetupGraphics();
else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE ||
setup_mode == SETUP_MODE_CHOOSE_VOLUME_LOOPS ||
execSetupGame();
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE ||
- setup_mode == SETUP_MODE_CHOOSE_RENDERING)
+ setup_mode == SETUP_MODE_CHOOSE_RENDERING ||
+ setup_mode == SETUP_MODE_CHOOSE_VSYNC)
execSetupGraphics();
else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE ||
setup_mode == SETUP_MODE_CHOOSE_VOLUME_LOOPS ||
static char *window_size_text;
static char *scaling_type_text;
static char *rendering_mode_text;
+static char *vsync_mode_text;
static char *scroll_delay_text;
static char *snapshot_mode_text;
static char *game_speed_text;
rendering_mode_text = rendering_mode_current->name;
}
+static void execSetupGraphics_setVsyncModes(void)
+{
+ if (vsync_modes == NULL)
+ {
+ int i;
+
+ for (i = 0; vsync_modes_list[i].value != NULL; i++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+ char identifier[32], name[32];
+ char *value = vsync_modes_list[i].value;
+ char *text = vsync_modes_list[i].text;
+
+ ti->node_top = &vsync_modes;
+ ti->sort_priority = i;
+
+ sprintf(identifier, "%s", value);
+ sprintf(name, "%s", text);
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+ setString(&ti->infotext, STR_SETUP_CHOOSE_VSYNC);
+
+ pushTreeInfo(&vsync_modes, ti);
+ }
+
+ /* sort vsync mode values to start with lowest vsync mode value */
+ sortTreeInfo(&vsync_modes);
+
+ /* set current vsync mode value to configured vsync mode value */
+ vsync_mode_current =
+ getTreeInfoFromIdentifier(vsync_modes, setup.vsync_mode);
+
+ /* if that fails, set current vsync mode to reliable default value */
+ if (vsync_mode_current == NULL)
+ vsync_mode_current =
+ getTreeInfoFromIdentifier(vsync_modes, STR_VSYNC_MODE_DEFAULT);
+
+ /* if that also fails, set current vsync mode to first available one */
+ if (vsync_mode_current == NULL)
+ vsync_mode_current = vsync_modes;
+ }
+
+ setup.vsync_mode = vsync_mode_current->identifier;
+
+ /* needed for displaying vsync mode text instead of identifier */
+ vsync_mode_text = vsync_mode_current->name;
+}
+
static void execSetupGraphics(void)
{
// update "setup.window_scaling_percent" from list selection
execSetupGraphics_setScalingTypes();
execSetupGraphics_setRenderingModes();
+ execSetupGraphics_setVsyncModes();
setup_mode = SETUP_MODE_GRAPHICS;
// screen rendering mode may have changed at this point
SDLSetScreenRenderingMode(setup.screen_rendering_mode);
+
+ // screen vsync mode may have changed at this point
+ SDLSetScreenVsyncMode(setup.vsync_mode);
#endif
}
DrawSetupScreen();
}
+static void execSetupChooseVsyncMode(void)
+{
+ setup_mode = SETUP_MODE_CHOOSE_VSYNC;
+
+ DrawSetupScreen();
+}
+
static void execSetupChooseVolumeSimple(void)
{
setup_mode = SETUP_MODE_CHOOSE_VOLUME_SIMPLE;
{ &setup.screen_rendering_mode, execSetupChooseRenderingMode },
{ &setup.screen_rendering_mode, &rendering_mode_text },
+ { &setup.vsync_mode, execSetupChooseVsyncMode },
+ { &setup.vsync_mode, &vsync_mode_text },
+
{ &setup.graphics_set, execSetupChooseGraphics },
{ &setup.graphics_set, &graphics_set_name },
{ TYPE_ENTER_LIST, execSetupChooseScrollDelay, "Scroll Delay:" },
{ TYPE_STRING, &scroll_delay_text, "" },
#endif
+ { TYPE_ENTER_LIST, execSetupChooseVsyncMode, "Vertical Sync (VSync):" },
+ { TYPE_STRING, &vsync_mode_text, "" },
{ TYPE_SWITCH, &setup.fade_screens, "Fade Screens:" },
{ TYPE_SWITCH, &setup.quick_switch, "Quick Player Focus Switch:" },
{ TYPE_SWITCH, &setup.quick_doors, "Quick Menu Doors:" },
DrawChooseTree(&scaling_type_current);
else if (setup_mode == SETUP_MODE_CHOOSE_RENDERING)
DrawChooseTree(&rendering_mode_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_VSYNC)
+ DrawChooseTree(&vsync_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
DrawChooseTree(&artwork.gfx_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
HandleChooseTree(mx, my, dx, dy, button, &scaling_type_current);
else if (setup_mode == SETUP_MODE_CHOOSE_RENDERING)
HandleChooseTree(mx, my, dx, dy, button, &rendering_mode_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_VSYNC)
+ HandleChooseTree(mx, my, dx, dy, button, &vsync_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
HandleChooseTree(mx, my, dx, dy, button, &artwork.gfx_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)