diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-02-18 08:58:58 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-02-18 08:58:58 +0000 |
| commit | 34cfcc5169cafa8ae9e0d6469e20dc11c122c077 (patch) | |
| tree | 47ddff4f53156e888c370b12c405a6849a9cb2a6 /plugins | |
| parent | 394f7a2b4a604dc40cf29f23a7121deb19eed79c (diff) | |
| download | pcsxr-34cfcc5169cafa8ae9e0d6469e20dc11c122c077.tar.gz | |
-(SysBeep)Added Mac OS X port of P.E.Op.S OpenGL plugin. (Patch #8361)
-Fixed help message for Windows. (Issue #8028).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@63522 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/peopsxgl/draw.c | 52 | ||||
| -rw-r--r-- | plugins/peopsxgl/externals.h | 13 | ||||
| -rw-r--r-- | plugins/peopsxgl/gpu.c | 80 | ||||
| -rw-r--r-- | plugins/peopsxgl/key.c | 4 |
4 files changed, 123 insertions, 26 deletions
diff --git a/plugins/peopsxgl/draw.c b/plugins/peopsxgl/draw.c index 32dcc83b..748824a1 100644 --- a/plugins/peopsxgl/draw.c +++ b/plugins/peopsxgl/draw.c @@ -27,6 +27,11 @@ #include "texture.h"
#include "menu.h"
+#if defined(_MACGL)
+// if you use it, you must include it
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#endif
////////////////////////////////////////////////////////////////////////////////////
// defines
@@ -125,9 +130,13 @@ BOOL bGLExt; BOOL bGLFastMovie=FALSE;
BOOL bGLSoft;
BOOL bGLBlend;
+#if defined (_MACGL) // always supported on OSX > 10.4.3
+#define glBlendEquationEXTEx glBlendEquationEXT
+#define glColorTableEXTEx glColorTableEXT
+#else
PFNGLBLENDEQU glBlendEquationEXTEx=NULL;
PFNGLCOLORTABLEEXT glColorTableEXTEx=NULL;
-
+#endif
// gfx card buffer infos
int iDepthFunc=0;
@@ -215,7 +224,9 @@ void GetExtInfos(void) iClampType=GL_TO_EDGE_CLAMP;
else iClampType=GL_CLAMP;
+#if !defined (_MACGL) // OSX > 10.4.3 defines this
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)NULL; // init ogl palette func pointer
+#endif
#ifndef __sun
if(iGPUHeight!=1024 && // no pal textures in ZN mode (height=1024)!
@@ -226,11 +237,14 @@ void GetExtInfos(void) #ifdef _WINDOWS
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)wglGetProcAddress("glColorTableEXT");
+#elif defined (_MACGL)
+ // no prob, done already in OSX > 10.4.3
#else
glColorTableEXTEx=(PFNGLCOLORTABLEEXT)glXGetProcAddress("glColorTableEXT");
#endif
if(glColorTableEXTEx==NULL) iUsePalTextures=0; // -> ha, cheater... no func, no support
+
}
else iUsePalTextures=0;
#else
@@ -261,13 +275,17 @@ void SetExtGLFuncs(void) if(wglSwapIntervalEXT) wglSwapIntervalEXT(iForceVSync);
}
#endif
-
+#ifdef _MACGL
+ SetVSync(iForceVSync);
+#endif
if(iUseExts && !(dwActFixes&1024) && // extensions wanted? and not turned off by game fix?
strstr((char *)glGetString(GL_EXTENSIONS), // and blend_subtract available?
"GL_EXT_blend_subtract"))
{ // -> get ogl blend function pointer
#ifdef _WINDOWS
glBlendEquationEXTEx=(PFNGLBLENDEQU)wglGetProcAddress("glBlendEquationEXT");
+#elif defined(_MACGL)
+ // no prob, OSX > 10.4.3 has this
#else
glBlendEquationEXTEx=(PFNGLBLENDEQU)glXGetProcAddress("glBlendEquationEXT");
#endif
@@ -276,7 +294,9 @@ void SetExtGLFuncs(void) {
if(glBlendEquationEXTEx) // -> change to additive blending (if subract was active)
glBlendEquationEXTEx(FUNC_ADD_EXT);
+#if !defined(_MACGL) // BTW, why set to null? strange...
glBlendEquationEXTEx=(PFNGLBLENDEQU)NULL; // -> no more blend function pointer
+#endif
}
//----------------------------------------------------//
@@ -501,8 +521,24 @@ void CreateScanLines(void) {
uiScanLine=glGenLists(1);
glNewList(uiScanLine,GL_COMPILE);
-
- for(y=0;y<iResY;y+=2)
+ #ifdef _MACGL
+ // not mac specific, just commenting out to be friendly
+ // use it if you like
+ // this draws anti-aliased lines with user-chosen color
+ glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT);
+ glEnable(GL_BLEND | GL_LINE_SMOOTH);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(iScanlineColor[0],iScanlineColor[1],iScanlineColor[2],iScanlineColor[3]);
+ glBegin(GL_LINES);
+ for(y=0;y<iResY;y+=2)
+ {
+ glVertex2f(0,y);
+ glVertex2f(iResX,y);
+ }
+ glEnd();
+ glPopAttrib();
+ #else
+ for(y=0;y<iResY;y+=2)
{
glBegin(GL_QUADS);
glVertex2f(0,y);
@@ -511,7 +547,9 @@ void CreateScanLines(void) glVertex2f(0,y+1);
glEnd();
}
- glEndList();
+
+ #endif
+ glEndList();
}
}
}
@@ -536,7 +574,9 @@ int GLinitialize() // CheckWGLExtensions(dcGlobal);
if(bWindowMode) ReleaseDC(hWWindow,dcGlobal); // win mode: release dc again
#endif
-
+#if defined (_MACGL)
+ BringContextForward();
+#endif
glViewport(rRatioRect.left, // init viewport by ratio rect
iResY-(rRatioRect.top+rRatioRect.bottom),
rRatioRect.right,
diff --git a/plugins/peopsxgl/externals.h b/plugins/peopsxgl/externals.h index 02b1fdf1..0fa4ac9f 100644 --- a/plugins/peopsxgl/externals.h +++ b/plugins/peopsxgl/externals.h @@ -16,6 +16,12 @@ * *
***************************************************************************/
+#if defined (_MACGL)
+// if you use it, you must include it.
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#endif
+
#define MIRROR_TEST 1
#define SCISSOR_TEST 1
@@ -84,6 +90,7 @@ #define TRUE 1
#define BOOL unsigned short
#define bool unsigned short
+
#define LOWORD(l) ((unsigned short)(l))
#define HIWORD(l) ((unsigned short)(((uint32_t)(l) >> 16) & 0xFFFF))
#define max(a,b) (((a) > (b)) ? (a) : (b))
@@ -222,8 +229,13 @@ extern BOOL bGLFastMovie; extern BOOL bGLSoft;
extern BOOL bGLBlend;
+#if !defined(_MACGL)
extern PFNGLBLENDEQU glBlendEquationEXTEx;
extern PFNGLCOLORTABLEEXT glColorTableEXTEx;
+#else // no pointers for mac (OSX >= 10.4.3)
+#define glBlendEquationEXTEx glBlendEquationEXT
+#define glColorTableEXTEx glColorTableEXT
+#endif
extern unsigned char gl_ux[8];
extern unsigned char gl_vy[8];
@@ -372,6 +384,7 @@ extern BOOL bNeedRGB24Update; extern BOOL bChangeWinMode;
extern GLuint uiScanLine;
extern int iUseScanLines;
+extern float iScanlineColor[]; /* 4 element array of RGBA float */
extern int lSelectedSlot;
extern int iScanBlend;
extern BOOL bInitCap;
diff --git a/plugins/peopsxgl/gpu.c b/plugins/peopsxgl/gpu.c index beb11156..f379372b 100644 --- a/plugins/peopsxgl/gpu.c +++ b/plugins/peopsxgl/gpu.c @@ -142,6 +142,7 @@ short imageY0,imageY1; BOOL bDisplayNotSet = TRUE;
GLuint uiScanLine=0;
int iUseScanLines=0;
+float iScanlineColor[] = {0,0,0, 0.3}; // easy on the eyes.
int lSelectedSlot=0;
unsigned char * pGfxCardScreen=0;
int iBlurBuffer=0;
@@ -694,7 +695,7 @@ long CALLBACK GPUopen(HWND hwndGPU) return 0;
}
-#else
+#elif !defined (_MACGL)
////////////////////////////////////////////////////////////////////////
// LINUX GPU OPEN: func to open up the gpu display (X stuff)
@@ -999,6 +1000,14 @@ void sysdep_create_display(void) // create display }
}
+#endif // !defined(_MACGL)
+
+#ifndef _WINDOWS
+
+#if defined(_MACGL)
+extern char * pCaptionText;
+#endif
+
////////////////////////////////////////////////////////////////////////
long GPUopen(unsigned long * disp,char * CapText,char * CfgFile)
@@ -1012,8 +1021,12 @@ long GPUopen(unsigned long * disp,char * CapText,char * CfgFile) bIsFirstFrame = TRUE; // we have to init later (well, no really... in Linux we do all in GPUopen)
+ #if defined (_MACGL)
+ unsigned long display = ulInitDisplay();
+ #else
sysdep_create_display(); // create display
-
+ #endif
+
InitializeTextureStore(); // init texture mem
rRatioRect.left = rRatioRect.top=0;
@@ -1024,14 +1037,20 @@ long GPUopen(unsigned long * disp,char * CapText,char * CfgFile) if(disp)
{
+ #if defined (_MACGL)
+ *disp = display;
+ #else
*disp=(unsigned long *)display; // return display ID to main emu
+ #endif
}
if(display) return 0;
return -1;
}
-#endif
+#endif // ndef _WINDOWS
+
+
////////////////////////////////////////////////////////////////////////
// close
@@ -1067,9 +1086,11 @@ long GPUclose() // LINUX CLOSE if(pGfxCardScreen) free(pGfxCardScreen); // free helper memory
pGfxCardScreen=0;
-
+ #if defined (_MACGL)
+ CloseDisplay();
+ #else
osd_close_display(); // destroy display
-
+ #endif
return 0;
}
@@ -1399,7 +1420,9 @@ void updateDisplay(void) // UPDATE DISPLAY HDC hdc=GetDC(hWWindow); // windows:
wglMakeCurrent(hdc,GLCONTEXT); // -> make context current again
#endif
-
+#if defined (_MACGL)
+ BringContextForward();
+#endif
bFakeFrontBuffer=FALSE;
bRenderFrontBuffer=FALSE;
@@ -1489,6 +1512,8 @@ void updateDisplay(void) // UPDATE DISPLAY if(iDrawnSomething)
#ifdef _WINDOWS
SwapBuffers(wglGetCurrentDC()); // -> to skip or not to skip
+#elif defined(_MACGL)
+ DoBufferSwap();
#else
glXSwapBuffers(display,window);
#endif
@@ -1506,6 +1531,8 @@ void updateDisplay(void) // UPDATE DISPLAY if(iDrawnSomething)
#ifdef _WINDOWS
SwapBuffers(wglGetCurrentDC()); // -> swap
+#elif defined(_MACGL)
+ DoBufferSwap();
#else
glXSwapBuffers(display,window);
#endif
@@ -1630,6 +1657,10 @@ void updateFrontDisplay(void) SwapBuffers(wglGetCurrentDC()); // -> swap
ReleaseDC(hWWindow,hdc); // -> ! important !
}
+#elif defined (_MACGL)
+if (iDrawnSomething){
+ DoBufferSwap();
+ }
#else
if(iDrawnSomething) // linux:
glXSwapBuffers(display,window);
@@ -1964,7 +1995,7 @@ void CALLBACK GPUupdateLace(void) updateDisplay();
}
-#ifdef _WINDOWS
+#if defined(_WINDOWS) || defined(_MACGL)
if(bChangeWinMode) ChangeWindowMode();
#endif
}
@@ -2906,7 +2937,24 @@ void CALLBACK GPUwriteData(uint32_t gdata) // call config dlg
////////////////////////////////////////////////////////////////////////
-#ifndef _WINDOWS
+#ifdef _WINDOWS
+
+long CALLBACK GPUconfigure(void)
+{
+ HWND hWP=GetActiveWindow();
+ DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGDLG),
+ hWP,(DLGPROC)CfgDlgProc);
+
+ return 0;
+}
+
+#elif defined(_MACGL)
+long CALLBACK GPUconfigure(void)
+{
+ DlgProc();
+ return 0;
+}
+#else
void StartCfgTool(char *arg) // linux: start external cfg tool
{
@@ -2949,18 +2997,7 @@ long CALLBACK GPUconfigure(void) return 0;
}
-#else
-
-long CALLBACK GPUconfigure(void)
-{
- HWND hWP=GetActiveWindow();
- DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGDLG),
- hWP,(DLGPROC)CfgDlgProc);
-
- return 0;
-}
-
-#endif
+#endif // def _WINDOWS / _MACGL
////////////////////////////////////////////////////////////////////////
// sets all kind of act fixes
@@ -3042,6 +3079,9 @@ void CALLBACK GPUabout(void) HWND hWP=GetActiveWindow(); // to be sure
DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG_ABOUT),
hWP,(DLGPROC)AboutDlgProc);
+#elif defined(_MACGL)
+
+ AboutDlgProc();
#else
StartCfgTool("ABOUT");
diff --git a/plugins/peopsxgl/key.c b/plugins/peopsxgl/key.c index 25afa172..dba1c839 100644 --- a/plugins/peopsxgl/key.c +++ b/plugins/peopsxgl/key.c @@ -46,6 +46,7 @@ uint32_t ulKeybits = 0; void GPUkeypressed(int keycode)
{
+/* arrives via the input plugin, so who knows what thread you're in */
switch(keycode)
{
case VK_F5:
@@ -78,6 +79,9 @@ void GPUkeypressed(int keycode) case VK_NEXT: BuildDispMenu( 1); break;
case VK_END: SwitchDispMenu( 1); break;
case VK_HOME: SwitchDispMenu(-1); break;
+#if defined (_MACGL)
+ default: { void HandleKey(int keycode); HandleKey(keycode); };
+#endif
}
}
|
