Play your Steam library's Windows games on a jailbroken PS5.
C++
Install games whose license grants one of two content copies
Leonardo Lobato88f1673bc0da
diff --git a/src/steam/backend/app_info.cpp b/src/steam/backend/app_info.cppindex 080b779..2b11e13 100644--- a/src/steam/backend/app_info.cpp+++ b/src/steam/backend/app_info.cpp@@ -435,14 +435,21 @@ std::vector<std::uint32_t> MissingBaseDepots(const AppInfo& app,const std::optional<std::set<std::uint32_t>>& owned_depots,const std::vector<DepotInfo>& selected) {if (!owned_depots) return {};+ const auto base_content = [](const DepotInfo& depot) {+ return !depot.depot_from_app && !depot.shared_install && !depot.is_dlc && depot.os_list.empty() &&+ depot.language.empty() && depot.manifest_gid && *depot.manifest_gid != 0;+ };+ // A license that grants base content of its own holds the game: the base depots it leaves out+ // are alternates for other licenses (Marvel Rivals lists a second copy of its content), and+ // Steam installs only what the license grants.+ for (const DepotInfo& depot : selected)+ if (base_content(depot) && depot.size) return {};std::uint64_t selected_size = 0;for (const DepotInfo& depot : selected) selected_size += depot.size;std::vector<std::uint32_t> missing;std::uint64_t missing_size = 0;for (const DepotInfo& depot : app.depots) {- if (owned_depots->count(depot.id) != 0 || depot.depot_from_app || depot.shared_install || depot.is_dlc ||- !depot.os_list.empty() || !depot.language.empty() || !depot.manifest_gid || *depot.manifest_gid == 0)- continue;+ if (owned_depots->count(depot.id) != 0 || !base_content(depot)) continue;missing.push_back(depot.id);missing_size += depot.size;}diff --git a/src/steam/backend/cm_client.cpp b/src/steam/backend/cm_client.cppindex 8d0ef33..51c71a7 100644--- a/src/steam/backend/cm_client.cpp+++ b/src/steam/backend/cm_client.cpp@@ -961,6 +961,7 @@ AcquisitionResult CmClient::FetchAcquisitionDates(const StoredSession& stored,result.owned_apps.clear();result.owned_depots.clear();result.package_apps.clear();+ result.package_depots.clear();}return result;};@@ -1008,6 +1009,8 @@ AcquisitionResult CmClient::FetchAcquisitionDates(const StoredSession& stored,continue;auto& apps = package_apps[package.package_id];apps.insert(apps.end(), contents.app_ids.begin(), contents.app_ids.end());+ auto& depots = result.package_depots[package.package_id];+ depots.insert(depots.end(), contents.depot_ids.begin(), contents.depot_ids.end());result.owned_apps.insert(contents.app_ids.begin(), contents.app_ids.end());result.owned_depots.insert(contents.depot_ids.begin(), contents.depot_ids.end());received.insert(package.package_id);diff --git a/src/steam/backend/cm_client.h b/src/steam/backend/cm_client.hindex af85b49..7364647 100644--- a/src/steam/backend/cm_client.h+++ b/src/steam/backend/cm_client.h@@ -54,6 +54,7 @@ struct AcquisitionResult {std::set<std::uint32_t> owned_depots;// The apps of each active licensed package, for games the owned list leaves out.std::map<std::uint32_t, std::vector<std::uint32_t>> package_apps;+ std::map<std::uint32_t, std::vector<std::uint32_t>> package_depots;// Licensed packages Steam left out, sent without a token, or sent unreadable; their apps are not owned here.std::uint32_t skipped_packages = 0;bool ok() const { return error == CmError::kNone; }diff --git a/src/steam/backend/steam_install_runner.cpp b/src/steam/backend/steam_install_runner.cppindex 0771e43..8afbf05 100644--- a/src/steam/backend/steam_install_runner.cpp+++ b/src/steam/backend/steam_install_runner.cpp@@ -128,6 +128,23 @@ InstallRunner::Result SteamInstallRunner::Install(const StoredSession& session,std::string ids;for (const auto depot : missing) ids += (ids.empty() ? "" : " ") + std::to_string(depot);log("depots", "partial", ("unowned=" + ids).c_str());+ // Which licenses carry the game and what they grant, against the app's depots.+ std::string packages;+ for (const auto& [package, apps] : entitlements.package_apps) {+ if (std::find(apps.begin(), apps.end(), id) == apps.end()) continue;+ packages += " " + std::to_string(package) + ":";+ const auto depots = entitlements.package_depots.find(package);+ if (depots != entitlements.package_depots.end())+ for (const auto depot : depots->second) packages += std::to_string(depot) + ",";+ }+ log("depots", "licenses", packages.c_str());+ std::string listed;+ for (const auto& depot : app->depots)+ listed += " " + std::to_string(depot.id) + ":" + std::to_string(depot.size) + ":" + depot.os_list + ":" ++ (depot.depot_from_app ? "from" + std::to_string(*depot.depot_from_app) : "") ++ (depot.shared_install ? "shared" : "") + (depot.is_dlc ? "dlc" : "") + ":" ++ (entitlements.owned_depots.count(depot.id) ? "owned" : "-") + ":" + depot.name;+ log("depots", "listed", listed.c_str());result.failure = "Steam didn't grant access to part of this game.";return result;}diff --git a/tests/steam_app_info_test.cpp b/tests/steam_app_info_test.cppindex 3b4625f..8c9a42c 100644--- a/tests/steam_app_info_test.cpp+++ b/tests/steam_app_info_test.cpp@@ -326,6 +326,24 @@ void TestMissingBaseDepots() {for (DepotInfo& depot : sizeless.depots) depot.size = 0;CHECK(SelectDepots(sizeless, {440}, partial, &selected, &reason));CHECK(MissingBaseDepots(sizeless, partial, selected).empty());++ // Marvel Rivals: the free license grants one content depot; a same-size copy and a third content+ // depot belong to other licenses. Together they outweigh the granted one, which is still the game.+ AppInfo rivals;+ rivals.app_id = 2767030;+ DepotInfo granted = content;+ granted.id = 2767031;+ granted.size = 74'083'193'346ull;+ DepotInfo copy = granted;+ copy.id = 2767032;+ DepotInfo other = granted;+ other.id = 2767033;+ other.size = 20'311'069'758ull;+ rivals.depots = {granted, copy, other};+ const std::set<std::uint32_t> free_license{2767031};+ CHECK(SelectDepots(rivals, {2767030}, free_license, &selected, &reason));+ CHECK((Ids(selected) == U32s{2767031}));+ CHECK(MissingBaseDepots(rivals, free_license, selected).empty());}void TestEligibleLaunches() {