Play your Steam library's Windows games on a jailbroken PS5.
C++
Ask for console storage when Playden runs from elsewhere
Leonardo Lobatoe188cd0512a7
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 162f61f..ded5cb7 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -690,6 +690,7 @@ GameId fixture_imported_game() { return GameId::Local("6d1f3a52-0c55-4f3e-9b2a-5struct StartupProblem {std::string title;std::string subtitle;+ bool show_detail = true; // the error line, for reports; left out where it adds nothing for the player};// What the startup error means for the player: the step that failed and how to fix it. The error@@ -704,6 +705,19 @@ StartupProblem describe_startup_problem(const std::string& detail, bool granted)const StartupProblem incomplete{"Playden's app folder is incomplete","Some of Playden's files in /data/homebrew are missing or can't be read. Copy the whole app folder from the ""release zip again (or use tools/console_title_deploy.py), then open Playden again."};+ constexpr const char* kElsewhere = "launcher is not installed in ";+ if (const auto at = detail.find(kElsewhere); at != std::string::npos) {+ const auto from = at + std::strlen(kElsewhere);+ const auto folder = detail.substr(from, detail.find(';', from) - from);+ const auto parent = folder.substr(0, folder.rfind('/'));+ // ProsperoStore can install to other folders and drives; its labels are Settings > Install location and+ // Uninstall (held) on the app's page.+ return {"Install Playden on console storage",+ "Playden runs only from " + folder + ", on the console's own storage. From ProsperoStore: set "+ "Settings > Install location to " + parent + ", hold Uninstall on Playden's page, then install it "+ "again. If you copied it by hand, move the app folder to " + parent + ".",+ false};+ }if (granted) {if (has("stable launcher source is invalid")) return incomplete;if (has("stable launcher source identity does not match"))@@ -4547,7 +4561,7 @@ void Simulation::rebuild_view() {auto problem = describe_startup_problem(state_.root_access_detail, state_.root_access_granted);view_.title = std::move(problem.title);view_.subtitle = std::move(problem.subtitle);- if (!state_.root_access_detail.empty())+ if (problem.show_detail && !state_.root_access_detail.empty())row("root-detail", RowKind::Status, "Startup error: " + state_.root_access_detail, "").enabled = false;row("root-quit", RowKind::Action, "Quit to Home", "root-quit");view_.legends = {"Cross Quit to Home"};diff --git a/src/platform/ps5/native_access.cpp b/src/platform/ps5/native_access.cppindex 2ee243b..af30e94 100644--- a/src/platform/ps5/native_access.cpp+++ b/src/platform/ps5/native_access.cpp@@ -256,6 +256,13 @@ NativeAccessResult NativeAccessBootstrap::PrepareAccess() {return result;}+ // Installed somewhere else (another drive's homebrew folder): Playden runs only from /data/homebrew,+ // and the grant does not answer for a title started from another folder. /data/homebrew is visible+ // before the grant; only a folder it lists as absent counts.+ if (ops_.path_kind(ops_.context, options_.stable_homebrew_root.c_str()) == NativePathKind::kDirectory &&+ ops_.path_kind(ops_.context, stable_root.c_str()) == NativePathKind::kMissing)+ return LauncherFallback("launcher is not installed in " + stable_root);+const int grant_code = ops_.request_data_access(ops_.context);if (grant_code != 0)return LauncherFallback(NativeFailure("native data grant", grant_code),@@ -267,6 +274,9 @@ NativeAccessResult NativeAccessBootstrap::PrepareAccess() {return result;};+ // Not visible before the grant, and missing after it: installed somewhere else too.+ if (ops_.path_kind(ops_.context, stable_root.c_str()) == NativePathKind::kMissing)+ return granted_fallback("launcher is not installed in " + stable_root);std::string path_error;if (!ValidatePaths(ops_, stable, options_.known_fresh_state,StubState::kReadable, &path_error)) {diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cppindex 8077748..ec8ea9c 100644--- a/tests/homebrew_live_model_test.cpp+++ b/tests/homebrew_live_model_test.cpp@@ -1187,6 +1187,12 @@ void live_root_access_missing() {{"stable launcher source is invalid: assets root is unavailable", true, "Playden's app folder is incomplete","Copy the whole app folder"},{"stable launcher source identity does not match", true, "Playden can't start", "restart the PS5"},+ {"launcher is not installed in /data/homebrew/PPSA97031; helper stage=done status=0 error=0", true,+ "Install Playden on console storage", "Playden runs only from /data/homebrew/PPSA97031, on the console's"},+ {"launcher is not installed in /data/homebrew/PPSA97031", false, "Install Playden on console storage",+ "set Settings > Install location to /data/homebrew, hold Uninstall"},+ {"launcher is not installed in /data/homebrew/PPSA97031", false, "Install Playden on console storage",+ "move the app folder to /data/homebrew."},};for (const auto& item : cases) {Simulation model_case({}, {}, ModelMode::Live);@@ -1194,8 +1200,12 @@ void live_root_access_missing() {const auto& case_view = model_case.view();const auto case_detail = std::find_if(case_view.rows.begin(), case_view.rows.end(),[](const auto& row) { return row.key == "root-detail"; });+ // The wrong-location screen says all there is to do; the others keep the error line for reports.+ const bool elsewhere = item.title == std::string("Install Playden on console storage");check(case_view.title == item.title && case_view.subtitle.find(item.advice) != std::string::npos &&- case_detail != case_view.rows.end() && case_detail->title == std::string("Startup error: ") + item.error,+ (elsewhere ? case_detail == case_view.rows.end()+ : case_detail != case_view.rows.end() &&+ case_detail->title == std::string("Startup error: ") + item.error),(std::string("root access: ") + item.error + " has its own title and fix").c_str());check(item.granted || std::string(item.advice) != "Load kstuff and the autoloader" ||case_view.subtitle.find("kstuff") != std::string::npos,diff --git a/tests/native_access_test.cpp b/tests/native_access_test.cppindex 3dfc7fc..108772a 100644--- a/tests/native_access_test.cpp+++ b/tests/native_access_test.cpp@@ -293,7 +293,34 @@ void InvalidOrMissingStableSourceNeverFallsBackAfterGrant() {const auto absent = missing_bootstrap.Prepare();CHECK(!absent.launcher_ready && !absent.runtime_ready);CHECK(absent.paths.title_root.empty());- CHECK(absent.error.find("stable") != std::string::npos);+ // Installed elsewhere (another drive's homebrew folder): the error names where Playden must be.+ CHECK(absent.granted && absent.error.find("launcher is not installed in /data/homebrew/FAKE77031") == 0);++ // Seen before the grant: /data/homebrew is listed and has no folder for this title. The grant is+ // not asked for (it does not answer for a title started from another folder).+ auto elsewhere = OrdinaryLauncher();+ elsewhere.paths["/data/homebrew"] = NativePathKind::kDirectory;+ NativeAccessBootstrap elsewhere_bootstrap(Ops(elsewhere), Options());+ const auto outside = elsewhere_bootstrap.Prepare();+ CHECK(!outside.runtime_ready && !outside.granted && elsewhere.grants == 0);+ CHECK(outside.error.find("launcher is not installed in /data/homebrew/FAKE77031") == 0);++ // A normal install that is visible before the grant still asks for it.+ auto visible = OrdinaryLauncher();+ visible.paths["/data/homebrew"] = NativePathKind::kDirectory;+ visible.paths[kStableRoot] = NativePathKind::kDirectory;+ NativeAccessBootstrap visible_bootstrap(Ops(visible), Options());+ const auto installed = visible_bootstrap.Prepare();+ CHECK(installed.runtime_ready && installed.granted && visible.grants == 1);++ // A folder that is there but incomplete is still that, not "installed elsewhere".+ auto broken = OrdinaryLauncher();+ broken.expose_stable_after_grant = false;+ broken.paths[kStableRoot] = NativePathKind::kDirectory;+ broken.identities[kStableRoot] = "playden-package-v1";+ NativeAccessBootstrap broken_bootstrap(Ops(broken), Options());+ const auto incomplete = broken_bootstrap.Prepare();+ CHECK(!incomplete.launcher_ready && incomplete.error.find("stable launcher source is invalid") == 0);}void RetryIsIdempotentAndDoesNotResetStorage() {