Skip to content

Commit 43a81a3

Browse files
refractionpcsx2lightningterror
authored andcommitted
GS/HW: Add CRC for Turok wrong width clear
1 parent 0df388c commit 43a81a3

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

bin/resources/GameIndex.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15195,7 +15195,9 @@ SLES-50479:
1519515195
region: "PAL-M4"
1519615196
compat: 5
1519715197
gsHWFixes:
15198+
halfPixelOffset: 2 # Fixes depth/fog lines.
1519815199
textureInsideRT: 1 # Fixes underwater levels.
15200+
getSkipCount: "GSC_Turok"
1519915201
SLES-50480:
1520015202
name: "Aggressive Inline"
1520115203
region: "PAL-M4"
@@ -16704,7 +16706,9 @@ SLES-51124:
1670416706
region: "PAL-G"
1670516707
compat: 5
1670616708
gsHWFixes:
16709+
halfPixelOffset: 2 # Fixes depth/fog lines.
1670716710
textureInsideRT: 1 # Fixes underwater levels.
16711+
getSkipCount: "GSC_Turok"
1670816712
SLES-51125:
1670916713
name: "Sega Soccer Slam"
1671016714
region: "PAL-E"
@@ -64136,7 +64140,9 @@ SLUS-20333:
6413664140
region: "NTSC-U"
6413764141
compat: 5
6413864142
gsHWFixes:
64143+
halfPixelOffset: 2 # Fixes depth/fog lines.
6413964144
textureInsideRT: 1 # Fixes underwater levels.
64145+
getSkipCount: "GSC_Turok"
6414064146
SLUS-20334:
6414164147
name: "Kelly Slater's Pro Surfer"
6414264148
region: "NTSC-U"

pcsx2/GS/Renderers/HW/GSHwHack.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,27 @@ bool GSHwHack::GSC_MetalGearSolid3(GSRendererHW& r, int& skip)
822822
return true;
823823
}
824824

825+
bool GSHwHack::GSC_Turok(GSRendererHW& r, int& skip)
826+
{
827+
// Turok does some very silly clears where it will set the alpha channel with a 512x512 draw, then decides the image is actually 640x448 later, this causes havok for the texture cache and target end blocks.
828+
// Since we can't look in to the future to check this, the options are either rearrange all the pages in a target when the width changes
829+
// (very slow, could break a ton of stuff which stores different things in the alpha channel), or this. I choose this.
830+
831+
if (r.m_index.tail == 6 && RPRIM->PRIM == 4 && !RTME && RFBMSK == 0x00FFFFFF && floor(r.m_vt.m_max.p.x) == 512 && r.m_env.CTXT[r.m_backed_up_ctx].FRAME.FBW == 10 && RFRAME.FBW == 8 && RFPSM == PSMCT32 && RTEST.ATE && RTEST.ATST == ATST_GEQUAL)
832+
{
833+
int num_pages = r.m_cached_ctx.FRAME.FBW * ((floor(r.m_vt.m_max.p.y) + 31) / 32);
834+
r.m_cached_ctx.FRAME.FBW = 10;
835+
// Round them up to fill the row, it later reads the bottom right corner clamped, but because we can't rearrange it ends up reading the black square.
836+
num_pages = ((num_pages + 9) / 10) * 10;
837+
838+
r.ReplaceVerticesWithSprite(
839+
r.GetDrawRectForPages(r.m_cached_ctx.FRAME.FBW, r.m_cached_ctx.FRAME.PSM, num_pages),
840+
GSVector2i(1, 1));
841+
}
842+
843+
return true;
844+
}
845+
825846
bool GSHwHack::OI_PointListPalette(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t)
826847
{
827848
const u32 n_vertices = r.m_vertex.next;
@@ -1312,6 +1333,7 @@ const GSHwHack::Entry<GSRendererHW::GSC_Ptr> GSHwHack::s_get_skip_count_function
13121333
CRC_F(GSC_PolyphonyDigitalGames),
13131334
CRC_F(GSC_MetalGearSolid3),
13141335
CRC_F(GSC_Battlefield2),
1336+
CRC_F(GSC_Turok),
13151337

13161338
// Channel Effect
13171339
CRC_F(GSC_NamcoGames),

pcsx2/GS/Renderers/HW/GSHwHack.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class GSHwHack
2626
static bool GSC_Battlefield2(GSRendererHW& r, int& skip);
2727
static bool GSC_PolyphonyDigitalGames(GSRendererHW& r, int& skip);
2828
static bool GSC_MetalGearSolid3(GSRendererHW& r, int& skip);
29+
static bool GSC_Turok(GSRendererHW& r, int& skip);
2930

3031
static bool OI_PointListPalette(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t);
3132
static bool OI_DBZBTGames(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t);

0 commit comments

Comments
 (0)