Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow merging framebuffers vertically like the old Juiced 2 fix. #18650

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "ForceUMDReadSpeed", &flags_.ForceUMDReadSpeed);
CheckSetting(iniFile, gameID, "AllowDelayedReadbacks", &flags_.AllowDelayedReadbacks);
CheckSetting(iniFile, gameID, "TacticsOgreEliminateDebugReadback", &flags_.TacticsOgreEliminateDebugReadback);
CheckSetting(iniFile, gameID, "FramebufferAllowLargeVerticalOffset", &flags_.FramebufferAllowLargeVerticalOffset);
}

void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct CompatFlags {
bool ForceUMDReadSpeed;
bool AllowDelayedReadbacks;
bool TacticsOgreEliminateDebugReadback;
bool FramebufferAllowLargeVerticalOffset;
};

struct VRCompat {
Expand Down
15 changes: 12 additions & 3 deletions GPU/Common/FramebufferManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,18 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer
drawing_width += x_offset;
break;
}
} else {
// We ignore this match.
// TODO: We can allow X/Y overlaps too, but haven't seen any so safer to not.
} 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) {
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;
WARN_LOG_REPORT_ONCE(tokimeki, FRAMEBUF, "Detected FBO at Y offset %d of %08x: %08x", y_offset, v->fb_address, params.fb_address);
gstate_c.SetCurRTOffset(0, y_offset);
vfb->height = std::max((int)vfb->height, y_offset + drawing_height);
drawing_height += y_offset;
// We ignore this match.
// TODO: We can allow X/Y overlaps too, but haven't seen any so safer to not.
break;
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,13 @@ ULES00928 = true
ULUS10312 = true
ULKS46154 = true

[FramebufferAllowLargeVerticalOffset]
# Tokimeki Memorial 4 (see #6379)
NPJH50127 = true
ULKS46226 = true
ULAS42206 = true
ULJM05541 = true

[AtracLoopHack]
#Atrac looped incorrectly see #7601 #13773 #11586 #10139 #12083

Expand Down