Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Look six folders deep for a game's programs (#34)

tslater20069efd09da6cc1
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index 71dcb44..d2de250 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -1383,7 +1383,7 @@ std::vector<GameProgram> ListGamePrograms(const std::string& install_root, const
"directx", "vcredist", "dotnet", "support", "$pluginsdir"};
std::vector<std::string> found;
std::vector<std::pair<std::string, int>> folders = {{"", 0}};
- constexpr int kMaxDepth = 3;
+ constexpr int kMaxDepth = 6;
constexpr std::size_t kMaxEntries = 4096;
std::size_t seen = 0;
for (std::size_t next = 0; next < folders.size() && found.size() < kMaxGamePrograms; ++next) {
diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.h
index 7f88e80..26ff7f4 100644
--- a/src/runtime/game_settings.h
+++ b/src/runtime/game_settings.h
@@ -247,7 +247,7 @@ struct GameProgram {
std::string detected; // GameDefaults::summary
};
inline constexpr std::size_t kMaxGamePrograms = 32;
-// The .exe files under install_root, a few folders deep, without following symbolic links
+// The .exe files under install_root, up to six folders deep, without following symbolic links
// or entering redistributable folders; at most kMaxGamePrograms, shallowest first.
std::vector<GameProgram> ListGamePrograms(const std::string& install_root, const KitCapabilities& kit = {});
// "pe32" or "pe64" for a game-relative program under install_root (any case); empty when it
diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cpp
index 18f65d8..8ab6a1a 100644
--- a/tests/game_probe_test.cpp
+++ b/tests/game_probe_test.cpp
@@ -304,6 +304,17 @@ int main() {
CHECK(reason.find("Steam DRM") != std::string::npos);
}
+ { // Final Fantasy XIII keeps its program four folders deep; the picker reaches it, but not
+ // a tree that is deeper than any game ships.
+ const auto root = fresh();
+ Touch(root / "FFXiiiLauncher.exe");
+ Touch(root / "white_data/prog/win/bin/ffxiiiimg.exe");
+ Touch(root / "a/b/c/d/e/f/g/too-deep.exe");
+ const auto programs = ListGamePrograms(root.string());
+ CHECK(programs.size() == 2 && programs[0].path == "FFXiiiLauncher.exe" &&
+ programs[1].path == "white_data/prog/win/bin/ffxiiiimg.exe");
+ }
+
{ // Selaco: Steam lists only .bat files around a .NET helper; the game's own program would start.
const auto root = fresh();
Touch(root / "Launch.bat");