From b7d402aacf99e9678fc3d730cdb5820687533f4c Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 14 Oct 2015 10:06:50 +1100 Subject: [PATCH] [Glide64] Subscreen delay fix for zelda OoT https://github.com/mupen64plus/mupen64plus-video-glide64mk2/commit/f3b47bbe40c7050ab0963d8eb34fca61941b5ae5 --- Source/Glide64/Main.cpp | 4 +++- Source/Glide64/rdp.cpp | 26 +++++++++++++++++++++++++- Source/Glide64/rdp.h | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 9289198cb..070f62320 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -411,7 +411,9 @@ void ReadSpecialSettings (const char * name) settings.hacks = 0; //detect games which require special hacks - if (strstr(name, (const char *)"ZELDA") || strstr(name, (const char *)"MASK")) + if (strstr(name, (const char *)"ZELDA")) + settings.hacks |= (hack_Zelda | hack_OoT); + else if(strstr(name, (const char *)"MASK")) settings.hacks |= hack_Zelda; else if (strstr(name, (const char *)"ROADSTERS TROPHY")) settings.hacks |= hack_Zelda; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 52213cf07..ed14f488f 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -470,6 +470,26 @@ static void DrawPartFrameBufferToScreen() ((wxUint32)((float)((color&0x07C0) >> 6) / 31.0f * 255.0f) << 16) | \ ((wxUint32)((float)((color&0x003E) >> 1) / 31.0f * 255.0f) << 8) +static void copyWhiteToRDRAM() +{ + if(rdp.ci_width == 0) + return; + + wxUint16 *ptr_dst = (wxUint16*)(gfx.RDRAM + rdp.cimg); + wxUint32 *ptr_dst32 = (wxUint32*)(gfx.RDRAM + rdp.cimg); + + for(wxUint32 y = 0; y < rdp.ci_height; y++) + { + for(wxUint32 x = 0; x < rdp.ci_width; x++) + { + if(rdp.ci_size == 2) + ptr_dst[(x + y * rdp.ci_width) ^ 1] = 0xFFFF; + else + ptr_dst32[x + y * rdp.ci_width] = 0xFFFFFFFF; + } + } +} + static void CopyFrameBuffer (GrBuffer_t buffer = GR_BUFFER_BACKBUFFER) { if (!fullscreen) @@ -892,8 +912,12 @@ EXPORT void CALL ProcessDList(void) rdp.scale_x = rdp.scale_x_bak; rdp.scale_y = rdp.scale_y_bak; } - if (settings.frame_buffer & fb_ref) + + if(settings.hacks & hack_OoT) + copyWhiteToRDRAM(); //Subscreen delay fix + else if (settings.frame_buffer & fb_ref) CopyFrameBuffer (); + if (rdp.cur_image) CloseTextureBuffer(rdp.read_whole_frame && ((settings.hacks&hack_PMario) || rdp.swap_ci_index >= 0)); diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index fff889af6..b5aae5164 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -330,6 +330,7 @@ typedef struct { #define hack_Tonic (1<<26) //tonic trouble #define hack_Yoshi (1<<27) //Yoshi Story #define hack_Zelda (1<<28) //zeldas hacks + #define hack_OoT (1<<29) //zelda OoT hacks wxUint32 hacks; //wrapper settings