1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Do not use frame buffer as texture if the buffer is just allocated.

Fixed tripleplay2000: black background in game #346

Problem: The game allocates auxiliary buffer with the same width
as the main one. Plugin detects it as main buffer and set its width
and height as of main buffer. Actual buffer height is half of main
buffer height, but it became known only when game switches to the
main buffer. Wrong buffer height leads to wrong calculation of
buffer address space. Game uses textures with addresses behind
the actual buffer’s address space but within calculated one.
Plugin tries to use buffer texture instead and, as the result,
everything is black.

Solution: The situation is bad. Plugin cannot detect that
allocated buffer is an aux one. I decided to forbid buffer usage
as texture if buffer is new. New buffer is blank, so reading from
it is strange. N64 games do lots of strange stuff, so this solution
is potentially dangerous.
This commit is contained in:
Sergey Lipskiy 2016-10-29 23:46:39 +07:00
parent df366f0f6b
commit 1d87a92c72
3 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,8 @@ FrameBuffer::FrameBuffer() :
m_startAddress(0), m_endAddress(0), m_size(0), m_width(0), m_height(0), m_validityChecked(0),
m_scaleX(0), m_scaleY(0),
m_copiedToRdram(false), m_fingerprint(false), m_cleared(false), m_changed(false), m_cfb(false),
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_needHeightCorrection(false),
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false),
m_needHeightCorrection(false), m_readable(false),
m_loadType(LOADTYPE_BLOCK), m_pDepthBuffer(nullptr),
m_resolveFBO(0), m_pResolveTexture(nullptr), m_resolved(false),
m_SubFBO(0), m_pSubTexture(nullptr)
@ -556,6 +557,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
if (m_pCurrent != nullptr) {
bPrevIsDepth = m_pCurrent->m_isDepthBuffer;
m_pCurrent->m_readable = true;
// Correct buffer's end address
if (!m_pCurrent->isAuxiliary()) {

View File

@ -38,6 +38,7 @@ struct FrameBuffer
bool m_isPauseScreen;
bool m_isOBScreen;
bool m_needHeightCorrection;
bool m_readable;
struct {
u32 uls, ult;

View File

@ -380,7 +380,7 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes)
FrameBufferList & fbList = frameBufferList();
FrameBuffer *pBuffer = fbList.findBuffer(_address);
bool bRes = pBuffer != nullptr;
bool bRes = pBuffer != nullptr && pBuffer->m_readable;
if (bRes) {
if ((config.generalEmulation.hacks & hack_blurPauseScreen) != 0) {
if (gDP.colorImage.address == gDP.depthImageAddress && pBuffer->m_copiedToRdram) {