From eb98f2fb88c72cad13d1ee8a0a4521ef8330a1d0 Mon Sep 17 00:00:00 2001 From: lightningterror Date: Fri, 19 Jul 2019 18:06:40 +0200 Subject: [PATCH] gsdx-hw: Add OI rendering fix for Big Mutha Truckers. It will allow to render the shadows properly, also update the crc hack to skip less effects. --- plugins/GSdx/Renderers/HW/GSHwHack.cpp | 18 ++++++------ plugins/GSdx/Renderers/HW/GSRendererHW.cpp | 33 ++++++++++++++++++++++ plugins/GSdx/Renderers/HW/GSRendererHW.h | 1 + 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/plugins/GSdx/Renderers/HW/GSHwHack.cpp b/plugins/GSdx/Renderers/HW/GSHwHack.cpp index 7351fa699a4eb..78adbb15f60bb 100644 --- a/plugins/GSdx/Renderers/HW/GSHwHack.cpp +++ b/plugins/GSdx/Renderers/HW/GSHwHack.cpp @@ -42,16 +42,14 @@ bool GSC_BigMuthaTruckers(const GSFrameInfo& fi, int& skip) { if(skip == 0) { - if(fi.TME && (fi.FBP == 0x00000 || fi.FBP == 0x00a00) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT16) - { - // A real mess. - // Half screen bottom and vertical stripes issues. - // - // HDR colclip/conclip not supported, - // Depth target lookup, - // Texture shuffle and SW emulated fbmask. - // https://github.com/PCSX2/pcsx2/issues/2449 - skip = 3; + if(fi.TME && (fi.TBP0 == 0x01400 || fi.TBP0 == 0x012c0) && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT16) + { + // Mid-texture pointer is a cache miss, + // luckily we replace a half-screen TS effect with a full-screen one in + // EmulateTextureShuffleAndFbmask (see #2934). + // While this works for the time being, it's not ideal. + // Skip the unneeded extra TS draw. + skip = 1; } } diff --git a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp index a25d0ad3de188..2832e90ed2b5a 100644 --- a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp +++ b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp @@ -1464,6 +1464,7 @@ GSRendererHW::Hacks::Hacks() , m_oo(NULL) , m_cu(NULL) { + m_oi_list.push_back(HackEntry(CRC::BigMuthaTruckers, CRC::RegionCount, &GSRendererHW::OI_BigMuthaTruckers)); m_oi_list.push_back(HackEntry(CRC::FFXII, CRC::EU, &GSRendererHW::OI_FFXII)); m_oi_list.push_back(HackEntry(CRC::FFX, CRC::RegionCount, &GSRendererHW::OI_FFX)); m_oi_list.push_back(HackEntry(CRC::MetalSlug6, CRC::RegionCount, &GSRendererHW::OI_MetalSlug6)); @@ -1689,6 +1690,38 @@ bool GSRendererHW::OI_BlitFMV(GSTextureCache::Target* _rt, GSTextureCache::Sourc // OI (others input?/implementation?) hacks replace current draw call +bool GSRendererHW::OI_BigMuthaTruckers(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) +{ + // Rendering pattern: + // CRTC frontbuffer at 0x0 is interlaced (half vertical resolution), + // game needs to do a depth effect (so green channel to alpha), + // but there is a vram limitation so green is pushed into the alpha channel of the CRCT buffer, + // vertical resolution is half so only half is processed at once + // We, however, don't have this limitation so we'll replace the draw with a full-screen TS. + + GIFRegTEX0 Texture = m_context->TEX0; + + GIFRegTEX0 Frame; + Frame.TBW = m_context->FRAME.FBW; + Frame.TBP0 = m_context->FRAME.FBP; + Frame.TBP0 = m_context->FRAME.Block(); + + if (PRIM->TME && Frame.TBW == 10 && Texture.TBW == 10 && Frame.TBP0 == 0x00a00 && Texture.PSM == PSM_PSMT8H && (m_r.y == 256 || m_r.y == 224)) + { + // 224 ntsc, 256 pal. + GL_INS("OI_BigMuthaTruckers half bottom offset"); + + size_t count = m_vertex.next; + GSVertex* v = &m_vertex.buff[0]; + const uint16 offset = (uint16)m_r.y * 16; + + for (size_t i = 0; i < count; i++) + v[i].V += offset; + } + + return true; +} + bool GSRendererHW::OI_FFXII(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) { static uint32* video = NULL; diff --git a/plugins/GSdx/Renderers/HW/GSRendererHW.h b/plugins/GSdx/Renderers/HW/GSRendererHW.h index f6d7720564e18..e9bbbbacf2f33 100644 --- a/plugins/GSdx/Renderers/HW/GSRendererHW.h +++ b/plugins/GSdx/Renderers/HW/GSRendererHW.h @@ -52,6 +52,7 @@ class GSRendererHW : public GSRenderer void OI_GsMemClear(); // always on void OI_DoubleHalfClear(GSTexture* rt, GSTexture* ds); // always on + bool OI_BigMuthaTruckers(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); bool OI_FFXII(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); bool OI_FFX(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); bool OI_MetalSlug6(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t);