Play your Steam library's Windows games on a jailbroken PS5.
C++
Run Direct3D 12 games through vkd3d-proton
Leonardo Lobatoa0fefdd89c73
diff --git a/COMPATIBILITY.md b/COMPATIBILITY.mdindex 291f74b..9de008f 100644--- a/COMPATIBILITY.md+++ b/COMPATIBILITY.md@@ -1,10 +1,10 @@# Compatibility-Games tested on a PS5 on firmware 13.60, plus community test reports (linked in the notes) on other firmware. Last updated 2026-10-17.+Games tested on a PS5 on firmware 13.60, plus community test reports (linked in the notes) on other firmware. Last updated 2026-10-19.> [!NOTE]-> Every game below was checked on runtime kit **0.10**, the first stable kit. OpenGL games draw through Mesa (Zink on-> Vulkan). See [Kits](#kits) for what each kit version changes.+> Games were checked on runtime kit **0.10**, the first stable kit, unless the Kit column names a newer one.+> OpenGL games draw through Mesa (Zink on Vulkan). See [Kits](#kits) for what each kit version changes.Did you test a game? [Open a test report](../../issues/new?template=test-report.yml), even when it works.@@ -18,7 +18,7 @@ Did you test a game? [Open a test report](../../issues/new?template=test-report.| ⛔ Refused | Playden refuses to prepare it and tells you why. For .NET and shared-section refusals, Game settings › Known problems › Try anyway prepares it anyway. |The **Kit** column is the newest runtime kit the game was checked on. The **Graphics** column is what the game-uses: Direct3D 8–11 goes through DXVK to Vulkan.+uses: Direct3D 8–11 goes through DXVK to Vulkan, and Direct3D 12 through vkd3d-proton (from kit 0.11).## Games@@ -26,7 +26,8 @@ uses: Direct3D 8–11 goes through DXVK to Vulkan.| --- | --- | --- | --- | --- || [STAR WARS: The Force Unleashed Ultimate Sith Edition](https://store.steampowered.com/app/32430) | ✅ Works | 0.10 | D3D9 · DXVK · 32-bit | In the game's own launcher, set Input Device to Xbox360 Controller (`IsKBAndMouse=FALSE`), then start `SWTFU.exe`. Loading a save and walking as Darth Vader with the controller work. Full campaign not tested. || [IMMORTALITY](https://store.steampowered.com/app/1350200) | ✅ Works | 0.10 | Unity · D3D11 · DXVK · 64-bit | Default configuration. Controller menus, film-grid zoom/navigation, opening clip playback and scrubbing, pause/image mode, and face selection to a second clip verified. Bundled Bink DLLs handle video; this does not verify the missing MF backend. Limited opening test; audio synchronization, later clips and full playthrough untested. |-| [Machinarium](https://store.steampowered.com/app/40700) | ✅ Works | 0.10 | DXVK · 32-bit DX9 | Select Machinarium_old_32bit_DX9.exe in Game settings > Program, then Recreate bottle. Verified menu, opening scene and first junkyard scene with native controller cursor/New Game input; no full playthrough. Current 64-bit executable crashes on a null D3D12 command allocator before Reset; DX9 bypasses it. |+| [Machinarium](https://store.steampowered.com/app/40700) | ✅ Works | 0.11 (dev) | — · D3D12 · vkd3d-proton · 64-bit | Game settings › Program = `Machinarium.exe`, Graphics = DXVK, Direct3D 12 = **vkd3d-proton**. Title screen, menus, New Game, the opening cutscene and the first junkyard scene with the controller cursor. With Wine's own Direct3D 12 it crashes before the first frame; on kit 0.10, `Machinarium_old_32bit_DX9.exe` (Recreate bottle after switching) works instead. |+| [Cyberpunk 2077](https://store.steampowered.com/app/1091500) | ✅ Works | 0.11 (dev) | REDengine 4 · D3D12 · vkd3d-proton · 64-bit | Game settings › Program = `bin/x64/Cyberpunk2077.exe` (the default launcher cannot start the game), Graphics = DXVK, Direct3D 12 = **vkd3d-proton**. The first start opens at 1024×768: set 1920×1080 in the game's Video settings. Intro, menus, character creation, the Nomad opening and walking in the garage with the controller; about 3 GB of video memory, no crash in a 13-minute session. Frame rate not measured yet. || [Bulletstorm: Full Clip Edition](https://store.steampowered.com/app/501590) | ✅ Works | 0.10 | Unreal 3 · DXVK · 64-bit | The startup movies, the title screen and the menus work with the controller. Campaign › Continue plays the loading movie and reaches the prologue. Longer gameplay untested. || [Fallout: New Vegas](https://store.steampowered.com/app/22380) | ✅ Works | 0.10 | Gamebryo · D3D9 · DXVK · 32-bit | Press Play once with the default program, the game's launcher, so it writes its settings. Then set Game settings › Program = `FalloutNV.exe`. The legal screen, the logos and the main menu (Continue, New, Load) work. Gameplay not tested yet. || [DoDonPachi Resurrection](https://store.steampowered.com/app/464450) | ✅ Works | 0.10 | — · D3D9 · DXVK · 32-bit | Intro, title screen, menus, the attract demo and a stage with the controller work. |@@ -136,5 +137,7 @@ To see which kit your console has, run the [log script](tools/collect_logs.py):runs inside the translator too.- **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): set Game settings › Graphics = DXVK and+ Direct3D 12 = vkd3d-proton. Its own variables (`VKD3D_DEBUG`, `VKD3D_CONFIG`, …) go in Environment variables.- **Kernel anti-cheat** games (for example Easy Anti-Cheat or BattlEye in kernel mode) cannot run.- Games that need a **third-party launcher or account** (EA app, Ubisoft Connect, Rockstar) are not supported yet.diff --git a/src/homebrew/runtime_host.cpp b/src/homebrew/runtime_host.cppindex 5851181..6da4804 100644--- a/src/homebrew/runtime_host.cpp+++ b/src/homebrew/runtime_host.cpp@@ -495,6 +495,34 @@ std::string RuntimeHost::ApplySteamworks(Composition& c, const rt::RuntimeInstalLog("ue3 eula app=" + std::to_string(record.app_id) + " guid=" + (eula.guid.empty() ? "-" : eula.guid) +" written=" + (eula.written ? "1" : "0") + (eula.ok ? std::string() : " failed=" + eula.message));if (!eula.ok) return "The game's EULA could not be marked accepted: " + eula.message + ".";+ // Direct3D 12 through vkd3d-proton: its DLLs go into the bottle, where the profile's overrides load them.+ if (c.kit) {+ std::string reason;+ if (!rt::ApplyD3D12Library((c.kit->view.root / c.kit->view.runtime.path).string(),+ (c.kit->view.root / c.kit->view.template_path).string(),+ (HostPath(record.data_root) / "library/prefixes/game").string(), settings.vkd3d_proton,+ &reason)) {+ Log("d3d12 app=" + std::to_string(record.app_id) + " vkd3d-proton=" + (settings.vkd3d_proton ? "1" : "0") ++ " failed=" + reason);+ return std::string(settings.vkd3d_proton ? "vkd3d-proton could not be set up: "+ : "Wine's Direct3D 12 could not be put back: ") + reason + ".";+ } else if (settings.vkd3d_proton) {+ Log("d3d12 app=" + std::to_string(record.app_id) + " vkd3d-proton=1");+ }+ }+ // vkd3d-proton's variables reach the game through the bottle's Environment key. Some change how it draws, so a+ // bottle that exists but cannot take them stops the start; one not made yet gets them on the next Play.+ {+ const auto prefix = (HostPath(record.data_root) / "library/prefixes/game").string();+ struct stat hive {};+ std::string reason;+ if (::lstat((prefix + "/user.reg").c_str(), &hive) == 0 &&+ !rt::ApplyBottleRegistryValues(rt::RenderBottleEnvironment(settings), prefix, config_.unix_time(), "user.reg",+ &reason)) {+ Log("bottle environment app=" + std::to_string(record.app_id) + " failed=" + reason);+ return "The game's vkd3d-proton variables could not be written: " + reason + ".";+ }+ }// Registry keys Steam's install script writes on a game's first start (Fallout: New Vegas's// launcher wants its install path there).if (const auto install_dir = rt::ProsperoWindowsPath(record.install_path)) {diff --git a/src/runtime/game_probe.h b/src/runtime/game_probe.hindex e5622a0..a1289ee 100644--- a/src/runtime/game_probe.h+++ b/src/runtime/game_probe.h@@ -60,5 +60,9 @@ std::string DetectedLabel(const std::string& summary);// The DLL overrides that make a game use the bottle's DXVK instead of Wine's Direct3D.inline constexpr const char* kDxvkOverrides = "d3d8,d3d9,d3d10core,d3d11,dxgi=n";+// The Direct3D 12 setting set to vkd3d-proton adds these after the DXVK ones (vkd3d-proton needs DXVK's dxgi).+inline constexpr const char* kVkd3dProtonOverrides = "d3d12,d3d12core=n";+// The same when the list does not already load a dxgi of its own choice.+inline constexpr const char* kVkd3dProtonDxgiOverrides = "d3d12,d3d12core,dxgi=n";} // namespace playden::runtimediff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cppindex da70dfa..57a97fd 100644--- a/src/runtime/game_settings.cpp+++ b/src/runtime/game_settings.cpp@@ -174,6 +174,11 @@ std::vector<SettingDefinition> BuildCatalogue() {{{"auto", "Automatic", ""}, {"gdi", "GDI", "2D only."}, {"dxvk", "DXVK", "Direct3D 9-11 on Vulkan."},{"opengl", "OpenGL", ""}},"auto"));+ list.push_back(Choice("d3d12", "Direct3D 12", "What draws a Direct3D 12 game.", "d3d12.dll · d3d12core.dll",+ T::kCompatibility,+ {{"wine", "Wine", "Wine's own Direct3D 12."},+ {"vkd3d-proton", "vkd3d-proton", "Direct3D 12 on Vulkan, as in Proton. Experimental."}},+ "wine"));list.push_back(Choice("steam_features", "Steam features", "How the game reaches Steam without the Steam client.","steam_api.dll · steam_api64.dll", T::kCompatibility,{{"emulate", "Offline emulation", "Playden's Steam emulator answers the game."},@@ -367,6 +372,11 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&if (overlay == values.end() || overlay->second.value != "on") return "Turn the performance overlay on first.";}if (id == "scaling" && dxvk) return "Not available with DXVK output yet.";+ // vkd3d-proton presents through DXVK's dxgi, which only the DXVK overrides load.+ if (id == "d3d12") {+ if (!kit.vkd3d_proton) return "Needs a runtime kit with vkd3d-proton.";+ if (!dxvk) return "Only available with DXVK.";+ }if ((id == "refresh" || id == "opengl_thread") && graphics != "opengl") return "Only available with OpenGL.";// Zink has no output rate or worker thread of its own; the runtime logs these as ignored.if ((id == "refresh" || id == "opengl_thread") && kit.opengl_zink)@@ -471,7 +481,8 @@ bool ValidateSettingValue(const GameRecipe& recipe, std::string_view id, std::stauto item = entry.substr(equals + 1);while (!name.empty() && name.back() == ' ') name.remove_suffix(1);while (!item.empty() && item.front() == ' ') item.remove_prefix(1);- if (!IsProsperoEnvironmentEntry(name, item) && !IsProsperoDebugEnvEntry(name, item))+ if (!IsProsperoEnvironmentEntry(name, item) && !IsProsperoDebugEnvEntry(name, item) &&+ !IsBottleEnvironmentEntry(name, item))return fail(std::string(name) + " is not an allowed variable");if (!names.insert(std::string(name)).second) return fail(std::string(name) + " appears twice");if (++count > kProsperoMaxEnvironmentEntries) return fail("at most 8 variables");@@ -687,6 +698,24 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* presif (out.graphics == "dxvk") list = list.empty() ? std::string(kDxvkOverrides) : kDxvkOverrides + (";" + list);overrides_row.value = list;}+ // vkd3d-proton's entry follows the Direct3D 12 row the same way, whoever wrote the list.+ out.vkd3d_proton = out.values["d3d12"].value == "vkd3d-proton";+ // It also brings DXVK's dxgi, which it presents through, when no other entry names dxgi.+ if (out.vkd3d_proton || overrides_row.value.find(kVkd3dProtonOverrides) != std::string::npos ||+ overrides_row.value.find(kVkd3dProtonDxgiOverrides) != std::string::npos) {+ std::string list;+ bool dxgi = false;+ for (const auto& entry : SplitDllOverrides(overrides_row.value)) {+ if (entry == kVkd3dProtonOverrides || entry == kVkd3dProtonDxgiOverrides) continue;+ list += (list.empty() ? "" : ";") + entry;+ auto names = "," + entry.substr(0, entry.find('=')) + ",";+ for (auto& c : names) c = static_cast<char>(c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);+ dxgi = dxgi || names.find(",dxgi,") != std::string::npos;+ }+ if (out.vkd3d_proton)+ list += (list.empty() ? "" : ";") + std::string(dxgi ? kVkd3dProtonOverrides : kVkd3dProtonDxgiOverrides);+ overrides_row.value = list;+ }out.dll_overrides = overrides_row.value;if (!out.dll_overrides.empty() && !IsProsperoDllOverrides(out.dll_overrides))return fail("dll_overrides", "library overrides are too long");@@ -1978,6 +2007,55 @@ bool ClearShaderCache(const LaunchEntry& launch, const std::string& install_rootreturn true;}+namespace {+constexpr const char* kBottleEnvironmentNames[] = {+ "VKD3D_CONFIG", "VKD3D_DEBUG", "VKD3D_DISABLE_EXTENSIONS", "VKD3D_FEATURE_LEVEL",+ "VKD3D_FRAME_RATE", "VKD3D_LOG_FILE", "VKD3D_SHADER_CACHE_PATH", "VKD3D_SHADER_DEBUG",+ "VKD3D_SHADER_MODEL", "VKD3D_SWAPCHAIN_IMAGES", "VKD3D_SWAPCHAIN_LATENCY_FRAMES",+ "VKD3D_SWAPCHAIN_PRESENT_MODE"};+} // namespace++bool IsBottleEnvironmentEntry(std::string_view name, std::string_view value) {+ if (std::find(std::begin(kBottleEnvironmentNames), std::end(kBottleEnvironmentNames), name) ==+ std::end(kBottleEnvironmentNames) ||+ value.empty() || value.size() >= 128)+ return false;+ for (const unsigned char c : value)+ if (c < 0x20 || c > 0x7e || c == '"' || c == '\'') return false;+ return true;+}++std::vector<RegistryValue> RenderBottleEnvironment(const EffectiveSettings& settings) {+ std::map<std::string, std::string> listed;+ const auto& environment = settings.values.at("environment");+ if (environment.available)+ for (std::size_t start = 0; start <= environment.value.size();) {+ const auto end = std::min(environment.value.find(';', start), environment.value.size());+ std::string entry = environment.value.substr(start, end - start);+ start = end + 1;+ const auto equals = entry.find('=');+ if (equals == std::string::npos) continue;+ std::string name = entry.substr(0, equals), item = entry.substr(equals + 1);+ while (!name.empty() && name.front() == ' ') name.erase(0, 1);+ while (!name.empty() && name.back() == ' ') name.pop_back();+ while (!item.empty() && item.front() == ' ') item.erase(0, 1);+ while (!item.empty() && item.back() == ' ') item.pop_back();+ if (IsBottleEnvironmentEntry(name, item)) listed[name] = item;+ }+ std::vector<RegistryValue> values;+ for (const char* name : kBottleEnvironmentNames) {+ const auto found = listed.find(name);+ std::string data;+ if (found != listed.end()) {+ data = "\"";+ for (const char c : found->second) data += c == '\\' ? std::string("\\\\") : std::string(1, c);+ data += "\"";+ }+ values.push_back({"Environment", name, data});+ }+ return values;+}+std::vector<RegistryValue> RenderRegistryValues(const EffectiveSettings& settings) {std::vector<RegistryValue> values;const auto& version = settings.values.at("windows_version");@@ -2236,6 +2314,71 @@ bool ApplyMediaRegistry(const std::string& runtime_dir, const std::string& prefireturn true;}+bool ApplyD3D12Library(const std::string& runtime_dir, const std::string& template_dir, const std::string& prefix_dir,+ bool vkd3d_proton, std::string* reason) {+ const auto fail = [&](std::string why) {+ if (reason) *reason = std::move(why);+ return false;+ };+ constexpr std::size_t kMaxD3D12DllBytes = 64u * 1024u * 1024u;+ // Left next to the DLLs while they are vkd3d-proton's, so switching back restores them whichever kit put them there.+ constexpr const char* kMarker = ".playden-vkd3d-proton";+ using Directory = decltype(ManagedDirectory::Open(std::filesystem::path(), DirectoryPolicy::kApprovedTree));+ struct Folder {+ Directory bottle;+ std::vector<std::pair<const char*, std::string>> writes;+ bool marked = false;+ };+ // Everything is read first, so a missing or unreadable file changes nothing.+ std::vector<Folder> folders;+ for (const auto& [arch, folder] : {std::pair{"x86_64-windows", "system32"}, std::pair{"i386-windows", "syswow64"}}) {+ Folder plan;+ plan.bottle = ManagedDirectory::Open(std::filesystem::path(prefix_dir) / "drive_c/windows" / folder,+ DirectoryPolicy::kApprovedTree);+ if (!plan.bottle) {+ if (errno == ENOENT) continue; // no bottle yet: the next Play puts them in+ return fail("cannot open the bottle's windows folders");+ }+ struct stat marker {};+ plan.marked = plan.bottle->InspectChild(kMarker, &marker);+ if (!plan.marked && errno != ENOENT) return fail("cannot inspect the bottle's vkd3d-proton marker");+ auto source = ManagedDirectory::Open(std::filesystem::path(runtime_dir) / "lib/vkd3d-proton" / arch,+ DirectoryPolicy::kApprovedTree);+ if (!source && vkd3d_proton) return fail("the kit has no vkd3d-proton");+ Directory original;+ for (const char* name : {"d3d12.dll", "d3d12core.dll"}) {+ std::string ours, current, wanted;+ if (source && ReadRegularAt(*source, name, kMaxD3D12DllBytes, &ours) != RelativeRead::kPresent)+ return fail(std::string("the kit's vkd3d-proton ") + name + " is missing");+ const auto state = ReadRegularAt(*plan.bottle, name, kMaxD3D12DllBytes, ¤t);+ if (state == RelativeRead::kError) return fail(std::string("cannot read the bottle's ") + name);+ if (vkd3d_proton) {+ wanted = std::move(ours);+ } else {+ // Bottles switched before the marker existed are recognized by the current kit's bytes.+ if (!plan.marked && (!source || state != RelativeRead::kPresent || current != ours)) continue;+ if (!original)+ original = ManagedDirectory::Open(std::filesystem::path(template_dir) / "drive_c/windows" / folder,+ DirectoryPolicy::kApprovedTree);+ if (!original || ReadRegularAt(*original, name, kMaxD3D12DllBytes, &wanted) != RelativeRead::kPresent)+ return fail(std::string("the kit template's ") + name + " is missing");+ }+ if (state != RelativeRead::kPresent || current != wanted) plan.writes.emplace_back(name, std::move(wanted));+ }+ folders.push_back(std::move(plan));+ }+ for (auto& plan : folders) {+ for (const auto& [name, data] : plan.writes)+ if (!WriteAtomicAt(*plan.bottle, name, data, 0644, false, false, true))+ return fail(std::string("cannot copy ") + name + " into the bottle");+ if (vkd3d_proton && !plan.marked && !WriteAtomicAt(*plan.bottle, kMarker, "", 0644, false, false, true))+ return fail("cannot mark the bottle's vkd3d-proton files");+ if (!vkd3d_proton && plan.marked && !plan.bottle->RemoveRegularFile(kMarker))+ return fail("cannot remove the bottle's vkd3d-proton marker");+ }+ return true;+}+bool ParseUe3InstallGuid(std::string_view install_info, std::string* guid) {static constexpr std::string_view open = "<InstallGuidString>", close = "</InstallGuidString>";const auto start = install_info.find(open);@@ -2342,6 +2485,7 @@ KitCapabilities KitCapabilitiesFromManifest(const std::vector<std::string>& capakit.game_root_unowned = has(kKitGameRootUnowned);kit.opengl_zink = has(kKitOpenGLZink);kit.wine_mono = has(kKitWineMono);+ kit.vkd3d_proton = has(kKitVkd3dProton);kit.registry = bottle_access;return kit;}diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.hindex 88bf911..dfd240e 100644--- a/src/runtime/game_settings.h+++ b/src/runtime/game_settings.h@@ -44,6 +44,7 @@ struct KitCapabilities {bool game_root_unowned = false; // games start from drives that record no file owners (exFAT)bool opengl_zink = false; // OpenGL games draw through Mesa's Zink, not the PS5 OpenGL SDKbool wine_mono = false; // .NET programs start on the kit's Wine Mono+ bool vkd3d_proton = false; // the kit's runtime carries vkd3d-proton's Direct3D 12 DLLs};struct SettingChoice {@@ -165,6 +166,8 @@ struct EffectiveSettings {// The runtime reads [debug] env lines (Zink kits). With [environment] as well, a variable [environment] does not// take (PW_, GALLIUM_, ZINK_, VK_) still goes there.bool debug_env_lines = false;+ // Direct3D 12 through vkd3d-proton: ApplyD3D12Library puts its DLLs in the bottle before the game starts.+ bool vkd3d_proton = false;};// The launch entry id of a program the player chose from the game folder.@@ -283,6 +286,15 @@ bool ClearShaderCache(const LaunchEntry& launch, const std::string& install_root// edit the bottle.std::vector<RegistryValue> RenderRegistryValues(const EffectiveSettings& settings);+// vkd3d-proton's own variables (VKD3D_DEBUG, VKD3D_CONFIG, ...), which neither profile section takes. Environment+// variables accepts them and they reach the game through the bottle's HKEY_CURRENT_USER\Environment, which Wine adds+// to the environment of the program it starts.+bool IsBottleEnvironmentEntry(std::string_view name, std::string_view value);++// The bottle's Environment values for those variables: each one Environment variables lists is set, every other one+// is removed, so a variable taken out of the row leaves the bottle as well.+std::vector<RegistryValue> RenderBottleEnvironment(const EffectiveSettings& settings);+// Applies values to Wine's user.reg text, keeping every other line. Sections Playden adds// carry the given Unix time. Returns false for text that is not a Wine registry file.bool ApplyRegistryValues(std::string* user_reg, const std::vector<RegistryValue>& values, std::int64_t unix_time,@@ -303,6 +315,14 @@ bool ApplyBottleRegistryValues(const std::vector<RegistryValue>& values, const sbool ApplyMediaRegistry(const std::string& runtime_dir, const std::string& prefix_dir,std::int64_t unix_time, std::string* reason);+// Puts the Direct3D 12 DLLs a game asked for in the stopped bottle's system32 and syswow64: vkd3d-proton's from+// <runtime_dir>/lib/vkd3d-proton when vkd3d_proton is set (the profile's overrides then load them as native), and+// otherwise the kit template's own copies back, but only where vkd3d-proton was put (a marker file next to the DLLs,+// or the current kit's bytes), so bottles that never used it are not touched. Every file is read before any is+// written, and files that already match are not rewritten. A bottle that does not exist yet is left for later.+bool ApplyD3D12Library(const std::string& runtime_dir, const std::string& template_dir, const std::string& prefix_dir,+ bool vkd3d_proton, std::string* reason);+// The <InstallGuidString> of an Unreal Engine 3 (UDK) Binaries/InstallInfo.xml: exactly one,// a 36-character 8-4-4-4-12 hex GUID once surrounding whitespace is trimmed.bool ParseUe3InstallGuid(std::string_view install_info, std::string* guid);@@ -389,6 +409,9 @@ inline constexpr const char* kKitOpenGLZink = "opengl-zink";// Runtime ability: the kit carries Wine Mono (at mono/wine-mono-<version>) and its template bottle points// Wine's mscoree at it, so .NET and mixed C++/CLI programs can start.inline constexpr const char* kKitWineMono = "wine-mono";+// Runtime ability: the kit's runtime carries vkd3d-proton's d3d12.dll and d3d12core.dll at+// lib/vkd3d-proton/<arch>-windows, for games that draw with Direct3D 12 (with DXVK's dxgi).+inline constexpr const char* kKitVkd3dProton = "vkd3d-proton";const std::vector<std::string>& SettingsKitCapabilityNames();// Settings gates from a verified kit's capabilities. bottle_access: the adapter can edit thediff --git a/src/runtime/kit_trust.cpp b/src/runtime/kit_trust.cppindex b53253e..24b5781 100644--- a/src/runtime/kit_trust.cpp+++ b/src/runtime/kit_trust.cpp@@ -13,7 +13,7 @@ KitAdmissionConfig DevelopmentKitAdmission() {config.known_capabilities = {"dxvk", "offline_bottle", "per_game_title", "wow64_i386", kKitSharedSections,kKitTitleAnyId, kKitGameRootUnowned, kKitOpenGLZink,kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent, kKitInputTuning,- kKitInputWheel, kKitEnvironment, kKitWineMono};+ kKitInputWheel, kKitEnvironment, kKitWineMono, kKitVkd3dProton};std::sort(config.known_capabilities.begin(), config.known_capabilities.end());return config;}diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cppindex 5c7d2e3..80ee78f 100644--- a/tests/game_settings_test.cpp+++ b/tests/game_settings_test.cpp@@ -882,6 +882,101 @@ int main(int argc, char** argv) {std::filesystem::create_symlink(root / "old/system.reg", media_manifest);CHECK(!ApplyMediaRegistry(media_runtime.string(), (root / "old").string(), 123, &reason));+ // vkd3d-proton's DLLs go into both windows folders of the bottle and come out again, replaced by the template's,+ // without touching a bottle whose files were never vkd3d-proton's.+ {+ const auto vkd3d_runtime = root / "vkd3d-runtime", vkd3d_template = root / "vkd3d-template";+ const auto vkd3d_bottle = root / "vkd3d-bottle", untouched = root / "vkd3d-untouched";+ const std::vector<std::pair<std::string, std::string>> folders = {{"x86_64-windows", "system32"},+ {"i386-windows", "syswow64"}};+ for (const auto& [arch, folder] : folders)+ for (const auto* name : {"d3d12.dll", "d3d12core.dll"}) {+ std::filesystem::create_directories(vkd3d_runtime / "lib/vkd3d-proton" / arch);+ std::ofstream(vkd3d_runtime / "lib/vkd3d-proton" / arch / name) << "vkd3d-proton " << arch << " " << name;+ for (const auto& prefix : {vkd3d_template, vkd3d_bottle, untouched}) {+ std::filesystem::create_directories(prefix / "drive_c/windows" / folder);+ std::ofstream(prefix / "drive_c/windows" / folder / name) << (prefix == untouched ? "older " : "fake ") << name;+ }+ }+ const auto dll = [&](const std::filesystem::path& prefix, const std::string& folder, const char* name) {+ return ReadText(prefix / "drive_c/windows" / folder / name);+ };+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), true, &reason));+ for (const auto& [arch, folder] : folders)+ CHECK(dll(vkd3d_bottle, folder, "d3d12core.dll") == "vkd3d-proton " + arch + " d3d12core.dll");+ const auto stamp = std::filesystem::last_write_time(vkd3d_bottle / "drive_c/windows/system32/d3d12.dll");+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), true, &reason));+ CHECK(std::filesystem::last_write_time(vkd3d_bottle / "drive_c/windows/system32/d3d12.dll") == stamp);+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), false, &reason));+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), untouched.string(), false, &reason));+ for (const auto& [arch, folder] : folders) {+ CHECK(dll(vkd3d_bottle, folder, "d3d12.dll") == "fake d3d12.dll");+ CHECK(dll(untouched, folder, "d3d12core.dll") == "older d3d12core.dll");+ }+ // A game whose bottle is not there yet starts without error; the next Play puts the DLLs in.+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), (root / "vkd3d-no-bottle").string(), true,+ &reason));+ for (const auto& [arch, folder] : folders)+ CHECK(!std::filesystem::exists(vkd3d_bottle / "drive_c/windows" / folder / ".playden-vkd3d-proton"));+ // A bottle switched by an earlier kit's vkd3d-proton is switched back through its marker, whatever the kit now holds.+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), true, &reason));+ CHECK(std::filesystem::exists(vkd3d_bottle / "drive_c/windows/syswow64/.playden-vkd3d-proton"));+ std::ofstream(vkd3d_runtime / "lib/vkd3d-proton/x86_64-windows/d3d12.dll") << "newer vkd3d-proton";+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), false, &reason));+ CHECK(dll(vkd3d_bottle, "system32", "d3d12.dll") == "fake d3d12.dll");+ CHECK(!std::filesystem::exists(vkd3d_bottle / "drive_c/windows/system32/.playden-vkd3d-proton"));+ // Nothing is written when a file it needs is missing.+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), true, &reason));+ std::filesystem::rename(vkd3d_template / "drive_c/windows/syswow64/d3d12core.dll", root / "held-core.dll");+ CHECK(!ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), false, &reason) &&+ reason.find("template") != std::string::npos);+ CHECK(dll(vkd3d_bottle, "system32", "d3d12.dll") == "newer vkd3d-proton");+ std::filesystem::rename(root / "held-core.dll", vkd3d_template / "drive_c/windows/syswow64/d3d12core.dll");+ // Without the kit's DLLs, turning it on fails, and turning it off still restores a marked bottle.+ std::filesystem::remove_all(vkd3d_runtime / "lib/vkd3d-proton");+ CHECK(!ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), true, &reason) &&+ reason.find("no vkd3d-proton") != std::string::npos);+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), vkd3d_bottle.string(), false, &reason));+ CHECK(dll(vkd3d_bottle, "system32", "d3d12.dll") == "fake d3d12.dll");+ CHECK(dll(vkd3d_bottle, "syswow64", "d3d12core.dll") == "fake d3d12core.dll");+ CHECK(ApplyD3D12Library(vkd3d_runtime.string(), vkd3d_template.string(), untouched.string(), false, &reason));+ CHECK(dll(untouched, "system32", "d3d12.dll") == "older d3d12.dll");+ }++ // vkd3d-proton's variables go through the bottle's Environment key: set while Environment variables lists them,+ // removed after, and a bottle that never had them keeps its user.reg untouched.+ {+ const auto env_bottle = root / "env-bottle";+ std::filesystem::create_directory(env_bottle);+ std::filesystem::permissions(env_bottle, std::filesystem::perms::owner_all);+ const std::string hive = "WINE REGISTRY Version 2\n;; All keys relative to REGISTRY\\\\User\\\\S-1-5-21-0-0-0-1000\n\n#arch=win64\n";+ std::ofstream(env_bottle / "user.reg") << hive;+ ::chmod((env_bottle / "user.reg").c_str(), 0600);+ KitCapabilities env_kit;+ env_kit.environment = true;+ EffectiveSettings env_settings;+ SettingsError env_error;+ CHECK(BuildEffectiveSettings(hl2, nullptr, {}, env_kit, &env_settings, &env_error));+ CHECK(ApplyBottleRegistryValues(RenderBottleEnvironment(env_settings), env_bottle.string(), 100, "user.reg", &reason));+ CHECK(ReadText(env_bottle / "user.reg") == hive && !std::filesystem::exists(env_bottle / "user.reg.playden-backup"));+ CHECK(!ValidateSettingValue(hl2, "environment", "VKD3D_NOPE=1", &reason));+ CHECK(!ValidateSettingValue(hl2, "environment", "VKD3D_DEBUG=\"x\"", &reason));+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"environment", "VKD3D_DEBUG=warn; VKD3D_LOG_FILE=C:\\vkd3d.log;DXVK_LOG_LEVEL=info"}},+ env_kit, &env_settings, &env_error));+ ProsperoProfile env_profile;+ CHECK(RenderProsperoProfile(hl2, env_settings, target, &env_profile, &reason));+ CHECK(env_profile.text.find("VKD3D") == std::string::npos && env_profile.text.find("DXVK_LOG_LEVEL") != std::string::npos);+ CHECK(ApplyBottleRegistryValues(RenderBottleEnvironment(env_settings), env_bottle.string(), 100, "user.reg", &reason));+ auto text = ReadText(env_bottle / "user.reg");+ CHECK(text.find("[Environment] 100\n") != std::string::npos);+ CHECK(text.find("\"VKD3D_DEBUG\"=\"warn\"\n") != std::string::npos);+ CHECK(text.find("\"VKD3D_LOG_FILE\"=\"C:\\\\vkd3d.log\"\n") != std::string::npos);+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"environment", "VKD3D_CONFIG=no_upload_hvv"}}, env_kit, &env_settings, &env_error));+ CHECK(ApplyBottleRegistryValues(RenderBottleEnvironment(env_settings), env_bottle.string(), 200, "user.reg", &reason));+ text = ReadText(env_bottle / "user.reg");+ CHECK(text.find("VKD3D_DEBUG") == std::string::npos && text.find("\"VKD3D_CONFIG\"=\"no_upload_hvv\"") != std::string::npos);+ }+// An oversized registry file is rejected before backup or replacement.const auto prefix = root / "prefix";std::filesystem::create_directory(prefix);@@ -1146,6 +1241,40 @@ int main(int argc, char** argv) {CHECK(BuildEffectiveSettings(generated, nullptr, {{"dll_overrides", saved}, {"graphics", "opengl"}}, KitCapabilities{},&settings, &error));CHECK(settings.graphics == "opengl" && settings.dll_overrides == "dinput8=n,b");+ // Direct3D 12 through vkd3d-proton needs the kit's DLLs and DXVK's dxgi. Its overrides follow the row after the+ // DXVK ones, in the recipe's list or the player's, and go away with it.+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"d3d12", "vkd3d-proton"}}, KitCapabilities{}, &settings, &error));+ CHECK(!settings.values.at("d3d12").available && settings.values.at("d3d12").value == "wine" && !settings.vkd3d_proton);+ KitCapabilities vkd3d_kit;+ vkd3d_kit.vkd3d_proton = true;+ CHECK(BuildEffectiveSettings(generated, nullptr, {}, vkd3d_kit, &settings, &error));+ CHECK(settings.values.at("d3d12").available && !settings.vkd3d_proton && settings.dll_overrides == kDxvkOverrides);+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"d3d12", "vkd3d-proton"}}, vkd3d_kit, &settings, &error));+ CHECK(settings.vkd3d_proton && settings.dll_overrides == std::string(kDxvkOverrides) + ";" + kVkd3dProtonOverrides);+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"d3d12", "vkd3d-proton"}, {"dll_overrides", "dinput8=n,b"}}, vkd3d_kit,+ &settings, &error));+ CHECK(settings.dll_overrides == saved + ";" + kVkd3dProtonOverrides);+ const auto with_vkd3d = settings.dll_overrides;+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"dll_overrides", with_vkd3d}}, vkd3d_kit, &settings, &error));+ CHECK(!settings.vkd3d_proton && settings.dll_overrides == saved);+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"d3d12", "vkd3d-proton"}, {"dll_overrides", with_vkd3d}}, vkd3d_kit,+ &settings, &error));+ CHECK(settings.dll_overrides == with_vkd3d);+ CHECK(BuildEffectiveSettings(generated, nullptr, {{"d3d12", "vkd3d-proton"}, {"graphics", "opengl"}}, vkd3d_kit,+ &settings, &error));+ CHECK(!settings.values.at("d3d12").available && !settings.vkd3d_proton && settings.dll_overrides.empty());+ // A recipe whose own list does not load DXVK's dxgi gets it with vkd3d-proton; a dxgi the player chose stays.+ KitCapabilities vkd3d_dxvk_kit = vkd3d_kit;+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"d3d12", "vkd3d-proton"}}, vkd3d_dxvk_kit, &settings, &error));+ CHECK(settings.dll_overrides == std::string("d3d9=n;") + kVkd3dProtonDxgiOverrides);+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"d3d12", "vkd3d-proton"}, {"dll_overrides", "d3d9=n;DXGI=b"}},+ vkd3d_dxvk_kit, &settings, &error));+ CHECK(settings.dll_overrides == std::string("d3d9=n;DXGI=b;") + kVkd3dProtonOverrides);+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"dll_overrides", std::string("d3d9=n;") + kVkd3dProtonDxgiOverrides}},+ vkd3d_dxvk_kit, &settings, &error));+ CHECK(!settings.vkd3d_proton && settings.dll_overrides == "d3d9=n");+ CHECK(KitCapabilitiesFromManifest({kKitVkd3dProton}, false).vkd3d_proton &&+ !KitCapabilitiesFromManifest({kKitDxvk}, false).vkd3d_proton);// A locked row keeps the recipe's value until the player changes it anyway.CHECK(BuildEffectiveSettings(hl2, nullptr, {{"graphics", "opengl"}}, KitCapabilities{}, &settings, &error));CHECK(settings.graphics == "dxvk" && settings.values.at("graphics").locked && !settings.values.at("graphics").unlocked);