From 687c0b45e2885a32bc8a065bdef1d667f718a202 Mon Sep 17 00:00:00 2001 From: lightningterror Date: Mon, 4 Dec 2017 10:36:07 +0100 Subject: [PATCH] Gsdx: Tekken 5 Channel effect and CRC Hacks Move CRC hack to Partial that fix the half screen bottom issue since the effect is not rendered correctly. Move CRC hack to Aggressive. These hacks are only needed when running upscaled resolution. They skip the blur effect which cause ghosting and some other screen issues. Side effect is they also remove the channel effect on OpenGL which is emulated correctly so let's put them on Aggressive. Comment out a hack, it's unknown what the hack does atm. If there are new issues then it will be added back. Added comments what the hacks do. Partial port for channel shuffle effect to Direct3D for Tekken5. The effect is skipped and not rendered but now the top left screen glitch has been resolved. Note: At least Minimum CRC level is required for this to work. --- plugins/GSdx/GSHwHack.cpp | 58 +++++++++++++++++++--------------- plugins/GSdx/GSRendererDX.cpp | 17 +++++++++- plugins/GSdx/GSRendererOGL.cpp | 1 + 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/plugins/GSdx/GSHwHack.cpp b/plugins/GSdx/GSHwHack.cpp index 9a1a15a316..1892c8faf1 100644 --- a/plugins/GSdx/GSHwHack.cpp +++ b/plugins/GSdx/GSHwHack.cpp @@ -578,6 +578,37 @@ bool GSC_BleachBladeBattlers(const GSFrameInfo& fi, int& skip) return true; } +bool GSC_Tekken5(const GSFrameInfo& fi, int& skip) +{ + if(skip == 0) + { + if(Aggressive && fi.TME && (fi.FBP == 0x02d60 || fi.FBP == 0x02d80 || fi.FBP == 0x02ea0 || fi.FBP == 0x03620) && fi.FPSM == fi.TPSM && fi.TBP0 == 0x00000 && fi.TPSM == PSM_PSMCT32) + { + // Fixes/removes ghosting/blur effect and white lines appearing in stages: Moonfit Wilderness, Acid Rain - caused by upscaling. + // Downside is it also removes the channel effect which is fixed on OpenGL. + // Let's enable this hack for Aggressive only since it's an upscaling issue for both renders. + skip = 95; + } + else if(fi.TME && (fi.FBP == 0x02bc0 || fi.FBP == 0x02be0 || fi.FBP == 0x02d00) && fi.FPSM == fi.TPSM && fi.TBP0 == 0x00000 && fi.TPSM == PSM_PSMCT32) + { + // The moving display effect(flames) is not emulated properly in the entire screen so let's remove the effect in the stage: Burning Temple. Related to half screen bottom issue. + // Fixes black lines in the stage: Burning Temple - caused by upscaling. Note the black lines can also be fixed with Merge Sprite hack. + skip = 2; + } + // It's unknown what this hack does so let's comment it out since it doesn't cause any issues when disabled it seems. + /*else if(fi.TME) + { + if( (fi.TPSM == PSM_PSMZ32 || fi.TPSM == PSM_PSMZ24 || fi.TPSM == PSM_PSMZ16 || fi.TPSM == PSM_PSMZ16S) || + (GSUtil::HasSharedBits(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)) ) + { + skip = 24; + } + }*/ + } + + return true; +} + bool GSC_TombRaider(const GSFrameInfo& fi, int& skip) { if(skip == 0) @@ -1256,31 +1287,6 @@ bool GSC_TalesOfAbyss(const GSFrameInfo& fi, int& skip) return true; } -bool GSC_Tekken5(const GSFrameInfo& fi, int& skip) -{ - if(skip == 0) - { - if(fi.TME && (fi.FBP == 0x02d60 || fi.FBP == 0x02d80 || fi.FBP == 0x02ea0 || fi.FBP == 0x03620) && fi.FPSM == fi.TPSM && fi.TBP0 == 0x00000 && fi.TPSM == PSM_PSMCT32) - { - skip = 95; - } - else if(fi.TME && (fi.FBP == 0x02bc0 || fi.FBP == 0x02be0 || fi.FBP == 0x02d00) && fi.FPSM == fi.TPSM && fi.TBP0 == 0x00000 && fi.TPSM == PSM_PSMCT32) - { - skip = 2; - } - else if(fi.TME) - { - if( (fi.TPSM == PSM_PSMZ32 || fi.TPSM == PSM_PSMZ24 || fi.TPSM == PSM_PSMZ16 || fi.TPSM == PSM_PSMZ16S) || - (GSUtil::HasSharedBits(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)) ) - { - skip = 24; - } - } - } - - return true; -} - bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip) { if(skip == 0) @@ -2431,6 +2437,7 @@ void GSState::SetupCrcHack() lut[CRC::SFEX3] = GSC_SFEX3; lut[CRC::TalesOfLegendia] = GSC_TalesOfLegendia; lut[CRC::TalesofSymphonia] = GSC_TalesofSymphonia; + lut[CRC::Tekken5] = GSC_Tekken5; lut[CRC::TimeSplitters2] = GSC_TimeSplitters2; lut[CRC::TombRaiderAnniversary] = GSC_TombRaider; lut[CRC::TombRaiderLegend] = GSC_TombRaiderLegend; @@ -2515,7 +2522,6 @@ void GSState::SetupCrcHack() lut[CRC::GT3] = GSC_GT3; lut[CRC::GTConcept] = GSC_GTConcept; lut[CRC::TalesOfAbyss] = GSC_TalesOfAbyss; - lut[CRC::Tekken5] = GSC_Tekken5; // RW frame buffer. UserHacks_AutoFlush allow to emulate it correctly lut[CRC::GTASanAndreas] = GSC_GTASanAndreas; diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index 48c90d2d93..266d75eed7 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -304,8 +304,23 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc // Channel shuffle effect not supported on DX. Let's keep the logic because it help to // reduce memory requirement (and why not a partial port) + + // Uncomment to disable (allow to trace the draw call) + // m_channel_shuffle = false; + if (m_channel_shuffle) { - if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MAXU & 0x8) == 8)) { + if (m_game.title == CRC::Tekken5) { + if (m_context->FRAME.FBW == 1) { + // Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness + // Skip channel effect, it misses a shader for proper screen effect but at least the top left screen issue isn't appearing anymore + // 12 pages: 2 calls by channel, 3 channels, 1 blit + // Minus current draw call + m_skip = 12 * (3 + 3 + 1) - 1; + } else { + // Could skip model drawing if wrongly detected + m_channel_shuffle = false; + } + } else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MAXU & 0x8) == 8)) { ; } else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MINU & 0x8) == 0)) { ; diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index c7a892e2a2..6f642ccaf8 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -422,6 +422,7 @@ void GSRendererOGL::EmulateChannelShuffle(GSTexture** rt, const GSTextureCache:: *rt = tex->m_from_target; } else if (m_game.title == CRC::Tekken5) { if (m_context->FRAME.FBW == 1) { + // Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness GL_INS("Tekken5 RGB Channel"); m_ps_sel.channel = 7; m_context->FRAME.FBMSK = 0xFF000000;