VSH: Boot games the XMB starts like any other game launch

A disc game or memory stick EBOOT started from the XMB used to be swapped in under the XMB's session,
so it ran without its PARAM.SFO, compat flags, game config, window title, savestates and so on.
Much of that is decided once, at boot (the memory map, the GPU backend, the shader cache), so
sceKernelLoadExec now asks the frontend for a reboot into the disc image or EBOOT (PSP_RequestBoot)
and stops. The app and headless boot it like a game from the game list.

The game keeps the XMB's launch args (CoreParameter::launchedFromVSH), so exiting boots the XMB
again, with the disc that's in the drive and those args, and the XMB comes back where it was without
auto-starting the disc. Homebrew keeps the disc that was in the drive. A disc whose executables are
all zeroes (the EUR Video Demo Disc's "game") still loads in place and fails back to the XMB.

In headless, the run carries on through the reboot, starting stopped under the debugger like the
first boot, since the reboot loses a pending cpu.runUntilTime.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-23 13:36:28 +02:00
1 parent 4c51104940
commit b547e01c9d
13 files changed
+277 -18

No files matched your search

+41
View File
@@ -92,6 +92,9 @@ enum CPUThreadState {
MetaFileSystem pspFileSystem;
ParamSFOData g_paramSFO;
ParamSFOData g_paramSFORaw;
static std::mutex g_bootRequestLock;
static std::optional<BootRequest> g_bootRequest;
static GlobalUIState globalUIState;
CoreParameter g_CoreParameter;
static FileLoader *g_loadedFile;
@@ -791,6 +794,12 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
IncrementDebugCounter(DebugCounter::GAME_BOOT);
{
// One the frontend didn't act on (the user stopped the game instead) is stale now.
std::lock_guard<std::mutex> guard(g_bootRequestLock);
g_bootRequest.reset();
}
g_bootState = BootState::Booting;
g_loaderDone = false;
g_loaderFailed = false;
@@ -933,6 +942,38 @@ BootState PollBootState() {
return g_bootState;
}
void BootRequest::ApplyTo(CoreParameter *coreParam) const {
coreParam->fileToStart = fileToStart;
coreParam->mountIso = mountIso;
coreParam->launchedFromVSH = launchedFromVSH;
coreParam->vshmainArgs = vshmainArgs;
coreParam->umdAutoboot.reset();
}
void PSP_RequestBoot(const BootRequest &request) {
INFO_LOG(Log::Loader, "Rebooting into %s (disc: %s)", request.fileToStart.c_str(), request.mountIso.c_str());
{
std::lock_guard<std::mutex> guard(g_bootRequestLock);
g_bootRequest = request;
}
Core_Stop();
}
bool PSP_HasBootRequest() {
std::lock_guard<std::mutex> guard(g_bootRequestLock);
return g_bootRequest.has_value();
}
bool PSP_TakeBootRequest(BootRequest *request) {
std::lock_guard<std::mutex> guard(g_bootRequestLock);
if (!g_bootRequest) {
return false;
}
*request = std::move(*g_bootRequest);
g_bootRequest.reset();
return true;
}
void PSP_Shutdown(bool success) {
// Do nothing if we never inited.
if (g_bootState == BootState::Off) {