Skip to content

Commit

Permalink
Merge pull request #18650 from hrydgard/tokimeki-vertical-fb-fix
Browse files Browse the repository at this point in the history
Allow merging framebuffers vertically like the old Juiced 2 fix.
  • Loading branch information
hrydgard committed Dec 30, 2023
2 parents de0d82d + a6f0415 commit 3d08b14
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
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
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
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
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

0 comments on commit 3d08b14

Please sign in to comment.