diff --git a/Config.h b/Config.h index 785cfca6..63afad79 100644 --- a/Config.h +++ b/Config.h @@ -98,6 +98,7 @@ struct Config #define hack_blurPauseScreen (1<<2) //Game copies frame buffer to depth buffer area, CPU blurs it. That image is used as background for pause screen. #define hack_scoreboard (1<<3) //Copy data from RDRAM to auxilary frame buffer. Scoreboard in Mario Tennis. #define hack_pilotWings (1<<4) //Special blend mode for PilotWings. +#define hack_subscreen (1<<5) //Fix subscreen delay in Zelda OOT extern Config config; diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 86fe27dc..9866711e 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -40,6 +40,8 @@ public: void CopyToRDRAM(u32 _address); private: + void _copyWhite(FrameBuffer * _pBuffer); + struct RGBA { u8 r, g, b, a; }; @@ -787,13 +789,42 @@ void FrameBufferToRDRAM::Destroy() { } } -void FrameBufferToRDRAM::CopyToRDRAM(u32 _address) { +void FrameBufferToRDRAM::_copyWhite(FrameBuffer * _pBuffer) +{ + if (_pBuffer->m_size == G_IM_SIZ_32b) { + u32 *ptr_dst = (u32*)(RDRAM + _pBuffer->m_startAddress); + + for (u32 y = 0; y < VI.height; ++y) { + for (u32 x = 0; x < VI.width; ++x) + ptr_dst[x + y*VI.width] = 0xFFFFFFFF; + } + } + else { + u16 *ptr_dst = (u16*)(RDRAM + _pBuffer->m_startAddress); + + for (u32 y = 0; y < VI.height; ++y) { + for (u32 x = 0; x < VI.width; ++x) { + ptr_dst[(x + y*VI.width) ^ 1] = 0xFFFF; + } + } + } + _pBuffer->m_RdramCrc = Adler32(0, RDRAM + _pBuffer->m_startAddress, (VI.width*VI.height) << _pBuffer->m_size >> 1); + _pBuffer->m_cleared = false; +} + +void FrameBufferToRDRAM::CopyToRDRAM(u32 _address) +{ if (VI.width == 0) // H width is zero. Don't copy return; FrameBuffer *pBuffer = frameBufferList().findBuffer(_address); if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen) return; + if ((config.generalEmulation.hacks & hack_subscreen) != 0) { + _copyWhite(pBuffer); + return; + } + _address = pBuffer->m_startAddress; if (config.video.multisampling != 0) { pBuffer->resolveMultisampledTexture(); diff --git a/RSP.cpp b/RSP.cpp index 27bc3e01..07d58e37 100644 --- a/RSP.cpp +++ b/RSP.cpp @@ -323,6 +323,10 @@ void RSP_Init() config.generalEmulation.hacks |= hack_scoreboard; else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != NULL) config.generalEmulation.hacks |= hack_pilotWings; + else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != NULL || + strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != NULL + ) + config.generalEmulation.hacks |= hack_subscreen; api().FindPluginPath(RSP.pluginpath);