Merge pull request #21250 from hrydgard/more-screenshot-fixes

Fix some more screenshot problems
This commit is contained in:
Henrik Rydgård
2026-02-13 16:10:22 +01:00
committed by GitHub
8 changed files with 36 additions and 20 deletions
+10 -6
View File
@@ -320,7 +320,7 @@ static GPUDebugBuffer ApplyRotation(const GPUDebugBuffer &buf, DisplayRotation r
}
}
}
rotated.SetIsBackbuffer(buf.IsBackBuffer());
return rotated;
}
@@ -340,29 +340,31 @@ bool ScreenshotNotifyEndOfFrame(Draw::DrawContext *draw) {
return false;
}
_dbg_assert_(draw);
GPUDebugBuffer buf;
if (g_display.rotation != DisplayRotation::ROTATE_0) {
_dbg_assert_(draw);
GPUDebugBuffer temp;
if (!::GetOutputFramebuffer(draw, temp)) {
g_pendingScreenshot.callback(ScreenshotResult::ScreenshotNotPossible);
g_pendingScreenshot = {};
return false;
}
_dbg_assert_msg_(temp.IsBackBuffer(), "temp isn't backbuffer??");
buf = ApplyRotation(temp, g_display.rotation);
} else {
_dbg_assert_(draw);
if (!GetOutputFramebuffer(draw, buf)) {
if (!::GetOutputFramebuffer(draw, buf)) {
g_pendingScreenshot.callback(ScreenshotResult::ScreenshotNotPossible);
g_pendingScreenshot = {};
return false;
}
}
_dbg_assert_(buf.IsBackBuffer());
_dbg_assert_msg_(buf.IsBackBuffer(), "buf isn't backbuffer?? rotation: %d", g_display.rotation);
const int w = buf.GetStride();
const int h = buf.GetHeight();
SaveScreenshotAsync(std::move(buf), w, h, g_pendingScreenshot.maxRes);
// Wipe the screenshot state.
g_pendingScreenshot = {};
return true;
}
@@ -398,6 +400,8 @@ bool ScreenshotNotifyPostGameRender(Draw::DrawContext *draw) {
}
SaveScreenshotAsync(std::move(buf), w, h, g_pendingScreenshot.maxRes);
// Wipe the screenshot state.
g_pendingScreenshot = {};
return true;
}
+3 -1
View File
@@ -122,6 +122,7 @@ struct GPUDebugBuffer {
height_ = other.height_;
stride_ = other.stride_;
flipped_ = other.flipped_;
isBackBuffer_ = other.isBackBuffer_;
fmt_ = other.fmt_;
other.alloc_ = false;
other.data_ = nullptr;
@@ -131,7 +132,7 @@ struct GPUDebugBuffer {
Free();
}
GPUDebugBuffer &operator = (GPUDebugBuffer &&other) noexcept {
GPUDebugBuffer &operator =(GPUDebugBuffer &&other) noexcept {
if (this != &other) {
Free();
alloc_ = other.alloc_;
@@ -140,6 +141,7 @@ struct GPUDebugBuffer {
stride_ = other.stride_;
flipped_ = other.flipped_;
fmt_ = other.fmt_;
isBackBuffer_ = other.isBackBuffer_;
other.alloc_ = false;
other.data_ = nullptr;
}
+4 -3
View File
@@ -863,9 +863,6 @@ void EmuScreen::OnVKey(VirtKey virtualKeyCode, bool down) {
System_PostUIMessage(UIMessage::SAVESTATE_DISPLAY_SLOT);
}
break;
case VIRTKEY_SCREENSHOT:
TakeUserScreenshot();
break;
case VIRTKEY_RAPID_FIRE:
__CtrlSetRapidFire(down, g_Config.iRapidFireInterval);
break;
@@ -896,6 +893,10 @@ void EmuScreen::ProcessVKey(VirtKey virtKey) {
pauseTrigger_ = true;
break;
case VIRTKEY_SCREENSHOT:
TakeUserScreenshot();
break;
case VIRTKEY_TOGGLE_DEBUGGER:
g_Config.bShowImDebugger = !g_Config.bShowImDebugger;
break;
+3 -4
View File
@@ -73,11 +73,10 @@ protected:
ScreenRenderFlags PreRender(ScreenRenderMode mode) override;
// ControlListener implementations
void OnVKey(VirtKey virtualKeyCode, bool down);
void OnVKeyAnalog(VirtKey virtualKeyCode, float value);
void OnVKey(VirtKey virtualKeyCode, bool down) override;
void OnVKeyAnalog(VirtKey virtualKeyCode, float value) override;
void UpdatePSPButtons(uint32_t buttonMask, uint32_t changedMask) override;
void SetPSPAnalog(int rotation, int stick, float x, float y);
void SetRawAnalog(int deviceId, float x, float y) {}
void SetPSPAnalog(int rotation, int stick, float x, float y) override;
private:
void CreateViews() override;
+9 -5
View File
@@ -86,11 +86,7 @@ void IAPScreen::CreateViews() {
WARN_LOG(Log::System, "Purchase failed or cancelled!");
});
} else {
#if PPSSPP_PLATFORM(ANDROID)
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppssppgold");
#else
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold");
#endif
LaunchPlayStoreOrWebsiteGold();
}
});
}
@@ -125,3 +121,11 @@ void IAPScreen::CreateViews() {
rightColumnItems->Add(restorePurchases);
}
}
void LaunchPlayStoreOrWebsiteGold() {
#if PPSSPP_PLATFORM(ANDROID)
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "market://details?id=org.ppsspp.ppssppgold");
#else
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold");
#endif
}
+2
View File
@@ -16,3 +16,5 @@ private:
// This screen can also be used to direct to Play Store purchases, for example.
bool useIAP_ = false;
};
void LaunchPlayStoreOrWebsiteGold();
+4
View File
@@ -1604,7 +1604,11 @@ void LaunchBuyGold(ScreenManager *screenManager) {
if (System_GetPropertyBool(SYSPROP_USE_IAP)) {
screenManager->push(new IAPScreen(true));
} else if (System_GetPropertyBool(SYSPROP_USE_APP_STORE)) {
#if PPSSPP_PLATFORM(ANDROID)
LaunchPlayStoreOrWebsiteGold();
#else
screenManager->push(new IAPScreen(false));
#endif
} else {
#if PPSSPP_PLATFORM(IOS_APP_STORE)
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold_ios");
+1 -1
View File
@@ -46,7 +46,7 @@ protected:
bool UnsyncKey(const KeyInput &key) override;
void UnsyncAxis(const AxisInput *axes, size_t count) override;
void OnVKey(VirtKey virtualKeyCode, bool down);
void OnVKey(VirtKey virtualKeyCode, bool down) override;
private:
void CreateSavestateControls(UI::LinearLayout *viewGroup);