From e5f0f956639c1ebb09575ccc571fde3b5bffc9d2 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sun, 10 Mar 2024 19:31:53 +0700 Subject: [PATCH] Correct subscreen hack see #2784 --- src/BufferCopy/ColorBufferToRDRAM.cpp | 5 +++-- src/FrameBuffer.cpp | 4 ++++ src/gDP.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/BufferCopy/ColorBufferToRDRAM.cpp b/src/BufferCopy/ColorBufferToRDRAM.cpp index e79785e3d..66c8f62e7 100644 --- a/src/BufferCopy/ColorBufferToRDRAM.cpp +++ b/src/BufferCopy/ColorBufferToRDRAM.cpp @@ -214,9 +214,10 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync) u32 *ptr_src = (u32*)pPixels; u16 *ptr_dst = (u16*)(RDRAM + _startAddress); m_blueNoiseIdx++; - if ((config.generalEmulation.hacks & hack_subscreen) != 0u && height == 1u) + if (gDP.m_subscreen) { copyWhiteToRDRAM(m_pCurFrameBuffer); - else + gDP.m_subscreen = false; + } else writeToRdram(ptr_src, ptr_dst, &ColorBufferToRDRAM::_RGBAtoRGBA16, dummyTester, 1, width, height, numPixels, _startAddress, m_pCurFrameBuffer->m_startAddress, m_pCurFrameBuffer->m_size); } else if (m_pCurFrameBuffer->m_size == G_IM_SIZ_8b) { u8 *ptr_src = (u8*)pPixels; diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index b5c2fa636..68cf2bf4d 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -918,6 +918,10 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt wnd.getDrawer().clearDepthBuffer(); } + if ((config.generalEmulation.hacks & hack_subscreen) != 0u && + _format == G_IM_FMT_I && _size == G_IM_SIZ_8b) + gDP.m_subscreen = gDP.otherMode._u64 == 0x00000cf00f0a0004; + m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress; m_pCurrent->m_isPauseScreen = m_pCurrent->m_isOBScreen = false; m_pCurrent->m_copied = false; diff --git a/src/gDP.h b/src/gDP.h index b698158ad..e118b64dd 100644 --- a/src/gDP.h +++ b/src/gDP.h @@ -270,6 +270,7 @@ struct gDPInfo gDPLoadTileInfo loadInfo[512]; gDPTexrectInfo lastTexRectInfo; texCoordBounds m_texCoordBounds; + bool m_subscreen{ false }; }; extern gDPInfo gDP;