Xbox Cloud Gaming app for PS5 Homebrew
C
fix(updater): dynamic sandbox mount resolution and test coverage for unjailed PS5
Rafael Abud Ferreiraf67081862e9d
diff --git a/src/app/shell_ps5.cpp b/src/app/shell_ps5.cppindex aebd1a9..7d6dbd9 100644--- a/src/app/shell_ps5.cpp+++ b/src/app/shell_ps5.cpp@@ -11,6 +11,8 @@#include "util/log.h"#include <cstdlib>+#include <cstring>+#include <dirent.h>#include <sys/stat.h>#include <csignal>#include <unistd.h>@@ -108,6 +110,18 @@ bool isInstalledCopy(const std::string& dir) {if (::stat("/mnt/sandbox/PPSA99810_000/app0/eboot.bin", &running) == 0 && here.st_ino == running.st_ino) {return true;}+ if (DIR* d = ::opendir("/mnt/sandbox")) {+ while (dirent* e = ::readdir(d)) {+ if (std::strstr(e->d_name, "PPSA99810") != nullptr) {+ std::string p = std::string("/mnt/sandbox/") + e->d_name + "/app0/eboot.bin";+ if (::stat(p.c_str(), &running) == 0 && here.st_ino == running.st_ino) {+ ::closedir(d);+ return true;+ }+ }+ }+ ::closedir(d);+ }return dir == "/data/homebrew/PPSA99810";}diff --git a/src/app/worker.cpp b/src/app/worker.cppindex 28604e8..a601bac 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -279,7 +279,7 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {platform::notify(ui::trf(ui::Str::SignedInAs, am.profile().gamertag), "signed in (notification)");static bool updateChecked = false;static platform::Thread s_updateThread;- if (!updateChecked && (g_autoplay.title.empty() || !g_autoplay.updateFeed.empty())) {+ if (!updateChecked && (g_autoplay.title.empty() || g_autoplay.title == "UPDATE" || !g_autoplay.updateFeed.empty())) {updateChecked = true;platform::startThread(s_updateThread, [] {platform::setThreadAffinity(platform::ThreadRole::Worker, "xcloud_upd");diff --git a/tests/test_main.cpp b/tests/test_main.cppindex fd94e52..901c33e 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -930,10 +930,12 @@ 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(contentVersionOf("v1.6.3") == "01.603.000" && contentVersionOf("v2.0.0") == "02.000.000" && contentVersionOf("v0.0.1") == "00.001.000");CHECK(isNewerVersion("v1.6.3", "1.6.2") && !isNewerVersion("v1.6.3", "1.6.3") && !isNewerVersion("1.6.2", "v1.6.3"));+ CHECK(isNewerVersion("v1.7.0", "1.6.99") && !isNewerVersion("", "1.6.2") && !isNewerVersion("1.6.2", ""));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("assets/media_showcase/01_home_screen.png") && updatablePath("licenses/Anime4K-MIT.txt"));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"));