From c94fde37a8664462e9f551662ad589f24cd06462 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 9 Jul 2023 00:13:36 +0300 Subject: [PATCH] gpu-gles: fix wrong long usage No idea if there is any point touching this code but the warnings were annoying. --- plugins/gpu-gles/gpuDraw.c | 6 +- plugins/gpu-gles/gpuDraw.h | 2 +- plugins/gpu-gles/gpuExternals.h | 80 +++++------ plugins/gpu-gles/gpuPrim.c | 122 ++++++++-------- plugins/gpu-gles/gpuPrim.h | 4 +- plugins/gpu-gles/gpuTexture.c | 248 ++++++++++++++++---------------- plugins/gpu-gles/gpuTexture.h | 42 +++--- plugins/gpu-gles/gpulib_if.c | 21 +-- 8 files changed, 263 insertions(+), 262 deletions(-) diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c index c49eac5f..d6670ee2 100644 --- a/plugins/gpu-gles/gpuDraw.c +++ b/plugins/gpu-gles/gpuDraw.c @@ -111,7 +111,7 @@ BOOL bCheckMask=FALSE; int iUseMask=0; int iSetMask=0; unsigned short sSetMask=0; -unsigned long lSetMask=0; +unsigned int lSetMask=0; // drawing/coord vars @@ -921,14 +921,14 @@ void offsetST(void) ///////////////////////////////////////////////////////// -void offsetScreenUpload(long Position) +void offsetScreenUpload(int Position) { if(bDisplayNotSet) SetOGLDisplaySettings(1); if(Position==-1) { - long lmdx,lmdy; + int lmdx,lmdy; lmdx=xrUploadArea.x0; lmdy=xrUploadArea.y0; diff --git a/plugins/gpu-gles/gpuDraw.h b/plugins/gpu-gles/gpuDraw.h index a45bf462..153e1e50 100644 --- a/plugins/gpu-gles/gpuDraw.h +++ b/plugins/gpu-gles/gpuDraw.h @@ -64,7 +64,7 @@ unsigned short offsetline(void); #endif void offsetST(void); void offsetBlk(void); -void offsetScreenUpload(long Position); +void offsetScreenUpload(int Position); void assignTexture3(void); void assignTexture4(void); void assignTextureSprite(void); diff --git a/plugins/gpu-gles/gpuExternals.h b/plugins/gpu-gles/gpuExternals.h index 0a8acf59..a6dbceb2 100644 --- a/plugins/gpu-gles/gpuExternals.h +++ b/plugins/gpu-gles/gpuExternals.h @@ -143,10 +143,10 @@ extern void ( APIENTRY * glPixelStorei )(GLenum pname, GLint param); #define bool unsigned short #endif #define LOWORD(l) ((unsigned short)(l)) -#define HIWORD(l) ((unsigned short)(((unsigned long)(l) >> 16) & 0xFFFF)) +#define HIWORD(l) ((unsigned short)(((unsigned int)(l) >> 16) & 0xFFFF)) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#define DWORD unsigned long +#define DWORD unsigned int typedef struct RECTTAG { @@ -173,8 +173,8 @@ typedef struct VRAMLOADTAG typedef struct PSXPOINTTAG { - long x; - long y; + int x; + int y; } PSXPoint_t; typedef struct PSXSPOINTTAG @@ -211,19 +211,19 @@ typedef struct PSXDISPLAYTAG PSXPoint_t DisplayPosition; PSXPoint_t DisplayEnd; - long Double; - long Height; - long PAL; - long InterlacedNew; - long Interlaced; - long InterlacedTest; - long RGB24New; - long RGB24; + int Double; + int Height; + int PAL; + int InterlacedNew; + int Interlaced; + int InterlacedTest; + int RGB24New; + int RGB24; PSXSPoint_t DrawOffset; PSXRect_t DrawArea; PSXPoint_t GDrawOffset; PSXPoint_t CumulOffset; - long Disabled; + int Disabled; PSXRect_t Range; } PSXDisplay_t; @@ -242,7 +242,7 @@ typedef struct OGLVertexTag COLTAG { unsigned char col[4]; - unsigned long lcol; + unsigned int lcol; } c; } OGLVertex; @@ -256,7 +256,7 @@ typedef union EXShortTag typedef union EXLongTag { unsigned char c[4]; - unsigned long l; + unsigned int l; EXShort s[2]; } EXLong; @@ -299,7 +299,7 @@ extern int iSetMask; extern int iDepthFunc; extern BOOL bCheckMask; extern unsigned short sSetMask; -extern unsigned long lSetMask; +extern unsigned int lSetMask; extern BOOL bSetClip; extern GLuint gTexScanName; @@ -309,8 +309,8 @@ extern GLuint gTexScanName; #ifndef _IN_SOFT -extern long GlobalTextAddrX,GlobalTextAddrY,GlobalTextTP; -extern long GlobalTextREST,GlobalTextABR,GlobalTextPAGE; +extern int GlobalTextAddrX,GlobalTextAddrY,GlobalTextTP; +extern int GlobalTextREST,GlobalTextABR,GlobalTextPAGE; extern short ly0,lx0,ly1,lx1,ly2,lx2,ly3,lx3; extern short g_m1; extern short g_m2; @@ -347,22 +347,22 @@ extern GLubyte ubGloAlpha; extern short sSprite_ux2; extern short sSprite_vy2; extern BOOL bRenderFrontBuffer; -extern unsigned long ulOLDCOL; -extern unsigned long ulClutID; +extern unsigned int ulOLDCOL; +extern unsigned int ulClutID; extern void (*primTableJ[256])(unsigned char *); extern void (*primTableSkip[256])(unsigned char *); extern unsigned short usMirror; -extern unsigned long dwCfgFixes; -extern unsigned long dwActFixes; -extern unsigned long dwEmuFixes; +extern unsigned int dwCfgFixes; +extern unsigned int dwActFixes; +extern unsigned int dwEmuFixes; extern BOOL bUseFixes; extern int iSpriteTex; extern int iDrawnSomething; -extern long drawX; -extern long drawY; -extern long drawW; -extern long drawH; +extern int drawX; +extern int drawY; +extern int drawW; +extern int drawH; extern short sxmin; extern short sxmax; extern short symin; @@ -383,10 +383,10 @@ extern GLint giWantedRGBA; extern GLint giWantedFMT; extern GLint giWantedTYPE; extern void (*LoadSubTexFn) (int,int,short,short); -extern long GlobalTexturePage; -extern unsigned long (*TCF[]) (unsigned long); +extern int GlobalTexturePage; +extern unsigned int (*TCF[]) (unsigned int ); extern unsigned short (*PTCF[]) (unsigned short); -extern unsigned long (*PalTexturedColourFn) (unsigned long); +extern unsigned int (*PalTexturedColourFn) (unsigned int); extern BOOL bUseFastMdec; extern BOOL bUse15bitMdec; extern int iFrameTexType; @@ -420,32 +420,32 @@ extern char szDispBuf[]; extern char szGPUKeys[]; extern PSXDisplay_t PSXDisplay; extern PSXDisplay_t PreviousPSXDisplay; -//extern unsigned long ulKeybits; +//extern unsigned int ulKeybits; extern TWin_t TWin; extern BOOL bDisplayNotSet; -extern long lGPUstatusRet; +extern int lGPUstatusRet; extern short imageX0,imageX1; extern short imageY0,imageY1; -extern long lClearOnSwap,lClearOnSwapColor; +extern int lClearOnSwap,lClearOnSwapColor; extern unsigned char * psxVub; extern char * psxVsb; extern unsigned short * psxVuw; extern signed short * psxVsw; -extern unsigned long * psxVul; -extern signed long * psxVsl; +extern unsigned int * psxVul; +extern signed int * psxVsl; extern GLfloat gl_z; extern BOOL bNeedRGB24Update; extern BOOL bChangeWinMode; extern GLuint uiScanLine; extern int iUseScanLines; -extern long lSelectedSlot; +extern int lSelectedSlot; extern int iScanBlend; extern BOOL bInitCap; extern int iBlurBuffer; extern int iLastRGB24; extern int iRenderFVR; extern int iNoScreenSaver; -extern unsigned long ulGPUInfoVals[]; +extern unsigned int ulGPUInfoVals[]; extern BOOL bNeedInterlaceUpdate; extern BOOL bNeedWriteUpload; extern BOOL bSkipNextFrame; @@ -461,7 +461,7 @@ extern int bFullScreen; #ifndef _IN_MENU -//extern unsigned long dwCoreFlags; +//extern unsigned int dwCoreFlags; extern GLuint gTexPicName; //extern PSXPoint_t ptCursorPoint[]; //extern unsigned short usCursorActive; @@ -539,7 +539,7 @@ typedef struct { #ifndef _IN_KEY -//extern unsigned long ulKeybits; +//extern unsigned int ulKeybits; #endif @@ -547,7 +547,7 @@ typedef struct { #ifndef _IN_ZN -extern unsigned long dwGPUVersion; +extern unsigned int dwGPUVersion; extern int iGPUHeight; extern int iGPUHeightMask; extern int GlobalTextIL; diff --git a/plugins/gpu-gles/gpuPrim.c b/plugins/gpu-gles/gpuPrim.c index 218ff66d..ed16e4a9 100644 --- a/plugins/gpu-gles/gpuPrim.c +++ b/plugins/gpu-gles/gpuPrim.c @@ -77,15 +77,15 @@ BOOL bUsingMovie=FALSE; // movie active flag PSXRect_t xrMovieArea; // rect for movie upload short sSprite_ux2; // needed for sprire adjust short sSprite_vy2; // -unsigned long ulOLDCOL=0; // active color -unsigned long ulClutID; // clut +unsigned int ulOLDCOL=0; // active color +unsigned int ulClutID; // clut -unsigned long dwCfgFixes; // game fixes -unsigned long dwActFixes=0; -unsigned long dwEmuFixes=0; +unsigned int dwCfgFixes; // game fixes +unsigned int dwActFixes=0; +unsigned int dwEmuFixes=0; BOOL bUseFixes; -long drawX,drawY,drawW,drawH; // offscreen drawing checkers +int drawX,drawY,drawW,drawH; // offscreen drawing checkers short sxmin,sxmax,symin,symax; unsigned int CSVERTEX=0,CSCOLOR=0,CSTEXTURE=0; @@ -147,9 +147,9 @@ void UpdateGlobalTP(unsigned short gdata) //////////////////////////////////////////////////////////////////////// -unsigned long DoubleBGR2RGB (unsigned long BGR) +unsigned int DoubleBGR2RGB (unsigned int BGR) { - unsigned long ebx,eax,edx; + unsigned int ebx,eax,edx; ebx=(BGR&0x000000ff)<<1; if(ebx&0x00000100) ebx=0x000000ff; @@ -163,7 +163,7 @@ unsigned long DoubleBGR2RGB (unsigned long BGR) return (ebx|eax|edx); } -unsigned short BGR24to16 (unsigned long BGR) +unsigned short BGR24to16 (unsigned int BGR) { return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6); } @@ -947,7 +947,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// - void SetRenderState(unsigned long DrawAttributes) + void SetRenderState(unsigned int DrawAttributes) { bDrawNonShaded = (SHADETEXBIT(DrawAttributes)) ? TRUE : FALSE; DrawSemiTrans = (SEMITRANSBIT(DrawAttributes)) ? TRUE : FALSE; @@ -955,7 +955,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// - void SetRenderColor(unsigned long DrawAttributes) + void SetRenderColor(unsigned int DrawAttributes) { if(bDrawNonShaded) {g_m1=g_m2=g_m3=128;} else @@ -968,7 +968,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// -void SetRenderMode(unsigned long DrawAttributes,BOOL bSCol) +void SetRenderMode(unsigned int DrawAttributes,BOOL bSCol) { if((bUseMultiPass) && (bDrawTextured) && !(bDrawNonShaded)) {bDrawMultiPass = TRUE; SetSemiTransMulti(0);} @@ -1024,7 +1024,7 @@ void SetRenderMode(unsigned long DrawAttributes,BOOL bSCol) // Set Opaque multipass color //////////////////////////////////////////////////////////////////////// -void SetOpaqueColor(unsigned long DrawAttributes) +void SetOpaqueColor(unsigned int DrawAttributes) { if(bDrawNonShaded) return; // no shading? bye @@ -1399,7 +1399,7 @@ BOOL CheckAgainstFrontScreen(short imageX0,short imageY0,short imageX1,short ima //////////////////////////////////////////////////////////////////////// -void PrepareFullScreenUpload (long Position) +void PrepareFullScreenUpload (int Position) { if (Position==-1) // rgb24 { @@ -1481,7 +1481,7 @@ void PrepareFullScreenUpload (long Position) unsigned char * LoadDirectMovieFast(void); -void UploadScreenEx(long Position) +void UploadScreenEx(int Position) { short ya,yb,xa,xb,x, y, YStep, XStep, U, UStep,ux[4],vy[4]; @@ -1565,7 +1565,7 @@ void UploadScreenEx(long Position) //////////////////////////////////////////////////////////////////////// -void UploadScreen(long Position) +void UploadScreen(int Position) { short x, y, YStep, XStep, U, s, UStep,ux[4],vy[4]; short xa,xb,ya,yb; @@ -1646,8 +1646,8 @@ void UploadScreen(long Position) gl_vy[2] = gl_vy[3] = s; gl_ux[0] = gl_ux[3] = gl_vy[0] = gl_vy[1] = 0; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); // upload texture data + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); // upload texture data offsetScreenUpload(Position); assignTextureVRAMWrite(); @@ -1712,7 +1712,7 @@ BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) void cmdSTP(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; STATUSREG&=~0x1800; // clear the necessary bits STATUSREG|=((gdata & 0x03) << 11); // set the current bits @@ -1745,7 +1745,7 @@ void cmdSTP(unsigned char * baseAddr) void cmdTexturePage(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; UpdateGlobalTP((unsigned short)gdata); GlobalTextREST = (gdata&0x00ffffff)>>9; } @@ -1756,9 +1756,9 @@ void cmdTexturePage(unsigned char * baseAddr) void cmdTextureWindow(unsigned char *baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; - unsigned long YAlign,XAlign; + unsigned int YAlign,XAlign; ulGPUInfoVals[INFO_TW]=gdata&0xFFFFF; @@ -1792,8 +1792,8 @@ void cmdTextureWindow(unsigned char *baseAddr) // Re-calculate the bit field, because we can't trust what is passed in the data - YAlign = (unsigned long)(32 - (TWin.Position.y1 >> 3)); - XAlign = (unsigned long)(32 - (TWin.Position.x1 >> 3)); + YAlign = (unsigned int)(32 - (TWin.Position.y1 >> 3)); + XAlign = (unsigned int)(32 - (TWin.Position.x1 >> 3)); // Absolute position of the start of the texture window @@ -1965,7 +1965,7 @@ void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) void cmdDrawAreaStart(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; drawX = gdata & 0x3ff; // for soft drawing if(drawX>=1024) drawX=1023; @@ -1996,7 +1996,7 @@ void cmdDrawAreaStart(unsigned char * baseAddr) void cmdDrawAreaEnd(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; drawW = gdata & 0x3ff; // for soft drawing if(drawW>=1024) drawW=1023; @@ -2031,7 +2031,7 @@ void cmdDrawAreaEnd(unsigned char * baseAddr) void cmdDrawOffset(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; PreviousPSXDisplay.DrawOffset.x = PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff); @@ -2241,7 +2241,7 @@ void primStoreImage(unsigned char * baseAddr) void primBlkFill(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); iDrawnSomething=1; @@ -2292,8 +2292,8 @@ void primBlkFill(unsigned char * baseAddr) { bDrawTextured = FALSE; bDrawSmoothShaded = FALSE; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); vertex[0].c.lcol=0xff000000; SETCOL(vertex[0]); if(ly0>pd->DisplayPosition.y) @@ -2320,8 +2320,8 @@ void primBlkFill(unsigned char * baseAddr) { bDrawTextured = FALSE; bDrawSmoothShaded = FALSE; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); vertex[0].c.lcol=gpuData[0]|0xff000000; SETCOL(vertex[0]); //glDisable(GL_SCISSOR_TEST); glError(); @@ -2491,12 +2491,12 @@ void primMoveImage(unsigned char * baseAddr) } else { - unsigned long *SRCPtr, *DSTPtr; + unsigned int *SRCPtr, *DSTPtr; unsigned short LineOffset; int dx=imageSX>>1; - SRCPtr = (unsigned long *)(psxVuw + (1024*imageY0) + imageX0); - DSTPtr = (unsigned long *)(psxVuw + (1024*imageY1) + imageX1); + SRCPtr = (unsigned int *)(psxVuw + (1024*imageY0) + imageX0); + DSTPtr = (unsigned int *)(psxVuw + (1024*imageY1) + imageX1); LineOffset = 512 - dx; @@ -2597,7 +2597,7 @@ void primMoveImage(unsigned char * baseAddr) void primTileS(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2662,7 +2662,7 @@ void primTileS(unsigned char * baseAddr) void primTile1(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2709,7 +2709,7 @@ void primTile1(unsigned char * baseAddr) void primTile8(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2756,7 +2756,7 @@ void primTile8(unsigned char * baseAddr) void primTile16(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2803,7 +2803,7 @@ void primTile16(unsigned char * baseAddr) /*void DrawMultiBlur(void) { - long lABR,lDST;float fx,fy; + int lABR,lDST;float fx,fy; lABR=GlobalTextABR; lDST=DrawSemiTrans; @@ -2836,7 +2836,7 @@ void primTile16(unsigned char * baseAddr) void DrawMultiFilterSprite(void) { - long lABR,lDST; + int lABR,lDST; if(bUseMultiPass || DrawSemiTrans || ubOpaqueDraw) { @@ -2867,7 +2867,7 @@ void DrawMultiFilterSprite(void) void primSprt8(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s; @@ -2988,7 +2988,7 @@ void primSprt8(unsigned char * baseAddr) void primSprt16(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s; @@ -3108,7 +3108,7 @@ void primSprt16(unsigned char * baseAddr) void primSprtSRest(unsigned char * baseAddr,unsigned short type) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s;unsigned short sTypeRest=0; @@ -3279,7 +3279,7 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) void primSprtS(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s;unsigned short sTypeRest=0; @@ -3418,7 +3418,7 @@ void primSprtS(unsigned char * baseAddr) void primPolyF4(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -3513,7 +3513,7 @@ BOOL bCheckFF9G4(unsigned char * baseAddr) if(iFF9Fix==2) { - long labr=GlobalTextABR; + int labr=GlobalTextABR; GlobalTextABR=1; primPolyG4(pFF9G4Cache); GlobalTextABR=labr; @@ -3527,7 +3527,7 @@ BOOL bCheckFF9G4(unsigned char * baseAddr) void primPolyG4(unsigned char * baseAddr) { - unsigned long *gpuData = (unsigned long *)baseAddr; + unsigned int *gpuData = (unsigned int *)baseAddr; short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -3578,7 +3578,7 @@ void primPolyG4(unsigned char * baseAddr) // cmd: flat shaded Texture3 //////////////////////////////////////////////////////////////////////// -BOOL DoLineCheck(unsigned long * gpuData) +BOOL DoLineCheck(unsigned int * gpuData) { BOOL bQuad=FALSE;short dx,dy; @@ -3745,7 +3745,7 @@ BOOL DoLineCheck(unsigned long * gpuData) void primPolyFT3(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4181,7 +4181,7 @@ void RectTexAlign(void) void primPolyFT4(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4269,7 +4269,7 @@ void primPolyFT4(unsigned char * baseAddr) void primPolyGT3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4378,7 +4378,7 @@ void primPolyGT3(unsigned char *baseAddr) void primPolyG3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4423,7 +4423,7 @@ void primPolyG3(unsigned char *baseAddr) void primPolyGT4(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4543,7 +4543,7 @@ void primPolyGT4(unsigned char *baseAddr) void primPolyF3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4587,7 +4587,7 @@ void primPolyF3(unsigned char *baseAddr) void primLineGSkip(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); int iMax=255; int i=2; @@ -4612,7 +4612,7 @@ void primLineGSkip(unsigned char *baseAddr) void primLineGEx(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int iMax=255; short cx0,cx1,cy0,cy1;int i;BOOL bDraw=TRUE; @@ -4676,7 +4676,7 @@ void primLineGEx(unsigned char *baseAddr) void primLineG2(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4721,7 +4721,7 @@ void primLineG2(unsigned char *baseAddr) void primLineFSkip(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int i=2,iMax=255; ly1 = (short)((gpuData[1]>>16) & 0xffff); @@ -4741,7 +4741,7 @@ void primLineFSkip(unsigned char *baseAddr) void primLineFEx(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int iMax; short cx0,cx1,cy0,cy1;int i; @@ -4799,7 +4799,7 @@ void primLineFEx(unsigned char *baseAddr) void primLineF2(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; diff --git a/plugins/gpu-gles/gpuPrim.h b/plugins/gpu-gles/gpuPrim.h index dc497671..c533acea 100644 --- a/plugins/gpu-gles/gpuPrim.h +++ b/plugins/gpu-gles/gpuPrim.h @@ -39,8 +39,8 @@ extern EGLSurface surface; extern EGLDisplay display; #endif -void UploadScreen (long Position); -void PrepareFullScreenUpload (long Position); +void UploadScreen (int Position); +void PrepareFullScreenUpload (int Position); BOOL CheckAgainstScreen(short imageX0,short imageY0,short imageX1,short imageY1); BOOL CheckAgainstFrontScreen(short imageX0,short imageY0,short imageX1,short imageY1); BOOL FastCheckAgainstScreen(short imageX0,short imageY0,short imageX1,short imageY1); diff --git a/plugins/gpu-gles/gpuTexture.c b/plugins/gpu-gles/gpuTexture.c index 2f96482a..5136682b 100644 --- a/plugins/gpu-gles/gpuTexture.c +++ b/plugins/gpu-gles/gpuTexture.c @@ -88,12 +88,12 @@ GLuint gTexMovieName=0; GLuint gTexBlurName=0; GLuint gTexFrameName=0; int iTexGarbageCollection=1; -unsigned long dwTexPageComp=0; +unsigned int dwTexPageComp=0; int iVRamSize=0; int iClampType=GL_CLAMP_TO_EDGE; int iFilter = GL_LINEAR; void (*LoadSubTexFn) (int,int,short,short); -unsigned long (*PalTexturedColourFn) (unsigned long); +unsigned int (*PalTexturedColourFn) (unsigned int); //////////////////////////////////////////////////////////////////////// // defines @@ -127,7 +127,7 @@ unsigned long (*PalTexturedColourFn) (unsigned long); //////////////////////////////////////////////////////////////////////// -unsigned char * CheckTextureInSubSCache(long TextureMode,unsigned long GivenClutId,unsigned short * pCache); +unsigned char * CheckTextureInSubSCache(int TextureMode,unsigned int GivenClutId,unsigned short * pCache); void LoadSubTexturePageSort(int pageid, int mode, short cx, short cy); void LoadPackedSubTexturePageSort(int pageid, int mode, short cx, short cy); void DefineSubTextureSort(void); @@ -136,7 +136,7 @@ void DefineSubTextureSort(void); // some globals //////////////////////////////////////////////////////////////////////// -long GlobalTexturePage; +int GlobalTexturePage; GLint XTexS; GLint YTexS; GLint DXTexS; @@ -147,7 +147,7 @@ BOOL bUse15bitMdec=FALSE; int iFrameTexType=0; int iFrameReadType=0; -unsigned long (*TCF[2]) (unsigned long); +unsigned int (*TCF[2]) (unsigned int); unsigned short (*PTCF[2]) (unsigned short); //////////////////////////////////////////////////////////////////////// @@ -158,7 +158,7 @@ unsigned short (*PTCF[2]) (unsigned short); typedef struct textureWndCacheEntryTag { - unsigned long ClutID; + unsigned int ClutID; short pageid; short textureMode; short Opaque; @@ -171,7 +171,7 @@ typedef struct textureWndCacheEntryTag typedef struct textureSubCacheEntryTagS { - unsigned long ClutID; + unsigned int ClutID; EXLong pos; unsigned char posTX; unsigned char posTY; @@ -200,7 +200,7 @@ int iTexWndLimit=MAXWNDTEXCACHE/2; GLubyte * texturepart=NULL; GLubyte * texturebuffer=NULL; -unsigned long g_x1,g_y1,g_x2,g_y2; +unsigned int g_x1,g_y1,g_x2,g_y2; unsigned char ubOpaqueDraw=0; unsigned short MAXTPAGES = 32; @@ -213,7 +213,7 @@ unsigned short MAXSORTTEX = 196; // porting... and honestly: nowadays the speed gain would be pointless //////////////////////////////////////////////////////////////////////// -unsigned long XP8RGBA(unsigned long BGR) +unsigned int XP8RGBA(unsigned int BGR) { if(!(BGR&0xffff)) return 0x50000000; if(DrawSemiTrans && !(BGR&0x8000)) @@ -221,7 +221,7 @@ unsigned long XP8RGBA(unsigned long BGR) return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8RGBAEx(unsigned long BGR) +unsigned int XP8RGBAEx(unsigned int BGR) { if(!(BGR&0xffff)) return 0x03000000; if(DrawSemiTrans && !(BGR&0x8000)) @@ -229,9 +229,9 @@ unsigned long XP8RGBAEx(unsigned long BGR) return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long CP8RGBA(unsigned long BGR) +unsigned int CP8RGBA(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x50000000; if(DrawSemiTrans && !(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);} @@ -240,9 +240,9 @@ unsigned long CP8RGBA(unsigned long BGR) return l; } -unsigned long CP8RGBAEx(unsigned long BGR) +unsigned int CP8RGBAEx(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x03000000; if(DrawSemiTrans && !(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);} @@ -251,33 +251,33 @@ unsigned long CP8RGBAEx(unsigned long BGR) return l; } -unsigned long XP8RGBA_0(unsigned long BGR) +unsigned int XP8RGBA_0(unsigned int BGR) { if(!(BGR&0xffff)) return 0x50000000; return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8RGBAEx_0(unsigned long BGR) +unsigned int XP8RGBAEx_0(unsigned int BGR) { if(!(BGR&0xffff)) return 0x03000000; return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8BGRA_0(unsigned long BGR) +unsigned int XP8BGRA_0(unsigned int BGR) { if(!(BGR&0xffff)) return 0x50000000; return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8BGRAEx_0(unsigned long BGR) +unsigned int XP8BGRAEx_0(unsigned int BGR) { if(!(BGR&0xffff)) return 0x03000000; return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; } -unsigned long CP8RGBA_0(unsigned long BGR) +unsigned int CP8RGBA_0(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x50000000; l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; @@ -285,9 +285,9 @@ unsigned long CP8RGBA_0(unsigned long BGR) return l; } -unsigned long CP8RGBAEx_0(unsigned long BGR) +unsigned int CP8RGBAEx_0(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x03000000; l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; @@ -295,9 +295,9 @@ unsigned long CP8RGBAEx_0(unsigned long BGR) return l; } -unsigned long CP8BGRA_0(unsigned long BGR) +unsigned int CP8BGRA_0(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x50000000; l=((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; @@ -305,9 +305,9 @@ unsigned long CP8BGRA_0(unsigned long BGR) return l; } -unsigned long CP8BGRAEx_0(unsigned long BGR) +unsigned int CP8BGRAEx_0(unsigned int BGR) { - unsigned long l; + unsigned int l; if(!(BGR&0xffff)) return 0x03000000; l=((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; @@ -315,41 +315,41 @@ unsigned long CP8BGRAEx_0(unsigned long BGR) return l; } -unsigned long XP8RGBA_1(unsigned long BGR) +unsigned int XP8RGBA_1(unsigned int BGR) { if(!(BGR&0xffff)) return 0x50000000; if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);} return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8RGBAEx_1(unsigned long BGR) +unsigned int XP8RGBAEx_1(unsigned int BGR) { if(!(BGR&0xffff)) return 0x03000000; if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);} return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8BGRA_1(unsigned long BGR) +unsigned int XP8BGRA_1(unsigned int BGR) { if(!(BGR&0xffff)) return 0x50000000; if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff);} return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; } -unsigned long XP8BGRAEx_1(unsigned long BGR) +unsigned int XP8BGRAEx_1(unsigned int BGR) { if(!(BGR&0xffff)) return 0x03000000; if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff);} return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; } -unsigned long P8RGBA(unsigned long BGR) +unsigned int P8RGBA(unsigned int BGR) { if(!(BGR&0xffff)) return 0; return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000; } -unsigned long P8BGRA(unsigned long BGR) +unsigned int P8BGRA(unsigned int BGR) { if(!(BGR&0xffff)) return 0; return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000; @@ -680,7 +680,7 @@ void ResetTextureArea(BOOL bDelTex) // Invalidate tex windows //////////////////////////////////////////////////////////////////////// -void InvalidateWndTextureArea(long X,long Y,long W, long H) +void InvalidateWndTextureArea(int X,int Y,int W, int H) { int i,px1,px2,py1,py2,iYM=1; textureWndCacheEntry * tsw=wcWndtexStore; @@ -771,11 +771,11 @@ void MarkFree(textureSubCacheEntryS * tsx) } } -void InvalidateSubSTextureArea(long X,long Y,long W, long H) +void InvalidateSubSTextureArea(int X,int Y,int W, int H) { int i,j,k,iMax,px,py,px1,px2,py1,py2,iYM=1; EXLong npos;textureSubCacheEntryS * tsb; - long x1,x2,y1,y2,xa,sw; + int x1,x2,y1,y2,xa,sw; W+=X-1; H+=Y-1; @@ -875,7 +875,7 @@ void InvalidateTextureAreaEx(void) //////////////////////////////////////////////////////////////////////// -void InvalidateTextureArea(long X,long Y,long W, long H) +void InvalidateTextureArea(int X,int Y,int W, int H) { if(W==0 && H==0) return; @@ -920,12 +920,12 @@ void DefineTextureWnd(void) void LoadStretchPackedWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm,ldx,ldy,ldxo; + unsigned int start,row,column,j,sxh,sxm,ldx,ldy,ldxo; unsigned int palstart; unsigned short *px,*pa,*ta; unsigned char *cSRCPtr,*cOSRCPtr; unsigned short *wSRCPtr,*wOSRCPtr; - unsigned long LineOffset;unsigned short s; + unsigned int LineOffset;unsigned short s; int pmult=pageid/16; unsigned short (*LPTCOL)(unsigned short); @@ -1112,22 +1112,22 @@ void LoadStretchPackedWndTexturePage(int pageid, int mode, short cx, short cy) void LoadStretchWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm,ldx,ldy,ldxo,s; + unsigned int start,row,column,j,sxh,sxm,ldx,ldy,ldxo,s; unsigned int palstart; - unsigned long *px,*pa,*ta; + unsigned int *px,*pa,*ta; unsigned char *cSRCPtr,*cOSRCPtr; unsigned short *wSRCPtr,*wOSRCPtr; - unsigned long LineOffset; + unsigned int LineOffset; int pmult=pageid/16; - unsigned long (*LTCOL)(unsigned long); + unsigned int (*LTCOL)(unsigned int); LTCOL=TCF[DrawSemiTrans]; ldxo=TWin.Position.x1-TWin.OPosition.x1; ldy =TWin.Position.y1-TWin.OPosition.y1; - pa=px=(unsigned long *)ubPaletteBuffer; - ta=(unsigned long *)texturepart; + pa=px=(unsigned int *)ubPaletteBuffer; + ta=(unsigned int *)texturepart; palstart=cx+(cy*1024); ubOpaqueDraw=0; @@ -1323,12 +1323,12 @@ void LoadStretchWndTexturePage(int pageid, int mode, short cx, short cy) void LoadPackedWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm; + unsigned int start,row,column,j,sxh,sxm; unsigned int palstart; unsigned short *px,*pa,*ta; unsigned char *cSRCPtr; unsigned short *wSRCPtr; - unsigned long LineOffset; + unsigned int LineOffset; int pmult=pageid/16; unsigned short (*LPTCOL)(unsigned short); @@ -1465,19 +1465,19 @@ void LoadPackedWndTexturePage(int pageid, int mode, short cx, short cy) void LoadWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm; + unsigned int start,row,column,j,sxh,sxm; unsigned int palstart; - unsigned long *px,*pa,*ta; + unsigned int *px,*pa,*ta; unsigned char *cSRCPtr; unsigned short *wSRCPtr; - unsigned long LineOffset; + unsigned int LineOffset; int pmult=pageid/16; - unsigned long (*LTCOL)(unsigned long); + unsigned int (*LTCOL)(unsigned int); LTCOL=TCF[DrawSemiTrans]; - pa=px=(unsigned long *)ubPaletteBuffer; - ta=(unsigned long *)texturepart; + pa=px=(unsigned int *)ubPaletteBuffer; + ta=(unsigned int *)texturepart; palstart=cx+(cy*1024); ubOpaqueDraw=0; @@ -1627,7 +1627,7 @@ void UploadTexWndPal(int mode,short cx,short cy) { unsigned int i,iSize; unsigned short * wSrcPtr; - unsigned long * ta=(unsigned long *)texturepart; + unsigned int * ta=(unsigned int *)texturepart; wSrcPtr=psxVuw+cx+(cy*1024); if(mode==0) i=4; else i=64; @@ -1677,10 +1677,10 @@ void DefinePalTextureWnd(void) void LoadPalWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm; + unsigned int start,row,column,j,sxh,sxm; unsigned char *ta; unsigned char *cSRCPtr; - unsigned long LineOffset; + unsigned int LineOffset; int pmult=pageid/16; ta=(unsigned char *)texturepart; @@ -1737,10 +1737,10 @@ void LoadPalWndTexturePage(int pageid, int mode, short cx, short cy) void LoadStretchPalWndTexturePage(int pageid, int mode, short cx, short cy) { - unsigned long start,row,column,j,sxh,sxm,ldx,ldy,ldxo; + unsigned int start,row,column,j,sxh,sxm,ldx,ldy,ldxo; unsigned char *ta,s; unsigned char *cSRCPtr,*cOSRCPtr; - unsigned long LineOffset; + unsigned int LineOffset; int pmult=pageid/16; ldxo=TWin.Position.x1-TWin.OPosition.x1; @@ -1815,7 +1815,7 @@ void LoadStretchPalWndTexturePage(int pageid, int mode, short cx, short cy) // tex window: main selecting, cache handler included //////////////////////////////////////////////////////////////////////// -GLuint LoadTextureWnd(long pageid,long TextureMode,unsigned long GivenClutId) +GLuint LoadTextureWnd(int pageid,int TextureMode,unsigned int GivenClutId) { textureWndCacheEntry * ts, * tsx=NULL; int i;short cx,cy; @@ -1837,8 +1837,8 @@ GLuint LoadTextureWnd(long pageid,long TextureMode,unsigned long GivenClutId) // palette check sum { - unsigned long l=0,row; - unsigned long * lSRCPtr=(unsigned long *)(psxVuw+cx+(cy*1024)); + unsigned int l=0,row; + unsigned int * lSRCPtr=(unsigned int *)(psxVuw+cx+(cy*1024)); if(TextureMode==1) for(row=1;row<129;row++) l+=((*lSRCPtr++)-1)*row; else for(row=1;row<9;row++) l+=((*lSRCPtr++)-1)<ClutID&(1<<30)) DrawSemiTrans=1; else DrawSemiTrans=0; - *((unsigned long *)&gl_ux[4])=r.l; + *((unsigned int *)&gl_ux[4])=r.l; gTexName=uiStexturePage[tsx->cTexID]; LoadSubTexFn(k,j,cx,cy); @@ -4117,7 +4117,7 @@ void CompressTextureSpace(void) if(dwTexPageComp==0xffffffff) dwTexPageComp=0; - *((unsigned long *)&gl_ux[4])=opos.l; + *((unsigned int *)&gl_ux[4])=opos.l; GlobalTexturePage=lOGTP; DrawSemiTrans=sOldDST; } @@ -4132,7 +4132,7 @@ void CompressTextureSpace(void) ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -GLuint SelectSubTextureS(long TextureMode, unsigned long GivenClutId) +GLuint SelectSubTextureS(int TextureMode, unsigned int GivenClutId) { unsigned char * OPtr;unsigned short iCache;short cx,cy; @@ -4174,9 +4174,9 @@ GLuint SelectSubTextureS(long TextureMode, unsigned long GivenClutId) // palette check sum.. removed MMX asm, this easy func works as well { - unsigned long l=0,row; + unsigned int l=0,row; - unsigned long * lSRCPtr=(unsigned long *)(psxVuw+cx+(cy*1024)); + unsigned int * lSRCPtr=(unsigned int *)(psxVuw+cx+(cy*1024)); if(TextureMode==1) for(row=1;row<129;row++) l+=((*lSRCPtr++)-1)*row; else for(row=1;row<9;row++) l+=((*lSRCPtr++)-1)<>24)&0xff) { -- 2.39.5