GregMiscellaneous: Various clean

git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3665 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-08-18 14:04:10 +00:00
parent e7b0d43544
commit 1c1eef8bde
4 changed files with 55 additions and 58 deletions

View File

@ -260,6 +260,7 @@ static const Game_Info crc_game_list[] =
{0x6F8545DB, ICO, US, 0, -1, -1}, {0x6F8545DB, ICO, US, 0, -1, -1},
{0xB01A4C95, ICO, JP, 0, -1, -1}, {0xB01A4C95, ICO, JP, 0, -1, -1},
{0x5C991F4E, ICO, Unknown_Region, 0, -1, -1}, {0x5C991F4E, ICO, Unknown_Region, 0, -1, -1},
// FIXME multiple CRC
{0x7ACF7E03, ICO, Unknown_Region, 0, -1, -1}, {0x7ACF7E03, ICO, Unknown_Region, 0, -1, -1},
{0xAEAD1CA3, GT4, JP, 0, -1, -1}, {0xAEAD1CA3, GT4, JP, 0, -1, -1},
{0x44A61C8F, GT4, Unknown_Region, 0, -1, -1}, {0x44A61C8F, GT4, Unknown_Region, 0, -1, -1},

View File

@ -295,19 +295,19 @@ extern GSconf conf;
// PSM types == Texture Storage Format // PSM types == Texture Storage Format
enum PSM_value enum PSM_value
{ {
PSMCT32 = 0, // 000000 PSMCT32 = 0, // 00 0000
PSMCT24 = 1, // 000001 PSMCT24 = 1, // 00 0001
PSMCT16 = 2, // 000010 PSMCT16 = 2, // 00 0010
PSMCT16S = 10, // 001010 PSMCT16S = 10, // 00 1010
PSMT8 = 19, // 010011 PSMT8 = 19, // 01 0011
PSMT4 = 20, // 010100 PSMT4 = 20, // 01 0100
PSMT8H = 27, // 011011 PSMT8H = 27, // 01 1011
PSMT4HL = 36, // 100100 PSMT4HL = 36, // 10 0100
PSMT4HH = 44, // 101100 PSMT4HH = 44, // 10 1100
PSMT32Z = 48, // 110000 PSMT32Z = 48, // 11 0000
PSMT24Z = 49, // 110001 PSMT24Z = 49, // 11 0001
PSMT16Z = 50, // 110010 PSMT16Z = 50, // 11 0010
PSMT16SZ = 58, // 111010 PSMT16SZ = 58, // 11 1010
}; };
// Check target bit mode. PSMCT32 and 32Z return 0, 24 and 24Z - 1 // Check target bit mode. PSMCT32 and 32Z return 0, 24 and 24Z - 1
@ -357,6 +357,25 @@ inline bool PSMT_IS16Z(int psm) {return ((psm & 0x32) == 0x32);}
// I'll have to look closer at it, because it'd seem like it'd return true for 24 bits. // I'll have to look closer at it, because it'd seem like it'd return true for 24 bits.
inline bool PSMT_IS32BIT(int psm) {return !!(psm <= 1);} inline bool PSMT_IS32BIT(int psm) {return !!(psm <= 1);}
// This function updates the 6th and 5th bit of psm
// 00 or 11 -> 00 ; 01 -> 10 ; 10 -> 01
inline int Switch_Top_Bytes (int X) {
if ( ( X & 0x30 ) == 0 )
return X;
else
return (X ^ 0x30);
}
// Some storage formats could share the same memory block (2 textures in 1 format). This include following combinations:
// PSMT24(24Z) with either 8H, 4HL, 4HH and PSMT4HL with PSMT4HH.
// We use slightly different versions of this function on comparison with GSDX, Storage format XOR 0x30 made Z-textures
// similar to normal ones and change higher bits on short (8 and 4 bits) textures.
inline bool PSMT_HAS_SHARED_BITS (int fpsm, int tpsm) {
int SUM = Switch_Top_Bytes(fpsm) + Switch_Top_Bytes(tpsm) ;
return (SUM == 0x15 || SUM == 0x1D || SUM == 0x2C || SUM == 0x30);
}
//----------------------- Data from registers ----------------------- //----------------------- Data from registers -----------------------
typedef union typedef union

View File

@ -377,7 +377,7 @@ inline void FlushUpdateEffect()
// Check, maybe we cold skip flush // Check, maybe we cold skip flush
inline bool IsFlushNoNeed(VB& curvb, const pixTest& curtest) inline bool IsFlushNoNeed(VB& curvb, const pixTest& curtest)
{ {
if (curvb.nCount == 0 || (curtest.zte && curtest.ztst == 0) /*|| g_bIsLost*/ || IsBadFrame(curvb) == 1) if (curvb.nCount == 0 || (curtest.zte && curtest.ztst == 0) /*|| g_bIsLost*/ || IsBadFrame(curvb))
{ {
curvb.nCount = 0; curvb.nCount = 0;
return true; return true;

View File

@ -25,6 +25,7 @@
#include "ZZoglFlushHack.h" #include "ZZoglFlushHack.h"
// GSC_... function has imported from GSdx
bool GSC_Null(const GSFrameInfo& fi, int& skip) bool GSC_Null(const GSFrameInfo& fi, int& skip)
{ {
//ZZLog::Error_Log("GSC_Null"); //ZZLog::Error_Log("GSC_Null");
@ -619,29 +620,12 @@ bool GSC_RadiataStories(const GSFrameInfo& fi, int& skip)
return true; return true;
} }
// This function work with 6 and 5th byte of psm and switch 00 and 11 to 0, 01 to 10, 10 to 01. inline bool GABEST_HAS_SHARED_BITS (int fbp, int fpsm, int tbp, int tpsm)
inline int Switch_Top_Bytes (int X) { {
if ( ( X & 48 ) == 0 ) if ( !PSMT_HAS_SHARED_BITS (fpsm, tpsm) )
return X; return ((fbp ^ tbp) == 0);
else else
return (X ^ 48); return false;
}
// Some storage formats could share the same memory block (2 textures in 1 format). This include following combinations:
// PSMT24(24Z) with either 8H, 4HL, 4HH and PSMT4HL with PSMT4HH.
// We use slightly different versions of this function on comparison with GSDX, Storage format XOR 48 made Z-textures
// similar to normal ones and change higher bits on short (8 and 4 bits) textures.
inline bool PSMT_HAS_SHARED_BITS (int fpsm, int tpsm) {
int SUM = Switch_Top_Bytes(fpsm) + Switch_Top_Bytes(tpsm) ;
return (SUM == 0x15 || SUM == 0x1D || SUM == 0x2C || SUM == 0x30);
}
inline bool GABEST_HAS_SHARED_BITS (int spb, int fpsm, int dpb, int tpsm) {
if ( !PSMT_HAS_SHARED_BITS (fpsm, tpsm) ) {
return (((spb ^ dpb)) == 0);
}
else
return false;
} }
bool IsBadFrame(ZeroGS::VB& curvb) bool IsBadFrame(ZeroGS::VB& curvb)
@ -656,34 +640,27 @@ bool IsBadFrame(ZeroGS::VB& curvb)
fi.TBP0 = curvb.tex0.tbp0; fi.TBP0 = curvb.tex0.tbp0;
fi.TPSM = curvb.tex0.psm; fi.TPSM = curvb.tex0.psm;
fi.TZTST = curvb.test.ztst; fi.TZTST = curvb.test.ztst;
if (GetSkipCount_Handler && !GetSkipCount_Handler(fi, g_SkipFlushFrame))
{
return 0;
}
if(g_SkipFlushFrame == 0 && (conf.SkipDraw > 0)) if (GetSkipCount_Handler && !GetSkipCount_Handler(fi, g_SkipFlushFrame))
{ return false;
if(fi.TME)
{ if(g_SkipFlushFrame == 0 && (conf.SkipDraw > 0))
// depth textures (bully, mgs3s1 intro, Front Mission 5) {
if (PSMT_ISZTEX(fi.TPSM) if(fi.TME)
// General, often problematic post processing {
|| (GABEST_HAS_SHARED_BITS(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)) // depth textures (bully, mgs3s1 intro, Front Mission 5)
) // Or General, often problematic post processing
{ if (PSMT_ISZTEX(fi.TPSM) || (GABEST_HAS_SHARED_BITS(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)))
//ZZLog::Error_Log("Run the draw hack"); g_SkipFlushFrame = conf.SkipDraw;
g_SkipFlushFrame = conf.SkipDraw; }
}
}
} }
if(g_SkipFlushFrame > 0) if(g_SkipFlushFrame > 0)
{ {
g_SkipFlushFrame--; g_SkipFlushFrame--;
return 1; return true;
} }
return 0; return false;
} }