zzogl-pg: Revamp configuration code. (Likely breaks Windows. I'll take care of that. Also, you may need to reset a few settings in ZZOgl after this commit...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3232 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-06-19 08:46:40 +00:00
parent 9f21cc3dcd
commit 328d046d6c
18 changed files with 191 additions and 184 deletions

View File

@ -37,7 +37,7 @@ enum GAME_HACK_OPTIONS
GAME_NOLOGZ = 0x20000000 // Intended for linux -- not logarithmic Z. GAME_NOLOGZ = 0x20000000 // Intended for linux -- not logarithmic Z.
}; };
#define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST)) #define USEALPHATESTING (!(conf.settings().no_alpha_test))
// CRC Information // CRC Information
enum Title_Info enum Title_Info

View File

@ -282,7 +282,6 @@ struct Vertex
u16 u, v; u16 u, v;
}; };
extern int g_GameSettings;
extern GSconf conf; extern GSconf conf;
extern int ppf; extern int ppf;

View File

@ -60,7 +60,6 @@ int g_TransferredToGPU = 0;
std::string s_strIniPath("inis/"); // Air's new ini path (r2361) std::string s_strIniPath("inis/"); // Air's new ini path (r2361)
std::string s_strLogPath("logs/"); std::string s_strLogPath("logs/");
int g_GameSettings = 0;
int CurrentSavestate = 0; // Number of SaveSlot. Default is 0 int CurrentSavestate = 0; // Number of SaveSlot. Default is 0
bool SaveStateExists = true; // We could not know save slot status before first change occured bool SaveStateExists = true; // We could not know save slot status before first change occured
const char* SaveStateFile = NULL; // Name of SaveFile for access check. const char* SaveStateFile = NULL; // Name of SaveFile for access check.
@ -368,15 +367,13 @@ void CALLBACK GSsetGameCRC(int crc, int options)
{ {
// TEXDESTROY_THRESH starts out at 16. // TEXDESTROY_THRESH starts out at 16.
VALIDATE_THRESH = 8; VALIDATE_THRESH = 8;
conf.mrtdepth = ((conf.gamesettings & GAME_DISABLEMRTDEPTH) != 0); conf.mrtdepth = (conf.settings().disable_mrt_depth != 0);
if (!conf.mrtdepth) if (!conf.mrtdepth)
ZZLog::Error_Log("Disabling MRT depth writing."); ZZLog::Error_Log("Disabling MRT depth writing.");
else else
ZZLog::Error_Log("Enabling MRT depth writing."); ZZLog::Error_Log("Enabling MRT depth writing.");
g_GameSettings |= GAME_PATH3HACK;
bool CRCValueChanged = (g_LastCRC != crc); bool CRCValueChanged = (g_LastCRC != crc);
g_LastCRC = crc; g_LastCRC = crc;
@ -392,8 +389,7 @@ void CALLBACK GSsetGameCRC(int crc, int options)
if (crc_game_list[i].v_thresh > 0) VALIDATE_THRESH = crc_game_list[i].v_thresh; if (crc_game_list[i].v_thresh > 0) VALIDATE_THRESH = crc_game_list[i].v_thresh;
if (crc_game_list[i].t_thresh > 0) TEXDESTROY_THRESH = crc_game_list[i].t_thresh; if (crc_game_list[i].t_thresh > 0) TEXDESTROY_THRESH = crc_game_list[i].t_thresh;
conf.gamesettings |= crc_game_list[i].flags; conf.def_hacks._u32 |= crc_game_list[i].flags;
g_GameSettings = conf.gamesettings | options;
ZZLog::Error_Log("Found CRC[%x] in crc game list.", crc); ZZLog::Error_Log("Found CRC[%x] in crc game list.", crc);
@ -401,8 +397,6 @@ void CALLBACK GSsetGameCRC(int crc, int options)
} }
} }
} }
g_GameSettings = conf.gamesettings | options;
} }
void CALLBACK GSsetFrameSkip(int frameskip) void CALLBACK GSsetFrameSkip(int frameskip)
@ -553,15 +547,13 @@ void OnKeyboardF6(int shift)
if (shift) if (shift)
{ {
conf.aa--; // -1 conf.decAA();
if (conf.aa > 4) conf.aa = 4; // u8 in unsigned, so negative value is 255.
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
ZeroGS::SetAA(conf.aa); ZeroGS::SetAA(conf.aa);
} }
else else
{ {
conf.aa++; conf.incAA();
if (conf.aa > 4) conf.aa = 0;
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
ZeroGS::SetAA(conf.aa); ZeroGS::SetAA(conf.aa);
} }
@ -584,7 +576,7 @@ void OnKeyboardF7(int shift)
} }
else else
{ {
conf.options ^= GSOPTION_WIREFRAME; conf.zz_options.wireframe = !conf.zz_options.wireframe;
glPolygonMode(GL_FRONT_AND_BACK, (conf.wireframe()) ? GL_LINE : GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, (conf.wireframe()) ? GL_LINE : GL_FILL);
sprintf(strtitle, "wireframe rendering - %s", (conf.wireframe()) ? "on" : "off"); sprintf(strtitle, "wireframe rendering - %s", (conf.wireframe()) ? "on" : "off");
} }
@ -665,7 +657,7 @@ void OnKeyboardF9(int shift)
FUNCLOG FUNCLOG
// printf ("A %d\n", HackinshTable[CurrentHackSetting].HackMask); // printf ("A %d\n", HackinshTable[CurrentHackSetting].HackMask);
conf.gamesettings &= !(HackinshTable[CurrentHackSetting].HackMask); conf.hacks._u32 &= !(HackinshTable[CurrentHackSetting].HackMask);
if (shift) if (shift)
{ {
@ -680,9 +672,8 @@ void OnKeyboardF9(int shift)
if (CurrentHackSetting == HACK_NUMBER) CurrentHackSetting = 0; if (CurrentHackSetting == HACK_NUMBER) CurrentHackSetting = 0;
} }
conf.gamesettings |= HackinshTable[CurrentHackSetting].HackMask; conf.hacks._u32 |= HackinshTable[CurrentHackSetting].HackMask;
g_GameSettings = conf.gamesettings;
ZeroGS::AddMessage(HackinshTable[CurrentHackSetting].HackName); ZeroGS::AddMessage(HackinshTable[CurrentHackSetting].HackName);
SaveConfig(); SaveConfig();
} }
@ -755,7 +746,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
break; break;
} }
if (conf.aa) if (conf.aa != 0)
{ {
char strtitle[64]; char strtitle[64];
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]); sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
@ -813,7 +804,7 @@ void ProcessMessages()
if (conf.fullscreen()) if (conf.fullscreen())
{ {
// destroy that msg // destroy that msg
conf.setfullscreen(false); conf.setFullscreen(false);
ZeroGS::ChangeDeviceSize(conf.width, conf.height); ZeroGS::ChangeDeviceSize(conf.width, conf.height);
UpdateWindow(GShwnd); UpdateWindow(GShwnd);
continue; // so that msg doesn't get sent continue; // so that msg doesn't get sent
@ -841,7 +832,7 @@ void ProcessMessages()
if ((GetKeyState(VK_MENU) & 0x8000) && (GetKeyState(VK_RETURN) & 0x8000)) if ((GetKeyState(VK_MENU) & 0x8000) && (GetKeyState(VK_RETURN) & 0x8000))
{ {
conf.options ^= GSOPTION_FULLSCREEN; conf.zz_options.fullscreen = !conf.zz_options.fullscreen;
ZeroGS::SetChangeDeviceSize( ZeroGS::SetChangeDeviceSize(
(conf.fullscreen()) ? 1280 : conf.width, (conf.fullscreen()) ? 1280 : conf.width,
@ -940,7 +931,7 @@ void CALLBACK GSmakeSnapshot(char *path)
{ {
snapshotnr++; snapshotnr++;
sprintf(filename, "%ssnap%03ld.%s", path, snapshotnr, (conf.options&GSOPTION_TGASNAP) ? "bmp" : "jpg"); sprintf(filename, "%ssnap%03ld.%s", path, snapshotnr, (conf.zz_options.tga_snap) ? "bmp" : "jpg");
bmpfile = fopen(filename, "rb"); bmpfile = fopen(filename, "rb");

View File

@ -119,7 +119,7 @@ template<int index> void _GSgifTransfer(u32 *pMem, u32 size)
pMem += 4; pMem += 4;
size--; size--;
if ((g_GameSettings & GAME_PATH3HACK) && (index == 2) && path->eop) nPath3Hack = 1; if ((conf.settings().path3) && (index == 2) && path->eop) nPath3Hack = 1;
// eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and // eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and
// values other than the EOP field are disregarded." // values other than the EOP field are disregarded."
@ -320,7 +320,7 @@ template<int index> void _GSgifTransfer(u32 *pMem, u32 size)
pMem += 4; pMem += 4;
size--; size--;
if ((g_GameSettings & GAME_PATH3HACK) && (index == 2) && path->eop) nPath3Hack = 1; if ((conf.settings() & GAME_PATH3HACK) && (index == 2) && path->eop) nPath3Hack = 1;
if (index == 0) if (index == 0)
{ {

View File

@ -28,7 +28,7 @@ void SaveConfig()
{ {
const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
u32 tempOptions = conf.options & ~conf.gamesettings; u32 tempHacks = conf.hacks._u32 & ~conf.def_hacks._u32;
FILE* f = fopen(iniFile.c_str(), "w"); FILE* f = fopen(iniFile.c_str(), "w");
if (f == NULL) if (f == NULL)
@ -40,10 +40,11 @@ void SaveConfig()
fprintf(f, "interlace = %hhx\n", conf.interlace); fprintf(f, "interlace = %hhx\n", conf.interlace);
fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth); fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth);
fprintf(f, "options = %x\n", tempOptions); //u32 fprintf(f, "zzoptions = %x\n", conf.zz_options); //u32
fprintf(f, "options = %x\n", tempHacks); //u32
fprintf(f, "bilinear = %hhx\n", conf.bilinear); fprintf(f, "bilinear = %hhx\n", conf.bilinear);
fprintf(f, "aliasing = %hhx\n", conf.aa); fprintf(f, "aliasing = %hhx\n", conf.aa);
//fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32 //fprintf(f, "gamesettings = %x\n", conf.def_hacks); //u32
fprintf(f, "width = %x\n", conf.width); //u32 fprintf(f, "width = %x\n", conf.width); //u32
fprintf(f, "height = %x\n", conf.height); //u32 fprintf(f, "height = %x\n", conf.height); //u32
fprintf(f, "x = %x\n", conf.x); //u32 fprintf(f, "x = %x\n", conf.x); //u32
@ -58,7 +59,8 @@ void LoadConfig()
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
conf.interlace = 0; // on, mode 1 conf.interlace = 0; // on, mode 1
conf.mrtdepth = 1; conf.mrtdepth = 1;
conf.options = 0; conf.zz_options._u32 = 0;
conf.hacks._u32 = 0;
conf.bilinear = 1; conf.bilinear = 1;
conf.width = 640; conf.width = 640;
conf.height = 480; conf.height = 480;
@ -80,7 +82,8 @@ void LoadConfig()
err = fscanf(f, "interlace = %hhx\n", &conf.interlace); err = fscanf(f, "interlace = %hhx\n", &conf.interlace);
err = fscanf(f, "mrtdepth = %hhx\n", &conf.mrtdepth); err = fscanf(f, "mrtdepth = %hhx\n", &conf.mrtdepth);
err = fscanf(f, "options = %x\n", &conf.options);//u32 err = fscanf(f, "zzoptions = %x\n", &conf.zz_options);//u32
err = fscanf(f, "options = %x\n", &conf.hacks);//u32
err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear); err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
err = fscanf(f, "aliasing = %hhx\n", &conf.aa); err = fscanf(f, "aliasing = %hhx\n", &conf.aa);
//err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32 //err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32
@ -93,29 +96,29 @@ void LoadConfig()
// filter bad files // filter bad files
if ((conf.aa < 0) || (conf.aa > 4)) conf.aa = 0; if (conf.aa > 4) conf.aa = 0;
conf.isWideScreen = conf.widescreen(); conf.isWideScreen = conf.widescreen();
switch (conf.options & GSOPTION_WINDIMS) switch (conf.zz_options.dimensions)
{ {
case GSOPTION_WIN640: case GSDim_640:
conf.width = 640; conf.width = 640;
conf.height = conf.isWideScreen ? 360 : 480; conf.height = conf.isWideScreen ? 360 : 480;
break; break;
case GSOPTION_WIN800: case GSDim_800:
conf.width = 800; conf.width = 800;
conf.height = conf.isWideScreen ? 450 : 600; conf.height = conf.isWideScreen ? 450 : 600;
break; break;
case GSOPTION_WIN1024: case GSDim_1024:
conf.width = 1024; conf.width = 1024;
conf.height = conf.isWideScreen ? 576 : 768; conf.height = conf.isWideScreen ? 576 : 768;
break; break;
case GSOPTION_WIN1280: case GSDim_1280:
conf.width = 1280; conf.width = 1280;
conf.height = conf.isWideScreen ? 720 : 960; conf.height = conf.isWideScreen ? 720 : 960;
break; break;

View File

@ -152,7 +152,7 @@ void CreateGameHackTable(GtkWidget *treeview)
for (map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) for (map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
{ {
gtk_list_store_append(treestore, &treeiter);//new row gtk_list_store_append(treestore, &treeiter);//new row
itval = (conf.gamesettings & it->second.value) ? true : false; itval = (conf.settings()._u32 & it->second.value) ? true : false;
snprintf(descbuf, 254, "%s", it->second.desc); snprintf(descbuf, 254, "%s", it->second.desc);
gtk_list_store_set(treestore, &treeiter, 0, itval, 1, descbuf, -1); gtk_list_store_set(treestore, &treeiter, 0, itval, 1, descbuf, -1);
} }
@ -176,19 +176,19 @@ void SaveGameHackTable(GtkWidget *treeview)
treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
gtk_tree_model_get_iter_first(treemodel, &treeiter); gtk_tree_model_get_iter_first(treemodel, &treeiter);
conf.gamesettings = 0; conf.hacks._u32 = 0;
for (map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) for (map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
{ {
treeoptval = false; treeoptval = false;
gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1); gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1);
if (treeoptval) conf.gamesettings |= it->second.value; if (treeoptval) conf.hacks._u32 |= it->second.value;
gtk_tree_model_iter_next(treemodel, &treeiter); gtk_tree_model_iter_next(treemodel, &treeiter);
} }
GSsetGameCRC(0, conf.gamesettings); GSsetGameCRC(0, conf.hacks._u32);
//---------- done getting advanced options ---------// //---------- done getting advanced options ---------//
} }
@ -270,7 +270,7 @@ void DisplayDialog()
snap_box = gtk_combo_box_new_text(); snap_box = gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "JPEG"); gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "JPEG");
gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "TIFF"); gtk_combo_box_append_text(GTK_COMBO_BOX(snap_box), "TIFF");
gtk_combo_box_set_active(GTK_COMBO_BOX(snap_box), conf.options & GSOPTION_TGASNAP); gtk_combo_box_set_active(GTK_COMBO_BOX(snap_box), conf.zz_options.tga_snap);
fullscreen_check = gtk_check_button_new_with_label("Fullscreen (Alt + Enter)"); fullscreen_check = gtk_check_button_new_with_label("Fullscreen (Alt + Enter)");
widescreen_check = gtk_check_button_new_with_label("Widescreen"); widescreen_check = gtk_check_button_new_with_label("Widescreen");
@ -284,7 +284,7 @@ void DisplayDialog()
gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1024x768"); gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1024x768");
gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1280x960"); gtk_combo_box_append_text(GTK_COMBO_BOX(size_box), "1280x960");
gtk_combo_box_set_active(GTK_COMBO_BOX(size_box), (conf.options&GSOPTION_WINDIMS) >> 4); gtk_combo_box_set_active(GTK_COMBO_BOX(size_box), conf.zz_options.dimensions);
main_box = gtk_hbox_new(false, 5); main_box = gtk_hbox_new(false, 5);
main_frame = gtk_frame_new("ZZOgl PG Config"); main_frame = gtk_frame_new("ZZOgl PG Config");
@ -341,7 +341,7 @@ void DisplayDialog()
if (return_value == GTK_RESPONSE_ACCEPT) if (return_value == GTK_RESPONSE_ACCEPT)
{ {
int fake_options = 0; ZZOptions fake_options;
SaveGameHackTable(tree); SaveGameHackTable(tree);
if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1)
@ -352,45 +352,20 @@ void DisplayDialog()
conf.negaa = 0; conf.negaa = 0;
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(size_box))) if (gtk_combo_box_get_active(GTK_COMBO_BOX(size_box)) != -1)
{ fake_options.dimensions = gtk_combo_box_get_active(GTK_COMBO_BOX(size_box));
case 0:
fake_options |= GSOPTION_WIN640;
break;
case 1:
fake_options |= GSOPTION_WIN800;
break;
case 2:
fake_options |= GSOPTION_WIN1024;
break;
case 3:
fake_options |= GSOPTION_WIN1280;
break;
}
conf.log = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_check)); conf.log = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_check));
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check)); conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bilinear_check));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check))) fake_options.wireframe = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wireframe_check));
fake_options |= GSOPTION_WIREFRAME; fake_options.capture_avi = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(avi_check));
fake_options.fullscreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fullscreen_check));
fake_options.widescreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check));
fake_options.tga_snap = gtk_combo_box_get_active(GTK_COMBO_BOX(snap_box));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(avi_check))) conf.zz_options = fake_options;
fake_options |= GSOPTION_CAPTUREAVI;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fullscreen_check)))
fake_options |= GSOPTION_FULLSCREEN;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check)))
fake_options |= GSOPTION_WIDESCREEN;
if (gtk_combo_box_get_active(GTK_COMBO_BOX(snap_box)) == 1)
fake_options |= GSOPTION_TGASNAP;
conf.options = fake_options;
SaveConfig(); SaveConfig();
} }

View File

@ -122,7 +122,7 @@ inline bool NoHighlights(int i)
// if ((resultA == 0x300b) && (result == 0x300) && ZeroGS::vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood // if ((resultA == 0x300b) && (result == 0x300) && ZeroGS::vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood
// Old code // Old code
return (!(g_GameSettings&GAME_XENOSPECHACK) || !ZeroGS::vb[i].zbuf.zmsk || prim->iip) ; return (!(conf.settings().xenosaga_spec) || !ZeroGS::vb[i].zbuf.zmsk || prim->iip) ;
} }
void __fastcall GIFPackedRegHandlerNull(u32* data) void __fastcall GIFPackedRegHandlerNull(u32* data)

View File

@ -38,6 +38,7 @@ extern HWND GShwnd;
#define GSdefs #define GSdefs
#include "PS2Edefs.h" #include "PS2Edefs.h"
#include "CRC.h"
// need C definitions -- no mangling please! // need C definitions -- no mangling please!
extern "C" u32 CALLBACK PS2EgetLibType(void); extern "C" u32 CALLBACK PS2EgetLibType(void);
@ -122,24 +123,71 @@ typedef struct
int x, y, c; int x, y, c;
} PointC; } PointC;
enum GSOption enum GSWindowDim
{ {
GSOPTION_FULLSCREEN = 0x2,
GSOPTION_TGASNAP = 0x4, GSDim_640 = 0,
GSOPTION_CAPTUREAVI = 0x8, GSDim_800,
GSDim_1024,
GSOPTION_WINDIMS = 0x30, GSDim_1280,
GSOPTION_WIN640 = 0x00,
GSOPTION_WIN800 = 0x10,
GSOPTION_WIN1024 = 0x20,
GSOPTION_WIN1280 = 0x30,
GSOPTION_WIDESCREEN = 0x40,
GSOPTION_WIREFRAME = 0x100,
GSOPTION_LOADED = 0x8000
}; };
typedef union
{
struct
{
u32 texture_targs : 1;
u32 auto_reset : 1;
u32 interlace_2x : 1;
u32 texa : 1; // apply texa to non textured polys
u32 no_target_resolve : 1;
u32 exact_color : 1;
u32 no_color_clamp : 1;
u32 ffx : 1;
u32 no_alpha_fail : 1;
u32 no_depth_update : 1;
u32 quick_resolve_1 : 1;
u32 no_quick_resolve : 1;
u32 no_target_clut : 1; // full 16 bit resolution
u32 no_stencil : 1;
u32 vss_hack_off : 1; // vertical stripe syndrome
u32 no_depth_resolve : 1;
u32 full_16_bit_res : 1;
u32 resolve_promoted : 1;
u32 fast_update : 1;
u32 no_alpha_test : 1;
u32 disable_mrt_depth : 1;
u32 args_32_bit : 1;
u32 path3 : 1;
u32 parallel_context : 1; // tries to parallelize both contexts so that render calls are reduced (xenosaga)
// makes the game faster, but can be buggy
u32 xenosaga_spec : 1; // xenosaga specularity hack (ignore any zmask=1 draws)
u32 partial_pointers : 1; // whenver the texture or render target are small, tries to look for bigger ones to read from
u32 partial_depth : 1; // tries to save depth targets as much as possible across height changes
u32 reget : 1; // some sort of weirdness in ReGet() code
u32 gust : 1; // Needed for Gustgames fast update.
u32 no_logz : 1; // Intended for linux -- not logarithmic Z.
u32 reserved1 :1;
u32 reserved2 :1;
};
u32 _u32;
} gameHacks;
//Configuration values. typedef union
{
struct
{
u32 fullscreen : 1;
u32 tga_snap : 1;
u32 capture_avi : 1;
u32 widescreen : 1;
u32 wireframe : 1;
u32 loaded : 1;
u32 dimensions : 2;
};
u32 _u32;
void ZZOptions(u32 value) { _u32 = value; }
} ZZOptions;
typedef struct typedef struct
{ {
@ -148,50 +196,47 @@ typedef struct
u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x
u8 negaa; // negative aliasing u8 negaa; // negative aliasing
u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it) u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it)
u32 options; // game options -- different hacks. ZZOptions zz_options;
u32 gamesettings;// default game settings gameHacks hacks; // game options -- different hacks.
gameHacks def_hacks;// default game settings
int width, height; // View target size, has no impact towards speed int width, height; // View target size, has no impact towards speed
int x, y; // Lets try for a persistant window position. int x, y; // Lets try for a persistant window position.
bool isWideScreen; // Widescreen support bool isWideScreen; // Widescreen support
u32 log; u32 log;
u32 settings() { return !!(options | gamesettings); } void incAA() { aa++; if (aa > 4) aa = 4; }
bool fullscreen() { return !!(options & GSOPTION_FULLSCREEN); } void decAA() { aa--; if (aa > 4) aa = 0; } // u8 is unsigned, so negative value is 255.
bool wireframe() { return !!(options & GSOPTION_WIREFRAME); }
bool widescreen() { return !!(options & GSOPTION_WIDESCREEN); } gameHacks settings()
bool captureAvi() { return !!(options & GSOPTION_CAPTUREAVI); } {
bool loaded() { return !!(options & GSOPTION_LOADED); } gameHacks tempHack;
tempHack._u32 = (hacks._u32 | def_hacks._u32 | GAME_PATH3HACK);
return tempHack;
}
bool fullscreen() { return !!(zz_options.fullscreen); }
bool wireframe() { return !!(zz_options.wireframe); }
bool widescreen() { return !!(zz_options.widescreen); }
bool captureAvi() { return !!(zz_options.capture_avi); }
bool loaded() { return !!(zz_options.loaded); }
void setFullscreen(bool flag) void setFullscreen(bool flag)
{ {
if (flag) zz_options.fullscreen = (flag) ? 1 : 0;
options |= GSOPTION_FULLSCREEN;
else
options &= GSOPTION_FULLSCREEN;
} }
void setWireframe(bool flag) void setWireframe(bool flag)
{ {
if (flag) zz_options.wireframe = (flag) ? 1 : 0;
options |= GSOPTION_WIREFRAME;
else
options &= GSOPTION_WIREFRAME;
} }
void setCaptureAvi(bool flag) void setCaptureAvi(bool flag)
{ {
if (flag) zz_options.capture_avi = (flag) ? 1 : 0;
options |= GSOPTION_CAPTUREAVI;
else
options &= GSOPTION_CAPTUREAVI;
} }
void setLoaded(bool flag) void setLoaded(bool flag)
{ {
if (flag) zz_options.loaded = (flag) ? 1 : 0;
options |= GSOPTION_LOADED;
else
options &= GSOPTION_LOADED;
} }
} GSconf; } GSconf;

View File

@ -17,9 +17,9 @@ void SaveConfig()
WritePrivateProfileString("Settings", "Antialiasing", szValue, iniFile.c_str()); WritePrivateProfileString("Settings", "Antialiasing", szValue, iniFile.c_str());
sprintf(szValue, "%u", conf.bilinear); sprintf(szValue, "%u", conf.bilinear);
WritePrivateProfileString("Settings", "Bilinear", szValue, iniFile.c_str()); WritePrivateProfileString("Settings", "Bilinear", szValue, iniFile.c_str());
sprintf(szValue, "%u", conf.options); //sprintf(szValue, "%u", conf.zz_options);
WritePrivateProfileString("Settings", "Options", szValue, iniFile.c_str()); //WritePrivateProfileString("Settings", "Options", szValue, iniFile.c_str());
sprintf(szValue, "%u", conf.gamesettings); sprintf(szValue, "%u", conf.hacks);
WritePrivateProfileString("Settings", "AdvancedOptions", szValue, iniFile.c_str()); WritePrivateProfileString("Settings", "AdvancedOptions", szValue, iniFile.c_str());
sprintf(szValue, "%u", conf.width); sprintf(szValue, "%u", conf.width);
WritePrivateProfileString("Settings", "Width", szValue, iniFile.c_str()); WritePrivateProfileString("Settings", "Width", szValue, iniFile.c_str());
@ -35,7 +35,8 @@ void LoadConfig()
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
conf.interlace = 0; // on, mode 1 conf.interlace = 0; // on, mode 1
conf.mrtdepth = 1; conf.mrtdepth = 1;
conf.options = 0; conf.hacks = 0;
conf.def_hacks = 0;
conf.bilinear = 1; conf.bilinear = 1;
conf.width = 640; conf.width = 640;
conf.height = 480; conf.height = 480;
@ -56,7 +57,7 @@ void LoadConfig()
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str()); GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
conf.aa = (u8)strtoul(szValue, NULL, 10); conf.aa = (u8)strtoul(szValue, NULL, 10);
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str()); GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
conf.options = strtoul(szValue, NULL, 10); conf.hacks = strtoul(szValue, NULL, 10);
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str()); GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
conf.gamesettings = strtoul(szValue, NULL, 10); conf.gamesettings = strtoul(szValue, NULL, 10);
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str()); GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
@ -70,24 +71,24 @@ void LoadConfig()
conf.isWideScreen = (conf.widescreen() != 0); conf.isWideScreen = (conf.widescreen() != 0);
switch (conf.options & GSOPTION_WINDIMS) switch (conf.zz_options.dimensions)
{ {
case GSOPTION_WIN640: case GSDim_640:
conf.width = 640; conf.width = 640;
conf.height = conf.isWideScreen ? 360 : 480; conf.height = conf.isWideScreen ? 360 : 480;
break; break;
case GSOPTION_WIN800: case GSDim_800:
conf.width = 800; conf.width = 800;
conf.height = conf.isWideScreen ? 450 : 600; conf.height = conf.isWideScreen ? 450 : 600;
break; break;
case GSOPTION_WIN1024: case GSDim_1024:
conf.width = 1024; conf.width = 1024;
conf.height = conf.isWideScreen ? 576 : 768; conf.height = conf.isWideScreen ? 576 : 768;
break; break;
case GSOPTION_WIN1280: case GSDim_1280:
conf.width = 1280; conf.width = 1280;
conf.height = conf.isWideScreen ? 720 : 960; conf.height = conf.isWideScreen ? 720 : 960;
break; break;

View File

@ -78,7 +78,7 @@ map<int, int> mapConfOpts;
void OnInitDialog(HWND hW) void OnInitDialog(HWND hW)
{ {
if (!(conf.options & GSOPTION_LOADED)) LoadConfig(); if (!(conf.zz_options.loaded)) LoadConfig();
CheckDlgButton(hW, IDC_CONFIG_INTERLACE, conf.interlace); CheckDlgButton(hW, IDC_CONFIG_INTERLACE, conf.interlace);
CheckDlgButton(hW, IDC_CONFIG_BILINEAR, conf.bilinear); CheckDlgButton(hW, IDC_CONFIG_BILINEAR, conf.bilinear);
@ -86,12 +86,10 @@ void OnInitDialog(HWND hW)
CheckRadioButton(hW, IDC_CONFIG_AANONE, IDC_CONFIG_AA4, IDC_CONFIG_AANONE + conf.aa); CheckRadioButton(hW, IDC_CONFIG_AANONE, IDC_CONFIG_AA4, IDC_CONFIG_AANONE + conf.aa);
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.wireframe()) ? 1 : 0); CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.wireframe()) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.captureAvi()) ? 1 : 0); CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.captureAvi()) ? 1 : 0);
//CheckDlgButton(hW, IDC_CONFIG_CACHEFBP, (conf.options&GSOPTION_ALPHACLAMP)?1:0);
CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.fullscreen()) ? 1 : 0); CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.fullscreen()) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_WIDESCREEN, (conf.widescreen()) ? 1 : 0); CheckDlgButton(hW, IDC_CONFIG_WIDESCREEN, (conf.widescreen()) ? 1 : 0);
//CheckDlgButton(hW, IDC_CONFIG_FFX, (conf.options&GSOPTION_FFXHACK)?1:0); CheckDlgButton(hW, IDC_CONFIG_BMPSS, (conf.zz_options.tga_snap) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_BMPSS, (conf.options&GSOPTION_TGASNAP) ? 1 : 0); CheckRadioButton(hW, IDC_CONF_WIN640, IDC_CONF_WIN1280, IDC_CONF_WIN640 + conf.zz_options.dimensions);
CheckRadioButton(hW, IDC_CONF_WIN640, IDC_CONF_WIN1280, IDC_CONF_WIN640 + ((conf.options&GSOPTION_WINDIMS) >> 4));
prevbilinearfilter = conf.bilinear; prevbilinearfilter = conf.bilinear;
@ -127,7 +125,7 @@ void OnInitDialog(HWND hW)
for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
{ {
CheckDlgButton(hW, it->first, (conf.gamesettings&it->second) ? 1 : 0); CheckDlgButton(hW, it->first, (conf.def_hacks&it->second) ? 1 : 0);
} }
} }
@ -172,32 +170,31 @@ void OnOK(HWND hW)
} }
conf.negaa = 0; conf.negaa = 0;
conf.options = 0; conf.zz_options = 0;
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? GSOPTION_CAPTUREAVI : 0; conf.zz_options.capture_avi = IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? 1 : 0;
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_WIREFRAME) ? GSOPTION_WIREFRAME : 0; conf.zz_options.wireframe = IsDlgButtonChecked(hW, IDC_CONFIG_WIREFRAME) ? 1 : 0;
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_FULLSCREEN) ? GSOPTION_FULLSCREEN : 0; conf.zz_options.fullscreen = IsDlgButtonChecked(hW, IDC_CONFIG_FULLSCREEN) ? 1 : 0;
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_WIDESCREEN) ? GSOPTION_WIDESCREEN : 0; conf.zz_options.widescreen = IsDlgButtonChecked(hW, IDC_CONFIG_WIDESCREEN) ? 1 : 0;
//conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_FFX) ? GSOPTION_FFXHACK : 0; conf.zz_options.tga_snap = IsDlgButtonChecked(hW, IDC_CONFIG_BMPSS) ? 1 : 0;
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_BMPSS) ? GSOPTION_TGASNAP : 0;
conf.gamesettings = 0; conf.hacks = 0;
for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
{ {
if (IsDlgButtonChecked(hW, it->first)) conf.gamesettings |= it->second; if (IsDlgButtonChecked(hW, it->first)) conf.hacks |= it->second;
} }
GSsetGameCRC(g_LastCRC, conf.gamesettings); GSsetGameCRC(g_LastCRC, conf.hacks);
if (SendDlgItemMessage(hW, IDC_CONF_WIN640, BM_GETCHECK, 0, 0)) if (SendDlgItemMessage(hW, IDC_CONF_WIN640, BM_GETCHECK, 0, 0))
conf.options |= GSOPTION_WIN640; conf.zz_options.dimensions = GSDim_640;
else if (SendDlgItemMessage(hW, IDC_CONF_WIN800, BM_GETCHECK, 0, 0)) else if (SendDlgItemMessage(hW, IDC_CONF_WIN800, BM_GETCHECK, 0, 0))
conf.options |= GSOPTION_WIN800; conf.zz_options.dimensions = GSDim_800;
else if (SendDlgItemMessage(hW, IDC_CONF_WIN1024, BM_GETCHECK, 0, 0)) else if (SendDlgItemMessage(hW, IDC_CONF_WIN1024, BM_GETCHECK, 0, 0))
conf.options |= GSOPTION_WIN1024; conf.zz_options.dimensions = GSDim_1024;
else if (SendDlgItemMessage(hW, IDC_CONF_WIN1280, BM_GETCHECK, 0, 0)) else if (SendDlgItemMessage(hW, IDC_CONF_WIN1280, BM_GETCHECK, 0, 0))
conf.options |= GSOPTION_WIN1280; conf.zz_options.dimensions = GSDim_1280;
SaveConfig(); SaveConfig();

View File

@ -254,7 +254,7 @@ inline void FrameObtainDispinfo(u32 bInterlace, tex0Info* dispinfo)
// hack!! // hack!!
// 2 * dispinfo[i].tw / dispinfo[i].th <= 1, metal slug 4 // 2 * dispinfo[i].tw / dispinfo[i].th <= 1, metal slug 4
if (bInterlace && 2 * dispinfo[i].tw / dispinfo[i].th <= 1 && !(g_GameSettings&GAME_INTERLACE2X)) if (bInterlace && 2 * dispinfo[i].tw / dispinfo[i].th <= 1 && !(conf.settings().interlace_2x))
{ {
dispinfo[i].th >>= 1; dispinfo[i].th >>= 1;
} }
@ -722,7 +722,7 @@ inline void AfterRenderDisplayFPS()
DrawText(str, left, top, 0xffc0ffff); DrawText(str, left, top, 0xffc0ffff);
} }
// Swapping buffers, so we could use another windows // Swapping buffers, so we could use another window
inline void AfterRenderSwapBuffers() inline void AfterRenderSwapBuffers()
{ {
if (glGetError() != GL_NO_ERROR) ZZLog::Debug_Log("glError before swap!"); if (glGetError() != GL_NO_ERROR) ZZLog::Debug_Log("glError before swap!");
@ -740,7 +740,7 @@ inline void AfterRenderMadeSnapshoot()
DrawText(str, left + 1, top + 1, 0xff000000); DrawText(str, left + 1, top + 1, 0xff000000);
DrawText(str, left, top, 0xffc0ffff); DrawText(str, left, top, 0xffc0ffff);
if (SaveRenderTarget(strSnapshot != "" ? strSnapshot.c_str() : "temp.jpg", nBackbufferWidth, -nBackbufferHeight, 0)) //(conf.options&GSOPTION_TGASNAP)?0:1) ) { if (SaveRenderTarget(strSnapshot != "" ? strSnapshot.c_str() : "temp.jpg", nBackbufferWidth, -nBackbufferHeight, 0)) //(conf.options.tga_snap)?0:1) ) {
{ {
char str[255]; char str[255];
sprintf(str, "saved %s\n", strSnapshot.c_str()); sprintf(str, "saved %s\n", strSnapshot.c_str());
@ -816,7 +816,7 @@ inline void AfterRendererUnimportantJob()
maxmin = 608; maxmin = 608;
} }
// Swich Frabuffers // Swich Framebuffers
inline void AfterRendererSwitchBackToTextures() inline void AfterRendererSwitchBackToTextures()
{ {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer);
@ -850,7 +850,7 @@ inline void AfterRendererSwitchBackToTextures()
// Reset Targets Helper, for hack. // Reset Targets Helper, for hack.
inline void AfterRendererAutoresetTargets() inline void AfterRendererAutoresetTargets()
{ {
if (g_GameSettings & GAME_AUTORESET) if (conf.settings().auto_reset)
{ {
s_nResolveCounts[s_nCurResolveIndex] = s_nResolved; s_nResolveCounts[s_nCurResolveIndex] = s_nResolved;
s_nCurResolveIndex = (s_nCurResolveIndex + 1) % ARRAY_SIZE(s_nResolveCounts); s_nCurResolveIndex = (s_nCurResolveIndex + 1) % ARRAY_SIZE(s_nResolveCounts);

View File

@ -299,7 +299,7 @@ inline void ZeroGS::CreateOtherCheck()
ZZLog::Error_Log("Could not properly make bitmasks, so some textures will be missed."); ZZLog::Error_Log("Could not properly make bitmasks, so some textures will be missed.");
/* Zeydlitz: we don't support 128-bit targets yet. they are slow and weirdo /* Zeydlitz: we don't support 128-bit targets yet. they are slow and weirdo
if( g_GameSettings & GAME_32BITTARGS ) { if( conf.settings() & GAME_32BITTARGS ) {
g_RenderFormatType = RFT_byte8; g_RenderFormatType = RFT_byte8;
ZZLog::Error_Log("Setting 32 bit render target."); ZZLog::Error_Log("Setting 32 bit render target.");
} }
@ -551,11 +551,10 @@ bool ZeroGS::Create(int _width, int _height)
SetAA(conf.aa); SetAA(conf.aa);
GSsetGameCRC(g_LastCRC, g_GameSettings); GSsetGameCRC(g_LastCRC, conf.settings()._u32);
GL_STENCILFUNC(GL_ALWAYS, 0, 0); GL_STENCILFUNC(GL_ALWAYS, 0, 0);
//g_GameSettings |= 0;//GAME_VSSHACK|GAME_FULL16BITRES|GAME_NODEPTHRESOLVE|GAME_FASTUPDATE;
//s_bWriteDepth = true; //s_bWriteDepth = true;
GL_BLEND_ALL(GL_ONE, GL_ONE, GL_ONE, GL_ONE); GL_BLEND_ALL(GL_ONE, GL_ONE, GL_ONE, GL_ONE);

View File

@ -455,7 +455,7 @@ inline CRenderTarget* FlushReGetTarget(int& tbw, int& tbp0, int& tpsm, VB& curvb
// This was incorrect code // This was incorrect code
CRenderTarget* ptextarg = NULL; CRenderTarget* ptextarg = NULL;
if (ptextarg == NULL && tpsm == PSMT8 && (g_GameSettings & GAME_REGETHACK)) if ((ptextarg == NULL) && (tpsm == PSMT8) && (conf.settings().reget))
{ {
// check for targets with half the width. Break Valkyrie Chronicles // check for targets with half the width. Break Valkyrie Chronicles
ptextarg = s_RTs.GetTarg(tbp0, tbw / 2, curvb); ptextarg = s_RTs.GetTarg(tbp0, tbw / 2, curvb);
@ -487,7 +487,7 @@ inline CRenderTarget* FlushReGetTarget(int& tbw, int& tbp0, int& tpsm, VB& curvb
ptextarg = s_DepthRTs.GetTarg(tbp0, tbw, curvb); ptextarg = s_DepthRTs.GetTarg(tbp0, tbw, curvb);
} }
if ((ptextarg == NULL) && (g_GameSettings & GAME_TEXTURETARGS)) if ((ptextarg == NULL) && (conf.settings().texture_targs))
{ {
// check if any part of the texture intersects the current target // check if any part of the texture intersects the current target
if (!PSMT_ISCLUT(tpsm) && (curvb.tex0.tbp0 >= curvb.frame.fbp) && ((curvb.tex0.tbp0) < curvb.prndr->end)) if (!PSMT_ISCLUT(tpsm) && (curvb.tex0.tbp0 >= curvb.frame.fbp) && ((curvb.tex0.tbp0) < curvb.prndr->end))
@ -782,7 +782,7 @@ inline void FlushDecodeClut(VB& curvb, GLuint& ptexclut)
inline int FlushGetShaderType(VB& curvb, CRenderTarget* ptextarg, GLuint& ptexclut) inline int FlushGetShaderType(VB& curvb, CRenderTarget* ptextarg, GLuint& ptexclut)
{ {
if (PSMT_ISCLUT(curvb.tex0.psm) && !(g_GameSettings&GAME_NOTARGETCLUT)) if (PSMT_ISCLUT(curvb.tex0.psm) && !(conf.settings().no_target_clut))
{ {
FlushDecodeClut(curvb, ptexclut); FlushDecodeClut(curvb, ptexclut);
@ -1076,7 +1076,7 @@ inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderT
inline bool AlphaCanRenderStencil(VB& curvb) inline bool AlphaCanRenderStencil(VB& curvb)
{ {
return g_bUpdateStencil && (PSMT_BITMODE(curvb.prndr->psm) != 1) && return g_bUpdateStencil && (PSMT_BITMODE(curvb.prndr->psm) != 1) &&
!ZZOglGet_fbmHighByte(curvb.frame.fbm) && !(g_GameSettings & GAME_NOSTENCIL); !ZZOglGet_fbmHighByte(curvb.frame.fbm) && !(conf.settings().no_stencil);
} }
inline void AlphaSetStencil(bool DoIt) inline void AlphaSetStencil(bool DoIt)
@ -1291,13 +1291,13 @@ inline bool AlphaFailureIgnore(const pixTest curtest)
if (curtest.atst == 1) return true; if (curtest.atst == 1) return true;
if (curtest.afail == 0) return true; if (curtest.afail == 0) return true;
if (g_GameSettings & GAME_NOALPHAFAIL && ((s_dwColorWrite < 8) || (s_dwColorWrite == 15 && curtest.atst == 5 && (curtest.aref == 64)))) if (conf.settings().no_alpha_fail && ((s_dwColorWrite < 8) || (s_dwColorWrite == 15 && curtest.atst == 5 && (curtest.aref == 64))))
return true; return true;
// old and seemingly incorrect code. // old and seemingly incorrect code.
// if ((s_dwColorWrite < 8 && s_dwColorWrite !=8) && curtest.afail == 1) // if ((s_dwColorWrite < 8 && s_dwColorWrite !=8) && curtest.afail == 1)
// return true; // return true;
// if ((s_dwColorWrite == 0xf) && curtest.atst == 5 && curtest.afail == 1 && !(g_GameSettings & GAME_REGETHACK)) // if ((s_dwColorWrite == 0xf) && curtest.atst == 5 && curtest.afail == 1 && !(conf.settings() & GAME_REGETHACK))
// return true; // return true;
return false; return false;
} }
@ -1477,7 +1477,7 @@ inline void AlphaSaveTarget(VB& curvb)
inline void AlphaColorClamping(VB& curvb, const pixTest curtest) inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
{ {
// clamp the final colors, when enabled ffx2 credits mess up // clamp the final colors, when enabled ffx2 credits mess up
if (curvb.curprim.abe && bAlphaClamping && GetRenderFormat() != RFT_byte8 && !(g_GameSettings&GAME_NOCOLORCLAMP)) // if !colclamp, skip if (curvb.curprim.abe && bAlphaClamping && GetRenderFormat() != RFT_byte8 && !(conf.settings().no_color_clamp)) // if !colclamp, skip
{ {
ResetAlphaVariables(); ResetAlphaVariables();

View File

@ -109,7 +109,7 @@ void SetupFragmentProgramParameters(FRAGMENTSHADER* pf, int context, int type)
pf->set_texture(pf->sInterlace, "g_sInterlace"); pf->set_texture(pf->sInterlace, "g_sInterlace");
// set global shader constants // set global shader constants
pf->set_shader_const(Vector(0.5f, (g_GameSettings&GAME_EXACTCOLOR) ? 0.9f / 256.0f : 0.5f / 256.0f, 0, 1 / 255.0f), "g_fExactColor"); pf->set_shader_const(Vector(0.5f, (conf.settings().exact_color) ? 0.9f / 256.0f : 0.5f / 256.0f, 0, 1 / 255.0f), "g_fExactColor");
pf->set_shader_const(Vector(-0.2f, -0.65f, 0.9f, 1.0f / 32767.0f), "g_fBilinear"); pf->set_shader_const(Vector(-0.2f, -0.65f, 0.9f, 1.0f / 32767.0f), "g_fBilinear");
pf->set_shader_const(Vector(1.0f / 256.0f, 1.0004f, 1, 0.5f), "g_fZBias"); pf->set_shader_const(Vector(1.0f / 256.0f, 1.0004f, 1, 0.5f), "g_fZBias");
pf->set_shader_const(Vector(0, 1, 0.001f, 0.5f), "g_fc0"); pf->set_shader_const(Vector(0, 1, 0.001f, 0.5f), "g_fc0");
@ -126,7 +126,7 @@ void SetupVertexProgramParameters(CGprogram prog, int context)
cgConnectParameter(g_vparamPosXY[context], p); cgConnectParameter(g_vparamPosXY[context], p);
// Set Z-test, log or no log; // Set Z-test, log or no log;
if (g_GameSettings&GAME_NOLOGZ) if (conf.settings().no_logz)
{ {
g_vdepth = Vector(255.0 / 256.0f, 255.0 / 65536.0f, 255.0f / (65535.0f * 256.0f), 1.0f / (65536.0f * 65536.0f)); g_vdepth = Vector(255.0 / 256.0f, 255.0 / 65536.0f, 255.0f / (65535.0f * 256.0f), 1.0f / (65536.0f * 65536.0f));
vlogz = Vector(1.0f, 0.0f, 0.0f, 0.0f); vlogz = Vector(1.0f, 0.0f, 0.0f, 0.0f);

View File

@ -248,7 +248,7 @@ inline int ZeroGS::VB::CheckFrameAddConstraints(int tbp)
frame = gsfb; frame = gsfb;
frame.fbh = maxpos; frame.fbh = maxpos;
if (!PSMT_ISHALF(frame.psm) || !(g_GameSettings&GAME_FULL16BITRES)) CheckFrame32bitRes(maxpos); if (!PSMT_ISHALF(frame.psm) || !(conf.settings().full_16_bit_res)) CheckFrame32bitRes(maxpos);
#ifdef DEVBUILD #ifdef DEVBUILD
if (frame.fbh == 0xe2) if (frame.fbh == 0xe2)

View File

@ -37,8 +37,6 @@
bool nullTex = false; bool nullTex = false;
extern int g_GameSettings;
using namespace ZeroGS; using namespace ZeroGS;
extern int g_TransferredToGPU; extern int g_TransferredToGPU;
extern bool g_bIsLost; extern bool g_bIsLost;
@ -125,7 +123,7 @@ inline bool ZeroGS::CRenderTarget::InitialiseDefaultTexture(u32 *ptr_p, int fbw,
// Draw 4 triangles from binded array using only stencil buffer // Draw 4 triangles from binded array using only stencil buffer
inline void FillOnlyStencilBuffer() inline void FillOnlyStencilBuffer()
{ {
if (ZeroGS::IsWriteDestAlphaTest() && !(g_GameSettings&GAME_NOSTENCIL)) if (ZeroGS::IsWriteDestAlphaTest() && !(conf.settings().no_stencil))
{ {
glColorMask(0, 0, 0, 0); glColorMask(0, 0, 0, 0);
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
@ -285,7 +283,7 @@ void ZeroGS::CRenderTarget::SetViewport()
inline bool NotResolveHelper() inline bool NotResolveHelper()
{ {
return ((s_nResolved > 8 && (2 * s_nResolved > fFPS - 10)) || (g_GameSettings&GAME_NOTARGETRESOLVE)); return ((s_nResolved > 8 && (2 * s_nResolved > fFPS - 10)) || (conf.settings().no_target_resolve));
} }
void ZeroGS::CRenderTarget::Resolve() void ZeroGS::CRenderTarget::Resolve()
@ -348,7 +346,7 @@ void ZeroGS::CRenderTarget::Resolve(int startrange, int endrange)
g_bSaveResolved = 0; g_bSaveResolved = 0;
} }
#endif #endif
if (g_GameSettings&GAME_NOTARGETRESOLVE) if (conf.settings().no_target_resolve)
{ {
status = TS_Resolved; status = TS_Resolved;
return; return;
@ -932,7 +930,7 @@ void ZeroGS::CDepthTarget::Resolve()
{ {
FUNCLOG FUNCLOG
if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth() && !(g_GameSettings&GAME_NODEPTHRESOLVE)) if (g_nDepthUsed > 0 && conf.mrtdepth && !(status&TS_Virtual) && ZeroGS::IsWriteDepth() && !(conf.settings().no_depth_resolve))
CRenderTarget::Resolve(); CRenderTarget::Resolve();
else else
{ {
@ -1283,7 +1281,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
{ {
bfound = it->second->fbh == frame.fbh; bfound = it->second->fbh == frame.fbh;
if ((g_GameSettings&GAME_PARTIALDEPTH) && !bfound) if ((conf.settings().partial_depth) && !bfound)
{ {
MAPTARGETS::iterator itnew = mapTargets.find(key + 1); MAPTARGETS::iterator itnew = mapTargets.find(key + 1);
@ -1302,7 +1300,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
} }
else else
{ {
if (PSMT_ISHALF(frame.psm) == PSMT_ISHALF(it->second->psm) && !(g_GameSettings & GAME_FULL16BITRES)) if (PSMT_ISHALF(frame.psm) == PSMT_ISHALF(it->second->psm) && !(conf.settings().full_16_bit_res))
bfound = (frame.fbh > 0x1c0 || it->second->fbh >= frame.fbh) && it->second->fbh <= maxposheight; bfound = (frame.fbh > 0x1c0 || it->second->fbh >= frame.fbh) && it->second->fbh <= maxposheight;
} }
} }
@ -1314,7 +1312,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
bfound = it != mapTargets.end() && ((opts & TO_StrictHeight) ? it->second->fbh == frame.fbh : it->second->fbh >= frame.fbh) && it->second->fbh <= maxposheight; bfound = it != mapTargets.end() && ((opts & TO_StrictHeight) ? it->second->fbh == frame.fbh : it->second->fbh >= frame.fbh) && it->second->fbh <= maxposheight;
} }
if (bfound && PSMT_ISHALF(frame.psm) && PSMT_ISHALF(it->second->psm) && (g_GameSettings&GAME_FULL16BITRES)) if (bfound && PSMT_ISHALF(frame.psm) && PSMT_ISHALF(it->second->psm) && (conf.settings().full_16_bit_res))
{ {
// mgs3 // mgs3
if (frame.fbh > it->second->fbh) if (frame.fbh > it->second->fbh)
@ -1336,7 +1334,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
if (!(opts & TO_StrictHeight)) if (!(opts & TO_StrictHeight))
{ {
if ((g_GameSettings & GAME_VSSHACKOFF)) if ((conf.settings().vss_hack_off))
{ {
if (PSMT_ISHALF(it->second->psm)) if (PSMT_ISHALF(it->second->psm))
{ {
@ -1386,7 +1384,7 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
// check if there exists a more recent target that this target could update from // check if there exists a more recent target that this target could update from
// only update if target isn't mirrored // only update if target isn't mirrored
bool bCheckHalfCovering = (g_GameSettings & GAME_FULL16BITRES) && PSMT_ISHALF(it->second->psm) && it->second->fbh + 32 < frame.fbh; bool bCheckHalfCovering = (conf.settings().full_16_bit_res) && PSMT_ISHALF(it->second->psm) && it->second->fbh + 32 < frame.fbh;
for (MAPTARGETS::iterator itnew = mapTargets.begin(); itnew != mapTargets.end(); ++itnew) for (MAPTARGETS::iterator itnew = mapTargets.begin(); itnew != mapTargets.end(); ++itnew)
{ {
@ -1442,10 +1440,10 @@ CRenderTarget* ZeroGS::CRenderTargetMngr::GetTarg(const frameInfo& frame, u32 op
{ {
if (it->second->start < end && start < it->second->end) if (it->second->start < end && start < it->second->end)
{ {
if ((g_GameSettings&GAME_FASTUPDATE) || if ((conf.settings().fast_update) ||
((frame.fbw == it->second->fbw) && ((frame.fbw == it->second->fbw) &&
// check depth targets only if partialdepth option // check depth targets only if partialdepth option
((it->second->fbp != frame.fbp) || ((g_GameSettings & GAME_PARTIALDEPTH) && (opts & CRenderTargetMngr::TO_DepthBuffer))))) ((it->second->fbp != frame.fbp) || ((conf.settings().partial_depth) && (opts & CRenderTargetMngr::TO_DepthBuffer)))))
{ {
if (besttarg != 0) if (besttarg != 0)
{ {
@ -2873,7 +2871,7 @@ void FlushTransferRanges(const tex0Info* ptex)
{ {
// check if target is currently being used // check if target is currently being used
if (!(g_GameSettings & GAME_NOQUICKRESOLVE)) if (!(conf.settings().no_quick_resolve))
{ {
if (ptarg->fbp != vb[0].gsfb.fbp) //&& (vb[0].prndr == NULL || ptarg->fbp != vb[0].prndr->fbp) ) { if (ptarg->fbp != vb[0].gsfb.fbp) //&& (vb[0].prndr == NULL || ptarg->fbp != vb[0].prndr->fbp) ) {
{ {
@ -2884,7 +2882,7 @@ void FlushTransferRanges(const tex0Info* ptex)
// (ffx changing screens, shadowhearts) // (ffx changing screens, shadowhearts)
// start == ptarg->start, used for kh to transfer text // start == ptarg->start, used for kh to transfer text
if (ptarg->IsDepth() || end - start > 0x50000 || ((g_GameSettings&GAME_QUICKRESOLVE1) && start == ptarg->start)) if (ptarg->IsDepth() || end - start > 0x50000 || ((conf.settings().quick_resolve_1) && start == ptarg->start))
ptarg->status |= CRenderTarget::TS_NeedUpdate | CRenderTarget::TS_Resolved; ptarg->status |= CRenderTarget::TS_NeedUpdate | CRenderTarget::TS_Resolved;
continue; continue;
@ -2926,7 +2924,7 @@ void FlushTransferRanges(const tex0Info* ptex)
// suikoden5 is faster with check, but too big of a value and kh screens mess up // suikoden5 is faster with check, but too big of a value and kh screens mess up
/* Zeydlitz remove this check, it does not do anything good /* Zeydlitz remove this check, it does not do anything good
if ((end - start > 0x8000) && (!(g_GameSettings & GAME_GUSTHACK) || (end-start > 0x40000))) { if ((end - start > 0x8000) && (!(conf.settings() & GAME_GUSTHACK) || (end-start > 0x40000))) {
// intersects, do only one sided resolves // intersects, do only one sided resolves
if( end-start > 4*ptarg->fbw ) { // at least it be greater than one scanline (spiro is faster) if( end-start > 4*ptarg->fbw ) { // at least it be greater than one scanline (spiro is faster)
if( start > ptarg->start ) { if( start > ptarg->start ) {
@ -2941,7 +2939,7 @@ void FlushTransferRanges(const tex0Info* ptex)
ptarg->status |= CRenderTarget::TS_Resolved; ptarg->status |= CRenderTarget::TS_Resolved;
if ((!ptarg->IsDepth() || (!(g_GameSettings & GAME_NODEPTHUPDATE) || end - start > 0x1000)) && ((end - start > 0x40000) || !(g_GameSettings & GAME_GUSTHACK))) if ((!ptarg->IsDepth() || (!(conf.settings().no_depth_update) || end - start > 0x1000)) && ((end - start > 0x40000) || !(conf.settings().gust)))
ptarg->status |= CRenderTarget::TS_NeedUpdate; ptarg->status |= CRenderTarget::TS_NeedUpdate;
} }
} }
@ -3046,7 +3044,7 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
// sometimes games can decompress to alpha channel of render target only, in this case // sometimes games can decompress to alpha channel of render target only, in this case
// do a resolve right away. wolverine x2 // do a resolve right away. wolverine x2
if ((gs.dstbuf.psm == PSMT8H || gs.dstbuf.psm == PSMT4HL || gs.dstbuf.psm == PSMT4HH) && !(g_GameSettings & GAME_GUSTHACK)) if (((gs.dstbuf.psm == PSMT8H) || (gs.dstbuf.psm == PSMT4HL) || (gs.dstbuf.psm == PSMT4HH)) && !(conf.settings().gust))
{ {
list<CRenderTarget*> listTransmissionUpdateTargs; list<CRenderTarget*> listTransmissionUpdateTargs;
s_RTs.GetTargs(start, end, listTransmissionUpdateTargs); s_RTs.GetTargs(start, end, listTransmissionUpdateTargs);

View File

@ -108,7 +108,7 @@ class CRenderTargetMngr
else else
mapTargets[key] = ptarg; mapTargets[key] = ptarg;
if (g_GameSettings & GAME_RESOLVEPROMOTED) if (conf.settings().resolve_promoted)
ptarg->status = CRenderTarget::TS_Resolved; ptarg->status = CRenderTarget::TS_Resolved;
else else
ptarg->status = CRenderTarget::TS_NeedUpdate; ptarg->status = CRenderTarget::TS_NeedUpdate;

View File

@ -609,7 +609,6 @@ __forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb)
if (diffY < 0) { p->y = - p->y; } if (diffY < 0) { p->y = - p->y; }
#endif #endif
p->f = ((s16)gs.gsvertex[index].f << 7) | 0x7f; p->f = ((s16)gs.gsvertex[index].f << 7) | 0x7f;
MOVZ(p, gs.gsvertex[index].z, curvb); MOVZ(p, gs.gsvertex[index].z, curvb);
@ -620,7 +619,7 @@ __forceinline void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb)
// if ((gs.texa.aem) && ((p->rgba & 0xffffff ) == 0)) // if ((gs.texa.aem) && ((p->rgba & 0xffffff ) == 0))
// p->rgba = 0; // p->rgba = 0;
if (g_GameSettings & GAME_TEXAHACK) if (conf.settings().texa)
{ {
u32 B = ((p->rgba & 0xfe000000) >> 1) + u32 B = ((p->rgba & 0xfe000000) >> 1) +
(0x01000000 * curvb.fba.fba) ; (0x01000000 * curvb.fba.fba) ;