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

Correct dirty hack for Mario Tennis scoreboard:

- do not clear RDRAM area for screboard buffers
- reload scoreboard texture to the buffer when buffer is selected or its height is corrected.
This commit is contained in:
Sergey Lipskiy 2015-03-15 11:31:43 +06:00
parent ff085b0cbf
commit 9935dab147
4 changed files with 22 additions and 7 deletions

View File

@ -91,9 +91,10 @@ struct Config
void resetToDefaults();
};
#define hack_Ogre64 (1<<0) //Ogre Battle 64 background copy
#define hack_noDepthFrameBuffers (1<<1) //Do not use depth buffers as texture
#define hack_blurPauseScreen (2<<1) //Game copies frame buffer to depth buffer area, CPU blurs it. That image is used as background for pause screen.
#define hack_Ogre64 (1<<0) //Ogre Battle 64 background copy
#define hack_noDepthFrameBuffers (1<<1) //Do not use depth buffers as texture
#define hack_blurPauseScreen (1<<2) //Game copies frame buffer to depth buffer area, CPU blurs it. That image is used as background for pause screen.
#define hack_scoreboard (1<<3) //Copy data from RDRAM to auxilary frame buffer. Scoreboard in Mario Tennis.
extern Config config;

View File

@ -270,6 +270,11 @@ void FrameBufferList::setBufferChanged()
}
}
bool FrameBufferList::_isMarioTennisScoreboard()
{
return (config.generalEmulation.hacks&hack_scoreboard) != 0 && m_pCurrent != NULL && (m_pCurrent->m_startAddress == 0x13ba50 || m_pCurrent->m_startAddress == 0x264430);
}
void FrameBufferList::correctHeight()
{
if (m_pCurrent == NULL)
@ -283,6 +288,10 @@ void FrameBufferList::correctHeight()
m_pCurrent->reinit((u32)gDP.scissor.lry);
else
m_pCurrent->m_height = (u32)gDP.scissor.lry;
if (_isMarioTennisScoreboard())
g_RDRAMtoFB.CopyFromRDRAM(m_pCurrent->m_startAddress + 4, false);
m_pCurrent->m_needHeightCorrection = false;
gSP.changed |= CHANGED_VIEWPORT;
}
@ -338,12 +347,14 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
{
if (VI.width == 0 || _height == 0)
return;
const bool bMarioTennisScoreboard = _isMarioTennisScoreboard();
OGLVideo & ogl = video();
if (m_pCurrent != NULL && gDP.colorImage.height > 0) {
if (m_pCurrent->m_width == VI.width)
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));
if (!config.frameBufferEmulation.copyFromRDRAM && !m_pCurrent->m_isDepthBuffer && m_pCurrent->m_RdramCrc == 0 && !m_pCurrent->m_cfb && !m_pCurrent->m_cleared && gDP.colorImage.height > 1)
if (!config.frameBufferEmulation.copyFromRDRAM && !bMarioTennisScoreboard && !m_pCurrent->m_isDepthBuffer && m_pCurrent->m_RdramCrc == 0 && !m_pCurrent->m_cfb && !m_pCurrent->m_cleared && gDP.colorImage.height > 1)
gDPFillRDRAM(m_pCurrent->m_startAddress, 0, 0, m_pCurrent->m_width, gDP.colorImage.height, m_pCurrent->m_width, m_pCurrent->m_size, m_pCurrent->m_fillcolor, false);
m_pCurrent = _findBuffer(m_pCurrent->m_startAddress, m_pCurrent->m_endAddress, m_pCurrent->m_width);
}
@ -394,9 +405,9 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
address, (depthBuffer.top != NULL && depthBuffer.top->renderbuf > 0) ? depthBuffer.top->address : 0
);
#endif
// HACK ALERT: Dirty hack for Mario Tennis score board
if (bNew && (m_pCurrent->m_startAddress == 0x13ba50 || m_pCurrent->m_startAddress == 0x264430))
g_RDRAMtoFB.CopyFromRDRAM(m_pCurrent->m_startAddress, false);
if (bMarioTennisScoreboard)
g_RDRAMtoFB.CopyFromRDRAM(m_pCurrent->m_startAddress + 4, false);
m_pCurrent->m_cleared = false;
m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress;

View File

@ -71,6 +71,7 @@ private:
FrameBufferList(const FrameBufferList &);
FrameBuffer * _findBuffer(u32 _startAddress, u32 _endAddress, u32 _width);
bool _isMarioTennisScoreboard();
typedef std::list<FrameBuffer> FrameBuffers;
FrameBuffers m_list;

View File

@ -333,6 +333,8 @@ void RSP_Init()
strstr(RSP.romname, (const char *)"MICKEY USA") != NULL
)
config.generalEmulation.hacks |= hack_blurPauseScreen;
else if (strstr(RSP.romname, (const char *)"MarioTennis") != NULL)
config.generalEmulation.hacks |= hack_scoreboard;
api().FindPluginPath(RSP.pluginpath);