Skip to content

Commit

Permalink
GS/HW: Fix up Tekken 5 CRC hack to not remove post + break other scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Jan 21, 2024
1 parent 8fe0c34 commit 49922eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
11 changes: 11 additions & 0 deletions bin/resources/GameIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ SCAJ-20125:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCAJ-20126:
name: "Tekken 5"
Expand All @@ -1529,6 +1530,7 @@ SCAJ-20126:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCAJ-20127:
name: "EyeToy - Play 2 [with Camera]"
Expand Down Expand Up @@ -1955,6 +1957,7 @@ SCAJ-20199:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCAJ-25002:
name: "Shinobi"
Expand Down Expand Up @@ -3605,6 +3608,7 @@ SCED-53538:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCED-53611:
name: "Official PlayStation 2 Magazine - German Kids Special"
Expand Down Expand Up @@ -5167,6 +5171,7 @@ SCES-53202:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCES-53247:
name: "WRC Rally Evolved"
Expand Down Expand Up @@ -6546,6 +6551,7 @@ SCKA-20049:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCKA-20050:
name: "Tales of Legendia"
Expand Down Expand Up @@ -6754,6 +6760,7 @@ SCKA-20081:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SCKA-20082:
name: "Ace Combat 5 - The Unsung War [PlayStation 2 Big Hit Series]"
Expand Down Expand Up @@ -52627,6 +52634,7 @@ SLPS-25510:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1 # Fixes vertical lines.
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SLPS-25511:
name: 羅刹 -Alternative-
Expand Down Expand Up @@ -55460,6 +55468,7 @@ SLPS-73223:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1 # Fixes vertical lines.
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SLPS-73224:
name: ゼノサーガ エピソードII[善悪の彼岸] PS2 the Best [ディスク1/2]
Expand Down Expand Up @@ -61311,6 +61320,7 @@ SLUS-21059:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1 # Fixes vertical lines.
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SLUS-21060:
name: "WWE SmackDown! vs. RAW"
Expand Down Expand Up @@ -61823,6 +61833,7 @@ SLUS-21160:
eeClampMode: 2 # Fixes camera and stops constant coin noises on Pirates Cove.
gsHWFixes:
alignSprite: 1 # Fixes vertical lines.
halfPixelOffset: 4 # Align post.
getSkipCount: "GSC_Tekken5"
SLUS-21161:
name: "Fight Night - Round 2"
Expand Down
18 changes: 12 additions & 6 deletions pcsx2/GS/Renderers/HW/GSHwHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ bool GSHwHack::GSC_Tekken5(GSRendererHW& r, int& skip)
{
pxAssertMsg((RTBP0 & 31) == 0, "TEX0 should be page aligned");

GSVertex* v = &r.m_vertex.buff[0];

// Make sure we're detecting the right effect.
if (((v[1].XYZ.X - v[0].XYZ.X) >> 4) != 8 || ((v[1].XYZ.Y - v[0].XYZ.Y) >> 4) != 14)
return false;

GSTextureCache::Target* rt = g_texture_cache->LookupTarget(GIFRegTEX0::Create(RTBP0, RFBW, RFPSM),
GSVector2i(1, 1), r.GetTextureScaleFactor(), GSTextureCache::RenderTarget);
if (!rt)
Expand All @@ -180,13 +186,13 @@ bool GSHwHack::GSC_Tekken5(GSRendererHW& r, int& skip)
return true;
}

if (!s_nativeres && RTME && (RFBP == 0x02d60 || RFBP == 0x02d80 || RFBP == 0x02ea0 || RFBP == 0x03620 || RFBP == 0x03640) && RFPSM == RTPSM && RTBP0 == 0x00000 && RTPSM == PSMCT32)
if (!s_nativeres && RTME && RTEX0.TFX == 1 && RFPSM == RTPSM && std::abs(static_cast<int>(RFBP - RTBP0)) == 0x180 && RTPSM == PSMCT32 && RFBMSK == 0xFF000000)
{
// Don't enable hack on native res if crc is below aggressive.
// 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.
// Let's enable this hack for Aggressive only since it's an upscaling issue for both renders.
skip = 95;
// Don't enable hack on native res.
// Fixes ghosting/blur effect and white lines appearing in stages: Moonfit Wilderness, Acid Rain - caused by upscaling.
const GSVector4i draw_size(r.m_vt.m_min.p.x, r.m_vt.m_min.p.y, r.m_vt.m_max.p.x + 1.0f, r.m_vt.m_max.p.y + 1.0f);
const GSVector4i read_size(r.m_vt.m_min.t.x, r.m_vt.m_min.t.y, r.m_vt.m_max.t.x + 0.5f, r.m_vt.m_max.t.y + 0.5f);
r.ReplaceVerticesWithSprite(draw_size, read_size, GSVector2i(read_size.width(), read_size.height()), draw_size);
}
else if (RZTST == 1 && RTME && (RFBP == 0x02bc0 || RFBP == 0x02be0 || RFBP == 0x02d00 || RFBP == 0x03480 || RFBP == 0x034a0) && RFPSM == RTPSM && RTBP0 == 0x00000 && RTPSM == PSMCT32)
{
Expand Down

0 comments on commit 49922eb

Please sign in to comment.