Play your Steam library's Windows games on a jailbroken PS5.
C++
Log and show why a SteamStub program is refused
Leonardo Lobato84be0c8a20bf
diff --git a/src/homebrew/runtime_host.cpp b/src/homebrew/runtime_host.cppindex 6082ea0..cc80c29 100644--- a/src/homebrew/runtime_host.cpp+++ b/src/homebrew/runtime_host.cpp@@ -414,6 +414,16 @@ std::shared_ptr<const RuntimeSnapshot> RuntimeHost::Shared() const {return shared_;}+// Every program of the folder wrapped in SteamStub, with the verdict and the form found, so a+// program the Program list greys out says why (#320).+void RuntimeHost::LogSteamStubPrograms(std::uint32_t app, const std::vector<rt::GameProgram>& programs) const {+ for (const auto& program : programs)+ if (program.steam_stub)+ Log("steamstub app=" + std::to_string(app) + " program=" + program.path ++ " supported=" + (program.steam_stub_supported ? "1" : "0") ++ " detail=" + (program.steam_stub_detail.empty() ? "unknown" : program.steam_stub_detail));+}+void RuntimeHost::Log(const std::string& line) const {if (config_.log) config_.log(line);}@@ -2784,9 +2794,11 @@ const rt::GameRecipe* RuntimeHost::RecipeForPrepare(Composition& c, const Runtimrt::GenerateGameRecipe(GameOf(request), request.runtime_number, request.title_name, launches, root.string(),&generated, reason, kit, choices, &soft, &diagnostics);// The same line an unpack writes, so a refused SteamStub program is found the same way.- if (!made && !diagnostics.steam_stub_program.empty())+ // A recipe made from another of Steam's programs says which one it skipped and why (The Saboteur, #320).+ if (!diagnostics.steam_stub_program.empty())Log("steamstub app=" + std::to_string(request.runtime_number) + " found=" + diagnostics.steam_stub_program +- " changed=- failed=" + *reason + " (" + (diagnostics.steam_stub_detail.empty() ? "unknown" : diagnostics.steam_stub_detail) + ")");+ " changed=- " + (made ? std::string("skipped") : "failed=" + *reason) + " (" ++ (diagnostics.steam_stub_detail.empty() ? "unknown" : diagnostics.steam_stub_detail) + ")");if (!made && launches.empty() && choices.program.empty())*reason = request.launch_reason.empty() ? "Steam lists no Windows program this console can start for this game.": request.launch_reason;@@ -2796,6 +2808,7 @@ const rt::GameRecipe* RuntimeHost::RecipeForPrepare(Composition& c, const Runtimstd::optional<rt::GameRecipe> draft;if (!made) {programs = rt::ListGamePrograms(root.string(), kit);+ LogSteamStubPrograms(request.runtime_number, programs);auto tried = choices;tried.try_anyway = true;rt::GameRecipe permissive;@@ -4683,6 +4696,7 @@ bool RuntimeHost::RunServices() {? rt::KitCapabilitiesFromManifest(composition->kit->capabilities, true) : rt::KitCapabilities{};auto programs = rt::ListGamePrograms(HostPath(install_path).string(), kit);Log("program scan app=" + std::to_string(app) + " programs=" + std::to_string(programs.size()));+ LogSteamStubPrograms(app, programs);Publish([&](RuntimeSnapshot& s) {auto& setup = s.game_setups[app];setup.programs = std::move(programs);diff --git a/src/homebrew/runtime_host.hpp b/src/homebrew/runtime_host.hppindex bc2c77e..d19d869 100644--- a/src/homebrew/runtime_host.hpp+++ b/src/homebrew/runtime_host.hpp@@ -717,6 +717,7 @@ class RuntimeHost {std::size_t LeftoverRequests(Composition& composition, bool remove);bool Stopping() const;void Log(const std::string& line) const;+ void LogSteamStubPrograms(std::uint32_t app, const std::vector<runtime::GameProgram>& programs) const;// Worker thread: publishes the work fraction when its whole percent changes; ClearWork removes it.void ReportWork(std::uint64_t done, std::uint64_t total);void ClearWork();diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cppindex 21ca34f..ce975eb 100644--- a/src/runtime/game_settings.cpp+++ b/src/runtime/game_settings.cpp@@ -2069,10 +2069,18 @@ std::vector<GameProgram> ListGamePrograms(const std::string& install_root, constprogram.path = relative;program.architecture = ExecutableArchitecture(install_root + "/" + relative);if (!program.architecture.empty()) {- const auto defaults = DefaultsFor(ProbeGame(install_root, relative), abilities);+ const auto probe = ProbeGame(install_root, relative);+ const auto defaults = DefaultsFor(probe, abilities);program.refusal = defaults.refusal;program.refusal_soft = defaults.refusal_soft;program.detected = defaults.summary;+ program.steam_stub = probe.steam_stub;+ program.steam_stub_supported = probe.steam_stub_supported;+ program.steam_stub_detail = probe.steam_stub_detail;+ // The player sees which SteamStub form it is ("3.1 x86 with flags 0x4"), so a report names it.+ if (probe.steam_stub && !probe.steam_stub_supported && !probe.steam_stub_detail.empty() &&+ !program.refusal.empty() && program.refusal.back() == '.')+ program.refusal.insert(program.refusal.size() - 1, " (SteamStub " + probe.steam_stub_detail + ")");}programs.push_back(std::move(program));}diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.hindex 1211cec..b1e239b 100644--- a/src/runtime/game_settings.h+++ b/src/runtime/game_settings.h@@ -373,6 +373,9 @@ struct GameProgram {std::string refusal; // why the console cannot run it; empty when it maybool refusal_soft = false; // "Try anyway" can get past the refusalstd::string detected; // GameDefaults::summary+ bool steam_stub = false; // SteamStub DRM wraps it+ bool steam_stub_supported = false; // ...in a form Playden unpacks+ std::string steam_stub_detail; // the SteamStub variant, or why it is not unpacked (runtime/steam_stub.h)};inline constexpr std::size_t kMaxGamePrograms = 32;// The .exe files under install_root, up to six folders deep, without following symbolic linksdiff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cppindex 0e6cb37..20f2fda 100644--- a/tests/game_probe_test.cpp+++ b/tests/game_probe_test.cpp@@ -570,6 +570,27 @@ int main() {CHECK(!GenerateGameRecipe(1, "Stub", {{"", "", "Stub.exe", "", ""}}, root.string(), &recipe, &reason, {}, {}, nullptr, &diagnostics));CHECK(diagnostics.steam_stub_program == "Stub.exe" && !diagnostics.steam_stub_detail.empty());CHECK(reason.find("Steam DRM") != std::string::npos);+ // The Program list keeps the SteamStub form of every program and names it in the refusal (#320).+ bool listed = false;+ for (const auto& program : ListGamePrograms(root.string())) {+ if (program.path != "Stub.exe") {+ CHECK(!program.steam_stub && program.steam_stub_detail.empty());+ continue;+ }+ listed = true;+ CHECK(program.steam_stub && !program.steam_stub_supported &&+ program.steam_stub_detail == diagnostics.steam_stub_detail);+ CHECK(program.refusal == "This game's program has Steam DRM in a form Playden can't unpack yet (SteamStub " ++ diagnostics.steam_stub_detail + ").");+ }+ CHECK(listed);+ // The recipe comes from Steam's other program, and the skipped one is still named (The Saboteur).+ WritePe(root / "VideoSetup.exe", {false, {"KERNEL32.dll", "d3d9.dll"}});+ GameRecipeDiagnostics skipped;+ CHECK(GenerateGameRecipe(24880, "The Saboteur", {{"", "", "Stub.exe", "", ""}, {"", "Video Setup", "VideoSetup.exe", "", ""}},+ root.string(), &recipe, &reason, {}, {}, nullptr, &skipped));+ CHECK(recipe.launch_entries[0].executable == "VideoSetup.exe");+ CHECK(skipped.steam_stub_program == "Stub.exe" && skipped.steam_stub_detail == diagnostics.steam_stub_detail);}{ // Final Fantasy XIII keeps its program four folders deep; the picker reaches it, but not