From cedc4f241dc4ae39d3fbc7ca7acfc9a27f13df37 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 4 Sep 2016 19:41:31 +0200 Subject: [PATCH] gsdx hw: add a crc hack for Dragon Quest & Final Fantasy in Itadaki Street The hack only fix the HW renderer but not the SW renderer. However I'm not sure the issue is from GSdx. The hack will disable alpha test that used to generate empty draw call. --- plugins/GSdx/GSCrc.cpp | 1 + plugins/GSdx/GSCrc.h | 1 + plugins/GSdx/GSRendererHW.cpp | 28 ++++++++++++++++++++++++++++ plugins/GSdx/GSRendererHW.h | 2 ++ 4 files changed, 32 insertions(+) diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index 92470e8dfe..f6b4dd700a 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -514,6 +514,7 @@ CRC::Game CRC::m_games[] = {0xFEFCF9DE, SteambotChronicles, JP, 0}, // Ponkotsu Roman Daikatsugeki: Bumpy Trot {0XE1BF5DCA, SuperManReturns, US, 0}, {0x06A7506A, SacredBlaze, JP, 0}, + {0x4CE7FB04, ItadakiStreet, JP, 0}, }; map CRC::m_map; diff --git a/plugins/GSdx/GSCrc.h b/plugins/GSdx/GSCrc.h index 722c00656f..5ee7ceba4b 100644 --- a/plugins/GSdx/GSCrc.h +++ b/plugins/GSdx/GSCrc.h @@ -174,6 +174,7 @@ public: SteambotChronicles, SacredBlaze, SuperManReturns, + ItadakiStreet, TitleCount, }; diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index dec9e02f08..5be2c9a83e 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -790,6 +790,7 @@ GSRendererHW::Hacks::Hacks() m_oi_list.push_back(HackEntry(CRC::TalesOfLegendia, CRC::RegionCount, &GSRendererHW::OI_TalesOfLegendia)); m_oi_list.push_back(HackEntry(CRC::SuperManReturns, CRC::RegionCount, &GSRendererHW::OI_SuperManReturns)); m_oi_list.push_back(HackEntry(CRC::ArTonelico2, CRC::RegionCount, &GSRendererHW::OI_ArTonelico2)); + m_oi_list.push_back(HackEntry(CRC::ItadakiStreet, CRC::RegionCount, &GSRendererHW::OI_ItadakiStreet)); if (!can_handle_depth) m_oi_list.push_back(HackEntry(CRC::SMTNocturne, CRC::RegionCount, &GSRendererHW::OI_SMTNocturne)); @@ -1546,6 +1547,33 @@ bool GSRendererHW::OI_ArTonelico2(GSTexture* rt, GSTexture* ds, GSTextureCache:: return true; } +bool GSRendererHW::OI_ItadakiStreet(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) +{ + if (m_context->TEST.ATST == ATST_NOTEQUAL && m_context->TEST.AREF == 0) { + // It is also broken on the SW renderer. Issue appears because fragment alpha is 0 + // I suspect the game expect low value of alpha, and due to bad rounding on the core + // you have wrongly 0. + // Otherwise some draws calls are empty (all pixels are discarded). + // It fixes missing element on the board + + GL_INS("OI_ItadakiStreetSpecial disable alpha test"); + m_context->TEST.ATST = ATST_ALWAYS; + +#if 0 // Not enough + uint32 dummy_fm; + uint32 dummy_zm; + + if (!TryAlphaTest(dummy_fm, dummy_zm)) { + GL_INS("OI_ItadakiStreetSpecial disable alpha test"); + m_context->TEST.ATST = ATST_ALWAYS; + } +#endif + } + + return true; +} + + // OO (others output?) hacks: invalidate extra local memory after the draw call void GSRendererHW::OO_DBZBT2() diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index c6b3041537..2308f7299a 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -72,6 +72,8 @@ private: bool OI_PointListPalette(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); bool OI_SuperManReturns(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); bool OI_ArTonelico2(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); + bool OI_ItadakiStreet(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t); + void OO_DBZBT2(); void OO_MajokkoALaMode2();