Skip to content

Commit

Permalink
GS/HW: Add CRC fixes for DT Carnage/Racer/Axel Impact
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Feb 8, 2025
1 parent 865b75b commit b377daa
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
17 changes: 16 additions & 1 deletion bin/resources/GameIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10365,9 +10365,14 @@ SCPS-56016:
gameFixes:
- GIFFIFOHack
gsHWFixes:
halfPixelOffset: 2 # Fixes post processing position.
nativeScaling: 2 # Fixes post effects.
estimateTextureRegion: 1 # Improves performance and reduces hash cache size.
gpuPaletteConversion: 2 # Improves performance and reduces hash cache size.
autoFlush: 1 # Corrects shadows (Currently still broken even with this).
recommendedBlendingLevel: 4 # Fixes car shadows but addeds about 5000 barriers, might impact slower machines.
gpuTargetCLUT: 2 # Fixes light flicker.
getSkipCount: "GSC_DTGames"
SCPS-72001:
name: "GRAN TURISMO3 A-spec [MEGA HITS!]"
name-sort: "ぐらんつーりすも3 A-spec [MEGA HITS!]"
Expand Down Expand Up @@ -23969,9 +23974,13 @@ SLES-53904:
clampModes:
vuClampMode: 0 # Fixes black artifacts on tracks
gsHWFixes:
halfPixelOffset: 2 # Fixes post processing position.
nativeScaling: 2 # Fixes post effects.
estimateTextureRegion: 1 # Improves performance and reduces hash cache size.
gpuPaletteConversion: 2 # Improves performance and reduces hash cache size.
autoFlush: 1 # Corrects shadows (Currently still broken even with this).
gpuTargetCLUT: 2 # Fixes light flicker.
getSkipCount: "GSC_DTGames"
SLES-53906:
name: "50 Cent - Bulletproof"
region: "PAL-F"
Expand Down Expand Up @@ -66754,9 +66763,13 @@ SLUS-21095:
region: "NTSC-U"
compat: 5
gsHWFixes:
halfPixelOffset: 2 # Fixes post processing position.
nativeScaling: 2 # Fixes post effects.
estimateTextureRegion: 1 # Improves performance and reduces hash cache size.
gpuPaletteConversion: 2 # Improves performance and reduces hash cache size.
autoFlush: 1 # Corrects shadows (Currently still broken even with this).
gpuTargetCLUT: 2 # Fixes light flicker.
getSkipCount: "GSC_DTGames"
SLUS-21096:
name: "Ape Escape - Pumped & Primed"
region: "NTSC-U"
Expand Down Expand Up @@ -70873,10 +70886,12 @@ SLUS-21793:
compat: 3
gsHWFixes:
halfPixelOffset: 2 # Fixes post processing position.
nativeScaling: 1 # Fixes post effects.
nativeScaling: 2 # Fixes post effects.
estimateTextureRegion: 1 # Improves performance and reduces hash cache size.
gpuPaletteConversion: 2 # Improves performance and reduces hash cache size.
autoFlush: 1 # Corrects shadows (Currently still broken even with this).
gpuTargetCLUT: 2 # Fixes light flicker.
getSkipCount: "GSC_DTGames"
SLUS-21794:
name: "Go, Diego, Go! Great Dinosaur Rescue"
region: "NTSC-U"
Expand Down
57 changes: 57 additions & 0 deletions pcsx2/GS/Renderers/HW/GSHwHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,62 @@ bool GSHwHack::GSC_SFEX3(GSRendererHW& r, int& skip)
return true;
}

bool GSHwHack::GSC_DTGames(GSRendererHW& r, int& skip)
{
if (skip == 0)
{
// The game does a shuffle based on the result of a copy from the depth buffer, which ends up looking bizzare so PCSX2 doesn't know how to deal with it.
// What they're actually doing is copying the red/green channel of the result (kind of a shadow stencil) to the alpha channel.
// The further problem to this is the limitation of alpha we can save on an RT as they copy in 255, so I can cheese it here pretending it's RTA'd
if (RTME && RFPSM == PSMCT32 && RTBP0 == RFBP && RTPSM == PSMCT16 && RTEST.ATE && RTEST.ATST == ATST_NEVER && RTEST.AFAIL == AFAIL_FB_ONLY && RFBMSK == 0xFFFFFF)
{
GSTextureCache::Target* rt = g_texture_cache->LookupTarget(GIFRegTEX0::Create(RTBP0, RFBW, RFPSM),
GSVector2i(1, 1), r.GetTextureScaleFactor(), GSTextureCache::RenderTarget);

if (!rt)
return false;

// Clear down the alpha first.
GSHWDrawConfig& clear = r.BeginHLEHardwareDraw(
rt->GetTexture(), nullptr, rt->GetScale(), nullptr, rt->GetScale(), rt->GetUnscaledRect());
clear.colormask.wrgba = 0;
clear.colormask.wa = 1;
r.EndHLEHardwareDraw(false);

// Shuffle the green channel in to alpha.
GSHWDrawConfig& config = r.BeginHLEHardwareDraw(
rt->GetTexture(), nullptr, rt->GetScale(), rt->GetTexture(), rt->GetScale(), rt->GetUnscaledRect());
config.ps.shuffle = 1;
config.ps.dst_fmt = GSLocalMemory::PSM_FMT_32;
config.ps.write_rg = 0;
config.ps.shuffle_same = 0;
config.ps.real16src = 0;
config.ps.shuffle_across = 1;
config.ps.process_rg = r.SHUFFLE_READ;
config.ps.process_ba = r.SHUFFLE_WRITE;
config.colormask.wrgba = 0;
config.colormask.wa = 1;
config.ps.rta_correction = 1;
config.ps.fbmask = 1;
config.ps.fbmask = 0x7FFFFFFF;

Check notice on line 194 in pcsx2/GS/Renderers/HW/GSHwHack.cpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

pcsx2/GS/Renderers/HW/GSHwHack.cpp#L194

Variable 'config.ps.fbmask' is reassigned a value before the old one has been used.
config.ps.tfx = TFX_DECAL;
config.ps.tcc = true;
r.EndHLEHardwareDraw(true);

rt->m_alpha_min = 0;
rt->m_alpha_max = 255;
skip = 69;
}
}
else
{
if (RTPSM != PSMCT16)
skip = 0;
}

return true;
}

bool GSHwHack::GSC_Tekken5(GSRendererHW& r, int& skip)
{
if (skip == 0)
Expand Down Expand Up @@ -1471,6 +1527,7 @@ const GSHwHack::Entry<GSRendererHW::GSC_Ptr> GSHwHack::s_get_skip_count_function
CRC_F(GSC_SakuraWarsSoLongMyLove),
CRC_F(GSC_Simple2000Vol114),
CRC_F(GSC_SFEX3),
CRC_F(GSC_DTGames),
CRC_F(GSC_TalesOfLegendia),
CRC_F(GSC_TalesofSymphonia),
CRC_F(GSC_UrbanReign),
Expand Down
1 change: 1 addition & 0 deletions pcsx2/GS/Renderers/HW/GSHwHack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class GSHwHack
static bool GSC_Manhunt2(GSRendererHW& r, int& skip);
static bool GSC_SacredBlaze(GSRendererHW& r, int& skip);
static bool GSC_SFEX3(GSRendererHW& r, int& skip);
static bool GSC_DTGames(GSRendererHW& r, int& skip);
static bool GSC_Tekken5(GSRendererHW& r, int& skip);
static bool GSC_BurnoutGames(GSRendererHW& r, int& skip);
static bool GSC_BlackAndBurnoutSky(GSRendererHW& r, int& skip);
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void GSRendererHW::ConvertSpriteTextureShuffle(u32& process_rg, u32& process_ba,
}
else
{
if ((floor(m_vt.m_max.p.y) <= rt->m_valid.w) && ((floor(m_vt.m_max.p.x) > (m_cached_ctx.FRAME.FBW * 64)) || (rt->m_TEX0.TBW != m_cached_ctx.FRAME.FBW)))
if (((m_r.width() + 8) & ~(GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].pgs.x - 1)) != GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].pgs.x && (floor(m_vt.m_max.p.y) <= rt->m_valid.w) && ((floor(m_vt.m_max.p.x) > (m_cached_ctx.FRAME.FBW * 64)) || (rt->m_TEX0.TBW < m_cached_ctx.FRAME.FBW)))
{
half_bottom_vert = false;
half_bottom_uv = false;
Expand Down

0 comments on commit b377daa

Please sign in to comment.