From bb137de2efc2c414dc66cb4a8cbb28697ac1a525 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 9 Oct 2010 07:32:33 +0000 Subject: [PATCH] zzogl-pg: Add a checkbox to disable automatic hack enabling, and straighten out the way auto-enabled hacks are being done a bit. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3905 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/GSmain.cpp | 9 ++++++--- plugins/zzogl-pg/opengl/Linux/Conf.cpp | 6 ++++-- plugins/zzogl-pg/opengl/Linux/Linux.cpp | 25 +++++++++++++++++++++---- plugins/zzogl-pg/opengl/Util.h | 15 ++++++++++++--- plugins/zzogl-pg/opengl/Win32/Conf.cpp | 1 + 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index 6d5847c6bb..3c5fec8549 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -166,7 +166,7 @@ void ReportHacks(gameHacks hacks) void ListHacks() { - if (conf.def_hacks._u32 != 0) + if ((!conf.disableHacks) && (conf.def_hacks._u32 != 0)) { ZZLog::WriteLn("AutoEnabling these hacks:"); ReportHacks(conf.def_hacks); @@ -267,8 +267,11 @@ void CALLBACK GSsetGameCRC(int crc, int options) // FIXME need to check SkipDraw is positive (enabled by users) GetSkipCount_Handler = GSC_list[crc_game_list[i].title]; - conf.def_hacks._u32 |= crc_game_list[i].flags; - ListHacks(); + if (!conf.disableHacks) + { + conf.def_hacks._u32 |= crc_game_list[i].flags; + ListHacks(); + } return; } } diff --git a/plugins/zzogl-pg/opengl/Linux/Conf.cpp b/plugins/zzogl-pg/opengl/Linux/Conf.cpp index 52f95c68fa..4c008e945f 100644 --- a/plugins/zzogl-pg/opengl/Linux/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Conf.cpp @@ -28,7 +28,6 @@ void SaveConfig() { const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); - u32 tempHacks = conf.hacks._u32 & ~conf.def_hacks._u32; FILE* f = fopen(iniFile.c_str(), "w"); if (f == NULL) @@ -41,7 +40,7 @@ void SaveConfig() fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth); fprintf(f, "zzoptions = %x\n", conf.zz_options._u32); - fprintf(f, "options = %x\n", tempHacks); + fprintf(f, "options = %x\n", conf.hacks); fprintf(f, "bilinear = %hhx\n", conf.bilinear); fprintf(f, "aliasing = %hhx\n", conf.aa); fprintf(f, "width = %x\n", conf.width); @@ -50,6 +49,7 @@ void SaveConfig() fprintf(f, "y = %x\n", conf.y); fprintf(f, "log = %x\n", conf.log); fprintf(f, "skipdraw = %x\n", conf.SkipDraw); + fprintf(f, "disablehacks = %x\n", conf.disableHacks); fclose(f); } @@ -64,6 +64,7 @@ void LoadConfig() conf.SkipDraw = 0; conf.width = 800; conf.height = 600; + conf.disableHacks = 0; const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); FILE* f = fopen(iniFile.c_str(), "r"); @@ -88,6 +89,7 @@ void LoadConfig() err = fscanf(f, "y = %x\n", &conf.y); err = fscanf(f, "log = %x\n", &conf.log); err = fscanf(f, "skipdraw = %x\n", &conf.SkipDraw); + err = fscanf(f, "disablehacks = %x\n", &conf.disableHacks); fclose(f); // turn off all hacks by default diff --git a/plugins/zzogl-pg/opengl/Linux/Linux.cpp b/plugins/zzogl-pg/opengl/Linux/Linux.cpp index bcd0b3b07c..3d8baee9c6 100644 --- a/plugins/zzogl-pg/opengl/Linux/Linux.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Linux.cpp @@ -167,7 +167,16 @@ void CreateGameHackTable(GtkWidget *treeview, gameHacks hacks) { gtk_list_store_append(treestore, &treeiter);//new row itval = (hacks._u32 & it->second.value) ? true : false; - snprintf(descbuf, 254, "%s", it->second.desc); + + if (conf.def_hacks._u32 & it->second.value) + { + snprintf(descbuf, 254, "*%s", it->second.desc); + } + else + { + snprintf(descbuf, 254, "%s", it->second.desc); + } + gtk_list_store_set(treestore, &treeiter, 0, itval, 1, descbuf, -1); } @@ -260,12 +269,12 @@ void DisplayDialog() GtkWidget *main_frame, *main_box; GtkWidget *option_frame, *option_box; - GtkWidget *log_check; + GtkWidget *log_check, *dis_hacks_check; GtkWidget *int_label, *int_box, *int_holder; GtkWidget *bilinear_label, *bilinear_box, *bilinear_holder; GtkWidget *aa_label, *aa_box, *aa_holder; GtkWidget *snap_label, *snap_box, *snap_holder; - GtkWidget *fullscreen_label, *widescreen_check; + GtkWidget *fullscreen_label, *widescreen_check; GtkWidget *advanced_button; @@ -342,6 +351,9 @@ void DisplayDialog() advanced_button = gtk_button_new_with_label("Advanced..."); + dis_hacks_check = gtk_check_button_new_with_label("Disable Automatic Hacks"); + gtk_widget_set_tooltip_text(dis_hacks_check, "Used for testing how useful hacks that are on automatically are."); + #ifdef ZEROGS_DEVBUILD separator = gtk_hseparator_new(); skipdraw_label = gtk_label_new("Skipdraw:"); @@ -373,6 +385,7 @@ void DisplayDialog() gtk_box_pack_start(GTK_BOX(option_box), snap_holder, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), widescreen_check, false, false, 2); gtk_box_pack_start(GTK_BOX(option_box), advanced_button, false, false, 2); + gtk_box_pack_start(GTK_BOX(option_box), dis_hacks_check, false, false, 2); #ifdef ZEROGS_DEVBUILD gtk_box_pack_start(GTK_BOX(option_box), separator, false, false, 2); @@ -386,10 +399,11 @@ void DisplayDialog() gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_check), conf.log); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widescreen_check), (conf.widescreen())); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dis_hacks_check), (conf.disableHacks)); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), main_frame); g_signal_connect_swapped(GTK_OBJECT (advanced_button), "clicked", G_CALLBACK(DisplayAdvancedDialog), advanced_button); - tempHacks = conf.settings(); + tempHacks = conf.hacks; gtk_widget_show_all(dialog); return_value = gtk_dialog_run(GTK_DIALOG(dialog)); @@ -417,6 +431,9 @@ void DisplayDialog() conf.zz_options = fake_options; conf.hacks = tempHacks; + + conf.disableHacks = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dis_hacks_check)); + GSsetGameCRC(g_LastCRC, conf.hacks._u32); SaveConfig(); diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index 0be705a308..705bdde7df 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -224,16 +224,25 @@ typedef struct bool isWideScreen; // Widescreen support u32 SkipDraw; u32 log; + u32 disableHacks; void incAA() { aa++; if (aa > 4) aa = 0; } void decAA() { aa--; if (aa > 4) aa = 4; } // u8 is unsigned, so negative value is 255. gameHacks settings() { - gameHacks tempHack; - tempHack._u32 = (hacks._u32 | def_hacks._u32); - return tempHack; + if (disableHacks) + { + return hacks; + } + else + { + gameHacks tempHack; + tempHack._u32 = (hacks._u32 | def_hacks._u32); + return tempHack; + } } + bool fullscreen() { return !!(zz_options.fullscreen); } bool wireframe() { return !!(zz_options.wireframe); } bool widescreen() { return !!(zz_options.widescreen); } diff --git a/plugins/zzogl-pg/opengl/Win32/Conf.cpp b/plugins/zzogl-pg/opengl/Win32/Conf.cpp index 8e4918455b..1a38ba531d 100644 --- a/plugins/zzogl-pg/opengl/Win32/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Conf.cpp @@ -43,6 +43,7 @@ void LoadConfig() conf.width = 640; conf.height = 480; conf.SkipDraw = 0; + conf.disableHacks = 0; FILE *fp = fopen(iniFile.c_str(), "rt");