Skip to content

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

C++

Pick vkd3d-proton for Direct3D 12 games that load dxgi

Leonardo Lobato32fdf7189fe0
diff --git a/src/runtime/game_probe.cpp b/src/runtime/game_probe.cpp
index b7c94d1..965289d 100644
--- a/src/runtime/game_probe.cpp
+++ b/src/runtime/game_probe.cpp
@@ -315,7 +315,9 @@ GameProbe ProbeGame(const std::string& install_root, const std::string& executab
GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtime) {
GameDefaults out;
const auto has = [&](const char* api) { return probe.apis.count(api) != 0; };
- const bool direct3d = has("d3d8") || has("d3d9") || has("d3d10") || has("d3d11") || has("dxgi");
+ // Direct3D 12 also loads dxgi, so dxgi alone doesn't mean an older Direct3D the game can fall back to.
+ const bool older_direct3d = has("d3d8") || has("d3d9") || has("d3d10") || has("d3d11");
+ const bool direct3d = older_direct3d || has("dxgi");
// Soft refusals: the detection is broad (a .NET launcher in front of a native game), so the
// engine defaults below are still worked out for a player who tries anyway.
std::string soft;
@@ -354,14 +356,14 @@ GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtime
} else if (probe.engine == "godot") {
out.graphics = "opengl";
out.arguments = "--rendering-driver opengl3";
+ } else if (has("d3d12") && !older_direct3d && runtime.vkd3d_proton) {
+ // vkd3d-proton presents through DXVK's dxgi, so the game gets DXVK as well.
+ out.graphics = "dxvk";
+ out.d3d12 = "vkd3d-proton";
} else if (direct3d || probe.engine == "gamemaker") {
out.graphics = "dxvk";
} else if (has("opengl")) {
out.graphics = "opengl";
- } else if (has("d3d12") && runtime.vkd3d_proton) {
- // vkd3d-proton presents through DXVK's dxgi, so the game gets DXVK as well.
- out.graphics = "dxvk";
- out.d3d12 = "vkd3d-proton";
} else if (has("d3d12")) {
out.refusal = "This game needs Direct3D 12, which this runtime kit can't draw yet.";
}
diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cpp
index f7e2bcd..f229fef 100644
--- a/tests/game_probe_test.cpp
+++ b/tests/game_probe_test.cpp
@@ -173,6 +173,7 @@ int main() {
WritePe(root / "Net.exe", {false, {"mscoree.dll"}});
WritePe(root / "Clr.exe", {true, {"KERNEL32.dll"}, true});
WritePe(root / "Twelve.exe", {true, {"d3d12.dll"}});
+ WritePe(root / "TwelveDxgi.exe", {true, {"dxgi.dll", "d3d12.dll"}});
CHECK(DefaultsFor(ProbeGame(root.string(), "Stub.exe")).refusal.find("Steam DRM") != std::string::npos);
CHECK(DefaultsFor(ProbeGame(root.string(), "Net.exe")).refusal.find(".NET") != std::string::npos);
CHECK(DefaultsFor(ProbeGame(root.string(), "Clr.exe")).refusal.find(".NET") != std::string::npos);
@@ -194,6 +195,9 @@ int main() {
vkd3d.vkd3d_proton = true;
const auto twelve = DefaultsFor(ProbeGame(root.string(), "Twelve.exe"), vkd3d);
CHECK(twelve.refusal.empty() && twelve.graphics == "dxvk" && twelve.d3d12 == "vkd3d-proton");
+ // Direct3D 12 games load dxgi too; that doesn't make them Direct3D 11 games.
+ const auto twelve_dxgi = DefaultsFor(ProbeGame(root.string(), "TwelveDxgi.exe"), vkd3d);
+ CHECK(twelve_dxgi.refusal.empty() && twelve_dxgi.graphics == "dxvk" && twelve_dxgi.d3d12 == "vkd3d-proton");
KitCapabilities vkd3d_kit;
vkd3d_kit.vkd3d_proton = true;
CHECK(GameProgramRefusal(root.string(), "Twelve.exe", vkd3d_kit, false).empty());