diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 3035c25a..0c331e45 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -422,6 +422,18 @@ void FrameBufferList::removeBuffer(u32 _address ) } } +void FrameBufferList::removeBuffers(u32 _width, u32 _height) +{ + m_pCurrent = NULL; + for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { + while (iter->m_width == _width && iter->m_height == _height) { + iter = m_list.erase(iter); + if (iter == m_list.end()) + return; + } + } +} + void FrameBufferList::attachDepthBuffer() { if (m_pCurrent == NULL) diff --git a/FrameBuffer.h b/FrameBuffer.h index 329501c8..4577d7db 100644 --- a/FrameBuffer.h +++ b/FrameBuffer.h @@ -50,6 +50,7 @@ public: void destroy(); void saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, u16 _height, bool _cfb); void removeBuffer(u32 _address); + void removeBuffers(u32 _width, u32 _height); void attachDepthBuffer(); FrameBuffer * findBuffer(u32 _startAddress); FrameBuffer * findTmpBuffer(u32 _address); diff --git a/VI.cpp b/VI.cpp index 7df68a40..9a206ee8 100644 --- a/VI.cpp +++ b/VI.cpp @@ -67,10 +67,10 @@ void VI_UpdateSize() // const int divot = ((*REG.VI_STATUS) >> 4) & 1; if (config.frameBufferEmulation.enable && (interlacedPrev != VI.interlaced || widthPrev != VI.width || heightPrev != VI.height)) { - frameBufferList().destroy(); + frameBufferList().removeBuffers(widthPrev, heightPrev); + frameBufferList().removeBuffers(VI.width, VI.height); depthBufferList().destroy(); depthBufferList().init(); - frameBufferList().init(); } VI.rwidth = VI.width != 0 ? 1.0f / VI.width : 0.0f;