headless: don't fake a framebuffer descriptor for the end-of-run screenshot

SendDebugScreenshot ignores the descriptor entirely and reads the display
framebuffer from the GPU, so filling one in was theatre - and it computed a
pointer from the display address, which is zero whenever the shell has the
display switched off.

Also reset g_screenshotSaved per test, so a test that emits its own screenshot
doesn't stop the next one getting the end-of-run capture, and clear the sceReg
open count on shutdown to match init.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-09-10 15:30:03 -06:00
1 parent 35d69dd4a1
commit e82980635b
2 files changed
+7 -7

No files matched your search

+1
View File
@@ -971,6 +971,7 @@ void __RegInit() {
void __RegShutdown() {
g_openCategories.clear();
g_openRegistryCount = 0;
}
static const KeyValue *LookupCategory(std::string_view path, int *count) {
+6 -7
View File
@@ -61,7 +61,6 @@
#include "Core/Util/PkgUnpack.h"
#include "headless/ReverseEngineer.h"
#include "Core/WebServer.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/HLE/sceUtility.h"
#include "Core/SaveState.h"
#include "GPU/GPUCommon.h"
@@ -305,6 +304,9 @@ static bool RunAutoTest(GraphicsContext *graphicsContext, CoreParameter &corePar
// Kinda ugly, trying to guesstimate the test name from filename...
currentTestName = GetTestName(coreParameter.fileToStart);
g_screenshotFailed = false;
// Per test, so a test that emits one of its own doesn't stop the next one getting the end-of-run
// capture below.
g_screenshotSaved = false;
std::string output;
if (opt.compare || opt.bench) {
@@ -410,12 +412,9 @@ static bool RunAutoTest(GraphicsContext *graphicsContext, CoreParameter &corePar
}
if (!g_screenshotSavePath.empty() && !g_screenshotSaved) {
DebugScreenshotDesc desc;
PSPPointer<u8> topaddr;
__DisplayGetFramebuf(&topaddr, &desc.stride, &desc.format, 0);
desc.data = &topaddr[0];
desc.height = 272;
SendDebugScreenshot(desc);
// SendDebugScreenshot ignores the descriptor and reads the display framebuffer from the GPU
// itself, so there's nothing to fill in here.
SendDebugScreenshot(DebugScreenshotDesc{});
}
PSP_Shutdown(true);