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

Add new fb validity check method: by checksum.

It is more safe than filling RDRAM with fillcolor, but not compatible with
Mario Tennis.
Thus it is made optional.

Fixed Perfect Dark - Crash often #323
This commit is contained in:
Sergey Lipskiy 2015-04-08 19:11:32 +06:00
parent 6fa0204709
commit 3d55b086ee
4 changed files with 14 additions and 2 deletions

View File

@ -36,6 +36,8 @@ void Config::resetToDefaults()
frameBufferEmulation.copyToRDRAM = 1;
frameBufferEmulation.detectCFB = 0;
frameBufferEmulation.N64DepthCompare = 0;
frameBufferEmulation.aspect = 1;
frameBufferEmulation.validityCheckMethod = 0;
textureFilter.txCacheSize = 100 * gc_uMegabyte;
textureFilter.txDump = 0;

View File

@ -53,6 +53,7 @@ struct Config
u32 detectCFB;
u32 N64DepthCompare;
u32 aspect; // 0: stretch ; 1: 4/3 ; 2: 16/9
u32 validityCheckMethod; // 0: checksum; 1: fill RDRAM
} frameBufferEmulation;
struct

View File

@ -364,8 +364,12 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
if (m_pCurrent->m_width == VI.width)
gDP.colorImage.height = min(gDP.colorImage.height, VI.height);
m_pCurrent->m_endAddress = min(RDRAMSize, m_pCurrent->m_startAddress + (((m_pCurrent->m_width * gDP.colorImage.height) << m_pCurrent->m_size >> 1) - 1));
if (!config.frameBufferEmulation.copyFromRDRAM && !bMarioTennisScoreboard && !m_pCurrent->m_isDepthBuffer && m_pCurrent->m_RdramCrc == 0 && !m_pCurrent->m_cfb && !m_pCurrent->m_cleared && gDP.colorImage.height > 1)
gDPFillRDRAM(m_pCurrent->m_startAddress, 0, 0, m_pCurrent->m_width, gDP.colorImage.height, m_pCurrent->m_width, m_pCurrent->m_size, m_pCurrent->m_fillcolor, false);
if (!config.frameBufferEmulation.copyFromRDRAM && !bMarioTennisScoreboard && !m_pCurrent->m_isDepthBuffer && m_pCurrent->m_RdramCrc == 0 && !m_pCurrent->m_cfb && !m_pCurrent->m_cleared && gDP.colorImage.height > 1) {
if (config.frameBufferEmulation.validityCheckMethod == 0)
m_pCurrent->m_RdramCrc = textureCRC(RDRAM + m_pCurrent->m_startAddress, m_pCurrent->m_height, m_pCurrent->m_width << m_pCurrent->m_size >> 1);
else
gDPFillRDRAM(m_pCurrent->m_startAddress, 0, 0, m_pCurrent->m_width, gDP.colorImage.height, m_pCurrent->m_width, m_pCurrent->m_size, m_pCurrent->m_fillcolor, false);
}
}
m_pCurrent = _findBuffer(m_pCurrent->m_startAddress, m_pCurrent->m_endAddress, m_pCurrent->m_width);
}
@ -397,6 +401,8 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
m_pCurrent->m_pResolveTexture->format = _format;
m_pCurrent->m_pResolveTexture->size = _size;
}
if (m_pCurrent->m_RdramCrc != 0)
m_pCurrent->m_RdramCrc = textureCRC(RDRAM + m_pCurrent->m_startAddress, m_pCurrent->m_height, m_pCurrent->m_width << m_pCurrent->m_size >> 1);
}
}
}

View File

@ -76,6 +76,8 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableN64DepthCompare", 0, "Enable N64 depth compare instead of OpenGL standard one. Experimental.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "ValidityCheckMethod", 0, "Method to check validity of texture frame buffer (0=by checksum, 1=fill RDRAM.");
assert(res == M64ERR_SUCCESS);
//#Texture filter settings
res = ConfigSetDefaultInt(g_configVideoGliden64, "txFilterMode", 0, "Texture filter (0=none, 1=Smooth filtering 1, 2=Smooth filtering 2, 3=Smooth filtering 3, 4=Smooth filtering 4, 5=Sharp filtering 1, 6=Sharp filtering 2)");
assert(res == M64ERR_SUCCESS);
@ -161,6 +163,7 @@ void Config_LoadConfig()
config.frameBufferEmulation.copyFromRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyColorFromRDRAM");
config.frameBufferEmulation.detectCFB = ConfigGetParamBool(g_configVideoGliden64, "EnableDetectCFB");
config.frameBufferEmulation.N64DepthCompare = ConfigGetParamBool(g_configVideoGliden64, "EnableN64DepthCompare");
config.frameBufferEmulation.validityCheckMethod = ConfigGetParamBool(g_configVideoGliden64, "ValidityCheckMethod");
config.generalEmulation.hacks = 0;
//#Texture filter settings
config.textureFilter.txFilterMode = ConfigGetParamInt(g_configVideoGliden64, "txFilterMode");