Skip to content

Commit

Permalink
gsdx-hw: Add OI rendering fix for Big Mutha Truckers.
Browse files Browse the repository at this point in the history
It will allow to render the shadows properly, also update the crc
hack to skip less effects.
  • Loading branch information
lightningterror committed Jul 29, 2019
1 parent 55d469e commit e79ea75
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
18 changes: 8 additions & 10 deletions plugins/GSdx/Renderers/HW/GSHwHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
33 changes: 33 additions & 0 deletions plugins/GSdx/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,7 @@ GSRendererHW::Hacks::Hacks()
, m_oo(NULL)
, m_cu(NULL)
{
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::BigMuthaTruckers, CRC::RegionCount, &GSRendererHW::OI_BigMuthaTruckers));
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::FFXII, CRC::EU, &GSRendererHW::OI_FFXII));
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::FFX, CRC::RegionCount, &GSRendererHW::OI_FFX));
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::MetalSlug6, CRC::RegionCount, &GSRendererHW::OI_MetalSlug6));
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/Renderers/HW/GSRendererHW.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e79ea75

Please sign in to comment.