From b158f98fc777cba4d61348d8faeec5bb94cd9fb8 Mon Sep 17 00:00:00 2001 From: gabest11 Date: Wed, 2 Nov 2011 17:41:22 +0000 Subject: [PATCH] GSdx: Bogus MSB bits of TEX0.CSA should be ignored as it looks. Only corrected where the palette is read (this fixes "Idol Janshi Suchie-Pai IV"), writes to the CLUT may be handled the same way, but so far no game has been found broken because of this. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4955 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSClut.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/GSdx/GSClut.cpp b/plugins/GSdx/GSClut.cpp index 8481ed7b1e..2521acbe06 100644 --- a/plugins/GSdx/GSClut.cpp +++ b/plugins/GSdx/GSClut.cpp @@ -223,7 +223,7 @@ void GSClut::Read(const GIFRegTEX0& TEX0) m_read.TEX0 = TEX0; m_read.dirty = false; - uint16* clut = m_clut + (TEX0.CSA << 4); + uint16* clut = m_clut; if(TEX0.CPSM == PSM_PSMCT32 || TEX0.CPSM == PSM_PSMCT24) { @@ -231,11 +231,14 @@ void GSClut::Read(const GIFRegTEX0& TEX0) { case PSM_PSMT8: case PSM_PSMT8H: + ASSERT(TEX0.CSA == 0); ReadCLUT_T32_I8(clut, m_buff32); break; case PSM_PSMT4: case PSM_PSMT4HL: case PSM_PSMT4HH: + //ASSERT(TEX0.CSA < 16); + clut += (TEX0.CSA & 15) << 4; ReadCLUT_T32_I4(clut, m_buff32, m_buff64); break; } @@ -246,11 +249,15 @@ void GSClut::Read(const GIFRegTEX0& TEX0) { case PSM_PSMT8: case PSM_PSMT8H: + ASSERT(TEX0.CSA < 16); + clut += (TEX0.CSA & 15) << 4; ReadCLUT_T16_I8(clut, m_buff32); break; case PSM_PSMT4: case PSM_PSMT4HL: case PSM_PSMT4HH: + ASSERT(TEX0.CSA < 32); + clut += TEX0.CSA << 4; ReadCLUT_T16_I4(clut, m_buff32, m_buff64); break; } @@ -267,7 +274,7 @@ void GSClut::Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA) m_read.dirty = false; m_read.adirty = true; - uint16* clut = m_clut + (TEX0.CSA << 4); + uint16* clut = m_clut; if(TEX0.CPSM == PSM_PSMCT32 || TEX0.CPSM == PSM_PSMCT24) { @@ -275,11 +282,14 @@ void GSClut::Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA) { case PSM_PSMT8: case PSM_PSMT8H: + ASSERT(TEX0.CSA == 0); ReadCLUT_T32_I8(clut, m_buff32); break; case PSM_PSMT4: case PSM_PSMT4HL: case PSM_PSMT4HH: + //ASSERT(TEX0.CSA < 16); // Idol Janshi Suchie-Pai IV (highlighted menu item, mahjong tiles) + clut += (TEX0.CSA & 15) << 4; // TODO: merge these functions ReadCLUT_T32_I4(clut, m_buff32); ExpandCLUT64_T32_I8(m_buff32, (uint64*)m_buff64); // sw renderer does not need m_buff64 anymore @@ -292,11 +302,15 @@ void GSClut::Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA) { case PSM_PSMT8: case PSM_PSMT8H: + ASSERT(TEX0.CSA < 16); + clut += (TEX0.CSA & 15) << 4; Expand16(clut, m_buff32, 256, TEXA); break; case PSM_PSMT4: case PSM_PSMT4HL: case PSM_PSMT4HH: + ASSERT(TEX0.CSA < 32); + clut += TEX0.CSA << 4; // TODO: merge these functions Expand16(clut, m_buff32, 16, TEXA); ExpandCLUT64_T32_I8(m_buff32, (uint64*)m_buff64); // sw renderer does not need m_buff64 anymore