[GTK3] Add the new frame blending modes to the GUI

This commit is contained in:
Maximilian Mader 2020-04-10 17:45:35 +02:00
parent f1122f3c2d
commit 5208481337
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
5 changed files with 50 additions and 24 deletions

View File

@ -97,7 +97,6 @@ static const GActionEntry app_entries[] = {
{ "open_vram_viewer", activate_open_vram_viewer, NULL, NULL, NULL }, { "open_vram_viewer", activate_open_vram_viewer, NULL, NULL, NULL },
{ "preferences", activate_preferences, NULL, NULL, NULL }, { "preferences", activate_preferences, NULL, NULL, NULL },
{ "reset", activate_reset, NULL, NULL, NULL }, { "reset", activate_reset, NULL, NULL, NULL },
{ "toggle_blend_frames", NULL, NULL, "true", NULL },
{ "toggle_developer_mode", NULL, NULL, "false", NULL }, { "toggle_developer_mode", NULL, NULL, "false", NULL },
{ "change_model", NULL, "s", "@s 'CGB'", on_model_changed }, { "change_model", NULL, "s", "@s 'CGB'", on_model_changed },
{ "toggle_mute", NULL, NULL, "false", on_mute_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) { static unsigned char number_of_buffers(void) {
if (fallback_canvas) return 2; if (fallback_canvas) return 2;
// TODO: Should we cache the action? bool should_blend = get_frame_blending_mode() != GB_FRAME_BLENDING_MODE_DISABLED;
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);
return should_blend? 3 : 2; 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) { 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)); config.menubar_override = (gchar *)gtk_combo_box_get_active_id(GTK_COMBO_BOX(w));
} }

View File

@ -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_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_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_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_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_dmg_model_changed(GtkWidget *w, gpointer user_data_gptr);
G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr); G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr);

View File

@ -314,14 +314,6 @@ Author: Maximilian Mader
<attribute name="action">app.toggle_mute</attribute> <attribute name="action">app.toggle_mute</attribute>
</item> </item>
</section> </section>
<section>
<attribute name="id">emulation-section-4</attribute>
<item>
<attribute name="label" translatable="yes">Blend Frames</attribute>
<attribute name="action">app.toggle_blend_frames</attribute>
</item>
</section>
</submenu> </submenu>
<submenu> <submenu>

View File

@ -630,15 +630,10 @@ Maximilian Mader https://github.com/max-m</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton" id="aspect_ratio_toggle"> <object class="GtkLabel">
<property name="label" translatable="yes">Keep Aspect Ratio</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="receives_default">False</property> <property name="label" translatable="yes">Frame blending:</property>
<property name="margin_top">5</property>
<property name="margin_bottom">10</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_keep_aspect_ratio_changed" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -646,6 +641,25 @@ Maximilian Mader https://github.com/max-m</property>
<property name="position">4</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBoxText" id="frame_blending_selector">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">10</property>
<items>
<item id="disabled" translatable="yes">Disabled</item>
<item id="simple" translatable="yes">Simple</item>
<item id="accurate" translatable="yes">Accurate</item>
</items>
<signal name="changed" handler="on_frame_blending_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="integer_scaling_toggle"> <object class="GtkCheckButton" id="integer_scaling_toggle">
<property name="label" translatable="yes">Use Integer Scaling</property> <property name="label" translatable="yes">Use Integer Scaling</property>
@ -660,7 +674,24 @@ Maximilian Mader https://github.com/max-m</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">4</property> <property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="aspect_ratio_toggle">
<property name="label" translatable="yes">Keep Aspect Ratio</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">10</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_keep_aspect_ratio_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -671,7 +702,7 @@ Maximilian Mader https://github.com/max-m</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">6</property> <property name="position">8</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -688,7 +719,7 @@ Maximilian Mader https://github.com/max-m</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">7</property> <property name="position">9</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -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, "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, "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, "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, "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_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); gtk_combo_box_set_active_id(builder_get(GTK_COMBO_BOX, "highpass_filter_selector"), config.high_pass_filter_id);