zzogl-pg: Misc things that caught my eye.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2781 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-03-27 01:01:31 +00:00
parent 1d93365724
commit 6712765616
5 changed files with 88 additions and 103 deletions

View File

@ -36,7 +36,6 @@ extern HWND GShwnd;
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/extensions/xf86vmode.h> #include <X11/extensions/xf86vmode.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
//#include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -120,22 +119,14 @@ struct RECT
int right, bottom; int right, bottom;
}; };
/*typedef struct {
Display *dpy;
int screen;
Window win;
GLXContext ctx;
XSetWindowAttributes attr;
Bool fs;
Bool doubleBuffered;
XF86VidModeModeInfo deskMode;
int x, y;
unsigned int width, height;
unsigned int depth;
} GLWindow;*/
#define GL_X11_WINDOW #define GL_X11_WINDOW
#else
#define GL_WIN32_WINDOW
#endif // linux basic definitions
class GLWindow class GLWindow
{ {
private: private:
@ -163,31 +154,6 @@ class GLWindow
extern GLWindow GLWin; extern GLWindow GLWin;
#else
#define GL_WIN32_WINDOW
class GLWindow
{
private:
bool fullScreen, doubleBuffered;
s32 x, y;
u32 width, height, depth;
public:
void SwapGLBuffers();
void SetTitle(char *strtitle);
bool CreateGLWindow(void *pDisplay);
bool ReleaseWindow();
void CloseWindow();
bool DisplayWindow(int _width, int _height);
void ResizeCheck();
};
extern GLWindow GLWin;
#endif // linux basic definitions
struct Vector_16F struct Vector_16F
{ {
u16 x, y, z, w; u16 x, y, z, w;
@ -856,19 +822,19 @@ extern GSinternal gs;
extern FILE *gsLog; extern FILE *gsLog;
void __Log(const char *fmt, ...); extern void __Log(const char *fmt, ...);
void __LogToConsole(const char *fmt, ...); extern void __LogToConsole(const char *fmt, ...);
void LoadConfig(); extern void LoadConfig();
void SaveConfig(); extern void SaveConfig();
extern void (*GSirq)(); extern void (*GSirq)();
void *SysLoadLibrary(char *lib); // Loads Library extern void *SysLoadLibrary(char *lib); // Loads Library
void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library extern void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
char *SysLibError(); // Gets previous error loading sysbols extern char *SysLibError(); // Gets previous error loading sysbols
void SysCloseLibrary(void *lib); // Closes Library extern void SysCloseLibrary(void *lib); // Closes Library
void SysMessage(const char *fmt, ...); extern void SysMessage(const char *fmt, ...);
#ifdef __LINUX__ #ifdef __LINUX__
#include "Utilities/MemcpyFast.h" #include "Utilities/MemcpyFast.h"
@ -911,17 +877,21 @@ private:
T* ptr; T* ptr;
}; };
#define RGBA32to16(c) \ static __forceinline u16 RGBA32to16(u32 c)
(u16)((((c) & 0x000000f8) >> 3) | \ {
(((c) & 0x0000f800) >> 6) | \ return (u16)((((c) & 0x000000f8) >> 3) |
(((c) & 0x00f80000) >> 9) | \ (((c) & 0x0000f800) >> 6) |
(((c) & 0x80000000) >> 16)) \ (((c) & 0x00f80000) >> 9) |
(((c) & 0x80000000) >> 16));
}
#define RGBA16to32(c) \ static __forceinline u32 RGBA16to32(u16 c)
(((c) & 0x001f) << 3) | \ {
(((c) & 0x03e0) << 6) | \ return (((c) & 0x001f) << 3) |
(((c) & 0x7c00) << 9) | \ (((c) & 0x03e0) << 6) |
(((c) & 0x8000) ? 0xff000000 : 0) \ (((c) & 0x7c00) << 9) |
(((c) & 0x8000) ? 0xff000000 : 0);
}
// converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits) // converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits)
// f is a u16 // f is a u16

View File

@ -476,6 +476,7 @@ GameHack HackinshTable[HACK_NUMBER] = {
{"***25 partial pointers", GAME_PARTIALPOINTERS}, {"***25 partial pointers", GAME_PARTIALPOINTERS},
{"***26 partial depth", GAME_PARTIALDEPTH}, {"***26 partial depth", GAME_PARTIALDEPTH},
{"***27 reget hack", GAME_REGETHACK}, {"***27 reget hack", GAME_REGETHACK},
{"***28 gust hack", GAME_GUSTHACK}, {"***28 gust hack", GAME_GUSTHACK},
{"***29 log-Z", GAME_NOLOGZ} {"***29 log-Z", GAME_NOLOGZ}
}; };

View File

@ -92,8 +92,10 @@ void CALLBACK GSgetLastTag(u64* ptag)
nPath3Hack = 0; nPath3Hack = 0;
} }
#ifdef _WIN32
// for debug assertion checks (thread affinity checks) // for debug assertion checks (thread affinity checks)
extern HANDLE g_hCurrentThread; extern HANDLE g_hCurrentThread;
#endif
void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size) void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
{ {

View File

@ -81,6 +81,7 @@ u32 results[65535] = {0,};
inline bool NoHighlights(int i) { inline bool NoHighlights(int i) {
// This is hack-code, I still in search of correct reason, why some triangles should not be drawn. // This is hack-code, I still in search of correct reason, why some triangles should not be drawn.
// I'd have thought we could just test prim->_val and ZeroGS::vb[i].zbuf.psm directly...
int resultA = prim->iip + ((prim->tme) << 1) + ((prim->fge) << 2) + ((prim->abe) << 3) + ((prim->aa1) << 4) + ((prim->fst) << 5) + ((prim->ctxt) << 6) + ((prim->fix)<< 7) + int resultA = prim->iip + ((prim->tme) << 1) + ((prim->fge) << 2) + ((prim->abe) << 3) + ((prim->aa1) << 4) + ((prim->fst) << 5) + ((prim->ctxt) << 6) + ((prim->fix)<< 7) +
((ZeroGS::vb[i].zbuf.psm ) << 8); ((ZeroGS::vb[i].zbuf.psm ) << 8);
// if ( results[resultA] == 0 ) { // if ( results[resultA] == 0 ) {
@ -90,6 +91,7 @@ inline bool NoHighlights(int i) {
// if (resultA == 0xb && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF // if (resultA == 0xb && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
const pixTest curtest = ZeroGS::vb[i].test; const pixTest curtest = ZeroGS::vb[i].test;
// Again, couldn't we just test curtest._val?
int result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9); int result = curtest.ate + ((curtest.atst) << 1) +((curtest.afail) << 4) + ((curtest.date) << 6) + ((curtest.datm) << 7) + ((curtest.zte) << 8) + ((curtest.ztst)<< 9);
// if (resultA == 0xb) // if (resultA == 0xb)
// if ( results[result] == 0) { // if ( results[result] == 0) {
@ -99,9 +101,15 @@ inline bool NoHighlights(int i) {
// 0, -50b, -500, !-300, -30a, -50a, -5cb, +100 (zte==1), -50d // 0, -50b, -500, !-300, -30a, -50a, -5cb, +100 (zte==1), -50d
// if (result == 0x50b && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF // if (result == 0x50b && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
// if psm is 16S or 24, tme, abe, & fst are true, the rest are false, result is 0x302 or 0x700, and there is a mask.
if ((resultA == 0x3a2a || resultA == 0x312a) && (result == 0x302 || result == 0x700) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Silent Hill:SM and Front Mission 5, result != 0x300 if ((resultA == 0x3a2a || resultA == 0x312a) && (result == 0x302 || result == 0x700) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Silent Hill:SM and Front Mission 5, result != 0x300
// if psm is 24, abe is true, tme doesn't matter, the rest are false, result is 0x54c or 0x50c and there is a mask.
if (((resultA == 0x3100) || (resultA == 0x3108)) && ((result == 0x54c) || (result == 0x50c)) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Okage if (((resultA == 0x3100) || (resultA == 0x3108)) && ((result == 0x54c) || (result == 0x50c)) && (ZeroGS::vb[i].zbuf.zmsk)) return false; // Okage
// if psm is 24, abe & tme are true, the rest are false, and no result.
if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories if ((resultA == 0x310a) && (result == 0x0)) return false; // Radiata Stories
// if psm is 16S, tme, abe, fst, and ctxt are true, the rest are false, result is 0x330 or 0x500, and there is a mask.
if (resultA == 0x3a6a && (result == 0x300 || result == 0x500)&& ZeroGS::vb[i].zbuf.zmsk) return false; // Okami, result != 0x30d if (resultA == 0x3a6a && (result == 0x300 || result == 0x500)&& ZeroGS::vb[i].zbuf.zmsk) return false; // Okami, result != 0x30d
// if ((resultA == 0x300b) && (result == 0x300) && ZeroGS::vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood // if ((resultA == 0x300b) && (result == 0x300) && ZeroGS::vb[i].zbuf.zmsk) return false; // ATF, but no Melty Blood
@ -228,7 +236,8 @@ void tex0Write(int i, u32 *data)
FUNCLOG FUNCLOG
u32 psm = ZZOglGet_psm_TexBitsFix(data[0]); u32 psm = ZZOglGet_psm_TexBitsFix(data[0]);
if( m_Blocks[psm].bpp == 0 ) { if ( m_Blocks[psm].bpp == 0 )
{
// kh and others // kh and others
return; return;
} }
@ -238,13 +247,16 @@ void tex0Write(int i, u32 *data)
ZeroGS::vb[i].bNeedTexCheck = 1; ZeroGS::vb[i].bNeedTexCheck = 1;
// don't update unless necessary // don't update unless necessary
if( PSMT_ISCLUT(psm) ) { if (PSMT_ISCLUT(psm))
if( ZeroGS::CheckChangeInClut(data[1], psm) ) { {
if (ZeroGS::CheckChangeInClut(data[1], psm))
{
// loading clut, so flush whole texture // loading clut, so flush whole texture
ZeroGS::vb[i].FlushTexData(); ZeroGS::vb[i].FlushTexData();
} }
// check if csa is the same!! (ffx bisaid island, grass) // check if csa is the same!! (ffx bisaid island, grass)
else if( (data[1]&0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1]&0x1f780000) ) { else if ((data[1] & 0x1f780000) != (ZeroGS::vb[i].uCurTex0Data[1] & 0x1f780000))
{
ZeroGS::Flush(i); // flush any previous entries ZeroGS::Flush(i); // flush any previous entries
} }
} }
@ -296,8 +308,11 @@ __forceinline void frameWrite(int i, u32 *data) {
FUNCLOG FUNCLOG
frameInfo& gsfb = ZeroGS::vb[i].gsfb; frameInfo& gsfb = ZeroGS::vb[i].gsfb;
if((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) && (gsfb.fbw == ZZOglGet_fbw_FrameBitsMult(data[0])) && if ((gsfb.fbp == ZZOglGet_fbp_FrameBitsMult(data[0])) &&
(gsfb.psm == ZZOglGet_psm_FrameBits(data[0])) && (gsfb.fbm == ZZOglGet_fbm_FrameBits(data[0])) ) { (gsfb.fbw == ZZOglGet_fbw_FrameBitsMult(data[0])) &&
(gsfb.psm == ZZOglGet_psm_FrameBits(data[0])) &&
(gsfb.fbm == ZZOglGet_fbm_FrameBits(data[0])) )
{
return; return;
} }

View File

@ -195,14 +195,8 @@ inline const char *error_name(int err) {
return "GL_OUT_OF_MEMORY"; return "GL_OUT_OF_MEMORY";
case GL_TABLE_TOO_LARGE: case GL_TABLE_TOO_LARGE:
return "GL_TABLE_TOO_LARGE"; return "GL_TABLE_TOO_LARGE";
default: { default:
return "Unknown GL error"; return "Unknown GL error";
// ... ok, who wrote this code? You should be slapped, fool! str is an uninitialized pointer! -- air.
//char *str;
//sprintf(str, "Unknown error(0x%x)", err);
//return str;
}
} }
} }
@ -434,37 +428,40 @@ extern int s_aviinit;
extern int s_avicapturing; extern int s_avicapturing;
// don't change these values! // don't change these values!
#define GAME_TEXTURETARGS 0x01 enum GAME_HACK_OPTIONS
#define GAME_AUTORESET 0x02 {
#define GAME_INTERLACE2X 0x04 GAME_TEXTURETARGS = 0x00000001,
#define GAME_TEXAHACK 0x08 // apply texa to non textured polys GAME_AUTORESET = 0x00000002,
#define GAME_NOTARGETRESOLVE 0x10 GAME_INTERLACE2X = 0x00000004,
#define GAME_EXACTCOLOR 0x20 GAME_TEXAHACK = 0x00000008, // apply texa to non textured polys
#define GAME_NOCOLORCLAMP 0x40 GAME_NOTARGETRESOLVE = 0x00000010,
#define GAME_FFXHACK 0x80 GAME_EXACTCOLOR = 0x00000020,
#define GAME_NOALPHAFAIL 0x0100 GAME_NOCOLORCLAMP = 0x00000040,
#define GAME_NODEPTHUPDATE 0x0200 GAME_FFXHACK = 0x00000080,
#define GAME_QUICKRESOLVE1 0x0400 GAME_NOALPHAFAIL = 0x00000100,
#define GAME_NOQUICKRESOLVE 0x0800 GAME_NODEPTHUPDATE = 0x00000200,
#define GAME_NOTARGETCLUT 0x1000 // full 16 bit resolution GAME_QUICKRESOLVE1 = 0x00000400,
#define GAME_NOSTENCIL 0x2000 GAME_NOQUICKRESOLVE = 0x00000800,
#define GAME_VSSHACKOFF 0x4000 // vertical stripe syndrome GAME_NOTARGETCLUT = 0x00001000, // full 16 bit resolution
#define GAME_NODEPTHRESOLVE 0x8000 GAME_NOSTENCIL = 0x00002000,
#define GAME_FULL16BITRES 0x00010000 GAME_VSSHACKOFF = 0x00004000, // vertical stripe syndrome
#define GAME_RESOLVEPROMOTED 0x00020000 GAME_NODEPTHRESOLVE = 0x00008000,
#define GAME_FASTUPDATE 0x00040000 GAME_FULL16BITRES = 0x00010000,
#define GAME_NOALPHATEST 0x00080000 GAME_RESOLVEPROMOTED = 0x00020000,
#define GAME_DISABLEMRTDEPTH 0x00100000 GAME_FASTUPDATE = 0x00040000,
#define GAME_32BITTARGS 0x00200000 GAME_NOALPHATEST = 0x00080000,
#define GAME_PATH3HACK 0x00400000 GAME_DISABLEMRTDEPTH = 0x00100000,
#define GAME_DOPARALLELCTX 0x00800000 // tries to parallelize both contexts so that render calls are reduced (xenosaga) GAME_32BITTARGS = 0x00200000,
// makes the game faster, but can be buggy GAME_PATH3HACK = 0x00400000,
#define GAME_XENOSPECHACK 0x01000000 // xenosaga specularity hack (ignore any zmask=1 draws) GAME_DOPARALLELCTX = 0x00800000, // tries to parallelize both contexts so that render calls are reduced (xenosaga)
#define GAME_PARTIALPOINTERS 0x02000000 // whenver the texture or render target are small, tries to look for bigger ones to read from // makes the game faster, but can be buggy
#define GAME_PARTIALDEPTH 0x04000000 // tries to save depth targets as much as possible across height changes GAME_XENOSPECHACK = 0x01000000, // xenosaga specularity hack (ignore any zmask=1 draws)
#define GAME_REGETHACK 0x08000000 // some sort of weirdness in ReGet() code GAME_PARTIALPOINTERS = 0x02000000, // whenver the texture or render target are small, tries to look for bigger ones to read from
#define GAME_GUSTHACK 0x10000000 // Needed for Gustgames fast update. GAME_PARTIALDEPTH = 0x04000000, // tries to save depth targets as much as possible across height changes
#define GAME_NOLOGZ 0x20000000 // Intended for linux -- not logaripmic Z. GAME_REGETHACK = 0x08000000, // some sort of weirdness in ReGet() code
GAME_GUSTHACK = 0x10000000, // Needed for Gustgames fast update.
GAME_NOLOGZ = 0x20000000 // Intended for linux -- not logarithmic Z.
};
#define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST)) #define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST))