Merge pull request #18822 from hrydgard/safer-tokimeki-fix

Avoid vertically merging the two main framebuffers, even if FramebufferAllowLargeVerticalOffset is on.
This commit is contained in:
Henrik Rydgård 2024-02-04 11:40:31 +01:00 committed by GitHub
commit b28502a07e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -425,7 +425,8 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer
vfb->height = drawing_height;
}
break;
} else if (!PSP_CoreParameter().compat.flags().DisallowFramebufferAtOffset && v->fb_stride == params.fb_stride && v->fb_format == params.fb_format && !PSP_CoreParameter().compat.flags().SplitFramebufferMargin) {
} else if (!PSP_CoreParameter().compat.flags().DisallowFramebufferAtOffset && !PSP_CoreParameter().compat.flags().SplitFramebufferMargin &&
v->fb_stride == params.fb_stride && v->fb_format == params.fb_format) {
u32 v_fb_first_line_end_ptr = v->fb_address + v->fb_stride * bpp;
u32 v_fb_end_ptr = v->fb_address + v->fb_stride * v->height * bpp;
@ -441,7 +442,9 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer
drawing_width += x_offset;
break;
}
} else if (PSP_CoreParameter().compat.flags().FramebufferAllowLargeVerticalOffset && params.fb_address > v->fb_address && v->fb_stride > 0 && (params.fb_address - v->fb_address) % v->FbStrideInBytes() == 0) {
} else if (PSP_CoreParameter().compat.flags().FramebufferAllowLargeVerticalOffset &&
params.fb_address > v->fb_address && v->fb_stride > 0 && (params.fb_address - v->fb_address) % v->FbStrideInBytes() == 0 &&
params.fb_address != 0x04088000 && v->fb_address != 0x04000000) { // Heuristic to avoid merging the main framebuffers.
int y_offset = (params.fb_address - v->fb_address) / v->FbStrideInBytes();
if (y_offset <= v->bufferHeight) { // note: v->height is misdetected as 256 instead of 272 here in tokimeki. Note that 272 is just the height of the upper part, it's supersampling vertically.
vfb = v;

View File

@ -1460,7 +1460,6 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
Achievements::FrameUpdate();
}
_dbg_assert_(gpu);
if (gpu && gpu->PresentedThisFrame()) {
framebufferBound = true;
}