From f4e1afa30cbd6246970418b8cdba6a1040fcd73e Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Mon, 9 Mar 2015 20:24:23 +0600 Subject: [PATCH] Split hack_noDepthFrameBuffers on two options: hack_noDepthFrameBuffers and hack_blurPauseScreen. hack_blurPauseScreen is for games, which copy color buffer into depth buffer area, blur it and use as background image. Examples: Conker BFD, Mickey USA hack_noDepthFrameBuffers is for games, which never use depth buffer area as texture Example: F-1 Pole Position, Mario Golf. --- Config.h | 1 + FrameBuffer.cpp | 4 +--- RSP.cpp | 7 +++++-- gDP.cpp | 8 ++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Config.h b/Config.h index b7355079..472abfd7 100644 --- a/Config.h +++ b/Config.h @@ -93,6 +93,7 @@ struct Config #define hack_Ogre64 (1<<0) //Ogre Battle 64 background copy #define hack_noDepthFrameBuffers (1<<1) //Do not use depth buffers as texture +#define hack_blurPauseScreen (2<<1) //Game copies frame buffer to depth buffer area, CPU blurs it. That image is used as background for pause screen. extern Config config; diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index f9e7c140..55aa174c 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -956,10 +956,8 @@ bool DepthBufferToRDRAM::CopyToRDRAM( u32 _address) { pDepthBuffer->m_cleared = false; pBuffer = frameBufferList().findBuffer(pDepthBuffer->m_address); - if (pBuffer != NULL) { - pBuffer->m_RdramCrc = CRC_Calculate(0xFFFFFFFF, RDRAM + pDepthBuffer->m_address, (VI.width*VI.height) << pBuffer->m_size >> 1); + if (pBuffer != NULL) pBuffer->m_cleared = false; - } glUnmapBuffer(GL_PIXEL_PACK_BUFFER); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); diff --git a/RSP.cpp b/RSP.cpp index bde4193a..8b02c542 100644 --- a/RSP.cpp +++ b/RSP.cpp @@ -325,10 +325,13 @@ void RSP_Init() if (strstr(RSP.romname, (const char *)"OgreBattle64") != NULL) config.generalEmulation.hacks |= hack_Ogre64; else if (strstr(RSP.romname, (const char *)"MarioGolf64") != NULL || - strstr(RSP.romname, (const char *)"CONKER BFD") != NULL || - strstr(RSP.romname, (const char *)"MICKEY USA") != NULL + strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != NULL ) config.generalEmulation.hacks |= hack_noDepthFrameBuffers; + else if (strstr(RSP.romname, (const char *)"CONKER BFD") != NULL || + strstr(RSP.romname, (const char *)"MICKEY USA") != NULL + ) + config.generalEmulation.hacks |= hack_blurPauseScreen; api().FindPluginPath(RSP.pluginpath); diff --git a/gDP.cpp b/gDP.cpp index 34276bb7..809949a1 100644 --- a/gDP.cpp +++ b/gDP.cpp @@ -514,13 +514,12 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes) return false; FrameBuffer *pBuffer = frameBufferList().findBuffer(_address); - const bool noDepthBuffers = (config.generalEmulation.hacks & hack_noDepthFrameBuffers) != 0; bool bRes = pBuffer != NULL; if ((bRes) //&& ((*(u32*)&RDRAM[pBuffer->startAddress] & 0xFFFEFFFE) == (pBuffer->startAddress & 0xFFFEFFFE)) // Does not work for Jet Force Gemini ) { - if (noDepthBuffers) { + if ((config.generalEmulation.hacks & hack_blurPauseScreen) != 0) { if (gDP.colorImage.address == gDP.depthImageAddress && pBuffer->m_RdramCrc != 0) { memcpy(RDRAM + gDP.depthImageAddress, RDRAM + pBuffer->m_startAddress, (pBuffer->m_width*pBuffer->m_height) << pBuffer->m_size >> 1); pBuffer->m_RdramCrc = 0; @@ -530,6 +529,11 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes) bRes = false; } + if ((config.generalEmulation.hacks & hack_noDepthFrameBuffers) != 0 && pBuffer->m_isDepthBuffer) { + frameBufferList().removeBuffer(pBuffer->m_startAddress); + bRes = false; + } + const u32 texEndAddress = _address + _bytes - 1; if (_address > pBuffer->m_startAddress && texEndAddress > (pBuffer->m_endAddress + (pBuffer->m_width << pBuffer->m_size >> 1))) { //frameBufferList().removeBuffer(pBuffer->m_startAddress);