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
This commit is contained in:
arcum42 2010-10-09 07:32:33 +00:00
parent c1c2866c1b
commit bb137de2ef
5 changed files with 44 additions and 12 deletions

View File

@ -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];
if (!conf.disableHacks)
{
conf.def_hacks._u32 |= crc_game_list[i].flags;
ListHacks();
}
return;
}
}

View File

@ -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

View File

@ -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;
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,7 +269,7 @@ 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;
@ -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();

View File

@ -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()
{
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); }

View File

@ -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");