Xbox Cloud Gaming app for PS5 Homebrew
C
fix(updater): support unjailed filesystem namespace on PS5
Rafael Abud Ferreira90d4c26aa31f
diff --git a/src/app/shell_ps5.cpp b/src/app/shell_ps5.cppindex cf1d9e5..aebd1a9 100644--- a/src/app/shell_ps5.cpp+++ b/src/app/shell_ps5.cpp@@ -98,8 +98,17 @@ void setMouseHandler(std::function<void(const MouseEvent&)>) {}bool isInstalledCopy(const std::string& dir) {// /app0 is the folder the system started the app from.struct stat here {}, running {};- return ::stat((dir + "/eboot.bin").c_str(), &here) == 0 && ::stat("/app0/eboot.bin", &running) == 0 &&- here.st_ino == running.st_ino;+ if (::stat((dir + "/eboot.bin").c_str(), &here) != 0) return false;+ if (::stat("/app0/eboot.bin", &running) == 0 && here.st_ino == running.st_ino) {+ return true;+ }+ // When unjailed for native trophy sync, rootdir is set to the true system root+ // where /app0 is not mounted at top level. The title's runtime files remain accessible+ // via the sandbox mount (/mnt/sandbox/PPSA99810_000/app0) or standard homebrew folder.+ if (::stat("/mnt/sandbox/PPSA99810_000/app0/eboot.bin", &running) == 0 && here.st_ino == running.st_ino) {+ return true;+ }+ return dir == "/data/homebrew/PPSA99810";}void restartOrExit() {diff --git a/src/platform/ps5/platform_ps5.cpp b/src/platform/ps5/platform_ps5.cppindex ff0110b..e88b92c 100644--- a/src/platform/ps5/platform_ps5.cpp+++ b/src/platform/ps5/platform_ps5.cpp@@ -377,6 +377,13 @@ bool restartApp() {// takes under a second, and the new eboot.bin is the one that starts).char* argv[] = {nullptr};int rc = sceSystemServiceLoadExec("/app0/eboot.bin", argv);+ if (rc != 0) {+ rc = sceSystemServiceLoadExec("/mnt/sandbox/PPSA99810_000/app0/eboot.bin", argv);+ }+ if (rc != 0) {+ std::string legacyEboot = std::string(kLegacyDir) + "/eboot.bin";+ rc = sceSystemServiceLoadExec(legacyEboot.c_str(), argv);+ }XC_LOGE("restart: sceSystemServiceLoadExec returned 0x%08x", static_cast<unsigned>(rc));return false;}diff --git a/tests/test_main.cpp b/tests/test_main.cppindex e0dbbf1..fd94e52 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -930,7 +930,10 @@ static std::string storedZip(const std::vector<std::pair<std::string, std::strinstatic void testUpdater() {using namespace xc::app;CHECK(contentVersionOf("v0.8.1") == "00.801.000" && contentVersionOf("1.10.0").empty());+ CHECK(contentVersionOf("v1.6.3") == "01.603.000");+ CHECK(isNewerVersion("v1.6.3", "1.6.2") && !isNewerVersion("v1.6.3", "1.6.3") && !isNewerVersion("1.6.2", "v1.6.3"));CHECK(updatablePath("eboot.bin") && updatablePath("sce_sys/param.json") && updatablePath("assets/fonts/a.ttf"));+ CHECK(updatablePath("assets/PSBox_Trophies.elf") && updatablePath("sce_module/libc.prx"));CHECK(!updatablePath("../eboot.bin") && !updatablePath("/data/x") && !updatablePath("a//b") && !updatablePath("a/./b"));CHECK(!updatablePath("account.json") && !updatablePath("settings.json") && !updatablePath("imgcache/x"));CHECK(!updatablePath("update.old/eboot.bin") && !updatablePath("update.journal") && !updatablePath("frame.ppm"));