gsdx-linux: Refresh the GUI

* Use table everywhere (better alignment)
* Factorize Box/Frame creation
* Factorize table insertion
* Add Anisotropic Filtering support
This commit is contained in:
Gregory Hainaut 2015-05-03 14:23:50 +02:00
parent ae70344fbc
commit c1ddad2d25
1 changed files with 199 additions and 247 deletions

View File

@ -96,7 +96,7 @@ GtkWidget* CreateInterlaceComboBox()
return combo_box; return combo_box;
} }
GtkWidget* CreateMsaaComboBox() GtkWidget* CreateFsaaComboBox()
{ {
GtkWidget *combo_box; GtkWidget *combo_box;
combo_box = gtk_combo_box_text_new (); combo_box = gtk_combo_box_text_new ();
@ -118,11 +118,35 @@ GtkWidget* CreateFilterComboBox()
GtkWidget *combo_box; GtkWidget *combo_box;
combo_box = gtk_combo_box_text_new (); combo_box = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Always Off"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Always flat");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Always On"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Always bilinear");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Normal"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "Normal");
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), theApp.GetConfig("filter", 0)); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), theApp.GetConfig("filter", 0));
gtk_widget_set_tooltip_text(combo_box, "Allow to control the texture interpolation.\nAlways flat is smoother\nAlways flat is more pixelated");
return combo_box;
}
GtkWidget* CreateAfComboBox()
{
GtkWidget *combo_box;
combo_box = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "OFF");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "2x");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "4x");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "8x");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "16x");
if (theApp.GetConfig("AnisotropicFiltering", 0)) {
int p = round(log2(theApp.GetConfig("MaxAnisotropy", 0)));
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), p);
} else {
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
}
return combo_box; return combo_box;
} }
@ -154,33 +178,38 @@ GtkWidget* CreateGlComboBox(const char* option)
return combo; return combo;
} }
static int s_table_line = 0;
static void InsertWidgetInTable(GtkWidget* table, GtkWidget *left, GtkWidget *right = NULL, GtkWidget *third = NULL) {
if (!left) {
gtk_table_attach_defaults(GTK_TABLE(table), right, 1, 2, s_table_line, s_table_line+1);
} else if (!right) {
gtk_table_attach_defaults(GTK_TABLE(table), left, 0, 1, s_table_line, s_table_line+1);
} else if (right == left) {
gtk_table_attach_defaults(GTK_TABLE(table), left, 0, 2, s_table_line, s_table_line+1);
} else {
gtk_table_attach_defaults(GTK_TABLE(table), left, 0, 1, s_table_line, s_table_line+1);
gtk_table_attach_defaults(GTK_TABLE(table), right, 1, 2, s_table_line, s_table_line+1);
}
if (third) {
gtk_table_attach_defaults(GTK_TABLE(table), third, 2, 3, s_table_line, s_table_line+1);
}
s_table_line++;
}
GtkWidget* CreateTableInBox(GtkWidget* parent_box, const char* frame_title, int row, int col) {
GtkWidget* table = gtk_table_new(row, col, false);
GtkWidget* container = (frame_title) ? gtk_frame_new (frame_title) : gtk_vbox_new(false, 5);
gtk_container_add(GTK_CONTAINER(container), table);
gtk_container_add(GTK_CONTAINER(parent_box), container);
return table;
}
bool RunLinuxDialog() bool RunLinuxDialog()
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *main_box, *central_box, *advance_box, *res_box, *hw_box, *sw_box, *shader_box;
GtkWidget *native_box, *fsaa_box, *resxy_box, *renderer_box, *interlace_box, *threads_box, *filter_box;
GtkWidget *hw_table, *shader_table, *res_frame, *hw_frame, *sw_frame, *shader_frame;
GtkWidget *interlace_combo_box, *threads_spin;
GtkWidget *interlace_label, *threads_label, *native_label, *fsaa_label, *rexy_label, *render_label, *filter_label;
GtkWidget *fsaa_combo_box, *render_combo_box, *filter_combo_box;
GtkWidget *shader, *shader_conf, *shader_label, *shader_conf_label;
GtkWidget *shadeboost_check, *paltex_check, *fba_check, *aa_check, *native_res_check, *fxaa_check, *shaderfx_check, *spin_thread_check;
GtkWidget *sb_contrast, *sb_brightness, *sb_saturation;
GtkWidget *resx_spin, *resy_spin;
GtkWidget *hack_table, *hack_skipdraw_label, *hack_box, *hack_frame;
GtkWidget *hack_alpha_check, *hack_date_check, *hack_offset_check, *hack_skipdraw_spin, *hack_sprite_check, * hack_wild_check, *hack_enble_check, *hack_logz_check, *align_sprite_check, *stretch_hack_check;
GtkWidget *hack_tco_label, *hack_tco_entry;
GtkWidget *gl_box, *gl_frame, *gl_table;
GtkWidget *notebook, *page_label[2];
int return_value; int return_value;
GdkPixbuf* logo_pixmap;
GtkWidget *logo_image;
/* Create the widgets */ /* Create the widgets */
dialog = gtk_dialog_new_with_buttons ( dialog = gtk_dialog_new_with_buttons (
"GSdx Config", "GSdx Config",
@ -191,120 +220,95 @@ bool RunLinuxDialog()
NULL); NULL);
// The main area for the whole dialog box. // The main area for the whole dialog box.
main_box = gtk_vbox_new(false, 5); GtkWidget* main_box = gtk_vbox_new(false, 5);
central_box = gtk_vbox_new(false, 5); GtkWidget* central_box = gtk_vbox_new(false, 5);
advance_box = gtk_vbox_new(false, 5); GtkWidget* advance_box = gtk_vbox_new(false, 5);
// The Internal resolution frame and container.
res_box = gtk_vbox_new(false, 5);
res_frame = gtk_frame_new ("OpenGL Internal Resolution (can cause glitches)");
gtk_container_add(GTK_CONTAINER(res_frame), res_box);
// The extra shader setting frame/container/table
shader_box = gtk_vbox_new(false, 5);
shader_frame = gtk_frame_new("Custom Shader Settings");
gtk_container_add(GTK_CONTAINER(shader_frame), shader_box);
shader_table = gtk_table_new(8,2, false);
gtk_container_add(GTK_CONTAINER(shader_box), shader_table);
// The hardware mode frame, container, and table.
hw_box = gtk_vbox_new(false, 5);
hw_frame = gtk_frame_new ("Hardware Mode Settings");
gtk_container_add(GTK_CONTAINER(hw_frame), hw_box);
hw_table = gtk_table_new(5,2, false);
gtk_container_add(GTK_CONTAINER(hw_box), hw_table);
// The software mode frame and container. (It doesn't have enough in it for a table.)
sw_box = gtk_vbox_new(false, 5);
sw_frame = gtk_frame_new ("Software Mode Settings");
gtk_container_add(GTK_CONTAINER(sw_frame), sw_box);
// The hack frame and container.
hack_box = gtk_hbox_new(false, 5);
hack_frame = gtk_frame_new ("Hacks");
gtk_container_add(GTK_CONTAINER(hack_frame), hack_box);
hack_table = gtk_table_new(3,3, false);
gtk_container_add(GTK_CONTAINER(hack_box), hack_table);
// Grab a logo, to make things look nice. // Grab a logo, to make things look nice.
logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL); GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL);
logo_image = gtk_image_new_from_pixbuf(logo_pixmap); GtkWidget* logo_image = gtk_image_new_from_pixbuf(logo_pixmap);
gtk_box_pack_start(GTK_BOX(main_box), logo_image, true, true, 0); gtk_box_pack_start(GTK_BOX(main_box), logo_image, true, true, 0);
// Create the renderer combo box and label, and stash them in a box. GtkWidget* main_table = CreateTableInBox(main_box , NULL , 2 , 2);
render_label = gtk_label_new ("Renderer:");
render_combo_box = CreateRenderComboBox();
renderer_box = gtk_hbox_new(false, 5);
// Use gtk_box_pack_start instead of gtk_container_add so it lines up nicely.
gtk_box_pack_start(GTK_BOX(renderer_box), render_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(renderer_box), render_combo_box, false, false, 5);
// Create the interlace combo box and label, and stash them in a box. GtkWidget* res_table = CreateTableInBox(central_box , "OpenGL Internal Resolution" , 3 , 3);
interlace_label = gtk_label_new ("Interlacing (F5):"); GtkWidget* shader_table = CreateTableInBox(central_box , "Custom Shader Settings" , 8 , 2);
interlace_combo_box = CreateInterlaceComboBox(); GtkWidget* hw_table = CreateTableInBox(central_box , "Hardware Mode Settings" , 5 , 2);
interlace_box = gtk_hbox_new(false, 5); GtkWidget* sw_table = CreateTableInBox(central_box , "Software Mode Settings" , 5 , 2);
gtk_box_pack_start(GTK_BOX(interlace_box), interlace_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(interlace_box), interlace_combo_box, false, false, 5);
// Create the filter combo box. GtkWidget* hack_table = CreateTableInBox(advance_box , "Hacks" , 7 , 2);
filter_label = gtk_label_new ("Force Texture Filtering:"); GtkWidget* gl_table = CreateTableInBox(advance_box , "OpenGL Very Advanced Custom Settings" , 10 , 2);
filter_combo_box = CreateFilterComboBox();
filter_box = gtk_hbox_new(false, 5);
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(filter_box), filter_combo_box, false, false, 0);
// Create the threading spin box and label, and stash them in a box. (Yes, we do a lot of that.) // Main
threads_label = gtk_label_new("Extra rendering threads:"); GtkWidget* render_label = gtk_label_new ("Renderer:");
threads_spin = gtk_spin_button_new_with_range(0,100,1); GtkWidget* render_combo_box = CreateRenderComboBox();
GtkWidget* interlace_label = gtk_label_new ("Interlacing (F5):");
GtkWidget* interlace_combo_box = CreateInterlaceComboBox();
s_table_line = 0;
InsertWidgetInTable(main_table, render_label, render_combo_box);
InsertWidgetInTable(main_table, interlace_label, interlace_combo_box);
// HW
GtkWidget* filter_label = gtk_label_new ("Texture Filtering:");
GtkWidget* filter_combo_box = CreateFilterComboBox();
GtkWidget* af_label = gtk_label_new("Anisotropic Filtering:");
GtkWidget* af_combo_box = CreateAfComboBox();
GtkWidget* paltex_check = gtk_check_button_new_with_label("Allow 8 bits textures");
GtkWidget* fba_check = gtk_check_button_new_with_label("Alpha correction (FBA)");
s_table_line = 0;
InsertWidgetInTable(hw_table, filter_label, filter_combo_box);
InsertWidgetInTable(hw_table, af_label, af_combo_box);
InsertWidgetInTable(hw_table, paltex_check, fba_check);
// SW
GtkWidget* threads_label = gtk_label_new("Extra rendering threads:");
GtkWidget* threads_spin = gtk_spin_button_new_with_range(0,100,1);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(threads_spin), theApp.GetConfig("extrathreads", 0)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(threads_spin), theApp.GetConfig("extrathreads", 0));
threads_box = gtk_hbox_new(false, 0);
gtk_box_pack_start(GTK_BOX(threads_box), threads_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(threads_box), threads_spin, false, false, 5);
// A bit of funkiness for the resolution box. GtkWidget* aa_check = gtk_check_button_new_with_label("Edge anti-aliasing (AA1)");
native_label = gtk_label_new("Original PS2 Resolution: "); GtkWidget* spin_thread_check= gtk_check_button_new_with_label("Disable thread sleeping (6+ cores CPU)");
native_res_check = gtk_check_button_new_with_label("Native");
native_box = gtk_hbox_new(false, 5);
gtk_box_pack_start(GTK_BOX(native_box), native_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(native_box), native_res_check, false, false, 5);
fsaa_label = gtk_label_new("Or Use Scaling:"); s_table_line = 0;
fsaa_combo_box = CreateMsaaComboBox(); InsertWidgetInTable(sw_table , threads_label , threads_spin);
fsaa_box = gtk_hbox_new(false, 5); InsertWidgetInTable(sw_table , aa_check);
gtk_box_pack_start(GTK_BOX(fsaa_box), fsaa_label, false, false, 5); InsertWidgetInTable(sw_table , spin_thread_check , spin_thread_check);
gtk_box_pack_start(GTK_BOX(fsaa_box), fsaa_combo_box, false, false, 5);
rexy_label = gtk_label_new("Custom Resolution:"); // Resolution
resx_spin = gtk_spin_button_new_with_range(256,8192,1); GtkWidget* native_label = gtk_label_new("Original PS2 Resolution: ");
GtkWidget* native_res_check = gtk_check_button_new_with_label("Native");
GtkWidget* fsaa_label = gtk_label_new("Or Use Scaling:");
GtkWidget* fsaa_combo_box = CreateFsaaComboBox();
GtkWidget* resxy_label = gtk_label_new("Custom Resolution:");
GtkWidget* resx_spin = gtk_spin_button_new_with_range(256,8192,1);
GtkWidget* resy_spin = gtk_spin_button_new_with_range(256,8192,1);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(resx_spin), theApp.GetConfig("resx", 1024)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(resx_spin), theApp.GetConfig("resx", 1024));
resy_spin = gtk_spin_button_new_with_range(256,8192,1);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(resy_spin), theApp.GetConfig("resy", 1024)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(resy_spin), theApp.GetConfig("resy", 1024));
resxy_box = gtk_hbox_new(false, 5);
gtk_box_pack_start(GTK_BOX(resxy_box), rexy_label, false, false, 5);
gtk_box_pack_start(GTK_BOX(resxy_box), resx_spin, false, false, 5);
gtk_box_pack_start(GTK_BOX(resxy_box), resy_spin, false, false, 5);
s_table_line = 0;
// shader fx entry InsertWidgetInTable(res_table, native_label, native_res_check);
shader = gtk_file_chooser_button_new("Select an external shader", GTK_FILE_CHOOSER_ACTION_OPEN); InsertWidgetInTable(res_table, fsaa_label, fsaa_combo_box);
shader_conf = gtk_file_chooser_button_new("Then select a config", GTK_FILE_CHOOSER_ACTION_OPEN); InsertWidgetInTable(res_table, resxy_label, resx_spin, resy_spin);
shader_label = gtk_label_new("External shader glsl");
shader_conf_label = gtk_label_new("External shader conf");
// Create our hack settings. // Create our hack settings.
hack_alpha_check = gtk_check_button_new_with_label("Alpha Hack"); GtkWidget* hack_alpha_check = gtk_check_button_new_with_label("Alpha Hack");
hack_date_check = gtk_check_button_new_with_label("Date Hack"); GtkWidget* hack_date_check = gtk_check_button_new_with_label("Date Hack");
hack_offset_check = gtk_check_button_new_with_label("Offset Hack"); GtkWidget* hack_offset_check = gtk_check_button_new_with_label("Offset Hack");
hack_skipdraw_label = gtk_label_new("Skipdraw:"); GtkWidget* hack_skipdraw_label = gtk_label_new("Skipdraw:");
hack_skipdraw_spin = gtk_spin_button_new_with_range(0,1000,1); GtkWidget* hack_skipdraw_spin = gtk_spin_button_new_with_range(0,1000,1);
hack_enble_check = gtk_check_button_new_with_label("Enable User Hacks"); GtkWidget* hack_enble_check = gtk_check_button_new_with_label("Enable User Hacks");
hack_wild_check = gtk_check_button_new_with_label("Wild arm Hack"); GtkWidget* hack_wild_check = gtk_check_button_new_with_label("Wild arm Hack");
hack_sprite_check = gtk_check_button_new_with_label("Sprite Hack"); GtkWidget* hack_sprite_check = gtk_check_button_new_with_label("Sprite Hack");
hack_tco_label = gtk_label_new("Texture Offset: 0x"); GtkWidget* hack_tco_label = gtk_label_new("Texture Offset: 0x");
hack_tco_entry = gtk_entry_new(); GtkWidget* hack_tco_entry = gtk_entry_new();
hack_logz_check = gtk_check_button_new_with_label("Log Depth Hack"); GtkWidget* hack_logz_check = gtk_check_button_new_with_label("Log Depth Hack");
align_sprite_check = gtk_check_button_new_with_label("Anti vertical line hack"); GtkWidget* align_sprite_check = gtk_check_button_new_with_label("Anti vertical line hack");
stretch_hack_check = gtk_check_button_new_with_label("Improve 2D sprite scaling accuracy"); GtkWidget* stretch_hack_check = gtk_check_button_new_with_label("Improve 2D sprite scaling accuracy");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(hack_skipdraw_spin), theApp.GetConfig("UserHacks_SkipDraw", 0)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(hack_skipdraw_spin), theApp.GetConfig("UserHacks_SkipDraw", 0));
set_hex_entry(hack_tco_entry, theApp.GetConfig("UserHacks_TCOffset", 0)); set_hex_entry(hack_tco_entry, theApp.GetConfig("UserHacks_TCOffset", 0));
@ -320,86 +324,54 @@ bool RunLinuxDialog()
gtk_widget_set_tooltip_text(hack_sprite_check, dialog_message(IDC_SPRITEHACK)); gtk_widget_set_tooltip_text(hack_sprite_check, dialog_message(IDC_SPRITEHACK));
gtk_widget_set_tooltip_text(hack_tco_label, dialog_message(IDC_TCOFFSETX)); gtk_widget_set_tooltip_text(hack_tco_label, dialog_message(IDC_TCOFFSETX));
gtk_widget_set_tooltip_text(hack_tco_entry, dialog_message(IDC_TCOFFSETX)); gtk_widget_set_tooltip_text(hack_tco_entry, dialog_message(IDC_TCOFFSETX));
gtk_widget_set_tooltip_text(hack_logz_check, "Use a logarithm depth instead of a linear depth"); gtk_widget_set_tooltip_text(hack_logz_check, "Use a logarithm depth instead of a linear depth (superseeded by ARB_clip_control)");
gtk_widget_set_tooltip_text(align_sprite_check, dialog_message(IDC_ALIGN_SPRITE)); gtk_widget_set_tooltip_text(align_sprite_check, dialog_message(IDC_ALIGN_SPRITE));
gtk_widget_set_tooltip_text(stretch_hack_check, dialog_message(IDC_STRETCH_SPRITE)); gtk_widget_set_tooltip_text(stretch_hack_check, dialog_message(IDC_STRETCH_SPRITE));
// Tables are strange. The numbers are for their position: left, right, top, bottom. // Tables are strange. The numbers are for their position: left, right, top, bottom.
int l = 0; s_table_line = 0;
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_enble_check, 0, 1, l, l+1); InsertWidgetInTable(hack_table , hack_enble_check);
l++; InsertWidgetInTable(hack_table , hack_alpha_check , hack_offset_check);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_alpha_check, 0, 1, l, l+1); InsertWidgetInTable(hack_table , hack_sprite_check , hack_wild_check);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_offset_check, 1, 2, l, l+1); InsertWidgetInTable(hack_table , hack_logz_check , hack_date_check);
l++; InsertWidgetInTable(hack_table , stretch_hack_check , align_sprite_check);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_sprite_check, 0, 1, l, l+1); InsertWidgetInTable(hack_table , hack_skipdraw_label , hack_skipdraw_spin);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_wild_check , 1, 2, l, l+1); InsertWidgetInTable(hack_table , hack_tco_label , hack_tco_entry);
l++;
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_logz_check, 0, 1, l, l+1);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_date_check, 1, 2, l, l+1);
l++;
gtk_table_attach_defaults(GTK_TABLE(hack_table), stretch_hack_check, 0, 1, l, l+1);
gtk_table_attach_defaults(GTK_TABLE(hack_table), align_sprite_check, 1, 2, l, l+1);
l++;
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_skipdraw_label, 0, 1, l, l+1);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_skipdraw_spin , 1, 2, l, l+1);
l++;
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_tco_label, 0, 1, l, l+1);
gtk_table_attach_defaults(GTK_TABLE(hack_table), hack_tco_entry, 1, 2, l, l+1);
// Create our checkboxes. // shader
shadeboost_check = gtk_check_button_new_with_label("Shade boost"); GtkWidget* shader = gtk_file_chooser_button_new("Select an external shader", GTK_FILE_CHOOSER_ACTION_OPEN);
paltex_check = gtk_check_button_new_with_label("Allow 8 bits textures"); GtkWidget* shader_conf = gtk_file_chooser_button_new("Then select a config", GTK_FILE_CHOOSER_ACTION_OPEN);
fba_check = gtk_check_button_new_with_label("Alpha correction (FBA)"); GtkWidget* shader_label = gtk_label_new("External shader glsl");
aa_check = gtk_check_button_new_with_label("Edge anti-aliasing (AA1)"); GtkWidget* shader_conf_label = gtk_label_new("External shader conf");
spin_thread_check= gtk_check_button_new_with_label("Disable thread sleeping (6+ cores CPU)");
fxaa_check = gtk_check_button_new_with_label("Fxaa shader");
shaderfx_check = gtk_check_button_new_with_label("External shader");
// Set the checkboxes. GtkWidget* shadeboost_check = gtk_check_button_new_with_label("Shade boost");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shadeboost_check), theApp.GetConfig("shadeboost", 1)); GtkWidget* fxaa_check = gtk_check_button_new_with_label("Fxaa shader");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paltex_check), theApp.GetConfig("paltex", 0)); GtkWidget* shaderfx_check = gtk_check_button_new_with_label("External shader");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fba_check), theApp.GetConfig("fba", 1));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(aa_check), theApp.GetConfig("aa1", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(spin_thread_check), theApp.GetConfig("spin_thread", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fxaa_check), theApp.GetConfig("fxaa", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shaderfx_check), theApp.GetConfig("shaderfx", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(native_res_check), theApp.GetConfig("nativeres", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stretch_hack_check), theApp.GetConfig("UserHacks_round_sprite_offset", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(align_sprite_check), theApp.GetConfig("UserHacks_align_sprite_X", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_alpha_check), theApp.GetConfig("UserHacks_AlphaHack", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_offset_check), theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_date_check), theApp.GetConfig("UserHacks_DateGL4", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_enble_check), theApp.GetConfig("UserHacks", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_wild_check), theApp.GetConfig("UserHacks_WildHack", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_sprite_check), theApp.GetConfig("UserHacks_SpriteHack", 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_logz_check), theApp.GetConfig("logz", 1));
// Shadeboost scale // Shadeboost scale
#if GTK_MAJOR_VERSION < 3 #if GTK_MAJOR_VERSION < 3
sb_brightness = gtk_hscale_new_with_range(0, 200, 10); GtkWidget* sb_brightness = gtk_hscale_new_with_range(0, 200, 10);
#else #else
sb_brightness = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10); GtkWidget* sb_brightness = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10);
#endif #endif
GtkWidget* sb_brightness_label = gtk_label_new("Shade Boost Brightness"); GtkWidget* sb_brightness_label = gtk_label_new("Shade Boost Brightness");
gtk_scale_set_value_pos(GTK_SCALE(sb_brightness), GTK_POS_RIGHT); gtk_scale_set_value_pos(GTK_SCALE(sb_brightness), GTK_POS_RIGHT);
gtk_range_set_value(GTK_RANGE(sb_brightness), theApp.GetConfig("ShadeBoost_Brightness", 50)); gtk_range_set_value(GTK_RANGE(sb_brightness), theApp.GetConfig("ShadeBoost_Brightness", 50));
#if GTK_MAJOR_VERSION < 3 #if GTK_MAJOR_VERSION < 3
sb_contrast = gtk_hscale_new_with_range(0, 200, 10); GtkWidget* sb_contrast = gtk_hscale_new_with_range(0, 200, 10);
#else #else
sb_contrast = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10); GtkWidget* sb_contrast = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10);
#endif #endif
GtkWidget* sb_contrast_label = gtk_label_new("Shade Boost Contrast"); GtkWidget* sb_contrast_label = gtk_label_new("Shade Boost Contrast");
gtk_scale_set_value_pos(GTK_SCALE(sb_contrast), GTK_POS_RIGHT); gtk_scale_set_value_pos(GTK_SCALE(sb_contrast), GTK_POS_RIGHT);
gtk_range_set_value(GTK_RANGE(sb_contrast), theApp.GetConfig("ShadeBoost_Contrast", 50)); gtk_range_set_value(GTK_RANGE(sb_contrast), theApp.GetConfig("ShadeBoost_Contrast", 50));
#if GTK_MAJOR_VERSION < 3 #if GTK_MAJOR_VERSION < 3
sb_saturation = gtk_hscale_new_with_range(0, 200, 10); GtkWidget* sb_saturation = gtk_hscale_new_with_range(0, 200, 10);
#else #else
sb_saturation = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10); GtkWidget* sb_saturation = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 200, 10);
#endif #endif
GtkWidget* sb_saturation_label = gtk_label_new("Shade Boost Saturation"); GtkWidget* sb_saturation_label = gtk_label_new("Shade Boost Saturation");
gtk_scale_set_value_pos(GTK_SCALE(sb_saturation), GTK_POS_RIGHT); gtk_scale_set_value_pos(GTK_SCALE(sb_saturation), GTK_POS_RIGHT);
@ -409,42 +381,17 @@ bool RunLinuxDialog()
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(shader), theApp.GetConfig("shaderfx_glsl", "dummy.glsl").c_str()); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(shader), theApp.GetConfig("shaderfx_glsl", "dummy.glsl").c_str());
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(shader_conf), theApp.GetConfig("shaderfx_conf", "dummy.ini").c_str()); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(shader_conf), theApp.GetConfig("shaderfx_conf", "dummy.ini").c_str());
// Populate all those boxes we created earlier with widgets. s_table_line = 0;
gtk_container_add(GTK_CONTAINER(res_box), native_box); InsertWidgetInTable(shader_table , fxaa_check);
gtk_container_add(GTK_CONTAINER(res_box), fsaa_box); InsertWidgetInTable(shader_table , shadeboost_check);
gtk_container_add(GTK_CONTAINER(res_box), resxy_box); InsertWidgetInTable(shader_table , sb_brightness_label , sb_brightness);
InsertWidgetInTable(shader_table , sb_contrast_label , sb_contrast);
gtk_container_add(GTK_CONTAINER(sw_box), threads_box); InsertWidgetInTable(shader_table , sb_saturation_label , sb_saturation);
gtk_container_add(GTK_CONTAINER(sw_box), aa_check); InsertWidgetInTable(shader_table , shaderfx_check);
gtk_container_add(GTK_CONTAINER(sw_box), spin_thread_check); InsertWidgetInTable(shader_table , shader_label , shader);
InsertWidgetInTable(shader_table , shader_conf_label , shader_conf);
// Tables are strange. The numbers are for their position: left, right, top, bottom.
gtk_table_attach_defaults(GTK_TABLE(shader_table), fxaa_check, 0, 1, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shadeboost_check, 0, 1, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_brightness_label, 0, 1, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_brightness, 1, 2, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_contrast_label, 0, 1, 3, 4);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_contrast, 1, 2, 3, 4);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_saturation_label, 0, 1, 4, 5);
gtk_table_attach_defaults(GTK_TABLE(shader_table), sb_saturation, 1, 2, 4, 5);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shaderfx_check, 0, 1, 5, 6);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shader_label, 0, 1, 6, 7);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shader, 1, 2, 6, 7);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shader_conf_label, 0, 1, 7, 8);
gtk_table_attach_defaults(GTK_TABLE(shader_table), shader_conf, 1, 2, 7, 8);
// Tables are strange. The numbers are for their position: left, right, top, bottom.
gtk_table_attach_defaults(GTK_TABLE(hw_table), filter_box, 0, 1, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(hw_table), paltex_check, 0, 1, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(hw_table), fba_check, 1, 2, 1, 2);
// The GL advance options // The GL advance options
gl_box = gtk_vbox_new(false, 5);
gl_frame = gtk_frame_new ("OpenGL Very Advanced Custom Settings");
gtk_container_add(GTK_CONTAINER(gl_frame), gl_box);
gl_table = gtk_table_new(10, 2, false);
gtk_container_add(GTK_CONTAINER(gl_box), gl_table);
GtkWidget* gl_bs_label = gtk_label_new("Buffer Storage:"); GtkWidget* gl_bs_label = gtk_label_new("Buffer Storage:");
GtkWidget* gl_bs_combo = CreateGlComboBox("override_GL_ARB_buffer_storage"); GtkWidget* gl_bs_combo = CreateGlComboBox("override_GL_ARB_buffer_storage");
GtkWidget* gl_bt_label = gtk_label_new("Bindless Texture:"); GtkWidget* gl_bt_label = gtk_label_new("Bindless Texture:");
@ -462,32 +409,20 @@ bool RunLinuxDialog()
GtkWidget* gl_tb_label = gtk_label_new("Texture Barrier:"); GtkWidget* gl_tb_label = gtk_label_new("Texture Barrier:");
GtkWidget* gl_tb_combo = CreateGlComboBox("override_GL_ARB_texture_barrier"); GtkWidget* gl_tb_combo = CreateGlComboBox("override_GL_ARB_texture_barrier");
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_gs_label, 0, 1, 0, 1); s_table_line = 0;
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_gs_combo, 1, 2, 0, 1); InsertWidgetInTable(gl_table , gl_gs_label , gl_gs_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_bs_label, 0, 1, 1, 2); InsertWidgetInTable(gl_table , gl_bs_label , gl_bs_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_bs_combo, 1, 2, 1, 2); InsertWidgetInTable(gl_table , gl_bt_label , gl_bt_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_bt_label, 0, 1, 2, 3); InsertWidgetInTable(gl_table , gl_sso_label , gl_sso_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_bt_combo, 1, 2, 2, 3); InsertWidgetInTable(gl_table , gl_ss_label , gl_ss_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_sso_label, 0, 1, 3, 4); InsertWidgetInTable(gl_table , gl_ils_label , gl_ils_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_sso_combo, 1, 2, 3, 4); InsertWidgetInTable(gl_table , gl_cc_label , gl_cc_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_ss_label, 0, 1, 4, 5); InsertWidgetInTable(gl_table , gl_tb_label , gl_tb_combo);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_ss_combo, 1, 2, 4, 5);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_ils_label, 0, 1, 5, 6);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_ils_combo, 1, 2, 5, 6);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_cc_label, 0, 1, 6, 7);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_cc_combo, 1, 2, 6, 7);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_tb_label, 0, 1, 7, 8);
gtk_table_attach_defaults(GTK_TABLE(gl_table), gl_tb_combo, 1, 2, 7, 8);
// those one are properly detected so no need a gui
#if 0
override_GL_ARB_copy_image = -1
override_GL_ARB_explicit_uniform_location = -1
override_GL_ARB_gpu_shader5 = -1
override_GL_ARB_shading_language_420pack = -1
#endif
// Handle some nice tab // Handle some nice tab
notebook = gtk_notebook_new();
GtkWidget* notebook = gtk_notebook_new();
GtkWidget* page_label[2];
page_label[0] = gtk_label_new("Global Setting"); page_label[0] = gtk_label_new("Global Setting");
page_label[1] = gtk_label_new("Advance Setting"); page_label[1] = gtk_label_new("Advance Setting");
@ -495,25 +430,36 @@ override_GL_ARB_shading_language_420pack = -1
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advance_box, page_label[1]); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advance_box, page_label[1]);
// Put everything in the big box. // Put everything in the big box.
gtk_container_add(GTK_CONTAINER(main_box), renderer_box);
gtk_container_add(GTK_CONTAINER(main_box), interlace_box);
gtk_container_add(GTK_CONTAINER(main_box), notebook); gtk_container_add(GTK_CONTAINER(main_box), notebook);
gtk_container_add(GTK_CONTAINER(central_box), res_frame); { // Set current value of checkboxes.
gtk_container_add(GTK_CONTAINER(central_box), shader_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shadeboost_check) , theApp.GetConfig("shadeboost" , 1));
gtk_container_add(GTK_CONTAINER(central_box), hw_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paltex_check) , theApp.GetConfig("paltex" , 0));
gtk_container_add(GTK_CONTAINER(central_box), sw_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fba_check) , theApp.GetConfig("fba" , 1));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(aa_check) , theApp.GetConfig("aa1" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(spin_thread_check) , theApp.GetConfig("spin_thread" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fxaa_check) , theApp.GetConfig("fxaa" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shaderfx_check) , theApp.GetConfig("shaderfx" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(native_res_check) , theApp.GetConfig("nativeres" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stretch_hack_check) , theApp.GetConfig("UserHacks_round_sprite_offset" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(align_sprite_check) , theApp.GetConfig("UserHacks_align_sprite_X" , 0));
gtk_container_add(GTK_CONTAINER(advance_box), hack_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_alpha_check) , theApp.GetConfig("UserHacks_AlphaHack" , 0));
gtk_container_add(GTK_CONTAINER(advance_box), gl_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_offset_check) , theApp.GetConfig("UserHacks_HalfPixelOffset" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_date_check) , theApp.GetConfig("UserHacks_DateGL4" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_enble_check) , theApp.GetConfig("UserHacks" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_wild_check) , theApp.GetConfig("UserHacks_WildHack" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_sprite_check) , theApp.GetConfig("UserHacks_SpriteHack" , 0));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hack_logz_check) , theApp.GetConfig("logz" , 1));
}
// Put the box in the dialog and show it to the world. // Put the box in the dialog and show it to the world.
gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_box); gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_box);
gtk_widget_show_all (dialog); gtk_widget_show_all (dialog);
return_value = gtk_dialog_run (GTK_DIALOG (dialog)); return_value = gtk_dialog_run (GTK_DIALOG (dialog));
if (return_value == GTK_RESPONSE_ACCEPT) if (return_value == GTK_RESPONSE_ACCEPT) {
{
int mode_height = 0, mode_width = 0; int mode_height = 0, mode_width = 0;
mode_width = theApp.GetConfig("ModeWidth", 640); mode_width = theApp.GetConfig("ModeWidth", 640);
@ -532,7 +478,7 @@ override_GL_ARB_shading_language_420pack = -1
case 4: theApp.SetConfig("renderer", 13); break; case 4: theApp.SetConfig("renderer", 13); break;
case 5: theApp.SetConfig("renderer", 17); break; case 5: theApp.SetConfig("renderer", 17); break;
// Fallback to SW opengl // Fallback to SW opengl
default: theApp.SetConfig("renderer", 13); break; default: theApp.SetConfig("renderer", 13); break;
} }
} }
@ -540,6 +486,12 @@ override_GL_ARB_shading_language_420pack = -1
if (gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) != -1) if (gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) != -1)
theApp.SetConfig( "interlace", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box))); theApp.SetConfig( "interlace", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)));
if (gtk_combo_box_get_active(GTK_COMBO_BOX(af_combo_box)) != -1) {
int af = gtk_combo_box_get_active(GTK_COMBO_BOX(af_combo_box));
theApp.SetConfig("AnisotropicFiltering", (af) ? 1 : 0);
theApp.SetConfig("MaxAnisotropy", round(exp2(af)));
}
theApp.SetConfig("extrathreads", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(threads_spin))); theApp.SetConfig("extrathreads", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(threads_spin)));
theApp.SetConfig("filter", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(filter_combo_box))); theApp.SetConfig("filter", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(filter_combo_box)));