\r
#define _IN_DRAW\r
\r
-#ifdef _WINDOWS\r
-#include "stdafx.h"\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <math.h>\r
-#include "externals.h"\r
-#include "gpu.h"\r
-#include "draw.h"\r
-#include "prim.h"\r
-#include "texture.h"\r
-#else\r
+\r
#include "gpuExternals.h"\r
#include "gpuPlugin.h"\r
#include "gpuDraw.h"\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <math.h>\r
-#endif\r
//#include "menu.h"\r
\r
////////////////////////////////////////////////////////////////////////////////////\r
////////////////////////////////////////////////////////////////////////////////////\r
// draw globals\r
\r
-#ifdef _WINDOWS\r
-HDC dcGlobal=NULL;\r
-HWND hWWindow;\r
-#else\r
void glBlendEquationEXT(GLenum mode);\r
void glColorTableEXT(GLenum target, GLenum internalFormat, GLsizei width, GLenum format,GLenum type, const GLvoid *data);\r
-#endif\r
\r
// draw globals; most will be initialized again later (by config or checks) \r
\r
// Set OGL pixel format\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-BOOL bSetupPixelFormat(HDC hDC)\r
-{\r
- int pixelformat;\r
- static PIXELFORMATDESCRIPTOR pfd = \r
- {\r
- sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd\r
- 1, // version number\r
- PFD_DRAW_TO_WINDOW | // support window\r
- PFD_SUPPORT_OPENGL | // support OpenGL\r
- PFD_DOUBLEBUFFER, // double buffered\r
- PFD_TYPE_RGBA, // RGBA type\r
- 16, // 16-bit color depth (adjusted later)\r
- 0, 0, 0, 0, 0, 0, // color bits ignored\r
- 0, // no alpha buffer\r
- 0, // shift bit ignored\r
- 0, // no accumulation buffer\r
- 0, 0, 0, 0, // accum bits ignored\r
- 0, // z-buffer \r
- 0,\r
- 0, // no auxiliary buffer\r
- PFD_MAIN_PLANE, // main layer\r
- 0, // reserved\r
- 0, 0, 0 // layer masks ignored\r
- };\r
- \r
- pfd.cColorBits=iColDepth; // set user color depth\r
- pfd.cDepthBits=iZBufferDepth; // set user zbuffer (by psx mask)\r
-\r
- if((pixelformat=ChoosePixelFormat(hDC,&pfd))==0) \r
- {\r
- MessageBox(NULL,"ChoosePixelFormat failed","Error",MB_OK);\r
- return FALSE;\r
- }\r
-\r
- if(SetPixelFormat(hDC,pixelformat, &pfd)==FALSE)\r
- {\r
- MessageBox(NULL,"SetPixelFormat failed","Error",MB_OK);\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
-}\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// Get extension infos (f.e. pal textures / packed pixels)\r
bPacked=TRUE; // -> ok\r
\r
\r
- #ifdef _WINDOWS\r
- iClampType=GL_CLAMP;\r
-#else\r
iClampType=GL_CLAMP_TO_EDGE;\r
-#endif\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
// Initialize OGL\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS \r
-HGLRC GLCONTEXT=NULL;\r
-#endif\r
-\r
#define MODE_RAW 0\r
#define MODE_X11 1\r
#define MODE_SDL 2\r
\r
int GLinitialize() \r
{\r
- //----------------------------------------------------// \r
-#ifdef _WINDOWS\r
- HGLRC objectRC;\r
- // init\r
- dcGlobal = GetDC(hWWindow); // FIRST: dc/rc stuff\r
- objectRC = wglCreateContext(dcGlobal); \r
- GLCONTEXT=objectRC;\r
- wglMakeCurrent(dcGlobal, objectRC);\r
- // CheckWGLExtensions(dcGlobal);\r
- if(bWindowMode) ReleaseDC(hWWindow,dcGlobal); // win mode: release dc again\r
-#endif\r
initEGL();\r
\r
//----------------------------------------------------// \r
{ \r
CleanupTextureStore(); // bye textures\r
\r
-#ifdef _WINDOWS \r
- wglMakeCurrent(NULL, NULL); // bye context\r
- if(GLCONTEXT) wglDeleteContext(GLCONTEXT);\r
- if(!bWindowMode && dcGlobal) \r
- ReleaseDC(hWWindow,dcGlobal);\r
-#endif\r
-\r
eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );\r
eglDestroySurface( display, surface );\r
eglDestroyContext( display, context );\r
// render pos / buffers\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifndef _WINDOWS\r
#define EqualRect(pr1,pr2) ((pr1)->left==(pr2)->left && (pr1)->top==(pr2)->top && (pr1)->right==(pr2)->right && (pr1)->bottom==(pr2)->bottom)\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// SetDisplaySettings: "simply" calcs the new drawing area and updates\r
//#include "gpuStdafx.h"\r
\r
//#include <mmsystem.h>\r
-\r
#define _IN_GPU\r
\r
-#ifdef _WINDOWS\r
-#include "stdafx.h"\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <stdarg.h>\r
-#include <string.h>\r
-#include <mmsystem.h>\r
-\r
-#include "externals.h"\r
-#include "gpu.h"\r
-#include "draw.h"\r
-#include "prim.h"\r
-#include "texture.h"\r
-#include "fps.h"\r
-#include "resource.h"\r
-#else\r
#include <stdlib.h>\r
#include <stdio.h>\r
#include <stdarg.h>\r
//#include "NoPic.h"\r
\r
#include "gpuStdafx.h"\r
-#endif\r
\r
-extern void ProcessEvents();\r
- \r
short g_m1=255,g_m2=255,g_m3=255;\r
short DrawSemiTrans=FALSE;\r
short Ymin;\r
BOOL bNeedRGB24Update=FALSE;\r
BOOL bChangeWinMode=FALSE;\r
\r
-#ifdef _WINDOWS\r
-extern HGLRC GLCONTEXT;\r
-#endif\r
-\r
unsigned long ulStatusControl[256];\r
\r
////////////////////////////////////////////////////////////////////////\r
int iRumbleTime = 0;\r
\r
static void (*rearmed_get_layer_pos)(int *x, int *y, int *w, int *h);\r
+static void flipEGL(void);\r
\r
////////////////////////////////////////////////////////////////////////\r
// stuff to make this a true PDK module\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-char * CALLBACK PSEgetLibName(void)\r
-{\r
- return "name";\r
-}\r
-\r
-unsigned long CALLBACK PSEgetLibType(void)\r
-{\r
- return 1;\r
-}\r
-\r
-unsigned long CALLBACK PSEgetLibVersion(void)\r
-{\r
- return 1<<16|1<<8|1;\r
-}\r
-#endif\r
-\r
////////////////////////////////////////////////////////////////////////\r
// snapshot funcs (saves screen to bitmap / text infos into file)\r
////////////////////////////////////////////////////////////////////////\r
\r
char * GetConfigInfos(int hW)\r
{\r
-#ifdef _WINDOWS\r
- HDC hdc;HGLRC hglrc;\r
-#endif\r
char szO[2][4]={"off","on "};\r
char szTxt[256];\r
char * pB=(char *)malloc(32767);\r
{\r
} \r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUmakeSnapshot(void)\r
-#else\r
void CALLBACK GPUmakeSnapshot(void)\r
-#endif\r
{\r
//bSnapShot = TRUE;\r
} \r
// GPU INIT... here starts it all (first func called by emu)\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-long CALLBACK GPUinit()\r
-#else\r
long CALLBACK GPUinit()\r
-#endif\r
{\r
memset(ulStatusControl,0,256*sizeof(unsigned long));\r
\r
-#ifdef _WINDOWS\r
-iResX=240;iResY=320;\r
-#endif\r
bChangeRes=FALSE;\r
-#ifdef _WINDOWS\r
-bWindowMode=TRUE;\r
-#else\r
bWindowMode=FALSE;\r
-#endif \r
-#ifdef _WINDOWS\r
-iWinSize=MAKELONG(iResX,iResY);\r
-#endif\r
\r
bKeepRatio = TRUE;\r
// different ways of accessing PSX VRAM\r
} \r
\r
\r
-////////////////////////////////////////////////////////////////////////\r
-// GPU OPEN: funcs to open up the gpu display (Windows)\r
-////////////////////////////////////////////////////////////////////////\r
-\r
-#ifdef _WINDOWS\r
-\r
-void ChangeDesktop() // change destop resolution\r
-{\r
- DEVMODE dv;long lRes,iTry=0; \r
-\r
- while(iTry<10) // keep on hammering...\r
- {\r
- memset(&dv,0,sizeof(DEVMODE));\r
- dv.dmSize=sizeof(DEVMODE);\r
- dv.dmBitsPerPel=iColDepth;\r
- dv.dmPelsWidth=iResX;\r
- dv.dmPelsHeight=iResY;\r
-\r
- dv.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;\r
-\r
- lRes=ChangeDisplaySettings(&dv,0); // ...hammering the anvil\r
-\r
- if(lRes==DISP_CHANGE_SUCCESSFUL) return;\r
- iTry++;Sleep(10);\r
- }\r
-}\r
-\r
////////////////////////////////////////////////////////////////////////\r
// OPEN interface func: attention! \r
// some emus are calling this func in their main Window thread,\r
// some PAD or SPU plugins would not work anymore)\r
////////////////////////////////////////////////////////////////////////\r
\r
-HMENU hPSEMenu=NULL;\r
-\r
-long CALLBACK GPUopen(HWND hwndGPU) \r
-#else\r
long CALLBACK GPUopen(int hwndGPU)\r
-#endif\r
{\r
- #ifdef _WINDOWS\r
- HDC hdc;RECT r;DEVMODE dv;\r
-\r
- hWWindow = hwndGPU; // store hwnd globally\r
- #endif\r
- // InitKeyHandler(); // init key handler (subclass window)\r
-\r
-\r
-\r
- #ifdef _WINDOWS\r
- iResX=240;iResY=320;\r
- #endif\r
iResX=800;iResY=480;\r
iColDepth=8;\r
bChangeRes=FALSE;\r
- #ifdef _WINDOWS\r
- bWindowMode=TRUE;\r
- #else\r
bWindowMode=FALSE;\r
- #endif \r
bFullVRam=FALSE;\r
iFilterType=0;\r
// bAdvancedBlend=FALSE;\r
//bOpaquePass=FALSE;\r
//bUseAntiAlias=FALSE;\r
//iTexQuality=0;\r
- #ifdef _WINDOWS\r
- iWinSize=MAKELONG(iResX,iResY);\r
- #endif\r
iUseMask=0;\r
iZBufferDepth=0;\r
bUseFastMdec=FALSE;\r
\r
\r
\r
-#ifdef _WINDOWS\r
- memset(&dv,0,sizeof(DEVMODE));\r
- dv.dmSize=sizeof(DEVMODE);\r
- EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dv);\r
-#endif\r
bIsFirstFrame = TRUE; // flag: we have to init OGL later in windows!\r
\r
-#ifdef _WINDOWS\r
- if(bWindowMode) // win mode?\r
- {\r
- DWORD dw=GetWindowLong(hWWindow, GWL_STYLE); // -> adjust wnd style (owndc needed by some stupid ogl drivers)\r
- dw&=~WS_THICKFRAME;\r
- dw|=WS_BORDER|WS_CAPTION|CS_OWNDC;\r
- SetWindowLong(hWWindow, GWL_STYLE, dw);\r
-\r
- hPSEMenu=GetMenu(hWWindow); // -> hide emu menu (if any)\r
- if(hPSEMenu!=NULL) SetMenu(hWWindow,NULL);\r
-\r
- iResX=LOWORD(iWinSize);iResY=HIWORD(iWinSize);\r
- ShowWindow(hWWindow,SW_SHOWNORMAL);\r
-\r
- MoveWindow(hWWindow, // -> center wnd\r
- GetSystemMetrics(SM_CXFULLSCREEN)/2-iResX/2,\r
- GetSystemMetrics(SM_CYFULLSCREEN)/2-iResY/2,\r
- iResX+GetSystemMetrics(SM_CXFIXEDFRAME)+3,\r
- iResY+GetSystemMetrics(SM_CYFIXEDFRAME)+GetSystemMetrics(SM_CYCAPTION)+3,\r
- TRUE);\r
- UpdateWindow(hWWindow); // -> let windows do some update\r
-\r
- if(dv.dmBitsPerPel==16 || dv.dmBitsPerPel==32) // -> overwrite user color info with desktop color info\r
- iColDepth=dv.dmBitsPerPel;\r
- }\r
- else // fullscreen mode:\r
- {\r
- if(dv.dmBitsPerPel!=(unsigned int)iColDepth || // -> check, if we have to change resolution\r
- dv.dmPelsWidth !=(unsigned int)iResX ||\r
- dv.dmPelsHeight!=(unsigned int)iResY)\r
- bChangeRes=TRUE; else bChangeRes=FALSE;\r
-\r
- if(bChangeRes) ChangeDesktop(); // -> change the res (had to do an own func because of some MS 'optimizations')\r
-\r
- SetWindowLong(hWWindow, GWL_STYLE, CS_OWNDC); // -> adjust wnd style as well (to be sure)\r
- \r
- hPSEMenu=GetMenu(hWWindow); // -> hide menu\r
- if(hPSEMenu!=NULL) SetMenu(hWWindow,NULL);\r
- ShowWindow(hWWindow,SW_SHOWMAXIMIZED); // -> max mode\r
- }\r
-#endif\r
rRatioRect.left = rRatioRect.top=0;\r
rRatioRect.right = iResX;\r
rRatioRect.bottom = iResY;\r
\r
-#ifdef _WINDOWS\r
- r.left=r.top=0;r.right=iResX;r.bottom=iResY; // hack for getting a clean black window until OGL gets initialized\r
- hdc = GetDC(hWWindow);\r
- FillRect(hdc,&r,(HBRUSH)GetStockObject(BLACK_BRUSH));\r
- bSetupPixelFormat(hdc);\r
- ReleaseDC(hWWindow,hdc);\r
-#endif\r
bDisplayNotSet = TRUE; \r
bSetClip=TRUE;\r
\r
// close\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-long CALLBACK GPUclose() // WINDOWS CLOSE\r
-{\r
-// ExitKeyHandler();\r
-\r
- GLcleanup(); // close OGL\r
-\r
- if(bChangeRes) // change res back\r
- ChangeDisplaySettings(NULL,0);\r
-\r
- if(hPSEMenu) // set menu again\r
- SetMenu(hWWindow,hPSEMenu);\r
-\r
- if(pGfxCardScreen) free(pGfxCardScreen); // free helper memory\r
- pGfxCardScreen=0;\r
-\r
-// if(iNoScreenSaver) EnableScreenSaver(TRUE); // enable screen saver again\r
-\r
- return 0;\r
-}\r
-\r
-#else\r
\r
long GPUclose() // LINUX CLOSE\r
{\r
\r
return 0;\r
}\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// I shot the sheriff... last function called from emu \r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
long CALLBACK GPUshutdown()\r
-#else\r
-long CALLBACK GPUshutdown()\r
-#endif\r
{\r
if(psxVSecure) free(psxVSecure); // kill emulated vram memory\r
psxVSecure=0;\r
{\r
BOOL bBlur=FALSE;\r
\r
-#ifdef _WINDOWS\r
-HDC hdc=GetDC(hWWindow); // windows:\r
-wglMakeCurrent(hdc,GLCONTEXT); // -> make context current again\r
-#endif\r
\r
bFakeFrontBuffer=FALSE;\r
bRenderFrontBuffer=FALSE;\r
{\r
if(!bSkipNextFrame) \r
{\r
- if(iDrawnSomething)\r
-#ifdef _WINDOWS\r
- SwapBuffers(wglGetCurrentDC()); // -> to skip or not to skip\r
-#else\r
- eglSwapBuffers(display,surface);\r
-#endif\r
+ if(iDrawnSomething) flipEGL();\r
}\r
- if(dwActFixes&0x180) // -> special old frame skipping: skip max one in a row\r
- {\r
if((fps_skip < fFrameRateHz) && !(bSkipNextFrame)) \r
{bSkipNextFrame = TRUE; fps_skip=fFrameRateHz;}\r
else bSkipNextFrame = FALSE;\r
- }\r
- else FrameSkip();\r
+\r
}\r
else // no skip ?\r
{\r
- if(iDrawnSomething)\r
-#ifdef _WINDOWS\r
- SwapBuffers(wglGetCurrentDC()); // -> swap\r
-#else\r
- eglSwapBuffers(display,surface);\r
-#endif\r
+ if(iDrawnSomething) flipEGL();\r
}\r
\r
iDrawnSomething=0;\r
// if(gTexPicName) DisplayPic();\r
// if(ulKeybits&KEY_SHOWFPS) DisplayText();\r
\r
-#ifdef _WINDOWS\r
- { // windows: \r
- HDC hdc=GetDC(hWWindow);\r
- wglMakeCurrent(hdc,GLCONTEXT); // -> make current again\r
- if(iDrawnSomething)\r
- SwapBuffers(wglGetCurrentDC()); // -> swap\r
- ReleaseDC(hWWindow,hdc); // -> ! important !\r
- }\r
-#else\r
if(iDrawnSomething) // linux:\r
- eglSwapBuffers(display,surface);\r
-#endif\r
+ flipEGL();\r
+\r
\r
//if(iBlurBuffer) UnBlurBackBuffer();\r
}\r
// window mode <-> fullscreen mode (windows)\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void ChangeWindowMode(void)\r
-{\r
- GPUclose();\r
- bWindowMode=!bWindowMode;\r
- GPUopen(hWWindow);\r
- bChangeWinMode=FALSE;\r
-}\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// swap update check (called by psx vsync function)\r
\r
static unsigned short usFirstPos=2;\r
\r
-#ifdef _WINDOWS\r
void CALLBACK GPUupdateLace(void)\r
-#else\r
-void CALLBACK GPUupdateLace(void)\r
-#endif\r
{\r
if(!(dwActFixes&0x1000)) \r
STATUSREG^=0x80000000; // interlaced bit toggle, if the CC game fix is not active (see gpuReadStatus)\r
updateDisplay();\r
}\r
\r
-#ifdef _WINDOWS\r
-if(bChangeWinMode) ChangeWindowMode();\r
-#endif\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
// process read request from GPU status register\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-unsigned long CALLBACK GPUreadStatus(void)\r
-#else\r
unsigned long CALLBACK GPUreadStatus(void)\r
-#endif\r
{\r
if(dwActFixes&0x1000) // CC game fix\r
{\r
// these are always single packet commands.\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
void CALLBACK GPUwriteStatus(unsigned long gdata)\r
-#else\r
-void CALLBACK GPUwriteStatus(unsigned long gdata)\r
-#endif\r
{\r
unsigned long lCommand=(gdata>>24)&0xff;\r
\r
-#ifdef _WINDOWS\r
if(bIsFirstFrame) GLinitialize(); // real ogl startup (needed by some emus)\r
-#endif\r
\r
ulStatusControl[lCommand]=gdata;\r
\r
// core read from vram\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUreadDataMem(unsigned int * pMem, int iSize)\r
-#else\r
void CALLBACK GPUreadDataMem(unsigned long * pMem, int iSize)\r
-#endif\r
{\r
int i;\r
\r
GPUIsIdle;\r
}\r
\r
-#ifdef _WINDOWS\r
unsigned long CALLBACK GPUreadData(void)\r
-#else\r
-unsigned long CALLBACK GPUreadData(void)\r
-#endif\r
{\r
unsigned long l;\r
-#ifdef _WINDOWS\r
GPUreadDataMem(&l,1);\r
-#else\r
- GPUreadDataMem(&l,1);\r
-#endif \r
return GPUdataRet;\r
}\r
\r
// processes data send to GPU data register\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUwriteDataMem(unsigned long * pMem, int iSize)\r
-#else\r
void CALLBACK GPUwriteDataMem(unsigned long * pMem, int iSize)\r
-#endif\r
{\r
unsigned char command;\r
unsigned long gdata=0;\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUwriteData(unsigned long gdata)\r
-#else\r
void CALLBACK GPUwriteData(unsigned long gdata)\r
-#endif\r
{\r
-#ifdef _WINDOWS\r
GPUwriteDataMem(&gdata,1);\r
-#else\r
- GPUwriteDataMem(&gdata,1);\r
-#endif \r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
#endif\r
\r
\r
-#ifdef _WINDOWS\r
-long CALLBACK GPUconfigure(void)\r
-#else\r
long CALLBACK GPUconfigure(void)\r
-#endif\r
{\r
\r
-#ifdef _WINDOWS\r
-// HWND hWP=GetActiveWindow();\r
-// DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGDLG),\r
-// hWP,(DLGPROC)CfgDlgProc);\r
-#else\r
-\r
-// StartCfgTool("CFG");\r
-\r
-#endif\r
\r
return 0;\r
}\r
// core gives a dma chain to gpu: same as the gpuwrite interface funcs\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
long CALLBACK GPUdmaChain(unsigned long * baseAddrL, unsigned long addr)\r
-#else\r
-long CALLBACK GPUdmaChain(unsigned long * baseAddrL, unsigned long addr)\r
-#endif\r
{\r
unsigned long dmaMem;\r
unsigned char * baseAddrB;\r
\r
dmaMem=addr+4;\r
\r
-#ifdef _WINDOWS\r
- if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count);\r
-#else\r
if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count);\r
-#endif\r
\r
addr = baseAddrL[addr>>2]&0xffffff;\r
}\r
// show about dlg\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUabout(void)\r
-#else\r
void CALLBACK GPUabout(void)\r
-#endif\r
{\r
\r
}\r
// We are ever fine ;)\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
long CALLBACK GPUtest(void)\r
-#else\r
-long CALLBACK GPUtest(void)\r
-#endif\r
{\r
// if test fails this function should return negative value for error (unable to continue)\r
// and positive value for warning (can continue but output might be crappy)\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-long CALLBACK GPUfreeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF)\r
-#else\r
long CALLBACK GPUfreeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF)\r
-#endif\r
{\r
if(ulGetFreezeData==2) \r
{\r
\r
ResetTextureArea(TRUE);\r
\r
-#ifdef _WINDOWS\r
- GPUwriteStatus(ulStatusControl[0]);\r
- GPUwriteStatus(ulStatusControl[1]);\r
- GPUwriteStatus(ulStatusControl[2]);\r
- GPUwriteStatus(ulStatusControl[3]);\r
- GPUwriteStatus(ulStatusControl[8]);\r
- GPUwriteStatus(ulStatusControl[6]);\r
- GPUwriteStatus(ulStatusControl[7]);\r
- GPUwriteStatus(ulStatusControl[5]);\r
- GPUwriteStatus(ulStatusControl[4]);\r
-#else\r
GPUwriteStatus(ulStatusControl[0]);\r
GPUwriteStatus(ulStatusControl[1]);\r
GPUwriteStatus(ulStatusControl[2]);\r
GPUwriteStatus(ulStatusControl[7]);\r
GPUwriteStatus(ulStatusControl[5]);\r
GPUwriteStatus(ulStatusControl[4]);\r
-#endif\r
return 1;\r
}\r
\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUgetScreenPic(unsigned char * pMem)\r
-#else\r
long CALLBACK GPUgetScreenPic(unsigned char * pMem)\r
-#endif\r
{\r
float XS,YS;int x,y,v;\r
unsigned char * ps, * px, * pf;\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-void CALLBACK GPUshowScreenPic(unsigned char * pMem)\r
-#else\r
long CALLBACK GPUshowScreenPic(unsigned char * pMem)\r
-#endif\r
{\r
// DestroyPic();\r
// if(pMem==0) return;\r
rearmed_get_layer_pos = cbs[0];\r
}\r
\r
+static void flipEGL(void)\r
+{\r
+ eglSwapBuffers(display, surface);\r
+}\r
\r
#define _IN_PRIMDRAW\r
\r
-#ifdef _WINDOWS\r
-#include "stdafx.h"\r
-#include "externals.h"\r
-#include "gpu.h"\r
-#include "draw.h"\r
-#include "texture.h"\r
-#else\r
#include "gpuStdafx.h"\r
#include "gpuExternals.h"\r
#include "gpuPlugin.h"\r
#include "gpuTexture.h"\r
#include "gpuPrim.h"\r
\r
-#endif\r
-\r
//////////////////////////////////////////////////////////////////////// \r
// defines\r
////////////////////////////////////////////////////////////////////////\r
// globals\r
////////////////////////////////////////////////////////////////////////\r
\r
-//#ifndef _WINDOWS\r
-//EGLSurface surface;\r
-//EGLDisplay display;\r
-//#endif\r
+EGLSurface surface;\r
+EGLDisplay display;\r
+\r
\r
BOOL bDrawTextured; // current active drawing states\r
BOOL bDrawSmoothShaded;\r
// Some ASM color convertion... Lewpy's special...\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-#pragma warning (disable : 4035)\r
-\r
-unsigned long DoubleBGR2RGB (unsigned long BGR)\r
-{\r
-\r
- __asm\r
- {\r
- mov eax, BGR /* this can hold the G value */\r
- mov ebx, eax /* this can hold the R value */\r
- mov edx, eax /* this can hold the B value */\r
- and ebx, 000000ffh /* mask the R value */\r
- shl ebx, 1\r
- test ebx, 00000100h\r
- jz RSKIP\r
- mov ebx, 000000ffh\r
-\r
-RSKIP: \r
- and eax, 0000ff00h /* mask the G value */\r
- shl eax, 1\r
- test eax, 00010000h\r
- jz GSKIP\r
- mov eax, 0000ff00h\r
-\r
-GSKIP: \r
- and edx, 00ff0000h /* mask the B value */\r
- shl edx, 1\r
- test edx, 01000000h\r
- jz BSKIP\r
- mov edx, 00ff0000h\r
- \r
-BSKIP: \r
- or eax, ebx /* add R to G value */\r
- or eax, edx /* add B to RG value */\r
- }\r
- /* Result returned in EAX */\r
-}\r
-\r
-unsigned short BGR24to16 (unsigned long BGR)\r
-{\r
- __asm\r
- {\r
- mov eax, BGR /* this can hold the G value */\r
- mov ebx, eax /* this can hold the R value */\r
- mov edx, eax /* this can hold the B value */\r
- shr ebx, 3 /* move the R value */\r
- and edx, 00f80000h /* mask the B value */\r
- shr edx, 9 /* move the B value */\r
- and eax, 00f800h /* mask the G value */\r
- shr eax, 6 /* move the G value */\r
- and ebx, 0000001fh /* mask the R value */\r
- or eax, ebx /* add R to G value */\r
- or eax, edx /* add B to RG value */\r
- }\r
- /* Result returned in AX */\r
-}\r
-\r
-#pragma warning (default : 4035)\r
-\r
-#else\r
\r
unsigned long DoubleBGR2RGB (unsigned long BGR)\r
{\r
return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6);\r
}\r
\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// OpenGL primitive drawing commands\r
////////////////////////////////////////////////////////////////////////\r
\r
-__inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, \r
+void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2,\r
OGLVertex* vertex3, OGLVertex* vertex4) \r
{\r
\r