ZZOgl-pg: Rework the GLX11Win.cpp code a bunch. Fix a bug leading to crashes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3714 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-09-01 10:28:37 +00:00
parent 009d6ba5e6
commit e686d47cd7
13 changed files with 372 additions and 297 deletions

View File

@ -0,0 +1,73 @@
/* ZZ Open GL graphics plugin
* Copyright (c)2009-2010 zeydlitz@gmail.com, arcum42@gmail.com
* Based on Zerofrog's ZeroGS KOSMOS (c)2005-2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GLWIN_H_INCLUDED
#define GLWIN_H_INCLUDED
#ifdef _WIN32
#define GL_WIN32_WINDOW
#else
#define GL_X11_WINDOW
#endif
#undef CreateWindow // Undo Windows.h global namespace pollution
#ifdef GL_X11_WINDOW
#include <X11/extensions/xf86vmode.h>
#endif
class GLWindow
{
private:
#ifdef GL_X11_WINDOW
Display *glDisplay;
int glScreen;
GLXContext context;
XVisualInfo *vi;
Window glWindow;
XSetWindowAttributes attr;
// Original desktop video mode
XF86VidModeModeInfo deskMode;
bool CreateVisual();
void GetGLXVersion();
void GetGLXVidModeVersion();
void GetWindowSize();
#endif
bool fullScreen, doubleBuffered;
s32 x, y;
u32 width, height, depth;
public:
void SwapGLBuffers();
bool ReleaseContext();
bool CreateWindow(void *pDisplay);
void CloseWindow();
bool DisplayWindow(int _width, int _height);
void SetTitle(char *strtitle);
void ResizeCheck();
};
extern GLWindow GLWin;
#endif // GLWIN_H_INCLUDED

View File

@ -19,6 +19,7 @@
#include "GS.h"
#include "zerogs.h"
#include "GLWin.h"
#ifdef GL_WIN32_WINDOW
@ -138,7 +139,7 @@ bool GLWindow::CreateWindow(void *pDisplay)
return (pDisplay != NULL);
}
bool GLWindow::ReleaseWindow()
bool GLWindow::ReleaseContext()
{
if (hRC) // Do We Have A Rendering Context?
{
@ -305,7 +306,7 @@ void GLWindow::SwapGLBuffers()
void GLWindow::SetTitle(char *strtitle)
{
SetWindowText(GShwnd, strtitle);
if (!conf.fullscreen()) SetWindowText(GShwnd, strtitle);
}
void GLWindow::ResizeCheck()

View File

@ -17,10 +17,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "GS.h"
#include "Util.h"
#include "GLWin.h"
#include "zerogs.h"
#ifdef GL_X11_WINDOW
#include <X11/Xlib.h>
@ -37,9 +37,9 @@ bool GLWindow::CreateWindow(void *pDisplay)
return true;
}
bool GLWindow::ReleaseWindow()
bool GLWindow::ReleaseContext()
{
if (context)
if (context && (glDisplay != NULL))
{
if (!glXMakeCurrent(glDisplay, None, NULL))
{
@ -51,6 +51,15 @@ bool GLWindow::ReleaseWindow()
context = NULL;
}
return true;
}
void GLWindow::CloseWindow()
{
conf.x = x;
conf.y = y;
SaveConfig();
/* switch back to original desktop resolution if we were in fullscreen */
if (glDisplay != NULL)
{
@ -61,15 +70,6 @@ bool GLWindow::ReleaseWindow()
}
}
return true;
}
void GLWindow::CloseWindow()
{
conf.x = x;
conf.y = y;
SaveConfig();
if (glDisplay != NULL)
{
XCloseDisplay(glDisplay);
@ -77,21 +77,8 @@ void GLWindow::CloseWindow()
}
}
bool GLWindow::DisplayWindow(int _width, int _height)
bool GLWindow::CreateVisual()
{
int i;
XVisualInfo *vi;
Colormap cmap;
int dpyWidth, dpyHeight;
int glxMajorVersion, glxMinorVersion;
int vidModeMajorVersion, vidModeMinorVersion;
Atom wmDelete;
Window winDummy;
unsigned int borderDummy;
x = conf.x;
y = conf.y;
// attributes for a single buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
@ -111,8 +98,6 @@ bool GLWindow::DisplayWindow(int _width, int _height)
None
};
GLWin.fullScreen = (conf.fullscreen());
/* get an appropriate visual */
vi = glXChooseVisual(glDisplay, glScreen, attrListDbl);
@ -133,10 +118,45 @@ bool GLWindow::DisplayWindow(int _width, int _height)
ZZLog::Error_Log("Failed to get buffered Visual!");
return false;
}
return true;
}
void GLWindow::GetWindowSize()
{
unsigned int borderDummy;
Window winDummy;
XGetGeometry(glDisplay, glWindow, &winDummy, &x, &y, &width, &height, &borderDummy, &depth);
ZZLog::Error_Log("Depth %d", depth);
}
void GLWindow::GetGLXVersion()
{
int glxMajorVersion, glxMinorVersion;
glXQueryVersion(glDisplay, &glxMajorVersion, &glxMinorVersion);
ZZLog::Error_Log("glX-Version %d.%d", glxMajorVersion, glxMinorVersion);
}
void GLWindow::GetGLXVidModeVersion()
{
int vidModeMajorVersion, vidModeMinorVersion;
XF86VidModeQueryVersion(glDisplay, &vidModeMajorVersion, &vidModeMinorVersion);
ZZLog::Error_Log("XF86VidModeExtension-Version %d.%d.", vidModeMajorVersion, vidModeMinorVersion);
}
bool GLWindow::DisplayWindow(int _width, int _height)
{
Colormap cmap;
x = conf.x;
y = conf.y;
fullScreen = (conf.fullscreen());
if (!CreateVisual()) return false;
/* create a GLX context */
context = glXCreateContext(glDisplay, vi, NULL, GL_TRUE);
@ -144,21 +164,21 @@ bool GLWindow::DisplayWindow(int _width, int _height)
/* create a color map */
cmap = XCreateColormap(glDisplay, RootWindow(glDisplay, vi->screen),
vi->visual, AllocNone);
attr.colormap = cmap;
attr.border_pixel = 0;
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask;
// get a connection
XF86VidModeQueryVersion(glDisplay, &vidModeMajorVersion, &vidModeMinorVersion);
GetGLXVersion();
if (fullScreen)
{
int dpyWidth, dpyHeight;
int modeNum = 0, bestMode = 0;
XF86VidModeModeInfo **modes = NULL;
int modeNum = 0;
int bestMode = 0;
// set best mode to current
bestMode = 0;
ZZLog::Error_Log("XF86VidModeExtension-Version %d.%d.", vidModeMajorVersion, vidModeMinorVersion);
GetGLXVidModeVersion();
XF86VidModeGetAllModeLines(glDisplay, glScreen, &modeNum, &modes);
if (modeNum > 0 && modes != NULL)
@ -168,7 +188,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
/* look for mode with requested resolution */
for (i = 0; i < modeNum; i++)
for (int i = 0; i < modeNum; i++)
{
if ((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height))
{
@ -186,7 +206,6 @@ bool GLWindow::DisplayWindow(int _width, int _height)
/* create a fullscreen window */
attr.override_redirect = True;
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask;
glWindow = XCreateWindow(glDisplay, RootWindow(glDisplay, vi->screen),
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
@ -209,15 +228,15 @@ bool GLWindow::DisplayWindow(int _width, int _height)
if (!fullScreen)
{
// create a window in window mode
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask;
glWindow = XCreateWindow(glDisplay, RootWindow(glDisplay, vi->screen),
0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);
// only set window title and handle wm_delete_events if in windowed mode
Atom wmDelete;
wmDelete = XInternAtom(glDisplay, "WM_DELETE_WINDOW", True);
XSetWMProtocols(glDisplay, glWindow, &wmDelete, 1);
XSetStandardProperties(glDisplay, glWindow, "ZZOgl-PG", "ZZOgl-PG", None, NULL, 0, NULL);
XMapRaised(glDisplay, glWindow);
XMoveWindow(glDisplay, glWindow, x, y);
@ -226,9 +245,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
// connect the glx-context to the window
glXMakeCurrent(glDisplay, glWindow, context);
XGetGeometry(glDisplay, glWindow, &winDummy, &x, &y, &width, &height, &borderDummy, &depth);
ZZLog::Error_Log("Depth %d", depth);
GetWindowSize();
if (glXIsDirect(glDisplay, context))
ZZLog::Error_Log("You have Direct Rendering!");
@ -249,6 +266,8 @@ void GLWindow::SwapGLBuffers()
}
void GLWindow::SetTitle(char *strtitle)
{
if (!conf.fullscreen())
{
XTextProperty prop;
memset(&prop, 0, sizeof(prop));
@ -259,6 +278,7 @@ void GLWindow::SetTitle(char *strtitle)
XFree(prop.value);
}
}
void GLWindow::ResizeCheck()
{
@ -275,6 +295,8 @@ void GLWindow::ResizeCheck()
if ((event.xconfigure.x != x) || (event.xconfigure.y != y))
{
// Fixme; x&y occassionally gives values near the top left corner rather then the real values,
// causing the window to change positions when adjusting ZZOgl's settings.
x = event.xconfigure.x;
y = event.xconfigure.y;
}

View File

@ -25,52 +25,16 @@
#include "Util.h"
#include "GifTransfer.h"
extern float fFPS;
//#include "GLWin.h"
using namespace std;
#ifdef _WIN32
#define GL_WIN32_WINDOW
#else
#define GL_X11_WINDOW
#endif
#undef CreateWindow // Undo Windows.h global namespace pollution
#ifdef GL_X11_WINDOW
#include <X11/extensions/xf86vmode.h>
#endif
extern float fFPS;
#define MEMORY_END 0x00400000
class GLWindow
{
private:
#ifdef GL_X11_WINDOW
Display *glDisplay;
Window glWindow;
int glScreen;
GLXContext context;
XSetWindowAttributes attr;
XF86VidModeModeInfo deskMode;
#endif
bool fullScreen, doubleBuffered;
s32 x, y;
u32 width, height, depth;
public:
void SwapGLBuffers();
void SetTitle(char *strtitle);
bool CreateWindow(void *pDisplay);
bool ReleaseWindow();
void CloseWindow();
bool DisplayWindow(int _width, int _height);
void ResizeCheck();
};
extern GLWindow GLWin;
extern int g_LastCRC;
extern u8* g_pBasePS2Mem;
extern u8* g_pbyGSMemory;
@ -95,195 +59,14 @@ class GSClut
u8* get(u32 addr);
u8* get_raw(u32 addr);
};
struct Vector_16F
{
u16 x, y, z, w;
};
REG64_(GSReg, BGCOLOR)
u32 R:8;
u32 G:8;
u32 B:8;
u32 _PAD1:8;
u32 _PAD2:32;
REG_END
REG64_(GSReg, BUSDIR)
u32 DIR:1;
u32 _PAD1:31;
u32 _PAD2:32;
REG_END
REG64_(GSReg, CSR)
u32 SIGNAL:1;
u32 FINISH:1;
u32 HSINT:1;
u32 VSINT:1;
u32 EDWINT:1;
u32 ZERO1:1;
u32 ZERO2:1;
u32 _PAD1:1;
u32 FLUSH:1;
u32 RESET:1;
u32 _PAD2:2;
u32 NFIELD:1;
u32 FIELD:1;
u32 FIFO:2;
u32 REV:8;
u32 ID:8;
u32 _PAD3:32;
REG_END
REG64_(GSReg, DISPFB) // (-1/2)
u32 FBP:9;
u32 FBW:6;
u32 PSM:5;
u32 _PAD:12;
u32 DBX:11;
u32 DBY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, DISPLAY) // (-1/2)
u32 DX:12;
u32 DY:11;
u32 MAGH:4;
u32 MAGV:2;
u32 _PAD:3;
u32 DW:12;
u32 DH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTBUF)
u32 EXBP:14;
u32 EXBW:6;
u32 FBIN:2;
u32 WFFMD:1;
u32 EMODA:2;
u32 EMODC:2;
u32 _PAD1:5;
u32 WDX:11;
u32 WDY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, EXTDATA)
u32 SX:12;
u32 SY:11;
u32 SMPH:4;
u32 SMPV:2;
u32 _PAD1:3;
u32 WW:12;
u32 WH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTWRITE)
u32 WRITE;
u32 _PAD2:32;
REG_END
REG64_(GSReg, IMR)
u32 _PAD1:8;
u32 SIGMSK:1;
u32 FINISHMSK:1;
u32 HSMSK:1;
u32 VSMSK:1;
u32 EDWMSK:1;
u32 _PAD2:19;
u32 _PAD3:32;
REG_END
REG64_(GSReg, PMODE)
u32 EN1:1;
u32 EN2:1;
u32 CRTMD:3;
u32 MMOD:1;
u32 AMOD:1;
u32 SLBG:1;
u32 ALP:8;
u32 _PAD:16;
u32 _PAD1:32;
REG_END
REG64_(GSReg, SIGLBLID)
u32 SIGID:32;
u32 LBLID:32;
REG_END
REG64_(GSReg, SMODE1)
u32 RC:3;
u32 LC:7;
u32 T1248:2;
u32 SLCK:1;
u32 CMOD:2;
u32 EX:1;
u32 PRST:1;
u32 SINT:1;
u32 XPCK:1;
u32 PCK2:2;
u32 SPML:4;
u32 GCONT:1;
u32 PHS:1;
u32 PVS:1;
u32 PEHS:1;
u32 PEVS:1;
u32 CLKSEL:2;
u32 NVCK:1;
u32 SLCK2:1;
u32 VCKSEL:2;
u32 VHP:1;
u32 _PAD1:27;
REG_END
REG64_(GSReg, SMODE2)
u32 INT:1;
u32 FFMD:1;
u32 DPMS:2;
u32 _PAD2:28;
u32 _PAD3:32;
REG_END
REG64_(GSReg, SIGBLID)
u32 SIGID;
u32 LBLID;
REG_END
extern int g_LastCRC;
extern u8* g_pBasePS2Mem;
#define PMODE ((GSRegPMODE*)(g_pBasePS2Mem+0x0000))
#define SMODE1 ((GSRegSMODE1*)(g_pBasePS2Mem+0x0010))
#define SMODE2 ((GSRegSMODE2*)(g_pBasePS2Mem+0x0020))
// SRFSH
#define SYNCH1 ((GSRegSYNCH1*)(g_pBasePS2Mem+0x0040))
#define SYNCH2 ((GSRegSYNCH2*)(g_pBasePS2Mem+0x0050))
#define SYNCV ((GSRegSYNCV*)(g_pBasePS2Mem+0x0060))
#define DISPFB1 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0070))
#define DISPLAY1 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x0080))
#define DISPFB2 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0090))
#define DISPLAY2 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x00a0))
#define EXTBUF ((GSRegEXTBUF*)(g_pBasePS2Mem+0x00b0))
#define EXTDATA ((GSRegEXTDATA*)(g_pBasePS2Mem+0x00c0))
#define EXTWRITE ((GSRegEXTWRITE*)(g_pBasePS2Mem+0x00d0))
#define BGCOLOR ((GSRegBGCOLOR*)(g_pBasePS2Mem+0x00e0))
#define CSR ((GSRegCSR*)(g_pBasePS2Mem+0x1000))
#define IMR ((GSRegIMR*)(g_pBasePS2Mem+0x1010))
#define BUSDIR ((GSRegBUSDIR*)(g_pBasePS2Mem+0x1040))
#define SIGLBLID ((GSRegSIGBLID*)(g_pBasePS2Mem+0x1080))
#define GET_GSFPS (((SMODE1->CMOD&1) ? 50 : 60) / (SMODE2->INT ? 1 : 2))
//
// sps2tags.h
//
#define GET_GIF_REG(tag, reg) \
(((tag).ai32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
// PS2 vertex
struct VertexGPU
{
// gained from XYZ2, XYZ3, XYZF2, XYZF3,
@ -299,7 +82,7 @@ struct VertexGPU
float s, t, q;
};
// Almost same with previous, controlled by prim.fst flagf
// Almost same as previous, controlled by prim.fst flags
struct Vertex
{
@ -508,10 +291,9 @@ union tex_0_info
u32 _u32[2];
u16 _u16[4];
u8 _u8[8];
tex_0_info(u64 data) { _u64 = data; }
tex_0_info(u32 data) { _u32[0] = data; _u32[1] = 0; }
tex_0_info(u32 data0, u32 data1) { _u32[0] = data0; _u32[1] = data1; }
u32 tbw_mult()

View File

@ -32,6 +32,7 @@ using namespace std;
#include "Mem.h"
#include "Regs.h"
#include "Profile.h"
#include "GLWin.h"
#include "zerogs.h"
#include "targets.h"
@ -318,13 +319,11 @@ void CALLBACK GSshutdown()
ZZLog::Close();
}
void CALLBACK GSclose()
{
FUNCLOG
ZeroGS::Destroy(1);
GLWin.CloseWindow();
SaveStateFile = NULL;
@ -442,7 +441,7 @@ static __forceinline void SetGSTitle()
// ZZLog::Debug_Log("Set profile.");
// g_bWriteProfile = 1;
// }
if (!(conf.fullscreen())) GLWin.SetTitle(strtitle);
GLWin.SetTitle(strtitle);
}
void CALLBACK GSvsync(int interlace)

View File

@ -25,6 +25,7 @@
#include "GS.h"
#include "Linux.h"
#include "zerogs.h"
#include "GLWin.h"
#include <map>
@ -52,7 +53,10 @@ void CALLBACK GSkeyEvent(keyEvent *ev)
break;
case XK_Escape:
if (conf.fullscreen()) GSclose();
if (conf.fullscreen())
{
GSclose();
}
break;
case XK_Shift_L:
@ -205,7 +209,6 @@ void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_da
void DisplayAdvancedDialog()
{
int return_value;
GtkWidget *dialog;
GtkWidget *advanced_frame, *advanced_box;

View File

@ -98,6 +98,7 @@
<Mode after="always" />
</ExtraCommands>
<Unit filename="../../CRC.h" />
<Unit filename="../../GLWin.h" />
<Unit filename="../../GLWin32.cpp" />
<Unit filename="../../GLWinX11.cpp" />
<Unit filename="../../GS.h" />

View File

@ -238,7 +238,7 @@ void tex0Write(int i, const u32 *data)
}
// check if csa is the same!! (ffx bisaid island, grass)
else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000))
else if ((data[1] & CPSM_CSA_BITMASK) != (ZeroGS::vb[i].uCurTex0Data[1] & CPSM_CSA_BITMASK))
{
ZeroGS::Flush(i); // flush any previous entries
}

View File

@ -764,6 +764,185 @@ REG128_SET(GIFPackedReg)
GIFPackedNOP NOP;
REG_SET_END
REG64_(GSReg, BGCOLOR)
u32 R:8;
u32 G:8;
u32 B:8;
u32 _PAD1:8;
u32 _PAD2:32;
REG_END
REG64_(GSReg, BUSDIR)
u32 DIR:1;
u32 _PAD1:31;
u32 _PAD2:32;
REG_END
REG64_(GSReg, CSR)
u32 SIGNAL:1;
u32 FINISH:1;
u32 HSINT:1;
u32 VSINT:1;
u32 EDWINT:1;
u32 ZERO1:1;
u32 ZERO2:1;
u32 _PAD1:1;
u32 FLUSH:1;
u32 RESET:1;
u32 _PAD2:2;
u32 NFIELD:1;
u32 FIELD:1;
u32 FIFO:2;
u32 REV:8;
u32 ID:8;
u32 _PAD3:32;
REG_END
REG64_(GSReg, DISPFB) // (-1/2)
u32 FBP:9;
u32 FBW:6;
u32 PSM:5;
u32 _PAD:12;
u32 DBX:11;
u32 DBY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, DISPLAY) // (-1/2)
u32 DX:12;
u32 DY:11;
u32 MAGH:4;
u32 MAGV:2;
u32 _PAD:3;
u32 DW:12;
u32 DH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTBUF)
u32 EXBP:14;
u32 EXBW:6;
u32 FBIN:2;
u32 WFFMD:1;
u32 EMODA:2;
u32 EMODC:2;
u32 _PAD1:5;
u32 WDX:11;
u32 WDY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, EXTDATA)
u32 SX:12;
u32 SY:11;
u32 SMPH:4;
u32 SMPV:2;
u32 _PAD1:3;
u32 WW:12;
u32 WH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTWRITE)
u32 WRITE;
u32 _PAD2:32;
REG_END
REG64_(GSReg, IMR)
u32 _PAD1:8;
u32 SIGMSK:1;
u32 FINISHMSK:1;
u32 HSMSK:1;
u32 VSMSK:1;
u32 EDWMSK:1;
u32 _PAD2:19;
u32 _PAD3:32;
REG_END
REG64_(GSReg, PMODE)
u32 EN1:1;
u32 EN2:1;
u32 CRTMD:3;
u32 MMOD:1;
u32 AMOD:1;
u32 SLBG:1;
u32 ALP:8;
u32 _PAD:16;
u32 _PAD1:32;
REG_END
REG64_(GSReg, SIGLBLID)
u32 SIGID:32;
u32 LBLID:32;
REG_END
REG64_(GSReg, SMODE1)
u32 RC:3;
u32 LC:7;
u32 T1248:2;
u32 SLCK:1;
u32 CMOD:2;
u32 EX:1;
u32 PRST:1;
u32 SINT:1;
u32 XPCK:1;
u32 PCK2:2;
u32 SPML:4;
u32 GCONT:1;
u32 PHS:1;
u32 PVS:1;
u32 PEHS:1;
u32 PEVS:1;
u32 CLKSEL:2;
u32 NVCK:1;
u32 SLCK2:1;
u32 VCKSEL:2;
u32 VHP:1;
u32 _PAD1:27;
REG_END
REG64_(GSReg, SMODE2)
u32 INT:1;
u32 FFMD:1;
u32 DPMS:2;
u32 _PAD2:28;
u32 _PAD3:32;
REG_END
REG64_(GSReg, SIGBLID)
u32 SIGID;
u32 LBLID;
REG_END
#define PMODE ((GSRegPMODE*)(g_pBasePS2Mem+0x0000))
#define SMODE1 ((GSRegSMODE1*)(g_pBasePS2Mem+0x0010))
#define SMODE2 ((GSRegSMODE2*)(g_pBasePS2Mem+0x0020))
// SRFSH
#define SYNCH1 ((GSRegSYNCH1*)(g_pBasePS2Mem+0x0040))
#define SYNCH2 ((GSRegSYNCH2*)(g_pBasePS2Mem+0x0050))
#define SYNCV ((GSRegSYNCV*)(g_pBasePS2Mem+0x0060))
#define DISPFB1 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0070))
#define DISPLAY1 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x0080))
#define DISPFB2 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0090))
#define DISPLAY2 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x00a0))
#define EXTBUF ((GSRegEXTBUF*)(g_pBasePS2Mem+0x00b0))
#define EXTDATA ((GSRegEXTDATA*)(g_pBasePS2Mem+0x00c0))
#define EXTWRITE ((GSRegEXTWRITE*)(g_pBasePS2Mem+0x00d0))
#define BGCOLOR ((GSRegBGCOLOR*)(g_pBasePS2Mem+0x00e0))
#define CSR ((GSRegCSR*)(g_pBasePS2Mem+0x1000))
#define IMR ((GSRegIMR*)(g_pBasePS2Mem+0x1010))
#define BUSDIR ((GSRegBUSDIR*)(g_pBasePS2Mem+0x1040))
#define SIGLBLID ((GSRegSIGBLID*)(g_pBasePS2Mem+0x1080))
//
// sps2tags.h
//
#define GET_GIF_REG(tag, reg) \
(((tag).ai32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
#define GET_GSFPS (((SMODE1->CMOD&1) ? 50 : 60) / (SMODE2->INT ? 1 : 2))
extern void WriteTempRegs();
extern void SetFrameSkip(bool skip);
extern void ResetRegs();

View File

@ -23,6 +23,7 @@
#include "GS.h"
#include "ZeroGSShaders/zerogsshaders.h"
#include "Profile.h"
#include "GLWin.h"
extern int CurrentSavestate, g_GSMultiThreaded, g_nPixelShaderVer;
extern char *libraryName;
@ -355,7 +356,7 @@ void ProcessMessages()
// check resizing
GLWin.ResizeCheck();
if (THR_KeyEvent) // This values was passed from GSKeyEvents which could be in another thread
if (THR_KeyEvent) // This value was passed from GSKeyEvents which could be in another thread
{
int my_KeyEvent = THR_KeyEvent;
bool my_bShift = THR_bShift;

View File

@ -22,6 +22,7 @@
//------------------ Includes
#include "ZZoglCRTC.h"
#include "GLWin.h"
using namespace ZeroGS;

View File

@ -23,6 +23,7 @@
#include "GS.h"
#include "Mem.h"
#include "zerogs.h"
#include "GLWin.h"
#include "ZeroGSShaders/zerogsshaders.h"
#include "targets.h"
@ -922,6 +923,7 @@ bool ZeroGS::Create(int _width, int _height)
}
}
extern bool GSclosing;
void ZeroGS::Destroy(bool bD3D)
{
Delete_Avi_Capture();
@ -949,20 +951,29 @@ void ZeroGS::Destroy(bool bD3D)
g_nCurVBOIndex = 0;
if (pvs != NULL)
{
for (int i = 0; i < ARRAY_SIZE(pvs); ++i)
{
SAFE_RELEASE_PROG(pvs[i]);
}
}
if (ppsRegular != NULL)
{
for (int i = 0; i < ARRAY_SIZE(ppsRegular); ++i)
{
SAFE_RELEASE_PROG(ppsRegular[i].prog);
}
}
if (ppsTexture != NULL)
{
for (int i = 0; i < ARRAY_SIZE(ppsTexture); ++i)
{
SAFE_RELEASE_PROG(ppsTexture[i].prog);
}
}
SAFE_RELEASE_PROG(pvsBitBlt.prog);
@ -979,8 +990,9 @@ void ZeroGS::Destroy(bool bD3D)
SAFE_DELETE(font_p);
GLWin.ReleaseWindow();
GLWin.ReleaseContext();
//if (GSclosing) assert(0);
mapGLExtensions.clear();
}

View File

@ -31,6 +31,7 @@
#include "zerogs.h"
#include "zpipe.h"
#include "targets.h"
#include "GLWin.h"
//----------------------- Defines