1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

modify fingerprint validity checking method

In Zelda OOT the CPU applies a filter on the framebuffer texture. If we
write a small amount of data at the beginning the CPU won't change our
specific values
This commit is contained in:
purplemarshmallow 2015-08-02 08:16:12 +02:00 committed by Sergey Lipskiy
parent e0face5f86
commit 0735bd0372

View File

@ -264,14 +264,18 @@ void FrameBuffer::copyRdram()
// This is necessary for auxilary buffers: game can restore content of RDRAM when buffer is not needed anymore // This is necessary for auxilary buffers: game can restore content of RDRAM when buffer is not needed anymore
// Thus content of RDRAM on moment of buffer creation will be the same as when buffer becomes obsolete. // Thus content of RDRAM on moment of buffer creation will be the same as when buffer becomes obsolete.
// Validity check will see that the RDRAM is the same and thus the buffer is valid, which is false. // Validity check will see that the RDRAM is the same and thus the buffer is valid, which is false.
// It can be enough to write data just little more than treshold level, but more safe to write twice as much in case that some values in buffer match our fingerprint. const u32 twoPercent = dataSize / 200;
//if (dataSize > ) { u32 start = m_startAddress >> 2;
//todo: make sure buffer is bigger than the fingerprint u32 * pData = (u32*)RDRAM;
u32 start = m_startAddress >> 2; for (u32 i = 0; i < twoPercent; ++i)
u32 * pData = (u32*)RDRAM; {
for (u32 i = 0; i < 4; ++i) if (i < 4)
pData[start++] = fingerprint[i]; pData[start++] = fingerprint[i];
//} else
pData[start++] = 0;
}
m_cleared = false;
return;
} }
} }
@ -296,8 +300,8 @@ bool FrameBuffer::isValid() const
++wrongPixels; ++wrongPixels;
} }
return wrongPixels < (m_endAddress - m_startAddress) / 400; // treshold level 1% of dwords return wrongPixels < (m_endAddress - m_startAddress) / 400; // treshold level 1% of dwords
} else if (!m_RdramCopy.empty()) { }
if (m_width != VI.width && config.frameBufferEmulation.validityCheckMethod == Config::vcFingerprint) { else if (m_width != VI.width) {
// Auxiliary frame buffer // Auxiliary frame buffer
//check if our fingerprint is still there //check if our fingerprint is still there
const u32 stride = m_width << m_size >> 1; const u32 stride = m_width << m_size >> 1;
@ -308,7 +312,8 @@ bool FrameBuffer::isValid() const
if ((pData[start++] & 0xFFFEFFFE) != (fingerprint[i] & 0xFFFEFFFE)) if ((pData[start++] & 0xFFFEFFFE) != (fingerprint[i] & 0xFFFEFFFE))
return false; return false;
return true; return true;
} }
else if (!m_RdramCopy.empty()) {
const u32 * const pCopy = (const u32*)m_RdramCopy.data(); const u32 * const pCopy = (const u32*)m_RdramCopy.data();
const u32 size = m_RdramCopy.size(); const u32 size = m_RdramCopy.size();
const u32 size_dwords = size >> 2; const u32 size_dwords = size >> 2;