From 6ae7408b8c8cc6b521151fd671d60ad78501b448 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Tue, 6 Apr 2010 02:43:22 +0000 Subject: [PATCH] zzogl-pg: Remove obsolete PS2E*.h files; fix a compilation error in Win32/Debug targets; set a bunch of eol-style:native props. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2816 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/GifTransfer.h | 360 +++---- plugins/zzogl-pg/opengl/Mem_Swizzle.h | 102 +- plugins/zzogl-pg/opengl/Mem_Transmit.h | 490 ++++----- plugins/zzogl-pg/opengl/Util.h | 768 +++++++------- plugins/zzogl-pg/opengl/Win32/zerogs.def | 74 +- plugins/zzogl-pg/opengl/Win32/zerogs.rc | 454 ++++---- .../zzogl-pg/opengl/Win32/zerogsogl_2008.sln | 84 +- .../opengl/Win32/zerogsogl_2008.vcproj | 978 +++++++++--------- plugins/zzogl-pg/opengl/common/PS2Edefs.h | 876 ---------------- plugins/zzogl-pg/opengl/common/PS2Etypes.h | 234 ----- plugins/zzogl-pg/opengl/targets.cpp | 8 +- plugins/zzogl-pg/opengl/x86.h | 344 +++--- 12 files changed, 1831 insertions(+), 2941 deletions(-) delete mode 100644 plugins/zzogl-pg/opengl/common/PS2Edefs.h delete mode 100644 plugins/zzogl-pg/opengl/common/PS2Etypes.h diff --git a/plugins/zzogl-pg/opengl/GifTransfer.h b/plugins/zzogl-pg/opengl/GifTransfer.h index aac1791ae8..ff2c4f7d37 100644 --- a/plugins/zzogl-pg/opengl/GifTransfer.h +++ b/plugins/zzogl-pg/opengl/GifTransfer.h @@ -1,180 +1,180 @@ -/* ZeroGS KOSMOS - * Copyright (C) 2005-2006 zerofrog@gmail.com - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef GIFTRANSFER_H_INCLUDED -#define GIFTRANSFER_H_INCLUDED - -#include "Regs.h" -#include "Util.h" - -// If you notice bugs in the newest revisions, you might try disabling this, -// to see if they are related. -#define NEW_GIF_TRANSFER -enum GIF_FLG -{ - GIF_FLG_PACKED = 0, - GIF_FLG_REGLIST = 1, - GIF_FLG_IMAGE = 2, - GIF_FLG_IMAGE2 = 3 -}; - -// -// GIFTag -union GIFTag -{ - u64 ai64[2]; - u32 ai32[4]; - struct - { - u32 NLOOP:15; - u32 EOP:1; - u32 _PAD1:16; - u32 _PAD2:14; - u32 PRE:1; - u32 PRIM:11; - u32 FLG:2; // enum GIF_FLG - u32 NREG:4; - u64 REGS:64; - }; - void set(u32 *data) - { - for(int i = 0; i <= 3; i++) - { - ai32[i] = data[i]; - } - } - GIFTag(u32 *data) - { - set(data); - } - GIFTag(){ ai64[0] = 0; ai64[1] = 0; } -}; - -// EE part. Data transfer packet description - -typedef struct -{ -#ifdef NEW_GIF_TRANSFER - u32 mode; - int reg; - u64 regs; - u32 nloop; - int eop; - int nreg; - u32 adonly; - GIFTag tag; -#else - int mode; - int regn; - u64 regs; - int nloop; - int eop; - int nreg; - u32 adonly; - GIFTag tag; -#endif - -#ifdef NEW_GIF_TRANSFER - void setTag(u32 *data) - { - tag.set(data); - - nloop = tag.NLOOP; - eop = tag.EOP; - mode = tag.FLG; - - // Hmm.... - nreg = tag.NREG << 2; - if (nreg == 0) nreg = 64; - - regs = tag.REGS; - reg = 0; - - // GS_LOG("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d\n", - // data[3], data[2], data[1], data[0], - // path->eop, path->nloop, mode, path->nreg, tag.PRE); - } - - u32 GetReg() - { - return (regs >> reg) & 0xf; - } - - bool StepReg() - { - reg += 4; - - if (reg == nreg) - { - reg = 0; - nloop--; - - if (nloop == 0) - { - return false; - } - } - return true; - } -#else - void setTag(u32 *data) - { - tag.set(data); - - nloop = tag.NLOOP; - eop = tag.EOP; - u32 tagpre = tag.PRE; - u32 tagprim = tag.PRIM; - u32 tagflg = tag.FLG; - - // Hmm.... - nreg = tag.NREG << 2; - if (nreg == 0) nreg = 64; - - // GS_LOG("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d\n", - // data[3], data[2], data[1], data[0], - // path->eop, path->nloop, tagflg, path->nreg, tagpre); - - mode = tagflg; - - switch (mode) - { - case GIF_FLG_PACKED: - regs = *(u64 *)(data+2); - regn = 0; - if (tagpre) GIFRegHandlerPRIM((u32*)&tagprim); - - break; - - case GIF_FLG_REGLIST: - regs = *(u64 *)(data+2); - regn = 0; - break; - } - } -#endif -} pathInfo; - -void _GSgifPacket(pathInfo *path, u32 *pMem); -void _GSgifRegList(pathInfo *path, u32 *pMem); -void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size); - -extern GIFRegHandler g_GIFPackedRegHandlers[]; -extern GIFRegHandler g_GIFRegHandlers[]; - -#endif // GIFTRANSFER_H_INCLUDED +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 zerofrog@gmail.com + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef GIFTRANSFER_H_INCLUDED +#define GIFTRANSFER_H_INCLUDED + +#include "Regs.h" +#include "Util.h" + +// If you notice bugs in the newest revisions, you might try disabling this, +// to see if they are related. +#define NEW_GIF_TRANSFER +enum GIF_FLG +{ + GIF_FLG_PACKED = 0, + GIF_FLG_REGLIST = 1, + GIF_FLG_IMAGE = 2, + GIF_FLG_IMAGE2 = 3 +}; + +// +// GIFTag +union GIFTag +{ + u64 ai64[2]; + u32 ai32[4]; + struct + { + u32 NLOOP:15; + u32 EOP:1; + u32 _PAD1:16; + u32 _PAD2:14; + u32 PRE:1; + u32 PRIM:11; + u32 FLG:2; // enum GIF_FLG + u32 NREG:4; + u64 REGS:64; + }; + void set(u32 *data) + { + for(int i = 0; i <= 3; i++) + { + ai32[i] = data[i]; + } + } + GIFTag(u32 *data) + { + set(data); + } + GIFTag(){ ai64[0] = 0; ai64[1] = 0; } +}; + +// EE part. Data transfer packet description + +typedef struct +{ +#ifdef NEW_GIF_TRANSFER + u32 mode; + int reg; + u64 regs; + u32 nloop; + int eop; + int nreg; + u32 adonly; + GIFTag tag; +#else + int mode; + int regn; + u64 regs; + int nloop; + int eop; + int nreg; + u32 adonly; + GIFTag tag; +#endif + +#ifdef NEW_GIF_TRANSFER + void setTag(u32 *data) + { + tag.set(data); + + nloop = tag.NLOOP; + eop = tag.EOP; + mode = tag.FLG; + + // Hmm.... + nreg = tag.NREG << 2; + if (nreg == 0) nreg = 64; + + regs = tag.REGS; + reg = 0; + + // GS_LOG("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d\n", + // data[3], data[2], data[1], data[0], + // path->eop, path->nloop, mode, path->nreg, tag.PRE); + } + + u32 GetReg() + { + return (regs >> reg) & 0xf; + } + + bool StepReg() + { + reg += 4; + + if (reg == nreg) + { + reg = 0; + nloop--; + + if (nloop == 0) + { + return false; + } + } + return true; + } +#else + void setTag(u32 *data) + { + tag.set(data); + + nloop = tag.NLOOP; + eop = tag.EOP; + u32 tagpre = tag.PRE; + u32 tagprim = tag.PRIM; + u32 tagflg = tag.FLG; + + // Hmm.... + nreg = tag.NREG << 2; + if (nreg == 0) nreg = 64; + + // GS_LOG("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d\n", + // data[3], data[2], data[1], data[0], + // path->eop, path->nloop, tagflg, path->nreg, tagpre); + + mode = tagflg; + + switch (mode) + { + case GIF_FLG_PACKED: + regs = *(u64 *)(data+2); + regn = 0; + if (tagpre) GIFRegHandlerPRIM((u32*)&tagprim); + + break; + + case GIF_FLG_REGLIST: + regs = *(u64 *)(data+2); + regn = 0; + break; + } + } +#endif +} pathInfo; + +void _GSgifPacket(pathInfo *path, u32 *pMem); +void _GSgifRegList(pathInfo *path, u32 *pMem); +void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size); + +extern GIFRegHandler g_GIFPackedRegHandlers[]; +extern GIFRegHandler g_GIFRegHandlers[]; + +#endif // GIFTRANSFER_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Mem_Swizzle.h b/plugins/zzogl-pg/opengl/Mem_Swizzle.h index 2c6410752f..683701fd37 100644 --- a/plugins/zzogl-pg/opengl/Mem_Swizzle.h +++ b/plugins/zzogl-pg/opengl/Mem_Swizzle.h @@ -1,51 +1,51 @@ -/* ZeroGS KOSMOS - * Copyright (C) 2005-2006 zerofrog@gmail.com - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MEM_SWIZZLE_H_INCLUDED -#define MEM_SWIZZLE_H_INCLUDED - -#include "GS.h" -#include "Mem.h" -#include "x86.h" - -extern __forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); - -extern __forceinline void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern __forceinline void __fastcall SwizzleBlock24_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern __forceinline void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern __forceinline void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern __forceinline void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); - -// special swizzle macros - which I converted to functions. -extern __forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -extern __forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); -#define SwizzleBlock24u SwizzleBlock24 -#define SwizzleBlock8Hu SwizzleBlock8H -#define SwizzleBlock4HHu SwizzleBlock4HH -#define SwizzleBlock4HLu SwizzleBlock4HL - -#endif // MEM_SWIZZLE_H_INCLUDED +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 zerofrog@gmail.com + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MEM_SWIZZLE_H_INCLUDED +#define MEM_SWIZZLE_H_INCLUDED + +#include "GS.h" +#include "Mem.h" +#include "x86.h" + +extern __forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); + +extern __forceinline void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock24_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); + +// special swizzle macros - which I converted to functions. +extern __forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +#define SwizzleBlock24u SwizzleBlock24 +#define SwizzleBlock8Hu SwizzleBlock8H +#define SwizzleBlock4HHu SwizzleBlock4HH +#define SwizzleBlock4HLu SwizzleBlock4HL + +#endif // MEM_SWIZZLE_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Mem_Transmit.h b/plugins/zzogl-pg/opengl/Mem_Transmit.h index c3c02b25a7..d9f6494fb8 100644 --- a/plugins/zzogl-pg/opengl/Mem_Transmit.h +++ b/plugins/zzogl-pg/opengl/Mem_Transmit.h @@ -1,245 +1,245 @@ -#ifndef MEM_TRANSMIT_H_INCLUDED -#define MEM_TRANSMIT_H_INCLUDED - -#include "GS.h" -#include "Mem.h" - -#define DSTPSM gs.dstbuf.psm -extern int tempX, tempY; -extern int pitch, area, fracX; -extern int nSize; -extern u8* pstart; - -// transfers whole rows -template -static __forceinline bool TransmitHostLocalY_(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) -{ - assert( (nSize%widthlimit) == 0 && widthlimit <= 4 ); - if ((gs.imageEndX-gs.trxpos.dx) % widthlimit) - { - // GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); - - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, pbuf += 1) - { - /* write as many pixel at one time as possible */ - wp(pstart, tempX%2048, tempY%2048, pbuf[0], gs.dstbuf.bw); - } - } - } - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, pbuf += widthlimit) - { - - /* write as many pixel at one time as possible */ - if( nSize < widthlimit ) return false; - - wp(pstart, tempX%2048, tempY%2048, pbuf[0], gs.dstbuf.bw); - - if( widthlimit > 1 ) - { - wp(pstart, (tempX+1)%2048, tempY%2048, pbuf[1], gs.dstbuf.bw); - - if( widthlimit > 2 ) - { - wp(pstart, (tempX+2)%2048, tempY%2048, pbuf[2], gs.dstbuf.bw); - - if( widthlimit > 3 ) - { - wp(pstart, (tempX+3)%2048, tempY%2048, pbuf[3], gs.dstbuf.bw); - } - } - } - } - - if ( tempX >= gs.imageEndX ) - { - assert(tempX == gs.imageEndX); - tempX = gs.trxpos.dx; - } - else - { - assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); - return false; - } - } - return true; -} - -template -static __forceinline bool TransmitHostLocalX_(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) -{ - for(u32 tempi = 0; tempi < blockheight; ++tempi) - { - for(tempX = startX; tempX < gs.imageEndX; tempX++, pbuf++) - { - wp(pstart, tempX%2048, (tempY+tempi)%2048, pbuf[0], gs.dstbuf.bw); - } - pbuf += pitch - fracX; - } - return true; -} - -// transfers whole rows -template -static __forceinline bool TransmitHostLocalY_24(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) -{ - if (widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit)) - { - //GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, pbuf += 3) - { - wp(pstart, tempX%2048, tempY%2048, *(u32*)(pbuf), gs.dstbuf.bw); - } - - if( tempX >= gs.imageEndX ) - { - assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); - tempX = gs.trxpos.dx; - } - else - { - assert( gs.imageTransfer == -1 || nSize == 0 ); - return false; - } - } - } - else - { - assert( /*(nSize%widthlimit) == 0 &&*/ widthlimit == 8 ); - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, pbuf += 3*widthlimit) - { - if (nSize < widthlimit) return false; - - /* write as many pixel at one time as possible */ - - wp(pstart, tempX%2048, tempY%2048, *(u32*)(pbuf+0), gs.dstbuf.bw); - wp(pstart, (tempX+1)%2048, tempY%2048, *(u32*)(pbuf+3), gs.dstbuf.bw); - wp(pstart, (tempX+2)%2048, tempY%2048, *(u32*)(pbuf+6), gs.dstbuf.bw); - wp(pstart, (tempX+3)%2048, tempY%2048, *(u32*)(pbuf+9), gs.dstbuf.bw); - wp(pstart, (tempX+4)%2048, tempY%2048, *(u32*)(pbuf+12), gs.dstbuf.bw); - wp(pstart, (tempX+5)%2048, tempY%2048, *(u32*)(pbuf+15), gs.dstbuf.bw); - wp(pstart, (tempX+6)%2048, tempY%2048, *(u32*)(pbuf+18), gs.dstbuf.bw); - wp(pstart, (tempX+7)%2048, tempY%2048, *(u32*)(pbuf+21), gs.dstbuf.bw); - } - - if (tempX >= gs.imageEndX) - { - assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); - tempX = gs.trxpos.dx; - } - else - { - if ( nSize < 0 ) - { - /* extracted too much */ - assert( (nSize%3)==0 && nSize > -24 ); - tempX += nSize/3; - nSize = 0; - } - assert( gs.imageTransfer == -1 || nSize == 0 ); - return false; - } - } - } - return true; -} - -// transmit until endX, don't check size since it has already been prevalidated -template -static __forceinline bool TransmitHostLocalX_24(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) -{ - for(u32 tempi = 0; tempi < blockheight; ++tempi) - { - for(tempX = startX; tempX < gs.imageEndX; tempX++, pbuf += 3) - { - wp(pstart, tempX%2048, (tempY+tempi)%2048, *(u32*)pbuf, gs.dstbuf.bw); - } - pbuf += 3*(pitch-fracX); - } - return true; -} - -// meant for 4bit transfers -template -static __forceinline bool TransmitHostLocalY_4(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) -{ - for(; tempY < endY; ++tempY) - { - for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit) - { - /* write as many pixel at one time as possible */ - wp(pstart, tempX%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+1)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); - pbuf++; - if ( widthlimit > 2 ) - { - wp(pstart, (tempX+2)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+3)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); - pbuf++; - - if( widthlimit > 4 ) - { - wp(pstart, (tempX+4)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+5)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); - pbuf++; - - if( widthlimit > 6 ) - { - wp(pstart, (tempX+6)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+7)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); - pbuf++; - } - } - } - } - - if ( tempX >= gs.imageEndX ) - { - tempX = gs.trxpos.dx; - } - else - { - assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); - return false; - } - } - return true; -} - -// transmit until endX, don't check size since it has already been prevalidated -template -static __forceinline bool TransmitHostLocalX_4(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) -{ - for(u32 tempi = 0; tempi < blockheight; ++tempi) - { - for(tempX = startX; tempX < gs.imageEndX; tempX+=2, pbuf++) - { - wp(pstart, tempX%2048, (tempY+tempi)%2048, pbuf[0]&0x0f, gs.dstbuf.bw); - wp(pstart, (tempX+1)%2048, (tempY+tempi)%2048, pbuf[0]>>4, gs.dstbuf.bw); - } - pbuf += (pitch-fracX)/2; - } - return true; -} - -// calculate pitch in source buffer -static __forceinline u32 TransPitch(u32 pitch, u32 size) -{ - return pitch * size / 8; -} - -static __forceinline u32 TransPitch2(u32 pitch, u32 size) -{ - if (size == 4) return pitch / 2; - if (size == 24) return pitch * 3; - return pitch; -} - -#endif // MEM_TRANSMIT_H_INCLUDED +#ifndef MEM_TRANSMIT_H_INCLUDED +#define MEM_TRANSMIT_H_INCLUDED + +#include "GS.h" +#include "Mem.h" + +#define DSTPSM gs.dstbuf.psm +extern int tempX, tempY; +extern int pitch, area, fracX; +extern int nSize; +extern u8* pstart; + +// transfers whole rows +template +static __forceinline bool TransmitHostLocalY_(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) +{ + assert( (nSize%widthlimit) == 0 && widthlimit <= 4 ); + if ((gs.imageEndX-gs.trxpos.dx) % widthlimit) + { + // GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); + + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, pbuf += 1) + { + /* write as many pixel at one time as possible */ + wp(pstart, tempX%2048, tempY%2048, pbuf[0], gs.dstbuf.bw); + } + } + } + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, pbuf += widthlimit) + { + + /* write as many pixel at one time as possible */ + if( nSize < widthlimit ) return false; + + wp(pstart, tempX%2048, tempY%2048, pbuf[0], gs.dstbuf.bw); + + if( widthlimit > 1 ) + { + wp(pstart, (tempX+1)%2048, tempY%2048, pbuf[1], gs.dstbuf.bw); + + if( widthlimit > 2 ) + { + wp(pstart, (tempX+2)%2048, tempY%2048, pbuf[2], gs.dstbuf.bw); + + if( widthlimit > 3 ) + { + wp(pstart, (tempX+3)%2048, tempY%2048, pbuf[3], gs.dstbuf.bw); + } + } + } + } + + if ( tempX >= gs.imageEndX ) + { + assert(tempX == gs.imageEndX); + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); + return false; + } + } + return true; +} + +template +static __forceinline bool TransmitHostLocalX_(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) +{ + for(u32 tempi = 0; tempi < blockheight; ++tempi) + { + for(tempX = startX; tempX < gs.imageEndX; tempX++, pbuf++) + { + wp(pstart, tempX%2048, (tempY+tempi)%2048, pbuf[0], gs.dstbuf.bw); + } + pbuf += pitch - fracX; + } + return true; +} + +// transfers whole rows +template +static __forceinline bool TransmitHostLocalY_24(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) +{ + if (widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit)) + { + //GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM); + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, pbuf += 3) + { + wp(pstart, tempX%2048, tempY%2048, *(u32*)(pbuf), gs.dstbuf.bw); + } + + if( tempX >= gs.imageEndX ) + { + assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || nSize == 0 ); + return false; + } + } + } + else + { + assert( /*(nSize%widthlimit) == 0 &&*/ widthlimit == 8 ); + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, pbuf += 3*widthlimit) + { + if (nSize < widthlimit) return false; + + /* write as many pixel at one time as possible */ + + wp(pstart, tempX%2048, tempY%2048, *(u32*)(pbuf+0), gs.dstbuf.bw); + wp(pstart, (tempX+1)%2048, tempY%2048, *(u32*)(pbuf+3), gs.dstbuf.bw); + wp(pstart, (tempX+2)%2048, tempY%2048, *(u32*)(pbuf+6), gs.dstbuf.bw); + wp(pstart, (tempX+3)%2048, tempY%2048, *(u32*)(pbuf+9), gs.dstbuf.bw); + wp(pstart, (tempX+4)%2048, tempY%2048, *(u32*)(pbuf+12), gs.dstbuf.bw); + wp(pstart, (tempX+5)%2048, tempY%2048, *(u32*)(pbuf+15), gs.dstbuf.bw); + wp(pstart, (tempX+6)%2048, tempY%2048, *(u32*)(pbuf+18), gs.dstbuf.bw); + wp(pstart, (tempX+7)%2048, tempY%2048, *(u32*)(pbuf+21), gs.dstbuf.bw); + } + + if (tempX >= gs.imageEndX) + { + assert(gs.imageTransfer == -1 || tempX == gs.imageEndX); + tempX = gs.trxpos.dx; + } + else + { + if ( nSize < 0 ) + { + /* extracted too much */ + assert( (nSize%3)==0 && nSize > -24 ); + tempX += nSize/3; + nSize = 0; + } + assert( gs.imageTransfer == -1 || nSize == 0 ); + return false; + } + } + } + return true; +} + +// transmit until endX, don't check size since it has already been prevalidated +template +static __forceinline bool TransmitHostLocalX_24(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) +{ + for(u32 tempi = 0; tempi < blockheight; ++tempi) + { + for(tempX = startX; tempX < gs.imageEndX; tempX++, pbuf += 3) + { + wp(pstart, tempX%2048, (tempY+tempi)%2048, *(u32*)pbuf, gs.dstbuf.bw); + } + pbuf += 3*(pitch-fracX); + } + return true; +} + +// meant for 4bit transfers +template +static __forceinline bool TransmitHostLocalY_4(_writePixel_0 wp, u32 widthlimit, u32 endY, const T *pbuf) +{ + for(; tempY < endY; ++tempY) + { + for(; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit) + { + /* write as many pixel at one time as possible */ + wp(pstart, tempX%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+1)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); + pbuf++; + if ( widthlimit > 2 ) + { + wp(pstart, (tempX+2)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+3)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); + pbuf++; + + if( widthlimit > 4 ) + { + wp(pstart, (tempX+4)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+5)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); + pbuf++; + + if( widthlimit > 6 ) + { + wp(pstart, (tempX+6)%2048, tempY%2048, *pbuf&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+7)%2048, tempY%2048, *pbuf>>4, gs.dstbuf.bw); + pbuf++; + } + } + } + } + + if ( tempX >= gs.imageEndX ) + { + tempX = gs.trxpos.dx; + } + else + { + assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); + return false; + } + } + return true; +} + +// transmit until endX, don't check size since it has already been prevalidated +template +static __forceinline bool TransmitHostLocalX_4(_writePixel_0 wp, u32 widthlimit, u32 blockheight, u32 startX, const T *pbuf) +{ + for(u32 tempi = 0; tempi < blockheight; ++tempi) + { + for(tempX = startX; tempX < gs.imageEndX; tempX+=2, pbuf++) + { + wp(pstart, tempX%2048, (tempY+tempi)%2048, pbuf[0]&0x0f, gs.dstbuf.bw); + wp(pstart, (tempX+1)%2048, (tempY+tempi)%2048, pbuf[0]>>4, gs.dstbuf.bw); + } + pbuf += (pitch-fracX)/2; + } + return true; +} + +// calculate pitch in source buffer +static __forceinline u32 TransPitch(u32 pitch, u32 size) +{ + return pitch * size / 8; +} + +static __forceinline u32 TransPitch2(u32 pitch, u32 size) +{ + if (size == 4) return pitch / 2; + if (size == 24) return pitch * 3; + return pitch; +} + +#endif // MEM_TRANSMIT_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index 6c49fcb575..e3f5fdde78 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -1,384 +1,384 @@ -/* ZeroGS KOSMOS - * Copyright (C) 2005-2006 zerofrog@gmail.com - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef UTIL_H_INCLUDED -#define UTIL_H_INCLUDED - - -#ifdef _WIN32 - -#include -#include - -extern HWND GShwnd; - -#else // linux basic definitions - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif - -#include -#include -#include - - -#define GSdefs -#include "PS2Edefs.h" - -// need C definitions -- no mangling please! -extern "C" u32 CALLBACK PS2EgetLibType(void); -extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type); -extern "C" char* CALLBACK PS2EgetLibName(void); - -#include "zerogsmath.h" - -#include - -#include -#include - -extern u32 THR_KeyEvent; // value for passing out key events beetwen threads -extern bool THR_bShift; -extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file path - -///////////////////// -// define when releasing -// The only code that uses it is commented out! -//#define ZEROGS_CACHEDCLEAR // much better performance -//#define RELEASE_TO_PUBLIC -// fixme - We should use ZEROGS_DEVBUILD to determine devel/debug builds from "public release" builds. -// Means a lot of search-and-replace though. (air) - -#ifdef ZEROGS_DEVBUILD -#define GS_LOG __Log -#else -#define GS_LOG 0&& -#endif - -#define ERROR_LOG __LogToConsole -//Logging for errors that are called often should have a time counter. - -#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC) - -// declare linux equivalents -static __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align) -{ - assert( align < 0x10000 ); - char* p = (char*)malloc(size+align); - int off = 2+align - ((int)(uptr)(p+2) % align); - - p += off; - *(u16*)(p-2) = off; - - return p; -} - -static __forceinline void pcsx2_aligned_free(void* pmem) -{ - if( pmem != NULL ) { - char* p = (char*)pmem; - free(p - (int)*(u16*)(p-2)); - } -} - -#define _aligned_malloc pcsx2_aligned_malloc -#define _aligned_free pcsx2_aligned_free - -#include // ftime(), struct timeb - -inline unsigned long timeGetTime() -{ -#ifdef _WIN32 - _timeb t; - _ftime(&t); -#else - timeb t; - ftime(&t); -#endif - - return (unsigned long)(t.time*1000+t.millitm); -} - -struct RECT -{ - int left, top; - int right, bottom; -}; - -#endif - -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) - - -typedef struct { - int x, y, w, h; -} Rect; - -typedef struct { - int x, y; -} Point; - -typedef struct { - int x0, y0; - int x1, y1; -} Rect2; - -typedef struct { - int x, y, c; -} PointC; - -#define GSOPTION_FULLSCREEN 0x2 -#define GSOPTION_TGASNAP 0x4 -#define GSOPTION_CAPTUREAVI 0x8 - -#define GSOPTION_WINDIMS 0x30 -#define GSOPTION_WIN640 0x00 -#define GSOPTION_WIN800 0x10 -#define GSOPTION_WIN1024 0x20 -#define GSOPTION_WIN1280 0x30 -#define GSOPTION_WIDESCREEN 0x40 - -#define GSOPTION_WIREFRAME 0x100 -#define GSOPTION_LOADED 0x8000 - -//Configuration values. -typedef struct -{ - u8 mrtdepth; // write color in render target - u8 interlace; // intelacing mode 0, 1, 3-off - u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x - u8 negaa; // negative aliasing - u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it) - u32 options; // game options -- different hacks. - u32 gamesettings;// default game settings - int width, height; // View target size, has no impact towards speed - bool isWideScreen; // Widescreen support -#ifdef GS_LOG - u32 log; -#endif -} GSconf; - -#ifdef __LINUX__ -static u32 __attribute__((unused)) lasttime = 0; -static u32 __attribute__((unused)) BigTime = 5000; -static bool __attribute__((unused)) SPAM_PASS; -#else -static u32 lasttime = 0; -static u32 BigTime = 5000; -static bool SPAM_PASS; -#endif - -#define ERROR_LOG_SPAM(text) { \ - if( timeGetTime() - lasttime > BigTime ) { \ - ERROR_LOG(text); \ - lasttime = timeGetTime(); \ - } \ -} -// The same macro with one-argument substitution. -#define ERROR_LOG_SPAMA(fmt, value) { \ - if( timeGetTime() - lasttime > BigTime ) { \ - ERROR_LOG(fmt, value); \ - lasttime = timeGetTime(); \ - } \ -} - -#define ERROR_LOG_SPAM_TEST(text) {\ - if( timeGetTime() - lasttime > BigTime ) { \ - ERROR_LOG(text); \ - lasttime = timeGetTime(); \ - SPAM_PASS = true; \ - } \ - else \ - SPAM_PASS = false; \ -} - -#if DEBUG_PROF -#define FILE_IS_IN_CHECK ((strcmp(__FILE__, "targets.cpp") == 0) || (strcmp(__FILE__, "ZZoglFlush.cpp") == 0)) - -#define FUNCLOG {\ - static bool Was_Here = false; \ - static unsigned long int waslasttime = 0; \ - if (!Was_Here && FILE_IS_IN_CHECK) { \ - Was_Here = true;\ - ERROR_LOG("%s:%d %s\n", __FILE__, __LINE__, __func__); \ - waslasttime = timeGetTime(); \ - } \ - if (FILE_IS_IN_CHECK && (timeGetTime() - waslasttime > BigTime )) { \ - Was_Here = false; \ - } \ -} -#else -#define FUNCLOG -#endif - -#define DEBUG_LOG printf - -#ifdef RELEASE_TO_PUBLIC -#define WARN_LOG 0&& -#define PRIM_LOG 0&& -#else -#define WARN_LOG printf -#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG -#endif - -#ifndef GREG_LOG -#define GREG_LOG 0&& -#endif -#ifndef PRIM_LOG -#define PRIM_LOG 0&& -#endif -#ifndef WARN_LOG -#define WARN_LOG 0&& -#endif - - -#define REG64(name) \ -union name \ -{ \ - u64 i64; \ - u32 ai32[2]; \ - struct { \ - -#define REG128(name)\ -union name \ -{ \ - u64 ai64[2]; \ - u32 ai32[4]; \ - struct { \ - -#define REG64_(prefix, name) REG64(prefix##name) -#define REG128_(prefix, name) REG128(prefix##name) - -#define REG_END }; }; -#define REG_END2 }; - -#define REG64_SET(name) \ -union name \ -{ \ - u64 i64; \ - u32 ai32[2]; \ - -#define REG128_SET(name)\ -union name \ -{ \ - u64 ai64[2]; \ - u32 ai32[4]; \ - -#define REG_SET_END }; - - -extern FILE *gsLog; - -extern void __Log(const char *fmt, ...); -extern void __LogToConsole(const char *fmt, ...); - -extern void LoadConfig(); -extern void SaveConfig(); - -extern void (*GSirq)(); - -extern void *SysLoadLibrary(char *lib); // Loads Library -extern void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library -extern char *SysLibError(); // Gets previous error loading sysbols -extern void SysCloseLibrary(void *lib); // Closes Library -extern void SysMessage(const char *fmt, ...); - -#ifdef __LINUX__ -#include "Utilities/MemcpyFast.h" -#define memcpy_amd memcpy_fast -#else -extern "C" void * memcpy_amd(void *dest, const void *src, size_t n); -extern "C" u8 memcmp_mmx(const void *dest, const void *src, int n); -#endif - -template -class CInterfacePtr -{ -public: - inline CInterfacePtr() : ptr(NULL) {} - inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if ( ptr != NULL ) ptr->AddRef(); } - inline ~CInterfacePtr() { if( ptr != NULL ) ptr->Release(); } - - inline T* operator* () { assert( ptr != NULL); return *ptr; } - inline T* operator->() { return ptr; } - inline T* get() { return ptr; } - - inline void release() { - if( ptr != NULL ) { ptr->Release(); ptr = NULL; } - } - - inline operator T*() { return ptr; } - - inline bool operator==(T* rhs) { return ptr == rhs; } - inline bool operator!=(T* rhs) { return ptr != rhs; } - - inline CInterfacePtr& operator= (T* newptr) { - if( ptr != NULL ) ptr->Release(); - ptr = newptr; - - if( ptr != NULL ) ptr->AddRef(); - return *this; - } - -private: - T* ptr; -}; - - -// IMPORTANT: For every Register there must be an End -void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers -void DVProfEnd(u32 dwUserData); -void DVProfWrite(char* pfilename, u32 frames = 0); -void DVProfClear(); // clears all the profilers - -#define DVPROFILE -#ifdef DVPROFILE - -class DVProfileFunc -{ -public: - u32 dwUserData; - DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; } - DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } - ~DVProfileFunc() { DVProfEnd(dwUserData); } -}; - -#else - -class DVProfileFunc -{ -public: - u32 dwUserData; - static __forceinline DVProfileFunc(char* pname) {} - static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { } - ~DVProfileFunc() {} -}; - -#endif - -#endif // UTIL_H_INCLUDED +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 zerofrog@gmail.com + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef UTIL_H_INCLUDED +#define UTIL_H_INCLUDED + + +#ifdef _WIN32 + +#include +#include + +extern HWND GShwnd; + +#else // linux basic definitions + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +#include +#include +#include + + +#define GSdefs +#include "PS2Edefs.h" + +// need C definitions -- no mangling please! +extern "C" u32 CALLBACK PS2EgetLibType(void); +extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type); +extern "C" char* CALLBACK PS2EgetLibName(void); + +#include "zerogsmath.h" + +#include + +#include +#include + +extern u32 THR_KeyEvent; // value for passing out key events beetwen threads +extern bool THR_bShift; +extern std::string s_strIniPath; // Air's new (r2361) new constant for ini file path + +///////////////////// +// define when releasing +// The only code that uses it is commented out! +//#define ZEROGS_CACHEDCLEAR // much better performance +//#define RELEASE_TO_PUBLIC +// fixme - We should use ZEROGS_DEVBUILD to determine devel/debug builds from "public release" builds. +// Means a lot of search-and-replace though. (air) + +#ifdef ZEROGS_DEVBUILD +#define GS_LOG __Log +#else +#define GS_LOG 0&& +#endif + +#define ERROR_LOG __LogToConsole +//Logging for errors that are called often should have a time counter. + +#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC) + +// declare linux equivalents +static __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align) +{ + assert( align < 0x10000 ); + char* p = (char*)malloc(size+align); + int off = 2+align - ((int)(uptr)(p+2) % align); + + p += off; + *(u16*)(p-2) = off; + + return p; +} + +static __forceinline void pcsx2_aligned_free(void* pmem) +{ + if( pmem != NULL ) { + char* p = (char*)pmem; + free(p - (int)*(u16*)(p-2)); + } +} + +#define _aligned_malloc pcsx2_aligned_malloc +#define _aligned_free pcsx2_aligned_free + +#include // ftime(), struct timeb + +inline unsigned long timeGetTime() +{ +#ifdef _WIN32 + _timeb t; + _ftime(&t); +#else + timeb t; + ftime(&t); +#endif + + return (unsigned long)(t.time*1000+t.millitm); +} + +struct RECT +{ + int left, top; + int right, bottom; +}; + +#endif + +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define min(a,b) (((a) < (b)) ? (a) : (b)) + + +typedef struct { + int x, y, w, h; +} Rect; + +typedef struct { + int x, y; +} Point; + +typedef struct { + int x0, y0; + int x1, y1; +} Rect2; + +typedef struct { + int x, y, c; +} PointC; + +#define GSOPTION_FULLSCREEN 0x2 +#define GSOPTION_TGASNAP 0x4 +#define GSOPTION_CAPTUREAVI 0x8 + +#define GSOPTION_WINDIMS 0x30 +#define GSOPTION_WIN640 0x00 +#define GSOPTION_WIN800 0x10 +#define GSOPTION_WIN1024 0x20 +#define GSOPTION_WIN1280 0x30 +#define GSOPTION_WIDESCREEN 0x40 + +#define GSOPTION_WIREFRAME 0x100 +#define GSOPTION_LOADED 0x8000 + +//Configuration values. +typedef struct +{ + u8 mrtdepth; // write color in render target + u8 interlace; // intelacing mode 0, 1, 3-off + u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x + u8 negaa; // negative aliasing + u8 bilinear; // set to enable bilinear support. 0 - off, 1 -- on, 2 -- force (use for textures that usually need it) + u32 options; // game options -- different hacks. + u32 gamesettings;// default game settings + int width, height; // View target size, has no impact towards speed + bool isWideScreen; // Widescreen support +#ifdef GS_LOG + u32 log; +#endif +} GSconf; + +#ifdef __LINUX__ +static u32 __attribute__((unused)) lasttime = 0; +static u32 __attribute__((unused)) BigTime = 5000; +static bool __attribute__((unused)) SPAM_PASS; +#else +static u32 lasttime = 0; +static u32 BigTime = 5000; +static bool SPAM_PASS; +#endif + +#define ERROR_LOG_SPAM(text) { \ + if( timeGetTime() - lasttime > BigTime ) { \ + ERROR_LOG(text); \ + lasttime = timeGetTime(); \ + } \ +} +// The same macro with one-argument substitution. +#define ERROR_LOG_SPAMA(fmt, value) { \ + if( timeGetTime() - lasttime > BigTime ) { \ + ERROR_LOG(fmt, value); \ + lasttime = timeGetTime(); \ + } \ +} + +#define ERROR_LOG_SPAM_TEST(text) {\ + if( timeGetTime() - lasttime > BigTime ) { \ + ERROR_LOG(text); \ + lasttime = timeGetTime(); \ + SPAM_PASS = true; \ + } \ + else \ + SPAM_PASS = false; \ +} + +#if DEBUG_PROF +#define FILE_IS_IN_CHECK ((strcmp(__FILE__, "targets.cpp") == 0) || (strcmp(__FILE__, "ZZoglFlush.cpp") == 0)) + +#define FUNCLOG {\ + static bool Was_Here = false; \ + static unsigned long int waslasttime = 0; \ + if (!Was_Here && FILE_IS_IN_CHECK) { \ + Was_Here = true;\ + ERROR_LOG("%s:%d %s\n", __FILE__, __LINE__, __func__); \ + waslasttime = timeGetTime(); \ + } \ + if (FILE_IS_IN_CHECK && (timeGetTime() - waslasttime > BigTime )) { \ + Was_Here = false; \ + } \ +} +#else +#define FUNCLOG +#endif + +#define DEBUG_LOG printf + +#ifdef RELEASE_TO_PUBLIC +#define WARN_LOG 0&& +#define PRIM_LOG 0&& +#else +#define WARN_LOG printf +#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG +#endif + +#ifndef GREG_LOG +#define GREG_LOG 0&& +#endif +#ifndef PRIM_LOG +#define PRIM_LOG 0&& +#endif +#ifndef WARN_LOG +#define WARN_LOG 0&& +#endif + + +#define REG64(name) \ +union name \ +{ \ + u64 i64; \ + u32 ai32[2]; \ + struct { \ + +#define REG128(name)\ +union name \ +{ \ + u64 ai64[2]; \ + u32 ai32[4]; \ + struct { \ + +#define REG64_(prefix, name) REG64(prefix##name) +#define REG128_(prefix, name) REG128(prefix##name) + +#define REG_END }; }; +#define REG_END2 }; + +#define REG64_SET(name) \ +union name \ +{ \ + u64 i64; \ + u32 ai32[2]; \ + +#define REG128_SET(name)\ +union name \ +{ \ + u64 ai64[2]; \ + u32 ai32[4]; \ + +#define REG_SET_END }; + + +extern FILE *gsLog; + +extern void __Log(const char *fmt, ...); +extern void __LogToConsole(const char *fmt, ...); + +extern void LoadConfig(); +extern void SaveConfig(); + +extern void (*GSirq)(); + +extern void *SysLoadLibrary(char *lib); // Loads Library +extern void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library +extern char *SysLibError(); // Gets previous error loading sysbols +extern void SysCloseLibrary(void *lib); // Closes Library +extern void SysMessage(const char *fmt, ...); + +#ifdef __LINUX__ +#include "Utilities/MemcpyFast.h" +#define memcpy_amd memcpy_fast +#else +extern "C" void * memcpy_amd(void *dest, const void *src, size_t n); +extern "C" u8 memcmp_mmx(const void *dest, const void *src, int n); +#endif + +template +class CInterfacePtr +{ +public: + inline CInterfacePtr() : ptr(NULL) {} + inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if ( ptr != NULL ) ptr->AddRef(); } + inline ~CInterfacePtr() { if( ptr != NULL ) ptr->Release(); } + + inline T* operator* () { assert( ptr != NULL); return *ptr; } + inline T* operator->() { return ptr; } + inline T* get() { return ptr; } + + inline void release() { + if( ptr != NULL ) { ptr->Release(); ptr = NULL; } + } + + inline operator T*() { return ptr; } + + inline bool operator==(T* rhs) { return ptr == rhs; } + inline bool operator!=(T* rhs) { return ptr != rhs; } + + inline CInterfacePtr& operator= (T* newptr) { + if( ptr != NULL ) ptr->Release(); + ptr = newptr; + + if( ptr != NULL ) ptr->AddRef(); + return *this; + } + +private: + T* ptr; +}; + + +// IMPORTANT: For every Register there must be an End +void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers +void DVProfEnd(u32 dwUserData); +void DVProfWrite(char* pfilename, u32 frames = 0); +void DVProfClear(); // clears all the profilers + +#define DVPROFILE +#ifdef DVPROFILE + +class DVProfileFunc +{ +public: + u32 dwUserData; + DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; } + DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } + ~DVProfileFunc() { DVProfEnd(dwUserData); } +}; + +#else + +class DVProfileFunc +{ +public: + u32 dwUserData; + static __forceinline DVProfileFunc(char* pname) {} + static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { } + ~DVProfileFunc() {} +}; + +#endif + +#endif // UTIL_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Win32/zerogs.def b/plugins/zzogl-pg/opengl/Win32/zerogs.def index 0bf6102024..e03455c0fa 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogs.def +++ b/plugins/zzogl-pg/opengl/Win32/zerogs.def @@ -1,37 +1,37 @@ -; Declares the module parameters for the DLL. - -;LIBRARY "ZeroGS" -;DESCRIPTION 'ZeroGS dll' - -EXPORTS - ; Explicit exports can go here - PS2EgetLibType @2 - PS2EgetLibName @3 - PS2EgetLibVersion2 @4 - GSinit @5 - GSshutdown @6 - GSopen @7 - GSclose @8 - GSgifTransfer1 @13 - GSgifTransfer2 @14 - GSgifTransfer3 @15 - GSreadFIFO @16 - GSvsync @17 - GSmakeSnapshot @18 - GSkeyEvent @19 - GSfreeze @20 - GSconfigure @21 - GStest @22 - GSabout @23 - GSreadFIFO2 @28 - GSirqCallback @29 - GSsetBaseMem @30 - GSwriteCSR @31 - GSchangeSaveState @32 - GSreset @33 - GSgifSoftReset @34 - GSsetFrameSkip @35 - GSsetGameCRC @36 - GSgetLastTag @37 - GSsetupRecording @38 - GSsetSettingsDir @39 +; Declares the module parameters for the DLL. + +;LIBRARY "ZeroGS" +;DESCRIPTION 'ZeroGS dll' + +EXPORTS + ; Explicit exports can go here + PS2EgetLibType @2 + PS2EgetLibName @3 + PS2EgetLibVersion2 @4 + GSinit @5 + GSshutdown @6 + GSopen @7 + GSclose @8 + GSgifTransfer1 @13 + GSgifTransfer2 @14 + GSgifTransfer3 @15 + GSreadFIFO @16 + GSvsync @17 + GSmakeSnapshot @18 + GSkeyEvent @19 + GSfreeze @20 + GSconfigure @21 + GStest @22 + GSabout @23 + GSreadFIFO2 @28 + GSirqCallback @29 + GSsetBaseMem @30 + GSwriteCSR @31 + GSchangeSaveState @32 + GSreset @33 + GSgifSoftReset @34 + GSsetFrameSkip @35 + GSsetGameCRC @36 + GSgetLastTag @37 + GSsetupRecording @38 + GSsetSettingsDir @39 diff --git a/plugins/zzogl-pg/opengl/Win32/zerogs.rc b/plugins/zzogl-pg/opengl/Win32/zerogs.rc index bc23026949..6ebcbf1593 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogs.rc +++ b/plugins/zzogl-pg/opengl/Win32/zerogs.rc @@ -1,227 +1,227 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resrc1.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "resource.h" -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_ZEROGSLOGO BITMAP "zerogs.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -IDR_SHADERS RCDATA "ps2hw.dat" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONFIG DIALOGEX 0, 0, 427, 401 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - CONTROL "Interlace Enable (toggle with F5)\n there are 2 modes + interlace off",IDC_CONFIG_INTERLACE, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,7,134,18 - CONTROL "Bilinear Filtering (Shift+F5)\n Best quality is on, turn off for speed.",IDC_CONFIG_BILINEAR, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,31,135,18 - CONTROL "None",IDC_CONFIG_AANONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,19,81,34,11 - CONTROL "2X",IDC_CONFIG_AA2,"Button",BS_AUTORADIOBUTTON,69,81,26,11 - CONTROL "4X",IDC_CONFIG_AA4,"Button",BS_AUTORADIOBUTTON,111,81,28,11 - CONTROL "8X",IDC_CONFIG_AA8,"Button",BS_AUTORADIOBUTTON,65,97,26,11 - CONTROL "16X",IDC_CONFIG_AA16,"Button",BS_AUTORADIOBUTTON,107,97,28,11 - CONTROL "Wireframe rendering (F7)",IDC_CONFIG_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,93,10 - CONTROL "Capture Avi (zerogs.avi) (F12)",IDC_CONFIG_CAPTUREAVI, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,140,109,10 - CONTROL "Save Snapshots as BMPs (default is JPG)",IDC_CONFIG_BMPSS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,161,147,10 - CONTROL "Fullscreen (Alt+Enter)\n to get out press Alt+Enter again",IDC_CONFIG_FULLSCREEN, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,177,146,17 - CONTROL "Wide Screen",IDC_CONFIG_WIDESCREEN, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,194,109,10 - CONTROL "640 x 480",IDC_CONF_WIN640,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,210,59,8 - CONTROL "800 x 600",IDC_CONF_WIN800,"Button",BS_AUTORADIOBUTTON,78,210,59,8 - CONTROL "1024 x 768",IDC_CONF_WIN1024,"Button",BS_AUTORADIOBUTTON,15,223,59,8 - CONTROL "1280 x 960",IDC_CONF_WIN1280,"Button",BS_AUTORADIOBUTTON,78,223,59,8 - DEFPUSHBUTTON "OK",IDOK,7,380,50,14 - PUSHBUTTON "Cancel",IDCANCEL,94,380,50,14 - GROUPBOX "Anti-aliasing for sharper graphics (F6)",IDC_STATIC,7,55,132,61 - GROUPBOX "Default Window Size (no speed impact)",IDC_STATIC,7,201,141,35 - LTEXT "Show Frames Per Second (Shift+F7)",IDC_STATIC,7,244,140,10 - GROUPBOX "Advanced Options",IDC_STATIC,152,7,268,387 - LTEXT "Each option is presented with a unique ID in hex. In order to preserve options across games, go into the game's patch (.pnach) file and type\n zerogs=IDS\nwhere IDS is the OR all of the values in hex for every option you want enabled. ",IDC_STATIC,161,16,252,33 - PUSHBUTTON "Use Defaults (recommended)",IDC_CONF_DEFAULT,159,76,151,14 - CONTROL "Disable alpha testing - 00080000",IDC_CONFOPT_00080000, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,104,119,10 - CONTROL "Disable stencil buffer - 00002000\nusually safe to do for simple scenes. Harvest Moon",IDC_CONFOPT_00002000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,114,118,22 - CONTROL "No target CLUT - 00001000\n(use on RE4, or foggy scenes)",IDC_CONFOPT_00001000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,169,120,24 - CONTROL "Disable depth updates - 00000200",IDC_CONFOPT_00000200, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,161,125,10 - CONTROL "Alpha Fail hack\nFor Sonic Unleashed, Shadow the Hedgehog, Ghost in the Shell. Remove vertical stripes or other coloring artefacts. Break Persona 4 and MGS3",IDC_CONFOPT_00000100, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,190,121,17 - CONTROL "Exact color testing - 00000020\nfixes overbright or shadow/black artifacts (crash n burn)",IDC_CONFOPT_00000020, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,209,119,25 - CONTROL "Tex Target checking - 00000001\nlego racers",IDC_CONFOPT_00000001, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,233,123,22 - CONTROL "Interlace 2X - 00000004\nfixes 2x bigger screen (gradius3)",IDC_CONFOPT_00000004, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,254,119,20 - CONTROL "No depth resolve - 00008000\nmight give z buffer artifacts",IDC_CONFOPT_00008000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,164,121,19 - CONTROL "full 16 bit resolution - 00010000\nuse when half the screen is missing, etc",IDC_CONFOPT_00010000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,185,125,23 - CONTROL "Auto Reset Targs - 00000002\nshadow hearts, samurai warriors (use when game is slow and toggling AA fixes it)",IDC_CONFOPT_00000002, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,212,124,32 - EDITTEXT IDC_CONFOPT_IDS,361,380,48,14,ES_AUTOHSCROLL | ES_READONLY - CONTROL "Resolve Hack #1 - 00000400\nspeeds some games (kingdom hearts)",IDC_CONFOPT_00000400, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,266,135,19 - CONTROL "Resolve Hack #2 - 00000800\nshadow hearts, urbz, destroy FFX",IDC_CONFOPT_00000800, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,276,117,17 - CONTROL "Resolve Hack #3 - 00020000\nneopets",IDC_CONFOPT_00020000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,287,125,17 - CONTROL "Fast Update - 00040000\nspeeds some games (okami). Sonic Unleashed",IDC_CONFOPT_00040000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,297,125,17 - PUSHBUTTON "Compute OR of IDS",IDC_CONFOPT_COMPUTEOR,283,380,73,14 - LTEXT "Important options are listed first. Note, setting option here means that they will be ADDED to whatever options are set in each pnach file.",IDC_STATIC,159,50,252,23 - CONTROL "No target resolves - 00000010\nStops all resolving of targets (try this first for really slow games). Dark Cloud 1",IDC_CONFOPT_00000010, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,104,111,33 - CONTROL "Enable Multiple RTs - 00100000",IDC_CONFOPT_00100000, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,91,119,10 - CONTROL "No color clamping - 00000040\nSpeeds games up but might be too bright or too dim",IDC_CONFOPT_00000040, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,157,137,123,22 - LTEXT "shortcuts: F6 - next, Shift+F6 - prev",IDC_STATIC,19,65,116,11 - CONTROL "No logaripmic-Z - 20000000\n decrease number of Z artefacts",IDC_CONFOPT_20000000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,138,111,28 - CONTROL "Partial Targets - 02000000\nReduces artifacts and speeds up some games (mgs3)",IDC_CONFOPT_02000000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,319,125,24 - CONTROL "Partial Depth - 04000000\nTries to save the depth target as much as possible (mgs3)",IDC_CONFOPT_04000000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,347,125,24 - CONTROL "Specular Highlights - 01000000\nMakes xenosaga and Okage graphics faster by removing highlights",IDC_CONFOPT_01000000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,313,125,25 - CONTROL "Gust fix, made gustgame more clean and fast - 10000000",IDC_CONFOPT_10000000, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,284,366,125,25 - -END - -IDD_ABOUT DIALOGEX 0, 0, 182, 220 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "GSabout" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "OK",IDOK,65,199,50,14 - LTEXT "ZZogl\n\nauthor: Zeydlitz(@gmail.com)\n\n\nthanks to Gabest for SSE optimizations",IDC_STATIC,7,7,160,47 - LTEXT "Static",IDC_ABOUTTEXT,7,65,152,124 -END - -IDD_LOGGING DIALOG 0, 0, 152, 55 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,40,35,50,14 - PUSHBUTTON "Cancel",IDCANCEL,95,35,50,14 - CONTROL "Log",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,15,28,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 420 - TOPMARGIN, 7 - BOTTOMMARGIN, 394 - END - - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 175 - TOPMARGIN, 7 - BOTTOMMARGIN, 213 - END - - IDD_LOGGING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 145 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resrc1.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""resource.h""\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resrc1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "resource.h" +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_ZEROGSLOGO BITMAP "zerogs.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +IDR_SHADERS RCDATA "ps2hw.dat" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONFIG DIALOGEX 0, 0, 427, 401 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL "Interlace Enable (toggle with F5)\n there are 2 modes + interlace off",IDC_CONFIG_INTERLACE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,7,134,18 + CONTROL "Bilinear Filtering (Shift+F5)\n Best quality is on, turn off for speed.",IDC_CONFIG_BILINEAR, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,31,135,18 + CONTROL "None",IDC_CONFIG_AANONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,19,81,34,11 + CONTROL "2X",IDC_CONFIG_AA2,"Button",BS_AUTORADIOBUTTON,69,81,26,11 + CONTROL "4X",IDC_CONFIG_AA4,"Button",BS_AUTORADIOBUTTON,111,81,28,11 + CONTROL "8X",IDC_CONFIG_AA8,"Button",BS_AUTORADIOBUTTON,65,97,26,11 + CONTROL "16X",IDC_CONFIG_AA16,"Button",BS_AUTORADIOBUTTON,107,97,28,11 + CONTROL "Wireframe rendering (F7)",IDC_CONFIG_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,93,10 + CONTROL "Capture Avi (zerogs.avi) (F12)",IDC_CONFIG_CAPTUREAVI, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,140,109,10 + CONTROL "Save Snapshots as BMPs (default is JPG)",IDC_CONFIG_BMPSS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,161,147,10 + CONTROL "Fullscreen (Alt+Enter)\n to get out press Alt+Enter again",IDC_CONFIG_FULLSCREEN, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,177,146,17 + CONTROL "Wide Screen",IDC_CONFIG_WIDESCREEN, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,194,109,10 + CONTROL "640 x 480",IDC_CONF_WIN640,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,210,59,8 + CONTROL "800 x 600",IDC_CONF_WIN800,"Button",BS_AUTORADIOBUTTON,78,210,59,8 + CONTROL "1024 x 768",IDC_CONF_WIN1024,"Button",BS_AUTORADIOBUTTON,15,223,59,8 + CONTROL "1280 x 960",IDC_CONF_WIN1280,"Button",BS_AUTORADIOBUTTON,78,223,59,8 + DEFPUSHBUTTON "OK",IDOK,7,380,50,14 + PUSHBUTTON "Cancel",IDCANCEL,94,380,50,14 + GROUPBOX "Anti-aliasing for sharper graphics (F6)",IDC_STATIC,7,55,132,61 + GROUPBOX "Default Window Size (no speed impact)",IDC_STATIC,7,201,141,35 + LTEXT "Show Frames Per Second (Shift+F7)",IDC_STATIC,7,244,140,10 + GROUPBOX "Advanced Options",IDC_STATIC,152,7,268,387 + LTEXT "Each option is presented with a unique ID in hex. In order to preserve options across games, go into the game's patch (.pnach) file and type\n zerogs=IDS\nwhere IDS is the OR all of the values in hex for every option you want enabled. ",IDC_STATIC,161,16,252,33 + PUSHBUTTON "Use Defaults (recommended)",IDC_CONF_DEFAULT,159,76,151,14 + CONTROL "Disable alpha testing - 00080000",IDC_CONFOPT_00080000, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,104,119,10 + CONTROL "Disable stencil buffer - 00002000\nusually safe to do for simple scenes. Harvest Moon",IDC_CONFOPT_00002000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,114,118,22 + CONTROL "No target CLUT - 00001000\n(use on RE4, or foggy scenes)",IDC_CONFOPT_00001000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,169,120,24 + CONTROL "Disable depth updates - 00000200",IDC_CONFOPT_00000200, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,161,125,10 + CONTROL "Alpha Fail hack\nFor Sonic Unleashed, Shadow the Hedgehog, Ghost in the Shell. Remove vertical stripes or other coloring artefacts. Break Persona 4 and MGS3",IDC_CONFOPT_00000100, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,190,121,17 + CONTROL "Exact color testing - 00000020\nfixes overbright or shadow/black artifacts (crash n burn)",IDC_CONFOPT_00000020, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,209,119,25 + CONTROL "Tex Target checking - 00000001\nlego racers",IDC_CONFOPT_00000001, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,233,123,22 + CONTROL "Interlace 2X - 00000004\nfixes 2x bigger screen (gradius3)",IDC_CONFOPT_00000004, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,254,119,20 + CONTROL "No depth resolve - 00008000\nmight give z buffer artifacts",IDC_CONFOPT_00008000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,164,121,19 + CONTROL "full 16 bit resolution - 00010000\nuse when half the screen is missing, etc",IDC_CONFOPT_00010000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,185,125,23 + CONTROL "Auto Reset Targs - 00000002\nshadow hearts, samurai warriors (use when game is slow and toggling AA fixes it)",IDC_CONFOPT_00000002, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,212,124,32 + EDITTEXT IDC_CONFOPT_IDS,361,380,48,14,ES_AUTOHSCROLL | ES_READONLY + CONTROL "Resolve Hack #1 - 00000400\nspeeds some games (kingdom hearts)",IDC_CONFOPT_00000400, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,266,135,19 + CONTROL "Resolve Hack #2 - 00000800\nshadow hearts, urbz, destroy FFX",IDC_CONFOPT_00000800, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,276,117,17 + CONTROL "Resolve Hack #3 - 00020000\nneopets",IDC_CONFOPT_00020000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,287,125,17 + CONTROL "Fast Update - 00040000\nspeeds some games (okami). Sonic Unleashed",IDC_CONFOPT_00040000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,297,125,17 + PUSHBUTTON "Compute OR of IDS",IDC_CONFOPT_COMPUTEOR,283,380,73,14 + LTEXT "Important options are listed first. Note, setting option here means that they will be ADDED to whatever options are set in each pnach file.",IDC_STATIC,159,50,252,23 + CONTROL "No target resolves - 00000010\nStops all resolving of targets (try this first for really slow games). Dark Cloud 1",IDC_CONFOPT_00000010, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,104,111,33 + CONTROL "Enable Multiple RTs - 00100000",IDC_CONFOPT_00100000, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,91,119,10 + CONTROL "No color clamping - 00000040\nSpeeds games up but might be too bright or too dim",IDC_CONFOPT_00000040, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,157,137,123,22 + LTEXT "shortcuts: F6 - next, Shift+F6 - prev",IDC_STATIC,19,65,116,11 + CONTROL "No logaripmic-Z - 20000000\n decrease number of Z artefacts",IDC_CONFOPT_20000000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,138,111,28 + CONTROL "Partial Targets - 02000000\nReduces artifacts and speeds up some games (mgs3)",IDC_CONFOPT_02000000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,319,125,24 + CONTROL "Partial Depth - 04000000\nTries to save the depth target as much as possible (mgs3)",IDC_CONFOPT_04000000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,347,125,24 + CONTROL "Specular Highlights - 01000000\nMakes xenosaga and Okage graphics faster by removing highlights",IDC_CONFOPT_01000000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,313,125,25 + CONTROL "Gust fix, made gustgame more clean and fast - 10000000",IDC_CONFOPT_10000000, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,284,366,125,25 + +END + +IDD_ABOUT DIALOGEX 0, 0, 182, 220 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "GSabout" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,65,199,50,14 + LTEXT "ZZogl\n\nauthor: Zeydlitz(@gmail.com)\n\n\nthanks to Gabest for SSE optimizations",IDC_STATIC,7,7,160,47 + LTEXT "Static",IDC_ABOUTTEXT,7,65,152,124 +END + +IDD_LOGGING DIALOG 0, 0, 152, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,40,35,50,14 + PUSHBUTTON "Cancel",IDCANCEL,95,35,50,14 + CONTROL "Log",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,15,28,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 7 + BOTTOMMARGIN, 394 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 213 + END + + IDD_LOGGING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 145 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resrc1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""resource.h""\r\n" + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.sln b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.sln index 74eb1458c4..3e19461acb 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.sln +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.sln @@ -1,42 +1,42 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZZOgl", "zerogsogl_2008.vcproj", "{2D4E85B2-F47F-4D65-B091-701E5C031DAC}" - ProjectSection(ProjectDependencies) = postProject - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "..\..\..\..\common\build\Utilities\utilities.vcproj", "{4639972E-424E-4E13-8B07-CA403C481346}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\..\3rdparty\zlib\zlib.vcproj", "{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Devel|Win32 = Devel|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Debug|Win32.ActiveCfg = Debug|Win32 - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Debug|Win32.Build.0 = Debug|Win32 - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Devel|Win32.ActiveCfg = Devel|Win32 - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Devel|Win32.Build.0 = Devel|Win32 - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Release|Win32.ActiveCfg = Release|Win32 - {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Release|Win32.Build.0 = Release|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.ActiveCfg = Debug|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.Build.0 = Debug|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Devel|Win32.ActiveCfg = Devel|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Devel|Win32.Build.0 = Devel|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Release|Win32.ActiveCfg = Release|Win32 - {4639972E-424E-4E13-8B07-CA403C481346}.Release|Win32.Build.0 = Release|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.ActiveCfg = Debug|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.Build.0 = Debug|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.ActiveCfg = Devel|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.Build.0 = Devel|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.ActiveCfg = Release|Win32 - {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZZOgl", "zerogsogl_2008.vcproj", "{2D4E85B2-F47F-4D65-B091-701E5C031DAC}" + ProjectSection(ProjectDependencies) = postProject + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "..\..\..\..\common\build\Utilities\utilities.vcproj", "{4639972E-424E-4E13-8B07-CA403C481346}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\..\3rdparty\zlib\zlib.vcproj", "{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Devel|Win32 = Devel|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Debug|Win32.Build.0 = Debug|Win32 + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Devel|Win32.ActiveCfg = Devel|Win32 + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Devel|Win32.Build.0 = Devel|Win32 + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Release|Win32.ActiveCfg = Release|Win32 + {2D4E85B2-F47F-4D65-B091-701E5C031DAC}.Release|Win32.Build.0 = Release|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.ActiveCfg = Debug|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.Build.0 = Debug|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Devel|Win32.ActiveCfg = Devel|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Devel|Win32.Build.0 = Devel|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Release|Win32.ActiveCfg = Release|Win32 + {4639972E-424E-4E13-8B07-CA403C481346}.Release|Win32.Build.0 = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.ActiveCfg = Debug|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.Build.0 = Debug|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.ActiveCfg = Devel|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.Build.0 = Devel|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.ActiveCfg = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj index cc1a7f9b30..a0867d17f8 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj @@ -1,489 +1,489 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/zzogl-pg/opengl/common/PS2Edefs.h b/plugins/zzogl-pg/opengl/common/PS2Edefs.h deleted file mode 100644 index dbd2f1fcff..0000000000 --- a/plugins/zzogl-pg/opengl/common/PS2Edefs.h +++ /dev/null @@ -1,876 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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 __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/zzogl-pg/opengl/common/PS2Etypes.h b/plugins/zzogl-pg/opengl/common/PS2Etypes.h deleted file mode 100644 index 258deaaded..0000000000 --- a/plugins/zzogl-pg/opengl/common/PS2Etypes.h +++ /dev/null @@ -1,234 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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 __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -// Renamed ARRAYSIZE to ArraySize -- looks nice and gets rid of Windows.h conflicts (air) -#ifndef ArraySize -#define ArraySize(x) (sizeof(x)/sizeof((x)[0])) -#endif - -////////////////////////////////////////////////////////////////////////////////////////// -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - -////////////////////////////////////////////////////////////////////////////////////////// -// Basic Atomic Types - -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -// Note: building the 'extern' into PCSX2_ALIGNED16_DECL fixes Visual Assist X's intellisense. - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED_EXTERN(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_EXTERN(x) extern __declspec(align(16)) x - -#define __naked __declspec(naked) -#define CALLBACK __stdcall - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier -#define CALLBACK // CALLBACK is win32-specific mess - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -// fixme - is this needed for recent versions of GCC? Or can we just use the macros -// above instead for both definitions (implementations) and declarations (includes)? -- air - -#define PCSX2_ALIGNED_EXTERN(alig,x) extern x -#define PCSX2_ALIGNED16_EXTERN(x) extern x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -////////////////////////////////////////////////////////////////////////////////////////// -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/zzogl-pg/opengl/targets.cpp b/plugins/zzogl-pg/opengl/targets.cpp index 7f99618a05..b4f738c49e 100644 --- a/plugins/zzogl-pg/opengl/targets.cpp +++ b/plugins/zzogl-pg/opengl/targets.cpp @@ -289,7 +289,7 @@ void ZeroGS::CRenderTarget::Resolve() GL_REPORT_ERRORD(); -#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) +#if defined(DEVBUILD) if( g_bSaveResolved ) { SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, RW(fbw), RH(fbh)); g_bSaveResolved = 0; @@ -311,7 +311,7 @@ void ZeroGS::CRenderTarget::Resolve(int startrange, int endrange) // flush if necessary FlushIfNecesary ( this ) ; -#if !defined(RELEASE_TO_PUBLIC) && defined(_DEBUG) +#if defined(DEVBUILD) if( g_bSaveResolved ) { SaveTexture("resolved.tga", GL_TEXTURE_RECTANGLE_NV, ptex, RW(fbw), RH(fbh)); g_bSaveResolved = 0; @@ -1981,10 +1981,10 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info u16* dst = (u16*)ptexdata; u16* src = (u16*)(g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy); -#if defined(ZEROGS_SSE2) +#if defined(ZEROGS_SSE2) if ( ((u32)(uptr)dst)%16 != 0 ) { // This is not unusual situation, when vector does not 16bit alignment, that is destructive for SSE2 - // instruction movdqa [%eax], xmm0 + // instruction movdqa [%eax], xmm0 // The idea would be resise vector to 15 elements, that set ptxedata to aligned position. // Later we would move eax by 16, so only we should verify is first element align // FIXME. As I see, texdata used only once here, it does not have any impact on other code. diff --git a/plugins/zzogl-pg/opengl/x86.h b/plugins/zzogl-pg/opengl/x86.h index d06e15ff5d..4fb6c4ee74 100644 --- a/plugins/zzogl-pg/opengl/x86.h +++ b/plugins/zzogl-pg/opengl/x86.h @@ -1,172 +1,172 @@ -/* ZeroGS KOSMOS - * Copyright (C) 2005-2006 Gabest/zerofrog@gmail.com - * http://www.gabest.org - * - * 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, 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#ifndef ZEROGS_X86 -#define ZEROGS_X86 - -#include "GS.h" - -extern "C" void __fastcall SwizzleBlock32_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern "C" void __fastcall SwizzleBlock16_sse2(u8* dst, u8* src, int srcpitch); -extern "C" void __fastcall SwizzleBlock8_sse2(u8* dst, u8* src, int srcpitch); -extern "C" void __fastcall SwizzleBlock4_sse2(u8* dst, u8* src, int srcpitch); -extern "C" void __fastcall SwizzleBlock32u_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern "C" void __fastcall SwizzleBlock16u_sse2(u8* dst, u8* src, int srcpitch); -extern "C" void __fastcall SwizzleBlock8u_sse2(u8* dst, u8* src, int srcpitch); -extern "C" void __fastcall SwizzleBlock4u_sse2(u8* dst, u8* src, int srcpitch); - -// frame swizzling - -// no AA -extern "C" void __fastcall FrameSwizzleBlock32_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall FrameSwizzleBlock16_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32Z_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16Z_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -// AA 2x -extern "C" void __fastcall FrameSwizzleBlock32A2_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall FrameSwizzleBlock16A2_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32A2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32ZA2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16A2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16ZA2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -// AA 4x -extern "C" void __fastcall FrameSwizzleBlock32A4_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall FrameSwizzleBlock16A4_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32A4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock32ZA4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16A4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern "C" void __fastcall Frame16SwizzleBlock16ZA4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -/*extern void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch); -extern void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch); -extern void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch);*/ - -// no AA -extern void __fastcall FrameSwizzleBlock32_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock24_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock16_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32Z_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16Z_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -// AA 2x -extern void __fastcall FrameSwizzleBlock32A2_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock24A2_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock16A2_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32A2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32ZA2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16A2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16ZA2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -// AA 4x -extern void __fastcall FrameSwizzleBlock32A4_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock24A4_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall FrameSwizzleBlock16A4_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32A4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock32ZA4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16A4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall Frame16SwizzleBlock16ZA4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); - -extern void __fastcall SwizzleColumn32_c(int y, u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); -extern void __fastcall SwizzleColumn16_c(int y, u8* dst, u8* src, int srcpitch); -extern void __fastcall SwizzleColumn8_c(int y, u8* dst, u8* src, int srcpitch); -extern void __fastcall SwizzleColumn4_c(int y, u8* dst, u8* src, int srcpitch); - -extern "C" void __fastcall WriteCLUT_T16_I8_CSM1_sse2(u32* vm, u32* clut); -extern "C" void __fastcall WriteCLUT_T32_I8_CSM1_sse2(u32* vm, u32* clut); -extern "C" void __fastcall WriteCLUT_T16_I4_CSM1_sse2(u32* vm, u32* clut); -extern "C" void __fastcall WriteCLUT_T32_I4_CSM1_sse2(u32* vm, u32* clut); -extern void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* vm, u32* clut); -extern void __fastcall WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut); - -extern void __fastcall WriteCLUT_T16_I4_CSM1_c(u32* vm, u32* clut); -extern void __fastcall WriteCLUT_T32_I4_CSM1_c(u32* vm, u32* clut); - -extern void SSE2_UnswizzleZ16Target( u16* dst, u16* src, int iters ); - -#ifdef ZEROGS_SSE2 - -#define FrameSwizzleBlock32 FrameSwizzleBlock32_c -#define FrameSwizzleBlock24 FrameSwizzleBlock24_c -#define FrameSwizzleBlock16 FrameSwizzleBlock16_c -#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c -#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c -#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c -#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c - -#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c -#define FrameSwizzleBlock24A2 FrameSwizzleBlock24A2_c -#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c -#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c -#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c -#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c -#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c - -#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c -#define FrameSwizzleBlock24A4 FrameSwizzleBlock24A4_c -#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c -#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c -#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c -#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c -#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c - -#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_sse2 -#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_sse2 -#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_sse2 -#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_sse2 - -#else - -#define FrameSwizzleBlock32 FrameSwizzleBlock32_c -#define FrameSwizzleBlock16 FrameSwizzleBlock16_c -#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c -#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c -#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c -#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c - -#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c -#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c -#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c -#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c -#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c -#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c - -#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c -#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c -#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c -#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c -#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c -#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c - -#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_c -#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_c -#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_c -#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_c - -#endif - -#endif +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 Gabest/zerofrog@gmail.com + * http://www.gabest.org + * + * 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, 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 GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#ifndef ZEROGS_X86 +#define ZEROGS_X86 + +#include "GS.h" + +extern "C" void __fastcall SwizzleBlock32_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern "C" void __fastcall SwizzleBlock16_sse2(u8* dst, u8* src, int srcpitch); +extern "C" void __fastcall SwizzleBlock8_sse2(u8* dst, u8* src, int srcpitch); +extern "C" void __fastcall SwizzleBlock4_sse2(u8* dst, u8* src, int srcpitch); +extern "C" void __fastcall SwizzleBlock32u_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern "C" void __fastcall SwizzleBlock16u_sse2(u8* dst, u8* src, int srcpitch); +extern "C" void __fastcall SwizzleBlock8u_sse2(u8* dst, u8* src, int srcpitch); +extern "C" void __fastcall SwizzleBlock4u_sse2(u8* dst, u8* src, int srcpitch); + +// frame swizzling + +// no AA +extern "C" void __fastcall FrameSwizzleBlock32_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall FrameSwizzleBlock16_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32Z_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16Z_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +// AA 2x +extern "C" void __fastcall FrameSwizzleBlock32A2_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall FrameSwizzleBlock16A2_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32A2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32ZA2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16A2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16ZA2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +// AA 4x +extern "C" void __fastcall FrameSwizzleBlock32A4_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall FrameSwizzleBlock16A4_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32A4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock32ZA4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16A4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern "C" void __fastcall Frame16SwizzleBlock16ZA4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +/*extern void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch); +extern void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch); +extern void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch);*/ + +// no AA +extern void __fastcall FrameSwizzleBlock32_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock24_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock16_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32Z_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16Z_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +// AA 2x +extern void __fastcall FrameSwizzleBlock32A2_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock24A2_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock16A2_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32A2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32ZA2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16A2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16ZA2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +// AA 4x +extern void __fastcall FrameSwizzleBlock32A4_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock24A4_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall FrameSwizzleBlock16A4_c(u16* dst, u32* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32A4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock32ZA4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16A4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); +extern void __fastcall Frame16SwizzleBlock16ZA4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); + +extern void __fastcall SwizzleColumn32_c(int y, u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern void __fastcall SwizzleColumn16_c(int y, u8* dst, u8* src, int srcpitch); +extern void __fastcall SwizzleColumn8_c(int y, u8* dst, u8* src, int srcpitch); +extern void __fastcall SwizzleColumn4_c(int y, u8* dst, u8* src, int srcpitch); + +extern "C" void __fastcall WriteCLUT_T16_I8_CSM1_sse2(u32* vm, u32* clut); +extern "C" void __fastcall WriteCLUT_T32_I8_CSM1_sse2(u32* vm, u32* clut); +extern "C" void __fastcall WriteCLUT_T16_I4_CSM1_sse2(u32* vm, u32* clut); +extern "C" void __fastcall WriteCLUT_T32_I4_CSM1_sse2(u32* vm, u32* clut); +extern void __fastcall WriteCLUT_T16_I8_CSM1_c(u32* vm, u32* clut); +extern void __fastcall WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut); + +extern void __fastcall WriteCLUT_T16_I4_CSM1_c(u32* vm, u32* clut); +extern void __fastcall WriteCLUT_T32_I4_CSM1_c(u32* vm, u32* clut); + +extern void SSE2_UnswizzleZ16Target( u16* dst, u16* src, int iters ); + +#ifdef ZEROGS_SSE2 + +#define FrameSwizzleBlock32 FrameSwizzleBlock32_c +#define FrameSwizzleBlock24 FrameSwizzleBlock24_c +#define FrameSwizzleBlock16 FrameSwizzleBlock16_c +#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c +#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c +#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c +#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c + +#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c +#define FrameSwizzleBlock24A2 FrameSwizzleBlock24A2_c +#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c +#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c +#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c +#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c +#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c + +#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c +#define FrameSwizzleBlock24A4 FrameSwizzleBlock24A4_c +#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c +#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c +#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c +#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c +#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c + +#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_sse2 +#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_sse2 +#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_sse2 +#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_sse2 + +#else + +#define FrameSwizzleBlock32 FrameSwizzleBlock32_c +#define FrameSwizzleBlock16 FrameSwizzleBlock16_c +#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c +#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c +#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c +#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c + +#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c +#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c +#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c +#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c +#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c +#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c + +#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c +#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c +#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c +#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c +#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c +#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c + +#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_c +#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_c +#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_c +#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_c + +#endif + +#endif