From 4611264ce37228abc47dccf6f0029414ca9412e2 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 11 Apr 2016 16:02:57 +0200 Subject: [PATCH] gsdx: add CRC hack for Nocturne PAL Reduce depth transfer to the real size of the game. Otherwise we need to handle a mix of color/depth transfer. --- plugins/GSdx/GSState.cpp | 22 ++++++++++++++++++++++ plugins/GSdx/GSTextureCache.cpp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 99f6ca5c40..6b18ed375a 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -1527,6 +1527,28 @@ void GSState::Write(const uint8* mem, int len) const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM]; + /* + * The game uses a resolution of 512x244. RT is located at 0x700 and depth at 0x0 + * + * #Bug number 1. (bad top bar) + * The game saves the depth buffer in the EE but with a resolution of + * 512x255. So it is ending to 0x7F8, ouch it saves the top of the RT too. + * + * #Bug number 2. (darker screen) + * The game will restore the previously saved buffer at position 0x0 to + * 0x7F8. Because of the extra RT pixels, GSdx will partialy invalidate + * the texture located at 0x700. Next access will generate a cache miss + * + * The no-solution: instead to handle garbage (aka RT) at the end of the + * depth buffer. Let's reduce the size of the transfer + */ + if (m_game.title == CRC::SMTNocturne) { + if (m_env.BITBLTBUF.DBP == 0 && m_env.BITBLTBUF.DPSM == PSM_PSMZ32 && w == 512 && h > 224) { + h = 224; + m_env.TRXREG.RRH = 224; + } + } + // printf("Write len=%d DBP=%05x DBW=%d DPSM=%d DSAX=%d DSAY=%d RRW=%d RRH=%d\n", len, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, m_env.TRXPOS.DSAX, m_env.TRXPOS.DSAY, m_env.TRXREG.RRW, m_env.TRXREG.RRH); if(!m_tr.Update(w, h, psm.trbpp, len)) diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index d5918aa786..f79e7848f0 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -726,7 +726,7 @@ void GSTextureCache::InvalidateLocalMem(GSOffset* off, const GSVector4i& r) // No depth handling please. if (psm == PSM_PSMZ32 || psm == PSM_PSMZ24 || psm == PSM_PSMZ16 || psm == PSM_PSMZ16S) { - GL_INS("ERROR: InvalidateLocalMem depth format isn't supported"); + GL_INS("ERROR: InvalidateLocalMem depth format isn't supported (%d,%d to %d,%d)", r.x, r.y, r.z, r.w); if (m_can_convert_depth) { for(auto t : m_dst[DepthStencil]) { if(GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM)) {