Skip to content

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

C++

Use DXVK for games with no detected graphics library

Leonardo Lobato6a00db0f59aa
diff --git a/src/runtime/game_probe.cpp b/src/runtime/game_probe.cpp
index 53a2ec9..a31874b 100644
--- a/src/runtime/game_probe.cpp
+++ b/src/runtime/game_probe.cpp
@@ -540,6 +540,10 @@ GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtime
out.graphics = "opengl";
} else if (has("d3d12")) {
out.refusal = "This game needs Direct3D 12, which this runtime kit can't draw yet.";
+ } else if (probe.engine.empty() && probe.apis.empty()) {
+ // Nothing names a graphics library: it is loaded at run time (Alan Wake's d3d9). Automatic means Wine's own
+ // Direct3D, which can't get an OpenGL context on the console, so DXVK covers the likeliest case.
+ out.graphics = "dxvk";
}
if (out.refusal.empty() && !soft.empty()) {
out.refusal = std::move(soft);
@@ -568,6 +572,8 @@ std::string DetectedLabel(const std::string& summary) {
facts.insert(summary.substr(start, end - start));
start = end + 1;
}
+ // Nothing detected: the graphics value is a default, not something the game's files said.
+ if (facts.count("unknown")) return {};
std::string engine;
for (const auto& [id, name] : std::initializer_list<std::pair<const char*, const char*>>{
{"unity", "Unity"}, {"unity-il2cpp", "Unity"}, {"unity-legacy", "Unity"}, {"unreal", "Unreal Engine"}, {"unreal5", "Unreal Engine 5"}, {"source", "Source"},
@@ -588,7 +594,8 @@ std::string DetectedLabel(const std::string& summary) {
? "Direct3D 11"
: facts.count("d3d10") ? "Direct3D 10" : facts.count("d3d9") ? "Direct3D 9"
: facts.count("d3d8") ? "Direct3D 8" : "Direct3D";
- if (engine.empty()) return api;
+ // DXVK without an engine or a Direct3D library named (only anticheat or shared-section facts) is the default too.
+ if (engine.empty()) return api == "Direct3D" ? std::string() : api;
return api.empty() ? engine : engine + " · " + api;
}
diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cpp
index 719ee4c..2034fe4 100644
--- a/tests/game_probe_test.cpp
+++ b/tests/game_probe_test.cpp
@@ -145,7 +145,38 @@ int main() {
WritePe(base / "elsewhere.dll", {true, {}, false, false, "d3d11.dll"});
fs::create_symlink(base / "elsewhere.dll", root / "UnityPlayer.dll");
const auto probe = ProbeGame(root.string(), "Game.exe");
- CHECK(probe.engine.empty() && probe.apis.empty() && DefaultsFor(probe).graphics == "auto");
+ CHECK(probe.engine.empty() && probe.apis.empty() && DefaultsFor(probe).graphics == "dxvk");
+ }
+ { // No graphics library named anywhere (Alan Wake loads d3d9 at run time): DXVK, as Wine's own Direct3D can't draw
+ // on the console. The label claims nothing.
+ const auto root = fresh();
+ WritePe(root / "AlanWake.exe", {false, {"KERNEL32.dll", "USER32.dll"}});
+ const auto probe = ProbeGame(root.string(), "AlanWake.exe");
+ CHECK(probe.engine.empty() && probe.apis.empty());
+ const auto defaults = DefaultsFor(probe);
+ CHECK(defaults.graphics == "dxvk" && defaults.summary == "unknown graphics=dxvk" && defaults.refusal.empty());
+ CHECK(DetectedLabel(defaults.summary).empty());
+ CHECK(DetectedLabel("anticheat graphics=dxvk").empty() && DetectedLabel("shared-section graphics=dxvk").empty());
+ // .NET without Wine Mono: still refused softly, with DXVK for a player who tries anyway.
+ auto dotnet = probe;
+ dotnet.dotnet = true;
+ const auto soft = DefaultsFor(dotnet);
+ CHECK(soft.refusal_soft && !soft.refusal.empty() && soft.graphics == "dxvk");
+ // A library beside the program that imports Direct3D 9 says so.
+ WritePe(root / "renderer.dll", {false, {"d3d9.dll", "KERNEL32.dll"}});
+ const auto sibling = DefaultsFor(ProbeGame(root.string(), "AlanWake.exe"));
+ CHECK(sibling.graphics == "dxvk" && sibling.summary == "d3d9 graphics=dxvk");
+ CHECK(DetectedLabel(sibling.summary) == "Direct3D 9");
+ // One that imports OpenGL keeps the game on OpenGL.
+ fs::remove(root / "renderer.dll");
+ WritePe(root / "gl.dll", {false, {"OPENGL32.dll", "KERNEL32.dll"}});
+ const auto opengl = DefaultsFor(ProbeGame(root.string(), "AlanWake.exe"));
+ CHECK(opengl.graphics == "opengl" && opengl.summary == "opengl graphics=opengl");
+ // Vulkan alone needs no translation: Automatic.
+ fs::remove(root / "gl.dll");
+ WritePe(root / "vk.dll", {false, {"vulkan-1.dll", "KERNEL32.dll"}});
+ const auto vulkan = ProbeGame(root.string(), "AlanWake.exe");
+ CHECK(vulkan.apis.count("vulkan") && DefaultsFor(vulkan).graphics == "auto");
}
{ // GameMaker names D3D11 in upper case.
const auto root = fresh();
diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cpp
index 4e40afc..fc92d75 100644
--- a/tests/game_settings_test.cpp
+++ b/tests/game_settings_test.cpp
@@ -1932,7 +1932,8 @@ int main(int argc, char** argv) {
CHECK(GenerateGameRecipe(4242, "Example", launches, game_root.string(), &generated, &reason));
CHECK(generated.id == GeneratedRecipeId(4242) && IsGeneratedRecipeId(generated.id) && !IsGeneratedRecipeId(hl2.id));
CHECK(generated.app_id == 4242 && generated.version == 2 && generated.architecture == "pe64");
- CHECK(generated.graphics == "auto" && generated.dll_overrides.empty() && generated.locked.empty());
+ // No graphics library named: DXVK (game_probe.cpp, DefaultsFor).
+ CHECK(generated.graphics == "dxvk" && generated.dll_overrides.empty() && generated.locked.empty());
CHECK(generated.launch_entries.size() == 2);
CHECK(generated.launch_entries[0].executable == "Bin/Game.exe" && generated.launch_entries[0].label == "Play");
CHECK(generated.launch_entries[0].working_directory == "Bin");