changeset 1568:d14490dee01f

Add sync_source to default.cfg and the Nuklear UI
author Michael Pavone <pavone@retrodev.com>
date Tue, 17 Apr 2018 23:05:08 -0700
parents 66387b1645e4
children 0ec89dadb36d
files default.cfg nuklear_ui/blastem_nuklear.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/default.cfg	Tue Apr 17 22:26:39 2018 -0700
+++ b/default.cfg	Tue Apr 17 23:05:08 2018 -0700
@@ -228,6 +228,11 @@
 }
 
 system {
+	#controls how the emulated system is synced to the host
+	#video provides the smoothest experience when the host and emulated system have similar refresh rates
+	#audio provides lower audio latency, especially when there is a refresh rate mismatch
+	sync_source video
+	#set this to random to debug initialization bugs
 	ram_init zero
 	default_region U
 	#controls whether MegaWiFi support is enabled or not
--- a/nuklear_ui/blastem_nuklear.c	Tue Apr 17 22:26:39 2018 -0700
+++ b/nuklear_ui/blastem_nuklear.c	Tue Apr 17 23:05:08 2018 -0700
@@ -776,6 +776,15 @@
 }
 void view_system_settings(struct nk_context *context)
 {
+	const char *sync_opts[] = {
+		"video",
+		"audio"
+	};
+	const uint32_t num_sync_opts = sizeof(sync_opts)/sizeof(*sync_opts);
+	static int32_t selected_sync = -1;
+	if (selected_sync < 0) {
+		selected_sync = find_match(sync_opts, num_sync_opts, "system\0sync_source\0", "video");
+	}
 	const char *regions[] = {
 		"J - Japan",
 		"U - Americas",
@@ -833,6 +842,7 @@
 	uint32_t height = render_height();
 	if (nk_begin(context, "System Settings", nk_rect(0, 0, width, height), 0)) {
 		nk_layout_row_static(context, 30, width > 300 ? 300 : width, 2);
+		selected_sync = settings_dropdown(context, "Sync Source", sync_opts, num_sync_opts, selected_sync, "system\0sync_source\0");
 		settings_int_property(context, "68000 Clock Divider", "", "clocks\0m68k_divider\0", 7, 1, 53);
 		settings_toggle(context, "Remember ROM Path", "ui\0remember_path\0", 1);
 		selected_region = settings_dropdown_ex(context, "Default Region", region_codes, regions, num_regions, selected_region, "system\0default_region\0");