From 395eb362f1fc9c3cf8b58273937840dd946eb215 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Mon, 16 Mar 2015 19:52:43 +0600 Subject: [PATCH] Don't save depth buffer when found buffer's width is less than VI.width. Otherwise out of memory writes are possible. That may happen when switching from interlaced to non-interlaced mode. Fixed crash/freeze in Perfect Dark, issue #285 --- FrameBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 66677703..5f3cf7d7 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -938,7 +938,7 @@ bool DepthBufferToRDRAM::CopyToRDRAM( u32 _address) { if (m_lastDList == RSP.DList) // Already read; return false; FrameBuffer *pBuffer = frameBufferList().findBuffer(_address); - if (pBuffer == NULL || pBuffer->m_pDepthBuffer == NULL || !pBuffer->m_pDepthBuffer->m_cleared) + if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_pDepthBuffer == NULL || !pBuffer->m_pDepthBuffer->m_cleared) return false; m_lastDList = RSP.DList;