From 5641f26651b8c411b69eedc4a5430b300196cb0b Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sun, 29 Sep 2019 02:07:33 +0200 Subject: [PATCH] [GTK3] Fix a few problems with the settings --- gtk3/main.c | 8 ++++---- gtk3/settings.c | 10 +++++----- gtk3/settings.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gtk3/main.c b/gtk3/main.c index 87d8a5b..01cd548 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -529,7 +529,7 @@ static void startup(GApplication *app, gpointer user_data_gptr) { // setup main window main_window = GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(app))); - gtk_application_window_set_show_menubar(main_window, true); + gtk_application_window_set_show_menubar(main_window, false); // create our renderer area gl_area = GTK_GL_AREA(gtk_gl_area_new()); @@ -575,7 +575,7 @@ static void startup(GApplication *app, gpointer user_data_gptr) { } else { // Attach a custom title bar - GtkWidget *titlebar = GTK_WIDGET(gtk_builder_get_object(builder, "main_header_bar")); + GtkWidget *titlebar = gtkget(GTK_WIDGET, "main_header_bar"); gtk_window_set_titlebar(GTK_WINDOW(main_window), titlebar); // Disable menubar @@ -809,7 +809,7 @@ static void run(GApplication *app, UserData *user_data) { const guchar *boot_rom_data; gsize boot_rom_size; - if (user_data->boot_rom_path) { + if (user_data->boot_rom_path != NULL) { g_print("Trying to load boot ROM from %s\n", user_data->boot_rom_path); if (GB_load_boot_rom(&gb, user_data->boot_rom_path)) { g_printerr("Falling back to boot ROM from config\n"); @@ -843,7 +843,7 @@ static void run(GApplication *app, UserData *user_data) { break; } - if (config.boot_rom_path != NULL) { + if (config.boot_rom_path != NULL && g_strcmp0(config.boot_rom_path, "other") != 0 && g_strcmp0(config.boot_rom_path, "auto") != 0) { boot_rom_path = g_build_filename(config.boot_rom_path, boot_rom_name, NULL); g_print("Trying to load boot ROM from %s\n", boot_rom_path); diff --git a/gtk3/settings.c b/gtk3/settings.c index 1fda9c5..a583d31 100644 --- a/gtk3/settings.c +++ b/gtk3/settings.c @@ -29,9 +29,7 @@ void load_config_from_key_file(config_t *config, GKeyFile *key_file) { #define EXPAND_GROUP(name, members) \ group_name = #name; \ - if (g_key_file_has_group(key_file, group_name)) { \ - members \ - } + members #define EXPAND_GROUP_MEMBER(member, key_type, default_value) \ config->member = g_key_file_get_##key_type(key_file, group_name, #member, &error); \ @@ -148,7 +146,6 @@ int load_settings(void) { } g_error_free(error); - return -1; } load_config_from_key_file(&config, key_file); @@ -196,7 +193,10 @@ void update_boot_rom_selector(GtkBuilder *builder) { enum menubar_override get_show_menubar(void) { if (config.menubar_override == NULL) goto default_value; - if (g_strcmp0(config.menubar_override, "show") == 0) { + if (g_strcmp0(config.menubar_override, "auto") == 0) { + return MENUBAR_AUTO; + } + else if (g_strcmp0(config.menubar_override, "show") == 0) { return MENUBAR_SHOW; } else if (g_strcmp0(config.menubar_override, "hide") == 0) { diff --git a/gtk3/settings.h b/gtk3/settings.h index 9c51bf2..75988e5 100644 --- a/gtk3/settings.h +++ b/gtk3/settings.h @@ -31,13 +31,13 @@ #define EXPAND_CONFIG \ EXPAND_GROUP(Emulation, \ EXPAND_GROUP_MEMBER(boot_rom_path, string, "auto") /* overrides search location for boot ROMs by name */ \ - EXPAND_GROUP_MEMBER(rewind_duration, integer, 0) \ + EXPAND_GROUP_MEMBER(rewind_duration, integer, 10) \ EXPAND_GROUP_MEMBER(dmg_revision_name, string, "DMG_CPU_C") \ EXPAND_GROUP_MEMBER(sgb_revision_name, string, "SGB2") \ EXPAND_GROUP_MEMBER(cgb_revision_name, string, "CPU_CGB_E") \ ) \ EXPAND_GROUP(Video, \ - EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbour") \ + EXPAND_GROUP_MEMBER(shader, string, "NearestNeighbor") \ EXPAND_GROUP_MEMBER(color_correction_id, string, "emulate_hardware") \ EXPAND_GROUP_MEMBER(keep_aspect_ratio, boolean, true) \ EXPAND_GROUP_MEMBER(use_integer_scaling, boolean, true) \