1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Implement fake copy color buffer to RDRAM for Zelda OOT.

Fixed Ocarina of Time pause delay #327
This commit is contained in:
Sergey Lipskiy 2015-04-04 16:32:17 +06:00
parent 7c91526edc
commit ebc5d5bef3
3 changed files with 37 additions and 1 deletions

View File

@ -98,6 +98,7 @@ struct Config
#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.
#define hack_pilotWings (1<<4) //Special blend mode for PilotWings.
#define hack_subscreen (1<<5) //Fix subscreen delay in Zelda OOT
extern Config config;

View File

@ -40,6 +40,8 @@ public:
void CopyToRDRAM(u32 _address);
private:
void _copyWhite(FrameBuffer * _pBuffer);
struct RGBA {
u8 r, g, b, a;
};
@ -787,13 +789,42 @@ void FrameBufferToRDRAM::Destroy() {
}
}
void FrameBufferToRDRAM::CopyToRDRAM(u32 _address) {
void FrameBufferToRDRAM::_copyWhite(FrameBuffer * _pBuffer)
{
if (_pBuffer->m_size == G_IM_SIZ_32b) {
u32 *ptr_dst = (u32*)(RDRAM + _pBuffer->m_startAddress);
for (u32 y = 0; y < VI.height; ++y) {
for (u32 x = 0; x < VI.width; ++x)
ptr_dst[x + y*VI.width] = 0xFFFFFFFF;
}
}
else {
u16 *ptr_dst = (u16*)(RDRAM + _pBuffer->m_startAddress);
for (u32 y = 0; y < VI.height; ++y) {
for (u32 x = 0; x < VI.width; ++x) {
ptr_dst[(x + y*VI.width) ^ 1] = 0xFFFF;
}
}
}
_pBuffer->m_RdramCrc = Adler32(0, RDRAM + _pBuffer->m_startAddress, (VI.width*VI.height) << _pBuffer->m_size >> 1);
_pBuffer->m_cleared = false;
}
void FrameBufferToRDRAM::CopyToRDRAM(u32 _address)
{
if (VI.width == 0) // H width is zero. Don't copy
return;
FrameBuffer *pBuffer = frameBufferList().findBuffer(_address);
if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen)
return;
if ((config.generalEmulation.hacks & hack_subscreen) != 0) {
_copyWhite(pBuffer);
return;
}
_address = pBuffer->m_startAddress;
if (config.video.multisampling != 0) {
pBuffer->resolveMultisampledTexture();

View File

@ -323,6 +323,10 @@ void RSP_Init()
config.generalEmulation.hacks |= hack_scoreboard;
else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != NULL)
config.generalEmulation.hacks |= hack_pilotWings;
else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != NULL ||
strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != NULL
)
config.generalEmulation.hacks |= hack_subscreen;
api().FindPluginPath(RSP.pluginpath);