Fix issue with raw screenshots not always being cropped correctly

Fixes #21664
This commit is contained in:
Henrik Rydgård committed 2026-05-12 10:12:41 +02:00
1 parent 575960c57f
commit e0d6664e85
3 files changed
+14 -7

No files matched your search

+5 -7
View File
@@ -394,6 +394,10 @@ bool ScreenshotNotifyPostGameRender(Draw::DrawContext *draw) {
if (buf.IsBackBuffer()) {
w = buf.GetStride();
h = buf.GetHeight();
} else if (maxRes < 0 && buf.GetScaleFactor() > 0) {
// Normal case. Crop to the current screen size if it's larger (some games render to large buffers and display a subset).
w = 480 * buf.GetScaleFactor();
h = 272 * buf.GetScaleFactor();
} else {
w = maxRes > 0 ? 480 * maxRes : buf.GetStride();
h = maxRes > 0 ? 272 * maxRes : buf.GetHeight();
@@ -491,7 +495,7 @@ bool Save8888RGBAScreenshot(std::vector<uint8_t> &bufferPNG, const u8 *bufferRGB
return success;
}
void TakeUserScreenshotImpl() {
void TakeUserScreenshot() {
Path path = GetSysDirectory(DIRECTORY_SCREENSHOT);
// Make sure the screenshot directory exists.
File::CreateDir(path);
@@ -553,9 +557,3 @@ void TakeUserScreenshotImpl() {
// TODO: What to do about ScreenshotNotPossible?
});
}
void TakeUserScreenshot() {
System_RunOnMainThread([]() {
TakeUserScreenshotImpl();
});
}