Permalink
Browse files

video-gliden64: more correct fix for zelda subscreen crash

  • Loading branch information...
1 parent e7a3ecd commit 415a60449fe5c12cbdeb1e33c8b9fd19236777d2 @fzurita fzurita committed Apr 12, 2016
Showing with 6 additions and 10 deletions.
  1. +6 −10 jni/mupen64plus-video-gliden64/src/FrameBuffer.cpp
@@ -546,23 +546,19 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
if (m_pCurrent != NULL) {
// Correct buffer's end address
if (!m_pCurrent->isAuxiliary()) {
-
- if(m_prevColorImageHeight == 0)
- {
- m_prevColorImageHeight = VI.height;
- }
if (gDP.colorImage.height > 200)
m_prevColorImageHeight = gDP.colorImage.height;
else if (gDP.colorImage.height == 0)
gDP.colorImage.height = m_prevColorImageHeight;
gDP.colorImage.height = min(gDP.colorImage.height, VI.height);
+ }
- m_pCurrent->m_endAddress = min(RDRAMSize, m_pCurrent->m_startAddress + (((m_pCurrent->m_width * gDP.colorImage.height) << m_pCurrent->m_size >> 1) - 1));
-
- } else if (m_pCurrent->m_needHeightCorrection && gDP.colorImage.height != 0) {
-
- m_pCurrent->m_endAddress = min(RDRAMSize, m_pCurrent->m_startAddress + (((m_pCurrent->m_width * gDP.colorImage.height) << m_pCurrent->m_size >> 1) - 1));
+ //Non-auxiliary buffers are always corrected, auxiliary buffers are correct only if they neeed correct.
+ //Also, before making any adjustments, make sure gDP.colorImage.height has a valid value.
+ if((!m_pCurrent->isAuxiliary() || m_pCurrent->m_needHeightCorrection) && gDP.colorImage.height != 0)
+ {
+ m_pCurrent->m_endAddress = min(RDRAMSize, m_pCurrent->m_startAddress + (((m_pCurrent->m_width * gDP.colorImage.height) << m_pCurrent->m_size >> 1) - 1));
}
if (!m_pCurrent->_isMarioTennisScoreboard() && !m_pCurrent->m_isDepthBuffer && !m_pCurrent->m_copiedToRdram && !m_pCurrent->m_cfb && !m_pCurrent->m_cleared && m_pCurrent->m_RdramCopy.empty() && gDP.colorImage.height > 1) {

0 comments on commit 415a604

Please sign in to comment.