Skip to content

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

C++

Start an XNA game's own program, not its server

Leonardo Lobatoe704663448ec
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index eae565e..7ec262a 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -1978,12 +1978,15 @@ namespace {
// A program that only starts the game: a launcher, updater or settings window (Win32 dialogs
// the controller can't use) or a .NET launcher. Steam often lists it as the default (#70, #46).
+// A program that draws or has a known engine is the game. A .NET program is the game only when it names XNA itself
+// (Guncraft): its graphics libraries and most engines are found from the folder (UnityPlayer.dll, a DLL that imports
+// Direct3D), which a .NET launcher beside the game shares.
bool StartsTheGameOnly(const std::string& program, const GameProbe& probe) {
auto name = LowerAscii(program.substr(program.rfind('/') == std::string::npos ? 0 : program.rfind('/') + 1));
// Redistributable installers and uninstallers are never the game, whatever they import (UE3Redist.exe draws a dialog with D3D9).
for (const char* word : {"redist", "dxsetup", "uninst"})
if (name.find(word) != std::string::npos) return true;
- if (probe.dotnet) return true;
+ if (probe.dotnet) return probe.engine != "xna";
if (!probe.apis.empty() || !probe.engine.empty()) return false;
for (const char* word : {"launch", "updater", "config", "setup", "settings"})
if (name.find(word) != std::string::npos) return true;
diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cpp
index 24bbcdf..2cead00 100644
--- a/tests/game_probe_test.cpp
+++ b/tests/game_probe_test.cpp
@@ -860,6 +860,32 @@ int main() {
CHECK(GenerateGameRecipe(1, "Server Side", {{"", "", "Launcher.exe", "", ""}}, side.string(), &recipe, &reason));
CHECK(recipe.launch_entries.size() == 2 && recipe.launch_entries[0].executable == "ServerSide.exe");
}
+ { // An XNA game's own program is the game, not a .NET launcher: Guncraft starts Guncraft.exe, not the
+ // dedicated server beside it (#576).
+ const auto guncraft = fresh();
+ // Both name the framework and OpenGL ("detected=xna,opengl"); the server is the larger.
+ WritePe(guncraft / "Guncraft.exe", {false, {"mscoree.dll"}, true, false, "Microsoft.Xna.Framework.Game opengl32.dll"});
+ WritePe(guncraft / "GunCraftServer.exe",
+ {false, {"mscoree.dll"}, true, false, "Microsoft.Xna.Framework.Game opengl32.dll", 0x40000});
+ KitCapabilities mono;
+ mono.wine_mono = true;
+ CHECK(GenerateGameRecipe(241720, "Guncraft", {{"", "", "Guncraft.exe", "", ""}}, guncraft.string(), &recipe, &reason,
+ mono));
+
+ CHECK(recipe.launch_entries.size() == 1 && recipe.launch_entries[0].executable == "Guncraft.exe" &&
+ recipe.graphics == "opengl");
+ // A .NET launcher that draws nothing is still one: the XNA game beside it is started, not its server.
+ WritePe(guncraft / "Launcher.exe", {false, {"mscoree.dll"}, true});
+ CHECK(GenerateGameRecipe(241720, "Guncraft", {{"", "", "Launcher.exe", "", ""}}, guncraft.string(), &recipe,
+ &reason, mono));
+ CHECK(recipe.launch_entries.size() == 2 && recipe.launch_entries[0].executable == "Guncraft.exe" &&
+ recipe.launch_entries[0].id == "game");
+ // ...even beside a DLL that imports Direct3D: the folder's graphics libraries are not the launcher's.
+ WritePe(guncraft / "Render.dll", {false, {"KERNEL32.dll", "d3d9.dll"}});
+ CHECK(GenerateGameRecipe(241720, "Guncraft", {{"", "", "Launcher.exe", "", ""}}, guncraft.string(), &recipe,
+ &reason, mono));
+ CHECK(recipe.launch_entries.size() == 2 && recipe.launch_entries[0].executable == "Guncraft.exe");
+ }
// A program that draws, or the player's choice, is started as listed.
CHECK(GenerateGameRecipe(1, "Game", {{"", "", "Tools/Viewer.exe", "", ""}}, root.string(), &recipe, &reason));
CHECK(recipe.launch_entries.size() == 1 && recipe.launch_entries[0].executable == "Tools/Viewer.exe");