Xbox Cloud Gaming app for PS5 Homebrew
C
fix(ps4): leave through sceSystemServiceLoadExec("exit")
Rafael Abud Ferreira05d607de07ec
diff --git a/src/app/ps4_main.cpp b/src/app/ps4_main.cppindex 694dfac..9aab562 100644--- a/src/app/ps4_main.cpp+++ b/src/app/ps4_main.cpp@@ -2,6 +2,7 @@// Copyright (C) 2026 RafaelNGP// The PS4's entry point: runs the app with PS4 backends and shell_ps4.cpp.#include "app/app_core.h"+#include "platform/ps4/exit_ps4.h"#include "util/log.h"#include <cstdio>@@ -29,5 +30,5 @@ int main(int argc, char** argv) {}xc::log::setFile(nullptr);std::fflush(nullptr);- _exit(rc);+ xc::platform::ps4::exitTitle(rc);}diff --git a/src/app/shell_ps4.cpp b/src/app/shell_ps4.cppindex 4c372ae..4477562 100644--- a/src/app/shell_ps4.cpp+++ b/src/app/shell_ps4.cpp@@ -6,6 +6,7 @@#include "app/updater.h"#include "display/display.h"#include "platform/platform.h"+#include "platform/ps4/exit_ps4.h"#include "ui/strings.h"#include "util/log.h"@@ -91,7 +92,7 @@ void restartOrExit() {if (!g_autoplay.noRestart) platform::restartApp();platform::notify(ui::tr(ui::Str::UpdateReopen), "update installed, restart failed: closing");platform::sleepMs(2000);- _exit(0);+ platform::ps4::exitTitle(0);}} // namespace xc::app::shelldiff --git a/src/platform/ps4/exit_ps4.h b/src/platform/ps4/exit_ps4.hnew file mode 100644index 0000000..917673f--- /dev/null+++ b/src/platform/ps4/exit_ps4.h@@ -0,0 +1,20 @@+// SPDX-License-Identifier: GPL-3.0-or-later+// Copyright (C) 2026 RafaelNGP+// How the PS4 build ends the process.+#pragma once++#include <unistd.h>++extern "C" int sceSystemServiceLoadExec(const char* path, const char* argv[]);++namespace xc::platform::ps4 {++// Leaves through the system, as XCloud4 does: libc's _exit path faults on this firmware+// (CE-34878-0 when closing). LoadExec("exit") ends the title; _exit only if it returns.+[[noreturn]] inline void exitTitle(int rc) {+ sceSystemServiceLoadExec("exit", nullptr);+ for (int i = 0; i < 100; ++i) usleep(100000);+ _exit(rc);+}++} // namespace xc::platform::ps4