From 5208481337880d438bcb0e1a1fc03bc072a42a86 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Fri, 10 Apr 2020 17:45:35 +0200 Subject: [PATCH] [GTK3] Add the new frame blending modes to the GUI --- gtk3/main.c | 11 ++++--- gtk3/main.h | 1 + gtk3/resources/gtk/menus-common.ui | 8 ----- gtk3/resources/ui/window.ui | 53 +++++++++++++++++++++++------- gtk3/settings.c | 1 + 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/gtk3/main.c b/gtk3/main.c index 389f6cf..95adc55 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -97,7 +97,6 @@ static const GActionEntry app_entries[] = { { "open_vram_viewer", activate_open_vram_viewer, NULL, NULL, NULL }, { "preferences", activate_preferences, NULL, NULL, NULL }, { "reset", activate_reset, NULL, NULL, NULL }, - { "toggle_blend_frames", NULL, NULL, "true", NULL }, { "toggle_developer_mode", NULL, NULL, "false", NULL }, { "change_model", NULL, "s", "@s 'CGB'", on_model_changed }, { "toggle_mute", NULL, NULL, "false", on_mute_changed }, @@ -713,10 +712,7 @@ static gboolean is_separator(GtkTreeModel *model, GtkTreeIter *iter, gpointer da static unsigned char number_of_buffers(void) { if (fallback_canvas) return 2; - // TODO: Should we cache the action? - GAction *action = g_action_map_lookup_action(G_ACTION_MAP(main_application), "toggle_blend_frames"); - GVariant *value = g_action_get_state(action); - gboolean should_blend = g_variant_get_boolean(value); + bool should_blend = get_frame_blending_mode() != GB_FRAME_BLENDING_MODE_DISABLED; return should_blend? 3 : 2; } @@ -1560,6 +1556,11 @@ G_MODULE_EXPORT void on_color_correction_changed(GtkWidget *w, gpointer user_dat } } +G_MODULE_EXPORT void on_frame_blending_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + config.frame_blending_mode = (gchar *)gtk_combo_box_get_active_id(box); +} + G_MODULE_EXPORT void on_color_menubar_override_changed(GtkWidget *w, gpointer user_data_gptr) { config.menubar_override = (gchar *)gtk_combo_box_get_active_id(GTK_COMBO_BOX(w)); } diff --git a/gtk3/main.h b/gtk3/main.h index cb22790..1e141fd 100644 --- a/gtk3/main.h +++ b/gtk3/main.h @@ -140,6 +140,7 @@ static void on_vram_tab_change(GtkWidget *widget, GParamSpec *pspec, GtkStackSwi G_MODULE_EXPORT void on_boot_rom_location_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_cgb_model_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_color_correction_changed(GtkWidget *w, gpointer user_data_gptr); +G_MODULE_EXPORT void on_frame_blending_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_color_menubar_override_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_dmg_model_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr); diff --git a/gtk3/resources/gtk/menus-common.ui b/gtk3/resources/gtk/menus-common.ui index c3b5c3f..3e76c6c 100644 --- a/gtk3/resources/gtk/menus-common.ui +++ b/gtk3/resources/gtk/menus-common.ui @@ -314,14 +314,6 @@ Author: Maximilian Mader app.toggle_mute - -
- emulation-section-4 - - Blend Frames - app.toggle_blend_frames - -
diff --git a/gtk3/resources/ui/window.ui b/gtk3/resources/ui/window.ui index 42f430c..4e23630 100644 --- a/gtk3/resources/ui/window.ui +++ b/gtk3/resources/ui/window.ui @@ -630,15 +630,10 @@ Maximilian Mader https://github.com/max-m - - Keep Aspect Ratio + True - True - False - 5 - 10 - True - + False + Frame blending: False @@ -646,6 +641,25 @@ Maximilian Mader https://github.com/max-m 4 + + + True + False + 5 + 10 + + Disabled + Simple + Accurate + + + + + False + True + 5 + + Use Integer Scaling @@ -660,7 +674,24 @@ Maximilian Mader https://github.com/max-m False True - 4 + 6 + + + + + Keep Aspect Ratio + True + True + False + 5 + 10 + True + + + + False + True + 7 @@ -671,7 +702,7 @@ Maximilian Mader https://github.com/max-m False True - 6 + 8 @@ -688,7 +719,7 @@ Maximilian Mader https://github.com/max-m False True - 7 + 9 diff --git a/gtk3/settings.c b/gtk3/settings.c index b68a078..d9784cf 100644 --- a/gtk3/settings.c +++ b/gtk3/settings.c @@ -108,6 +108,7 @@ void on_preferences_realize(GtkWidget *w, gpointer builder_ptr) { gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "cgb_revision_selector"), config.cgb_revision_name); gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "shader_selector"), config.shader); gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "color_correction_selector"), config.color_correction_id); + gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "frame_blending_selector"), config.frame_blending_mode); gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "integer_scaling_toggle"), config.use_integer_scaling); gtk_toggle_button_set_active(builder_get(GTK_TOGGLE_BUTTON, "aspect_ratio_toggle"), config.keep_aspect_ratio); gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "highpass_filter_selector"), config.high_pass_filter_id);