Play your Steam library's Windows games on a jailbroken PS5.
C++
Start Direct3D 12 games that asked for feature level 12_0 - Games on vkd3d-proton now get `VKD3D_FEATURE_LEVEL=12_0` by default. The PS5 GPU has only Tier 1 tiled resources, so vkd3d-proton stopped at feature level 11_1, and games that need 12_0 said "DirectX 12 is not supported on your system" or "requires a GPU that supports Direct3D feature level 12_0" and quit. Playden writes it at every Play; a `VKD3D_FEATURE_LEVEL` typed in Game settings › Environment variables still wins. - Unreal Engine 5 games now default to Direct3D 12 = vkd3d-proton, so they start with `-dx12` instead of `-dx11`. Many Unreal 5 projects ship only the Direct3D 12 renderer and stopped with "Unable to launch with RHI 'DirectX 11' since the project is not configured to support it". - Unreal 5 is told apart from Unreal 4 by the Nanite settings its Shipping program names, also behind the root launcher. Unreal 4 games stay on Direct3D 11 through DXVK, and so does Unreal 5 on a kit without vkd3d-proton. Game settings shows the renderer it starts on: "Unreal Engine 5 · Direct3D 12". - The choice is made when a game is set up, so Unreal 5 games set up earlier keep `-dx11` until Maintenance › Recreate bottle. COMPATIBILITY.md says so.
Leonardo Lobato1a7f74b3ae08
diff --git a/COMPATIBILITY.md b/COMPATIBILITY.mdindex b2c17f0..1faf23b 100644--- a/COMPATIBILITY.md+++ b/COMPATIBILITY.md@@ -286,7 +286,11 @@ To see which kit your console has, run the [log script](tools/collect_logs.py):- **New games can stay at *Waiting for the PS5*** when ShadowMountPlus stops registering titles. ReloadShadowMountPlus.- **Direct3D 12 games** need a kit with vkd3d-proton (0.11 or later). Playden turns it on for games that use- Direct3D 12, except Unity and Unreal games: for those, set Game settings › Direct3D 12 = vkd3d-proton. Its own variables (`VKD3D_DEBUG`, `VKD3D_CONFIG`, …) go in Environment variables.+ Direct3D 12 and for Unreal Engine 5 games (from 0.9.0), except Unity and Unreal 4 games: for those, set Game settings+ › Direct3D 12 = vkd3d-proton. Games set up before 0.9.0 keep their setting until Maintenance › Recreate bottle. A game+ that says Direct3D 12 or feature level 12_0 is not supported gets feature level 12_0 from 0.9.0; Environment variables+ `VKD3D_FEATURE_LEVEL=11_1` turns that off. vkd3d-proton's other variables (`VKD3D_DEBUG`, `VKD3D_CONFIG`, …) go in+ Environment variables too.- **Denuvo Anti-Tamper** games (for example Hi-Fi RUSH) cannot run, and support is not planned.- **Kernel anti-cheat** games (for example Easy Anti-Cheat or BattlEye in kernel mode) cannot run, and support is not planned.- Games that need a **third-party launcher or account** (EA app, Ubisoft Connect, Rockstar) are not supported yet.diff --git a/src/runtime/game_probe.cpp b/src/runtime/game_probe.cppindex 6c31716..12683fa 100644--- a/src/runtime/game_probe.cpp+++ b/src/runtime/game_probe.cpp@@ -201,7 +201,11 @@ void AddImports(const PeFacts& facts, std::set<std::string>* apis) {constexpr std::pair<const char*, const char*> kEngineMarks[] = {{"sil_windows_use_", "sil"},{"microsoft.xna.framework", "xna"}};-void ScanNames(const std::string& path, std::set<std::string>* apis, std::string* engine = nullptr) {+// Unreal Engine 5 names Nanite's console variables (as UTF-16, scanned in lower case); Unreal 4 has no Nanite.+constexpr char kUnreal5Mark[] = "r\0.\0n\0a\0n\0i\0t\0e\0";++void ScanNames(const std::string& path, std::set<std::string>* apis, std::string* engine = nullptr,+ bool* unreal5 = nullptr) {Program program(path);std::vector<std::string> needles;std::vector<const char*> found_as;@@ -213,6 +217,7 @@ void ScanNames(const std::string& path, std::set<std::string>* apis, std::stringneedles.push_back(wide);found_as.push_back(api);}+ const std::string_view unreal5_mark(kUnreal5Mark, sizeof(kUnreal5Mark) - 1);constexpr std::size_t kChunk = 1 << 20;constexpr std::size_t kOverlap = 32;std::vector<unsigned char> buffer(kChunk + kOverlap); // heap: console worker stacks are small@@ -229,6 +234,7 @@ void ScanNames(const std::string& path, std::set<std::string>* apis, std::stringif (engine && engine->empty())for (const auto& [mark, name] : kEngineMarks)if (text.find(mark) != std::string_view::npos) *engine = name;+ if (unreal5 && !*unreal5 && text.find(unreal5_mark) != std::string_view::npos) *unreal5 = true;offset += count;kept = std::min(kOverlap, size);std::memmove(buffer.data(), buffer.data() + size - kept, kept);@@ -347,7 +353,7 @@ GameProbe ProbeGame(const std::string& install_root, const std::string& executabfor (const auto& [name, directory] : here)if (!directory && EndsWith(Lower(name), ".dll")) AddImports(ReadPe((root / folder / name).string()), &probe.apis);std::string marked_engine;- ScanNames((root / executable).string(), &probe.apis, &marked_engine);+ ScanNames((root / executable).string(), &probe.apis, &marked_engine, &probe.unreal5);if (const auto unity = Find(here, "unityplayer.dll", false); unity || Find(here, Lower(stem) + "_data", true)) {probe.engine = "unity";@@ -356,7 +362,13 @@ GameProbe ProbeGame(const std::string& install_root, const std::string& executabif (unity) ScanNames((root / folder / *unity).string(), &probe.apis);} else if (EndsWith(lower_file, "-shipping.exe") || Find(here, "engine", true)) {probe.engine = "unreal";- if (!EndsWith(lower_file, "-shipping.exe")) probe.unreal_program = FindShipping(root, folder, 0);+ if (!EndsWith(lower_file, "-shipping.exe")) {+ probe.unreal_program = FindShipping(root, folder, 0);+ // The root program is only a launcher: the engine version is in the Shipping program.+ std::set<std::string> shipping_apis;+ if (!probe.unreal_program.empty())+ ScanNames((root / probe.unreal_program).string(), &shipping_apis, nullptr, &probe.unreal5);+ }} else if (const auto bin = Find(here, "bin", true); bin && Find(Entries(root / folder / *bin), "engine.dll", false)) {probe.engine = "source";} else if (Find(here, "data.win", false)) {@@ -389,6 +401,7 @@ GameProbe ProbeGame(const std::string& install_root, const std::string& executab} else {probe.engine = marked_engine;}+ if (probe.engine != "unreal") probe.unreal5 = false; // the mark only means Unreal 5 in an Unreal gamefor (const auto* entries : {&here, &top})if (Find(*entries, "easyanticheat", true) || Find(*entries, "battleye", true)) probe.anticheat = true;return probe;@@ -420,8 +433,11 @@ GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtimeout.arguments = probe.legacy_unity ? "-force-d3d9 {resolution}" : "-force-d3d11 {resolution}";out.resolution_arguments = "-screen-width {w} -screen-height {h}";} else if (probe.engine == "unreal") {+ // Unreal 4 draws on DXVK. Unreal 5 projects are often Direct3D 12 only ("Unable to launch with RHI 'DirectX+ // 11'"), so they get vkd3d-proton, which turns -dx11 into -dx12 (game_settings.cpp).out.graphics = "dxvk";out.arguments = "-dx11";+ if (probe.unreal5 && runtime.vkd3d_proton) out.d3d12 = "vkd3d-proton";} else if (probe.engine == "source") {out.graphics = "dxvk";out.arguments = "{resolution}";@@ -462,9 +478,12 @@ GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtimeout.refusal_soft = true;}std::string facts = probe.engine;+ if (probe.unreal5) facts += "5";if (probe.il2cpp) facts += facts.empty() ? "il2cpp" : "-il2cpp";if (probe.legacy_unity) facts += "-legacy";for (const auto& api : probe.apis) facts += (facts.empty() ? "" : ",") + api;+ // An Unreal 5 game names both renderers; this says which one it starts on.+ if (probe.unreal5) facts += out.d3d12.empty() ? ",dx11" : ",dx12";if (probe.anticheat) facts += (facts.empty() ? "" : ",") + std::string("anticheat");if (probe.shared_section) facts += (facts.empty() ? "" : ",") + std::string("shared-section");out.summary = (facts.empty() ? "unknown" : facts) + " graphics=" + out.graphics;@@ -483,12 +502,14 @@ std::string DetectedLabel(const std::string& summary) {}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"}, {"source", "Source"},+ {"unity", "Unity"}, {"unity-il2cpp", "Unity"}, {"unity-legacy", "Unity"}, {"unreal", "Unreal Engine"}, {"unreal5", "Unreal Engine 5"}, {"source", "Source"},{"gamemaker", "GameMaker"}, {"godot", "Godot"}, {"love", "L\xC3\x96VE"}, {"nwjs", "NW.js"}, {"sil", "SIL"},{"idtech3", "id Tech 3"}, {"hashlink", "HashLink"}, {"xna", "XNA"}, {"java", "Java"}})if (facts.count(id)) engine = name;std::string api;if (graphics == "opengl") api = "OpenGL";+ else if (graphics == "dxvk" && engine == "Unreal Engine 5")+ api = facts.count("dx12") ? "Direct3D 12" : "Direct3D 11";else if (graphics == "dxvk" && facts.count("d3d12") && engine != "Unity" && engine != "Unreal Engine")// Direct3D 12 also loads dxgi; a game that names both 11 and 12 can draw with either.api = facts.count("d3d11") ? "Direct3D 11 and 12" : "Direct3D 12";diff --git a/src/runtime/game_probe.h b/src/runtime/game_probe.hindex 3a30db2..7a8d7d8 100644--- a/src/runtime/game_probe.h+++ b/src/runtime/game_probe.h@@ -29,6 +29,7 @@ struct GameProbe {// child process, which the console cannot do): the *-Shipping.exe to start instead,// relative to the install root, as spelled on disk.std::string unreal_program;+ bool unreal5 = false; // Unreal Engine 5 (its Shipping program names Nanite's settings)};inline constexpr unsigned long long kProbeScanBytes = 256ull * 1024ull * 1024ull;diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cppindex 64c988d..c8094c7 100644--- a/src/runtime/game_settings.cpp+++ b/src/runtime/game_settings.cpp@@ -2409,6 +2409,9 @@ std::vector<RegistryValue> RenderBottleEnvironment(const EffectiveSettings& settwhile (!item.empty() && item.back() == ' ') item.pop_back();if (IsBottleEnvironmentEntry(name, item)) listed[name] = item;}+ // The PS5 GPU has only Tier 1 tiled resources, so vkd3d-proton stops at feature level 11_1, and games that ask+ // for 12_0 (most Unreal 5 games) say Direct3D 12 is not supported. A value typed in Environment variables wins.+ if (settings.vkd3d_proton && !listed.count("VKD3D_FEATURE_LEVEL")) listed["VKD3D_FEATURE_LEVEL"] = "12_0";// A Frame limit on a display-120hz runtime replaces a VKD3D_FRAME_RATE typed in Environment variables: the display// paces the cap, or, for 30 at 120 Hz output, vkd3d-proton's own limiter does.if (FrameLimitOwnsCap(settings)) {diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cppindex ecf9f30..f1a65e3 100644--- a/tests/game_probe_test.cpp+++ b/tests/game_probe_test.cpp@@ -333,6 +333,60 @@ int main() {CHECK(recipe.launch_entries[0].working_directory == "Game/Binaries/Win64");CHECK(recipe.launch_entries[0].arguments == "-nosplash" && recipe.arguments == "-dx11" && recipe.graphics == "dxvk");CHECK(recipe.detected == "unreal,anticheat graphics=dxvk");+ // Unreal 4 stays on Direct3D 11 with vkd3d-proton in the kit.+ RuntimeAbilities vkd3d;+ vkd3d.vkd3d_proton = true;+ CHECK(!probe.unreal5 && DefaultsFor(probe, vkd3d).d3d12.empty());+ }+ { // Unreal 5 (Nanite's settings in the Shipping program, behind the root launcher) gets vkd3d-proton.+ const auto root = fresh();+ WritePe(root / "Hellraiser.exe", {true, {"KERNEL32.dll"}});+ fs::create_directories(root / "Engine/Binaries/Win64");+ PeSpec shipping{true, {"d3d11.dll", "d3d12.dll"}};+ shipping.text = std::string("r\0.\0N\0a\0n\0i\0t\0e\0.\0", 18);+ WritePe(root / "Hellraiser/Binaries/Win64/Hellraiser-Win64-Shipping.exe", shipping);+ const auto probe = ProbeGame(root.string(), "Hellraiser.exe");+ CHECK(probe.engine == "unreal" && probe.unreal5);+ RuntimeAbilities vkd3d;+ vkd3d.vkd3d_proton = true;+ const auto defaults = DefaultsFor(probe, vkd3d);+ CHECK(defaults.d3d12 == "vkd3d-proton" && defaults.arguments == "-dx11" && defaults.graphics == "dxvk");+ CHECK(defaults.summary == "unreal5,dx12 graphics=dxvk");+ CHECK(DetectedLabel(defaults.summary) == "Unreal Engine 5 \xC2\xB7 Direct3D 12");+ // Without vkd3d-proton it starts on Direct3D 11, as before.+ const auto older = DefaultsFor(probe);+ CHECK(older.d3d12.empty() && older.arguments == "-dx11");+ CHECK(DetectedLabel(older.summary) == "Unreal Engine 5 \xC2\xB7 Direct3D 11");+ // Started as the Shipping program itself (which imports d3d12), the same, label included.+ const auto direct = ProbeGame(root.string(), "Hellraiser/Binaries/Win64/Hellraiser-Win64-Shipping.exe");+ CHECK(direct.unreal5 && DefaultsFor(direct, vkd3d).d3d12 == "vkd3d-proton");+ CHECK(DetectedLabel(DefaultsFor(direct).summary) == "Unreal Engine 5 \xC2\xB7 Direct3D 11");+ CHECK(DetectedLabel(DefaultsFor(direct, vkd3d).summary) == "Unreal Engine 5 \xC2\xB7 Direct3D 12");+ // The generated recipe starts it with -dx12 on a kit with vkd3d-proton.+ KitCapabilities vkd3d_kit;+ vkd3d_kit.vkd3d_proton = true;+ GameRecipe recipe;+ std::string reason;+ CHECK(GenerateGameRecipe(5184670, "Hellraiser", {{"", "", "Hellraiser.exe", "", ""}}, root.string(), &recipe,+ &reason, vkd3d_kit));+ CHECK(recipe.defaults.at("d3d12") == "vkd3d-proton" && recipe.arguments == "-dx11");+ EffectiveSettings settings;+ SettingsError error;+ CHECK(BuildEffectiveSettings(recipe, nullptr, {}, vkd3d_kit, &settings, &error));+ CHECK(settings.vkd3d_proton && settings.values.at("arguments").value == "-dx12");+ }+ { // Nanite's name in a game that isn't Unreal, or no Shipping program behind the launcher: no Unreal 5.+ const auto root = fresh();+ PeSpec named{true, {"d3d11.dll"}};+ named.text = std::string("r\0.\0N\0a\0n\0i\0t\0e\0", 16);+ WritePe(root / "Other.exe", named);+ const auto other = ProbeGame(root.string(), "Other.exe");+ CHECK(other.engine.empty() && !other.unreal5 && DefaultsFor(other).summary == "d3d11 graphics=dxvk");+ const auto bare = fresh();+ WritePe(bare / "Game.exe", {true, {"KERNEL32.dll"}});+ fs::create_directories(bare / "Engine/Binaries/Win64");+ const auto launcher = ProbeGame(bare.string(), "Game.exe");+ CHECK(launcher.engine == "unreal" && launcher.unreal_program.empty() && !launcher.unreal5);}{ // Generated recipes: DXVK through overrides that follow the graphics value; graphics is open.const auto root = fresh();diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cppindex 89dd5c8..5ca79cf 100644--- a/tests/game_settings_test.cpp+++ b/tests/game_settings_test.cpp@@ -389,6 +389,17 @@ int main(int argc, char** argv) {for (const auto& value : RenderBottleEnvironment(shown))if (value.name == "VKD3D_FRAME_RATE") vkd3d_rate = value.data;CHECK(vkd3d_rate.empty());+ // vkd3d-proton reports feature level 12_0 unless Environment variables sets another one; other games get none.+ const auto feature_level = [](const EffectiveSettings& values) {+ for (const auto& value : RenderBottleEnvironment(values))+ if (value.name == "VKD3D_FEATURE_LEVEL") return value.data;+ return std::string();+ };+ CHECK(feature_level(shown) == "\"12_0\"");+ CHECK(BuildEffectiveSettings(d3d12, nullptr, {{"environment", "VKD3D_FEATURE_LEVEL=11_1"}}, display, &shown, &error));+ CHECK(feature_level(shown) == "\"11_1\"");+ CHECK(BuildEffectiveSettings(hl2, nullptr, {}, display, &shown, &error));+ CHECK(feature_level(shown).empty());// One pacer: a Frame limit replaces frame-rate variables the player typed in Environment variables, both// vkd3d-proton's (bottle environment) and DXVK's (profile); with Off they apply as before.