mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Correct validity check for 8bit frame buffers.
Buffer is valid if number of wrong pixels is less than 1% That is made for Jet Force Gemini, which writes to the area of auxilary buffers, so strict check does not work.
This commit is contained in:
parent
4bc815c6ec
commit
d65cdbdefe
20
gDP.cpp
20
gDP.cpp
|
@ -544,15 +544,25 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes)
|
|||
if (bRes && pBuffer->m_validityChecked != RSP.DList) {
|
||||
if (pBuffer->m_cleared) {
|
||||
const u32 color = pBuffer->m_fillcolor & 0xFFFEFFFE;
|
||||
for (u32 i = pBuffer->m_startAddress + 4; i < pBuffer->m_endAddress; i += 4) {
|
||||
if (((*(u32*)&RDRAM[i]) & 0xFFFEFFFE) != color) {
|
||||
frameBufferList().removeBuffer(pBuffer->m_startAddress);
|
||||
bRes = false;
|
||||
break;
|
||||
if (pBuffer->m_size > G_IM_SIZ_8b) {
|
||||
for (u32 i = pBuffer->m_startAddress + 4; i < pBuffer->m_endAddress; i += 4) {
|
||||
if (((*(u32*)&RDRAM[i]) & 0xFFFEFFFE) != color) {
|
||||
bRes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
u32 wrongPixels = 0;
|
||||
for (u32 i = pBuffer->m_startAddress + 4; i < pBuffer->m_endAddress; i += 4) {
|
||||
if (((*(u32*)&RDRAM[i]) & 0xFFFEFFFE) != color)
|
||||
++wrongPixels;
|
||||
}
|
||||
bRes = wrongPixels < (pBuffer->m_endAddress - pBuffer->m_startAddress)/100; // treshold level 1%
|
||||
}
|
||||
if (bRes)
|
||||
pBuffer->m_validityChecked = RSP.DList;
|
||||
else
|
||||
frameBufferList().removeBuffer(pBuffer->m_startAddress);
|
||||
} else if (pBuffer->m_RdramCrc != 0) {
|
||||
const u32 crc = CRC_Calculate(0xFFFFFFFF, RDRAM + pBuffer->m_startAddress, (VI.width*VI.height) << pBuffer->m_size >> 1);
|
||||
bRes = (pBuffer->m_RdramCrc == crc);
|
||||
|
|
Loading…
Reference in New Issue
Block a user