From 66986e66e392f859953fb77c952ac334a6953dd7 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sat, 29 Jul 2023 19:02:01 +0100 Subject: [PATCH] GS/HW: Add GSC for Hitman - Blood Money to avoid failed shuffle/move. --- bin/resources/GameIndex.yaml | 10 ++++++++++ pcsx2/GS/Renderers/HW/GSHwHack.cpp | 18 ++++++++++++++++++ pcsx2/GS/Renderers/HW/GSHwHack.h | 1 + 3 files changed, 29 insertions(+) diff --git a/bin/resources/GameIndex.yaml b/bin/resources/GameIndex.yaml index 929449bc16..3c10c20b9e 100644 --- a/bin/resources/GameIndex.yaml +++ b/bin/resources/GameIndex.yaml @@ -18834,26 +18834,36 @@ SLES-53028: region: "PAL-E" clampModes: vuClampMode: 0 # Fixes bump mapping issues. + gsHWFixes: + getSkipCount: "GSC_HitmanBloodMoney" SLES-53029: name: "Hitman - Blood Money" region: "PAL-F" clampModes: vuClampMode: 0 # Fixes bump mapping issues. + gsHWFixes: + getSkipCount: "GSC_HitmanBloodMoney" SLES-53030: name: "Hitman - Blood Money" region: "PAL-G" clampModes: vuClampMode: 0 # Fixes bump mapping issues. + gsHWFixes: + getSkipCount: "GSC_HitmanBloodMoney" SLES-53031: name: "Hitman - Blood Money" region: "PAL-I" clampModes: vuClampMode: 0 # Fixes bump mapping issues. + gsHWFixes: + getSkipCount: "GSC_HitmanBloodMoney" SLES-53032: name: "Hitman - Blood Money" region: "PAL-S" clampModes: vuClampMode: 0 # Fixes bump mapping issues. + gsHWFixes: + getSkipCount: "GSC_HitmanBloodMoney" SLES-53035: name: "Masters of the Universe - He-Man - Defender of Greyskull" region: "PAL-E" diff --git a/pcsx2/GS/Renderers/HW/GSHwHack.cpp b/pcsx2/GS/Renderers/HW/GSHwHack.cpp index 87ac87cbbd..364662ab8a 100644 --- a/pcsx2/GS/Renderers/HW/GSHwHack.cpp +++ b/pcsx2/GS/Renderers/HW/GSHwHack.cpp @@ -889,6 +889,23 @@ bool GSHwHack::GSC_BigMuthaTruckers(GSRendererHW& r, int& skip) return true; } +bool GSHwHack::GSC_HitmanBloodMoney(GSRendererHW& r, int& skip) +{ + // The game does a stupid thing where it backs up the last 2 pages of the framebuffer with shuffles, uploads a CT32 texture to it + // then copies the RGB back (keeping the new alpha only). It's pretty gross, I have no idea why they didn't just upload a new alpha. + // This is a real pain to emulate with the current state of things, so let's just clear the dirty area from the upload and pretend it wasn't there. + + // Catch the first draw of the copy back. + if (RFBP > 0 && RTPSM == PSMT8H && RFPSM == PSMCT32) + { + GSTextureCache::Target* target = g_texture_cache->FindOverlappingTarget(RFBP, RFBP + 1); + if (target) + target->m_dirty.clear(); + } + + return false; +} + bool GSHwHack::OI_PointListPalette(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) { const u32 n_vertices = r.m_vertex.next; @@ -1458,6 +1475,7 @@ const GSHwHack::Entry GSHwHack::s_get_skip_count_function CRC_F(GSC_NFSUndercover), CRC_F(GSC_PolyphonyDigitalGames), CRC_F(GSC_MetalGearSolid3), + CRC_F(GSC_HitmanBloodMoney), // Channel Effect CRC_F(GSC_GiTS), diff --git a/pcsx2/GS/Renderers/HW/GSHwHack.h b/pcsx2/GS/Renderers/HW/GSHwHack.h index 79fcac8fd1..2bb5c04036 100644 --- a/pcsx2/GS/Renderers/HW/GSHwHack.h +++ b/pcsx2/GS/Renderers/HW/GSHwHack.h @@ -45,6 +45,7 @@ public: static bool GSC_PolyphonyDigitalGames(GSRendererHW& r, int& skip); static bool GSC_MetalGearSolid3(GSRendererHW& r, int& skip); static bool GSC_BigMuthaTruckers(GSRendererHW& r, int& skip); + static bool GSC_HitmanBloodMoney(GSRendererHW& r, int& skip); static bool OI_PointListPalette(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); static bool OI_DBZBTGames(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t);