X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpu-gles%2FgpuPlugin.c;h=368c5ce39a4d2745796e7ed7c9176256023b35bd;hp=07f158c3201063be1462a5585389f78f3e72287b;hb=07f75e28d81b8acc64cfb6dee9302fb0eba8774a;hpb=ce879073e4f228deec8bec5db8a2ff640636c88f diff --git a/plugins/gpu-gles/gpuPlugin.c b/plugins/gpu-gles/gpuPlugin.c index 07f158c3..368c5ce3 100644 --- a/plugins/gpu-gles/gpuPlugin.c +++ b/plugins/gpu-gles/gpuPlugin.c @@ -83,8 +83,8 @@ int iTileCheat=0; // memory image of the PSX vram //////////////////////////////////////////////////////////////////////// -u8 *psxVSecure; -u8 *psxVub; +unsigned char *psxVSecure; +unsigned char *psxVub; signed char *psxVsb; unsigned short *psxVuw; unsigned short *psxVuw_eom; @@ -112,10 +112,10 @@ unsigned long ulStatusControl[256]; static long GPUdataRet; long lGPUstatusRet; -s8 szDispBuf[64]; +char szDispBuf[64]; static unsigned long gpuDataM[256]; -static u8 gpuCommand = 0; +static unsigned char gpuCommand = 0; static long gpuDataC = 0; static long gpuDataP = 0; @@ -144,7 +144,7 @@ BOOL bDisplayNotSet = TRUE; GLuint uiScanLine=0; int iUseScanLines=0; long lSelectedSlot=0; -u8 * pGfxCardScreen=0; +unsigned char * pGfxCardScreen=0; int iBlurBuffer=0; int iScanBlend=0; int iRenderFVR=0; @@ -154,12 +154,14 @@ int iFakePrimBusy = 0; int iRumbleVal = 0; int iRumbleTime = 0; +static void (*rearmed_get_layer_pos)(int *x, int *y, int *w, int *h); + //////////////////////////////////////////////////////////////////////// // stuff to make this a true PDK module //////////////////////////////////////////////////////////////////////// #ifdef _WINDOWS -s8 * CALLBACK PSEgetLibName(void) +char * CALLBACK PSEgetLibName(void) { return "name"; } @@ -206,14 +208,14 @@ void ResizeWindow() SetAspectRatio(); } -s8 * GetConfigInfos(int hW) +char * GetConfigInfos(int hW) { #ifdef _WINDOWS HDC hdc;HGLRC hglrc; #endif - s8 szO[2][4]={"off","on "}; - s8 szTxt[256]; - s8 * pB=(s8 *)malloc(32767); + char szO[2][4]={"off","on "}; + char szTxt[256]; + char * pB=(char *)malloc(32767); /* if(!pB) return NULL; *pB=0; @@ -235,7 +237,7 @@ s8 * GetConfigInfos(int hW) strcat(pB,szTxt); sprintf(szTxt,"OGL version: %s\r\n\r\n",(char *)glGetString(GL_VERSION)); strcat(pB,szTxt); - //strcat(pB,(s8 *)glGetString(GL_EXTENSIONS)); + //strcat(pB,(char *)glGetString(GL_EXTENSIONS)); //strcat(pB,"\r\n\r\n"); #ifdef _WINDOWS @@ -396,7 +398,7 @@ void DoSnapShot(void) #ifdef _WINDOWS void CALLBACK GPUmakeSnapshot(void) #else -void CALLBACK GPU_makeSnapshot(void) +void CALLBACK GPUmakeSnapshot(void) #endif { //bSnapShot = TRUE; @@ -409,7 +411,7 @@ void CALLBACK GPU_makeSnapshot(void) #ifdef _WINDOWS long CALLBACK GPUinit() #else -long CALLBACK GPU_init() +long CALLBACK GPUinit() #endif { memset(ulStatusControl,0,256*sizeof(unsigned long)); @@ -430,7 +432,7 @@ iWinSize=MAKELONG(iResX,iResY); bKeepRatio = TRUE; // different ways of accessing PSX VRAM -psxVSecure=(u8 *)malloc((iGPUHeight*2)*1024 + (1024*1024)); // always alloc one extra MB for soft drawing funcs security +psxVSecure=(unsigned char *)malloc((iGPUHeight*2)*1024 + (1024*1024)); // always alloc one extra MB for soft drawing funcs security if(!psxVSecure) return -1; psxVub=psxVSecure+512*1024; // security offset into double sized psx vram! @@ -543,7 +545,7 @@ HMENU hPSEMenu=NULL; long CALLBACK GPUopen(HWND hwndGPU) #else -long CALLBACK GPU_open(int hwndGPU) +long CALLBACK GPUopen(int hwndGPU) #endif { #ifdef _WINDOWS @@ -555,12 +557,11 @@ long CALLBACK GPU_open(int hwndGPU) - - #ifdef _WINDOWS iResX=240;iResY=320; #endif - iColDepth=32; + iResX=800;iResY=480; + iColDepth=8; bChangeRes=FALSE; #ifdef _WINDOWS bWindowMode=TRUE; @@ -705,7 +706,7 @@ long CALLBACK GPUclose() // WINDOWS CLOSE #else -long GPU_close() // LINUX CLOSE +long GPUclose() // LINUX CLOSE { GLcleanup(); // close OGL @@ -725,7 +726,7 @@ long GPU_close() // LINUX CLOSE #ifdef _WINDOWS long CALLBACK GPUshutdown() #else -long CALLBACK GPU_shutdown() +long CALLBACK GPUshutdown() #endif { if(psxVSecure) free(psxVSecure); // kill emulated vram memory @@ -783,7 +784,7 @@ void SetScanLines(void) int iLastRGB24=0; // special vars for checking when to skip two display updates int iSkipTwo=0; -void GPU_vSinc(void){ +void GPUvSinc(void){ updateDisplay(); } void updateDisplay(void) // UPDATE DISPLAY @@ -1118,6 +1119,7 @@ float xs,ys,s;RECT r; if(!PSXDisplay.DisplayModeNew.x) return; if(!PSXDisplay.DisplayModeNew.y) return; +#if 0 xs=(float)iResX/(float)PSXDisplay.DisplayModeNew.x; ys=(float)iResY/(float)PSXDisplay.DisplayModeNew.y; @@ -1169,7 +1171,11 @@ if(r.bottom>24)&0xff; @@ -1722,8 +1728,8 @@ void CheckVRamReadEx(int x, int y, int dx, int dy) int ux,uy,udx,udy,wx,wy; unsigned short * p1, *p2; float XS,YS; - u8 * ps; - u8 * px; + unsigned char * ps; + unsigned char * px; unsigned short s,sx; if(STATUSREG&GPUSTATUS_RGB24) return; @@ -1820,7 +1826,7 @@ void CheckVRamReadEx(int x, int y, int dx, int dy) if(!pGfxCardScreen) { glPixelStorei(GL_PACK_ALIGNMENT,1); - pGfxCardScreen=(u8 *)malloc(iResX*iResY*4); + pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4); } ps=pGfxCardScreen; @@ -1873,7 +1879,7 @@ void CheckVRamRead(int x, int y, int dx, int dy, bool bFront) { unsigned short sArea;unsigned short * p; int ux,uy,udx,udy,wx,wy;float XS,YS; - u8 * ps, * px; + unsigned char * ps, * px; unsigned short s=0,sx; if(STATUSREG&GPUSTATUS_RGB24) return; @@ -1968,7 +1974,7 @@ void CheckVRamRead(int x, int y, int dx, int dy, bool bFront) if(!pGfxCardScreen) { glPixelStorei(GL_PACK_ALIGNMENT,1); - pGfxCardScreen=(u8 *)malloc(iResX*iResY*4); + pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4); } ps=pGfxCardScreen; @@ -2012,7 +2018,7 @@ void CheckVRamRead(int x, int y, int dx, int dy, bool bFront) #ifdef _WINDOWS void CALLBACK GPUreadDataMem(unsigned int * pMem, int iSize) #else -void CALLBACK GPU_readDataMem(unsigned long * pMem, int iSize) +void CALLBACK GPUreadDataMem(unsigned long * pMem, int iSize) #endif { int i; @@ -2088,14 +2094,14 @@ GPUIsIdle; #ifdef _WINDOWS unsigned long CALLBACK GPUreadData(void) #else -unsigned long CALLBACK GPU_readData(void) +unsigned long CALLBACK GPUreadData(void) #endif { unsigned long l; #ifdef _WINDOWS GPUreadDataMem(&l,1); #else - GPU_readDataMem(&l,1); + GPUreadDataMem(&l,1); #endif return GPUdataRet; } @@ -2104,7 +2110,7 @@ unsigned long CALLBACK GPU_readData(void) // helper table to know how much data is used by drawing commands //////////////////////////////////////////////////////////////////////// -const u8 primTableCX[256] = +const unsigned char primTableCX[256] = { // 00 0,0,3,0,0,0,0,0, @@ -2181,10 +2187,10 @@ const u8 primTableCX[256] = #ifdef _WINDOWS void CALLBACK GPUwriteDataMem(unsigned long * pMem, int iSize) #else -void CALLBACK GPU_writeDataMem(unsigned long * pMem, int iSize) +void CALLBACK GPUwriteDataMem(unsigned long * pMem, int iSize) #endif { -u8 command; +unsigned char command; unsigned long gdata=0; int i=0; GPUIsBusy; @@ -2244,7 +2250,7 @@ ENDVRAM: if(iDataWriteMode==DR_NORMAL) { - void (* *primFunc)(u8 *); + void (* *primFunc)(unsigned char *); if(bSkipNextFrame) primFunc=primTableSkip; else primFunc=primTableJ; @@ -2256,7 +2262,7 @@ if(iDataWriteMode==DR_NORMAL) if(gpuDataC == 0) { - command = (u8)((gdata>>24) & 0xff); + command = (unsigned char)((gdata>>24) & 0xff); if(primTableCX[command]) { @@ -2285,7 +2291,7 @@ if(iDataWriteMode==DR_NORMAL) if(gpuDataP == gpuDataC) { gpuDataC=gpuDataP=0; - primFunc[gpuCommand]((u8 *)gpuDataM); + primFunc[gpuCommand]((unsigned char *)gpuDataM); if(dwEmuFixes&0x0001 || dwActFixes&0x20000) // hack for emulating "gpu busy" in some games iFakePrimBusy=4; @@ -2304,13 +2310,13 @@ GPUIsIdle; #ifdef _WINDOWS void CALLBACK GPUwriteData(unsigned long gdata) #else -void CALLBACK GPU_writeData(unsigned long gdata) +void CALLBACK GPUwriteData(unsigned long gdata) #endif { #ifdef _WINDOWS GPUwriteDataMem(&gdata,1); #else - GPU_writeDataMem(&gdata,1); + GPUwriteDataMem(&gdata,1); #endif } @@ -2349,9 +2355,9 @@ return iT; /*#include -void StartCfgTool(s8 * pCmdLine) // linux: start external cfg tool +void StartCfgTool(char * pCmdLine) // linux: start external cfg tool { - FILE * cf;s8 filename[255],t[255]; + FILE * cf;char filename[255],t[255]; strcpy(filename,"cfg/cfgPeopsMesaGL"); // look in cfg sub folder first cf=fopen(filename,"rb"); @@ -2398,7 +2404,7 @@ void StartCfgTool(s8 * pCmdLine) // linux: start external cf #ifdef _WINDOWS long CALLBACK GPUconfigure(void) #else -long CALLBACK GPU_configure(void) +long CALLBACK GPUconfigure(void) #endif { @@ -2452,11 +2458,11 @@ return FALSE; #ifdef _WINDOWS long CALLBACK GPUdmaChain(unsigned long * baseAddrL, unsigned long addr) #else -long CALLBACK GPU_dmaChain(unsigned long * baseAddrL, unsigned long addr) +long CALLBACK GPUdmaChain(unsigned long * baseAddrL, unsigned long addr) #endif { unsigned long dmaMem; -u8 * baseAddrB; +unsigned char * baseAddrB; short count;unsigned int DMACommandCounter = 0; if(bIsFirstFrame) GLinitialize(); @@ -2465,7 +2471,7 @@ GPUIsBusy; lUsedAddr[0]=lUsedAddr[1]=lUsedAddr[2]=0xffffff; -baseAddrB = (u8*) baseAddrL; +baseAddrB = (unsigned char*) baseAddrL; do { @@ -2481,7 +2487,7 @@ do #ifdef _WINDOWS if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count); #else - if(count>0) GPU_writeDataMem(&baseAddrL[dmaMem>>2],count); + if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count); #endif addr = baseAddrL[addr>>2]&0xffffff; @@ -2500,7 +2506,7 @@ return 0; #ifdef _WINDOWS void CALLBACK GPUabout(void) #else -void CALLBACK GPU_about(void) +void CALLBACK GPUabout(void) #endif { @@ -2513,7 +2519,7 @@ void CALLBACK GPU_about(void) #ifdef _WINDOWS long CALLBACK GPUtest(void) #else -long CALLBACK GPU_test(void) +long CALLBACK GPUtest(void) #endif { // if test fails this function should return negative value for error (unable to continue) @@ -2531,7 +2537,7 @@ long CALLBACK GPU_test(void) #ifdef _WINDOWS long CALLBACK GPUfreeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF) #else -long CALLBACK GPU_freeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF) +long CALLBACK GPUfreeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF) #endif { if(ulGetFreezeData==2) @@ -2574,15 +2580,15 @@ ResetTextureArea(TRUE); GPUwriteStatus(ulStatusControl[5]); GPUwriteStatus(ulStatusControl[4]); #else - GPU_writeStatus(ulStatusControl[0]); - GPU_writeStatus(ulStatusControl[1]); - GPU_writeStatus(ulStatusControl[2]); - GPU_writeStatus(ulStatusControl[3]); - GPU_writeStatus(ulStatusControl[8]); - GPU_writeStatus(ulStatusControl[6]); - GPU_writeStatus(ulStatusControl[7]); - GPU_writeStatus(ulStatusControl[5]); - GPU_writeStatus(ulStatusControl[4]); + GPUwriteStatus(ulStatusControl[0]); + GPUwriteStatus(ulStatusControl[1]); + GPUwriteStatus(ulStatusControl[2]); + GPUwriteStatus(ulStatusControl[3]); + GPUwriteStatus(ulStatusControl[8]); + GPUwriteStatus(ulStatusControl[6]); + GPUwriteStatus(ulStatusControl[7]); + GPUwriteStatus(ulStatusControl[5]); + GPUwriteStatus(ulStatusControl[4]); #endif return 1; } @@ -2596,7 +2602,7 @@ ResetTextureArea(TRUE); //10 = red //11 = transparent -u8 cFont[10][120]= +unsigned char cFont[10][120]= { // 0 {0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, @@ -2822,7 +2828,7 @@ u8 cFont[10][120]= //////////////////////////////////////////////////////////////////////// -void PaintPicDot(u8 * p,u8 c) +void PaintPicDot(unsigned char * p,unsigned char c) { if(c==0) {*p++=0x00;*p++=0x00;*p=0x00;return;} if(c==1) {*p++=0xff;*p++=0xff;*p=0xff;return;} @@ -2832,19 +2838,19 @@ void PaintPicDot(u8 * p,u8 c) //////////////////////////////////////////////////////////////////////// #ifdef _WINDOWS -void CALLBACK GPUgetScreenPic(u8 * pMem) +void CALLBACK GPUgetScreenPic(unsigned char * pMem) #else -long CALLBACK GPU_getScreenPic(u8 * pMem) +long CALLBACK GPUgetScreenPic(unsigned char * pMem) #endif { float XS,YS;int x,y,v; - u8 * ps, * px, * pf; - u8 c; + unsigned char * ps, * px, * pf; + unsigned char c; if(!pGfxCardScreen) { glPixelStorei(GL_PACK_ALIGNMENT,1); - pGfxCardScreen=(u8 *)malloc(iResX*iResY*4); + pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4); } ps=pGfxCardScreen; @@ -2883,13 +2889,13 @@ long CALLBACK GPU_getScreenPic(u8 * pMem) { c=cFont[lSelectedSlot][x+y*6]; v=(c&0xc0)>>6; - PaintPicDot(pf,(u8)v);pf+=3; // paint the dots into the rect + PaintPicDot(pf,(unsigned char)v);pf+=3; // paint the dots into the rect v=(c&0x30)>>4; - PaintPicDot(pf,(u8)v);pf+=3; + PaintPicDot(pf,(unsigned char)v);pf+=3; v=(c&0x0c)>>2; - PaintPicDot(pf,(u8)v);pf+=3; + PaintPicDot(pf,(unsigned char)v);pf+=3; v=c&0x03; - PaintPicDot(pf,(u8)v);pf+=3; + PaintPicDot(pf,(unsigned char)v);pf+=3; } pf+=104*3; } @@ -2915,9 +2921,9 @@ long CALLBACK GPU_getScreenPic(u8 * pMem) //////////////////////////////////////////////////////////////////////// #ifdef _WINDOWS -void CALLBACK GPUshowScreenPic(u8 * pMem) +void CALLBACK GPUshowScreenPic(unsigned char * pMem) #else -long CALLBACK GPU_showScreenPic(u8 * pMem) +long CALLBACK GPUshowScreenPic(unsigned char * pMem) #endif { // DestroyPic(); @@ -2958,3 +2964,10 @@ void CALLBACK GPUdisplayFlags(unsigned long dwFlags) { // dwCoreFlags=dwFlags; } + +// pcsx-rearmed callbacks +void CALLBACK GPUrearmedCallbacks(const void **cbs) +{ + rearmed_get_layer_pos = cbs[0]; +} +