mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Don't crash when trying to take screenshots outside a game.
This commit is contained in:
parent
a04e24c300
commit
37646d67b7
1 changed files with 5 additions and 3 deletions
|
@ -216,15 +216,17 @@ const u8 *ConvertBufferTo888RGB(const GPUDebugBuffer &buf, u8 *&temp, u32 &w, u3
|
|||
}
|
||||
|
||||
bool TakeGameScreenshot(const char *filename, ScreenshotFormat fmt, ScreenshotType type, int *width, int *height, int maxRes) {
|
||||
if (!gpuDebug) {
|
||||
ERROR_LOG(COMMON, "Can't take screenshots when GPU not running");
|
||||
return false;
|
||||
}
|
||||
GPUDebugBuffer buf;
|
||||
bool success = false;
|
||||
u32 w = (u32)-1;
|
||||
u32 h = (u32)-1;
|
||||
|
||||
if (type == SCREENSHOT_DISPLAY || type == SCREENSHOT_RENDER) {
|
||||
if (gpuDebug) {
|
||||
success = gpuDebug->GetCurrentFramebuffer(buf, type == SCREENSHOT_RENDER ? GPU_DBG_FRAMEBUF_RENDER : GPU_DBG_FRAMEBUF_DISPLAY, maxRes);
|
||||
}
|
||||
success = gpuDebug->GetCurrentFramebuffer(buf, type == SCREENSHOT_RENDER ? GPU_DBG_FRAMEBUF_RENDER : GPU_DBG_FRAMEBUF_DISPLAY, maxRes);
|
||||
|
||||
// Only crop to the top left when using a render screenshot.
|
||||
w = maxRes > 0 ? 480 * maxRes : PSP_CoreParameter().renderWidth;
|
||||
|
|
Loading…
Add table
Reference in a new issue