zzogl-pg: If ZZOgl automatically turns a game hack on, it shouldn't leave it on.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3231 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-06-19 06:23:40 +00:00
parent d3266a3921
commit 9f21cc3dcd
13 changed files with 107 additions and 62 deletions

View File

@ -97,7 +97,7 @@ bool GLWindow::CreateWindow(void *pDisplay)
RegisterClassEx(&wc);
if (conf.options & GSOPTION_FULLSCREEN)
if (conf.fullscreen())
{
dwExStyle = WS_EX_APPWINDOW;
dwStyle = WS_POPUP;
@ -186,7 +186,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
RECT rcdesktop;
GetWindowRect(GetDesktopWindow(), &rcdesktop);
if (conf.options & GSOPTION_FULLSCREEN)
if (conf.fullscreen())
{
nBackbufferWidth = rcdesktop.right - rcdesktop.left;
nBackbufferHeight = rcdesktop.bottom - rcdesktop.top;
@ -216,7 +216,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
SetWindowPos(GShwnd, HWND_TOP, X, Y, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
if (conf.options & GSOPTION_FULLSCREEN)
if (conf.fullscreen())
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
@ -231,7 +231,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
if (MessageBox(NULL, "The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?", "NeHe GL", MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
conf.options &= ~GSOPTION_FULLSCREEN;
conf.setFullscreen(false);
else
return false;
}

View File

@ -110,7 +110,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
None
};
GLWin.fullScreen = !!(conf.options & GSOPTION_FULLSCREEN);
GLWin.fullScreen = (conf.fullscreen());
/* get an appropriate visual */
vi = glXChooseVisual(glDisplay, glScreen, attrListDbl);

View File

@ -585,8 +585,8 @@ void OnKeyboardF7(int shift)
else
{
conf.options ^= GSOPTION_WIREFRAME;
glPolygonMode(GL_FRONT_AND_BACK, (conf.options&GSOPTION_WIREFRAME) ? GL_LINE : GL_FILL);
sprintf(strtitle, "wireframe rendering - %s", (conf.options&GSOPTION_WIREFRAME) ? "on" : "off");
glPolygonMode(GL_FRONT_AND_BACK, (conf.wireframe()) ? GL_LINE : GL_FILL);
sprintf(strtitle, "wireframe rendering - %s", (conf.wireframe()) ? "on" : "off");
}
}
@ -810,10 +810,10 @@ void ProcessMessages()
case VK_ESCAPE:
if (conf.options & GSOPTION_FULLSCREEN)
if (conf.fullscreen())
{
// destroy that msg
conf.options &= ~GSOPTION_FULLSCREEN;
conf.setfullscreen(false);
ZeroGS::ChangeDeviceSize(conf.width, conf.height);
UpdateWindow(GShwnd);
continue; // so that msg doesn't get sent
@ -844,8 +844,8 @@ void ProcessMessages()
conf.options ^= GSOPTION_FULLSCREEN;
ZeroGS::SetChangeDeviceSize(
(conf.options&GSOPTION_FULLSCREEN) ? 1280 : conf.width,
(conf.options&GSOPTION_FULLSCREEN) ? 960 : conf.height);
(conf.fullscreen()) ? 1280 : conf.width,
(conf.fullscreen()) ? 960 : conf.height);
}
}
@ -1034,11 +1034,14 @@ void CALLBACK GSvsync(int interlace)
// ZZLog::Debug_Log("Set profile.");
// g_bWriteProfile = 1;
// }
if (!(conf.options & GSOPTION_FULLSCREEN)) GLWin.SetTitle(strtitle);
if (!(conf.fullscreen())) GLWin.SetTitle(strtitle);
if (fFPS < 16) UPDATE_FRAMES = 4;
else if (fFPS < 32) UPDATE_FRAMES = 8;
else UPDATE_FRAMES = 16;
if (fFPS < 16)
UPDATE_FRAMES = 4;
else if (fFPS < 32)
UPDATE_FRAMES = 8;
else
UPDATE_FRAMES = 16;
nToNextUpdate = UPDATE_FRAMES;
@ -1089,19 +1092,19 @@ int CALLBACK GSsetupRecording(int start, void* pData)
if (start)
{
if (conf.options & GSOPTION_CAPTUREAVI) return 1;
if (conf.captureAvi()) return 1;
ZeroGS::StartCapture();
conf.options |= GSOPTION_CAPTUREAVI;
conf.setCaptureAvi(true);
ZZLog::Warn_Log("Started recording zerogs.avi.");
}
else
{
if (!(conf.options & GSOPTION_CAPTUREAVI)) return 1;
if (!(conf.captureAvi())) return 1;
conf.options &= ~GSOPTION_CAPTUREAVI;
conf.setCaptureAvi(false);
ZeroGS::StopCapture();

View File

@ -27,6 +27,8 @@
void SaveConfig()
{
const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
u32 tempOptions = conf.options & ~conf.gamesettings;
FILE* f = fopen(iniFile.c_str(), "w");
if (f == NULL)
@ -38,10 +40,10 @@ void SaveConfig()
fprintf(f, "interlace = %hhx\n", conf.interlace);
fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth);
fprintf(f, "options = %x\n", conf.options); //u32
fprintf(f, "options = %x\n", tempOptions); //u32
fprintf(f, "bilinear = %hhx\n", conf.bilinear);
fprintf(f, "aliasing = %hhx\n", conf.aa);
fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
//fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
fprintf(f, "width = %x\n", conf.width); //u32
fprintf(f, "height = %x\n", conf.height); //u32
fprintf(f, "x = %x\n", conf.x); //u32
@ -81,7 +83,7 @@ void LoadConfig()
err = fscanf(f, "options = %x\n", &conf.options);//u32
err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
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
err = fscanf(f, "width = %x\n", &conf.width);//u32
err = fscanf(f, "height = %x\n", &conf.height);//u32
err = fscanf(f, "x = %x\n", &conf.x);//u32
@ -93,7 +95,7 @@ void LoadConfig()
if ((conf.aa < 0) || (conf.aa > 4)) conf.aa = 0;
conf.isWideScreen = conf.options & GSOPTION_WIDESCREEN;
conf.isWideScreen = conf.widescreen();
switch (conf.options & GSOPTION_WINDIMS)
{
@ -120,9 +122,9 @@ void LoadConfig()
}
// turn off all hacks by default
conf.options &= ~(GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI);
conf.options |= GSOPTION_LOADED;
conf.setWireframe(false);
conf.setCaptureAvi(false);
conf.setLoaded(true);
if (conf.width <= 0 || conf.height <= 0)
{

View File

@ -51,7 +51,7 @@ void CALLBACK GSkeyEvent(keyEvent *ev)
break;
case XK_Escape:
if (conf.options & GSOPTION_FULLSCREEN) GSclose();
if (conf.fullscreen()) GSclose();
break;
case XK_Shift_L:
@ -225,7 +225,7 @@ void DisplayDialog()
GtkWidget *advanced_scroll;
GtkWidget *tree;
if (!(conf.options & GSOPTION_LOADED)) LoadConfig();
if (!(conf.loaded())) LoadConfig();
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons(
@ -328,10 +328,10 @@ void DisplayDialog()
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_check), conf.log);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bilinear_check), conf.bilinear);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wireframe_check), (conf.options & GSOPTION_WIREFRAME));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(avi_check), (conf.options & GSOPTION_CAPTUREAVI));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fullscreen_check), (conf.options & GSOPTION_FULLSCREEN));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widescreen_check), (conf.options & GSOPTION_WIDESCREEN));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wireframe_check), (conf.wireframe()));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(avi_check), (conf.captureAvi()));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fullscreen_check), (conf.fullscreen()));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widescreen_check), (conf.widescreen()));
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), main_frame);
@ -403,7 +403,7 @@ void CALLBACK GSconfigure()
char strcurdir[256];
getcwd(strcurdir, 256);
if (!(conf.options & GSOPTION_LOADED)) LoadConfig();
if (!(conf.loaded())) LoadConfig();
DisplayDialog();
}

View File

@ -154,6 +154,46 @@ typedef struct
int x, y; // Lets try for a persistant window position.
bool isWideScreen; // Widescreen support
u32 log;
u32 settings() { return !!(options | gamesettings); }
bool fullscreen() { return !!(options & GSOPTION_FULLSCREEN); }
bool wireframe() { return !!(options & GSOPTION_WIREFRAME); }
bool widescreen() { return !!(options & GSOPTION_WIDESCREEN); }
bool captureAvi() { return !!(options & GSOPTION_CAPTUREAVI); }
bool loaded() { return !!(options & GSOPTION_LOADED); }
void setFullscreen(bool flag)
{
if (flag)
options |= GSOPTION_FULLSCREEN;
else
options &= GSOPTION_FULLSCREEN;
}
void setWireframe(bool flag)
{
if (flag)
options |= GSOPTION_WIREFRAME;
else
options &= GSOPTION_WIREFRAME;
}
void setCaptureAvi(bool flag)
{
if (flag)
options |= GSOPTION_CAPTUREAVI;
else
options &= GSOPTION_CAPTUREAVI;
}
void setLoaded(bool flag)
{
if (flag)
options |= GSOPTION_LOADED;
else
options &= GSOPTION_LOADED;
}
} GSconf;
//Logging for errors that are called often should have a time counter.

View File

@ -68,7 +68,7 @@ void LoadConfig()
if (conf.aa < 0 || conf.aa > 4) conf.aa = 0;
conf.isWideScreen = ((conf.options & GSOPTION_WIDESCREEN) != 0);
conf.isWideScreen = (conf.widescreen() != 0);
switch (conf.options & GSOPTION_WINDIMS)
{
@ -93,10 +93,10 @@ void LoadConfig()
break;
}
// turn off all hacks by defaultof
conf.options &= ~(GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI);
conf.options |= GSOPTION_LOADED;
// turn off all hacks by default
conf.setWireframe(false);
conf.setCaptureAvi(false);
conf.setLoaded(true);
if (conf.width <= 0 || conf.height <= 0)
{

View File

@ -84,11 +84,11 @@ void OnInitDialog(HWND hW)
CheckDlgButton(hW, IDC_CONFIG_BILINEAR, conf.bilinear);
CheckDlgButton(hW, IDC_CONFIG_DEPTHWRITE, conf.mrtdepth);
CheckRadioButton(hW, IDC_CONFIG_AANONE, IDC_CONFIG_AA4, IDC_CONFIG_AANONE + conf.aa);
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.options&GSOPTION_WIREFRAME) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.options&GSOPTION_CAPTUREAVI) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.wireframe()) ? 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.options&GSOPTION_FULLSCREEN) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_WIDESCREEN, (conf.options&GSOPTION_WIDESCREEN) ? 1 : 0);
CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.fullscreen()) ? 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.options&GSOPTION_TGASNAP) ? 1 : 0);
CheckRadioButton(hW, IDC_CONF_WIN640, IDC_CONF_WIN1280, IDC_CONF_WIN640 + ((conf.options&GSOPTION_WINDIMS) >> 4));

View File

@ -312,7 +312,7 @@ inline void RenderStartHelper(u32 bInterlace)
SET_STREAM();
GL_REPORT_ERRORD();
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
DisableAllgl();
@ -793,7 +793,7 @@ inline void AfterRendererUnimportantJob()
AfterRenderSwapBuffers();
if (conf.options & GSOPTION_WIREFRAME)
if (conf.wireframe())
{
// clear all targets
s_nWireframeCount = 1;
@ -835,7 +835,7 @@ inline void AfterRendererSwitchBackToTextures()
EXTWRITE->WRITE = 0;
}
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glEnable(GL_SCISSOR_TEST);

View File

@ -199,7 +199,7 @@ ZeroGS::Create_Window(int _width, int _height)
if (!GLWin.DisplayWindow(_width, _height)) return false;
s_nFullscreen = (conf.options & GSOPTION_FULLSCREEN) ? 1 : 0;
s_nFullscreen = (conf.fullscreen()) ? 1 : 0;
conf.mrtdepth = 0; // for now

View File

@ -250,7 +250,7 @@ inline void SetAlphaTest(const pixTest& curtest)
// Switch wireframe rendering off for first flush, so it's draw few solid primitives
inline void SwitchWireframeOff()
{
if (conf.options & GSOPTION_WIREFRAME)
if (conf.wireframe())
{
if (s_nWireframeCount > 0)
{
@ -262,7 +262,7 @@ inline void SwitchWireframeOff()
// Switch wireframe rendering on, look at previous function
inline void SwitchWireframeOn()
{
if (conf.options & GSOPTION_WIREFRAME)
if (conf.wireframe())
{
if (s_nWireframeCount > 0)
{

View File

@ -503,7 +503,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
assert(ptex != 0);
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (ZeroGS::IsWriteDestAlphaTest())
{
@ -526,7 +526,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
FillOnlyStencilBuffer();
glEnable(GL_SCISSOR_TEST);
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.mrtdepth && pdepth != NULL && ZeroGS::IsWriteDepth()) pdepth->SetRenderTarget(1);
status = TS_Resolved;
@ -595,7 +595,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
fbh /= 2; // have 16 bit surfaces are usually 2x higher
SetViewport();
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
SETVERTEXSHADER(pvsBitBlt.prog);
@ -624,7 +624,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
ptex = ptexConv;
// no need to free psys since the render target is getting shrunk
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// reset textures
BindToSample(&ptex) ;
@ -702,7 +702,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
SetViewport();
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
SETVERTEXSHADER(pvsBitBlt.prog);
@ -733,7 +733,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
psys = _aligned_malloc(Tex_Memory_Size(fbw, fbh), 16);
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// reset textures
BindToSample(&ptex) ;
@ -805,7 +805,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
SetViewport();
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
SETVERTEXSHADER(pvsBitBlt.prog);
@ -815,7 +815,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
// restore
swap(ptex, ptexFeedback);
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glEnable(GL_SCISSOR_TEST);
@ -1054,7 +1054,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
SetViewport();
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
@ -1071,7 +1071,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
ResetRenderTarget(1);
}
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glEnable(GL_SCISSOR_TEST);

View File

@ -321,7 +321,7 @@ void ZeroGS::ChangeWindowSize(int nNewWidth, int nNewHeight)
nBackbufferWidth = max(nNewWidth, 16);
nBackbufferHeight = max(nNewHeight, 16);
if (!(conf.options & GSOPTION_FULLSCREEN))
if (!(conf.fullscreen()))
{
conf.width = nNewWidth;
conf.height = nNewHeight;
@ -334,7 +334,7 @@ void ZeroGS::SetChangeDeviceSize(int nNewWidth, int nNewHeight)
s_nNewWidth = nNewWidth;
s_nNewHeight = nNewHeight;
if (!(conf.options & GSOPTION_FULLSCREEN))
if (!(conf.fullscreen()))
{
conf.width = nNewWidth;
conf.height = nNewHeight;
@ -534,7 +534,7 @@ void ZeroGS::RenderCustom(float fAlpha)
v.x = v.y = v.z = v.w = fAlpha;
ZZcgSetParameter4fv(ppsBaseTexture.sOneColor, v, "g_fOneColor");
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// inside vhDCb[0]'s target area, so render that region only
cgGLSetTextureParameter(ppsBaseTexture.sFinal, ptexLogo);
@ -548,7 +548,7 @@ void ZeroGS::RenderCustom(float fAlpha)
DrawTriangle();
// restore
if (conf.options & GSOPTION_WIREFRAME) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
ProcessMessages();