Skip to content

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

C++

Start Direct3D 12-only games on kits with vkd3d-proton

Leonardo Lobato1abac2f82fe2
diff --git a/src/runtime/game_probe.cpp b/src/runtime/game_probe.cpp
index d7dd533..b7c94d1 100644
--- a/src/runtime/game_probe.cpp
+++ b/src/runtime/game_probe.cpp
@@ -358,8 +358,12 @@ GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtime
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 isn't supported on the PS5 yet.";
+ out.refusal = "This game needs Direct3D 12, which this runtime kit can't draw yet.";
}
if (out.refusal.empty() && !soft.empty()) {
out.refusal = std::move(soft);
diff --git a/src/runtime/game_probe.h b/src/runtime/game_probe.h
index a1289ee..cce50d3 100644
--- a/src/runtime/game_probe.h
+++ b/src/runtime/game_probe.h
@@ -40,10 +40,11 @@ struct GameDefaults {
std::string arguments; // recipe arguments; may hold "{resolution}"
std::string resolution_arguments;
std::string environment; // "NAME=value;..." the engine needs, for the Environment variables setting
+ std::string d3d12; // the Direct3D 12 setting the game needs ("vkd3d-proton"), empty for the default
std::string refusal; // non-empty: the console cannot run this program; a sentence for the player
// The refusal comes from a broad detection (.NET, a shared section) that a run could get
// past, so the player may "Try anyway"; graphics and arguments are still filled in.
- // SteamStub forms Playden can't unpack, NW.js and Direct3D 12 only are never soft.
+ // SteamStub forms Playden can't unpack, NW.js and Direct3D 12 only (on a kit without vkd3d-proton) are never soft.
bool refusal_soft = false;
std::string summary; // e.g. "unity,d3d11 graphics=dxvk", for logs and the settings sheet
};
@@ -51,6 +52,7 @@ struct GameDefaults {
struct RuntimeAbilities {
bool shared_sections = false; // maps a shared section the console's pages can't hold as a private copy
bool wine_mono = false; // carries Wine Mono, so .NET programs start
+ bool vkd3d_proton = false; // carries vkd3d-proton, so Direct3D 12 programs draw
};
GameDefaults DefaultsFor(const GameProbe& probe, const RuntimeAbilities& runtime = {});
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index 56a9405..cdc3e22 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -1447,6 +1447,7 @@ bool GenerateGameRecipe(std::uint32_t app_id, const std::string& name, const std
RuntimeAbilities abilities;
abilities.shared_sections = kit.shared_sections;
abilities.wine_mono = kit.wine_mono;
+ abilities.vkd3d_proton = kit.vkd3d_proton;
const auto defaults = DefaultsFor(probe, abilities);
if (!defaults.refusal.empty() && !(defaults.refusal_soft && choices.try_anyway)) {
if (first_refusal.empty()) first_refusal = defaults.refusal, first_refusal_soft = defaults.refusal_soft;
@@ -1474,6 +1475,7 @@ bool GenerateGameRecipe(std::uint32_t app_id, const std::string& name, const std
// Most Steam games stop when the Steam client is missing; the emulator answers instead.
out.defaults["steam_features"] = "emulate";
if (!defaults.environment.empty()) out.defaults["environment"] = defaults.environment;
+ if (!defaults.d3d12.empty()) out.defaults["d3d12"] = defaults.d3d12;
} else if (architecture != out.architecture) {
continue;
@@ -1526,6 +1528,7 @@ std::string GameProgramRefusal(const std::string& install_root, const std::strin
RuntimeAbilities abilities;
abilities.shared_sections = kit.shared_sections;
abilities.wine_mono = kit.wine_mono;
+ abilities.vkd3d_proton = kit.vkd3d_proton;
const auto defaults = DefaultsFor(ProbeGame(install_root, *on_disk), abilities);
return defaults.refusal_soft && try_anyway ? std::string() : defaults.refusal;
}
@@ -1567,6 +1570,7 @@ std::vector<GameProgram> ListGamePrograms(const std::string& install_root, const
RuntimeAbilities abilities;
abilities.shared_sections = kit.shared_sections;
abilities.wine_mono = kit.wine_mono;
+ abilities.vkd3d_proton = kit.vkd3d_proton;
for (const auto& relative : found) {
GameProgram program;
program.path = relative;
diff --git a/tests/game_probe_test.cpp b/tests/game_probe_test.cpp
index e8ade21..f7e2bcd 100644
--- a/tests/game_probe_test.cpp
+++ b/tests/game_probe_test.cpp
@@ -189,6 +189,23 @@ int main() {
CHECK(GameProgramRefusal(root.string(), "Net.exe", kit, false).empty());
CHECK(GameProgramRefusal(root.string(), "Net.exe", KitCapabilities{}, false).find(".NET") != std::string::npos);
CHECK(DefaultsFor(ProbeGame(root.string(), "Twelve.exe")).refusal.find("Direct3D 12") != std::string::npos);
+ // A kit with vkd3d-proton draws it: DXVK for dxgi, and the Direct3D 12 setting on vkd3d-proton.
+ RuntimeAbilities vkd3d;
+ 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");
+ KitCapabilities vkd3d_kit;
+ vkd3d_kit.vkd3d_proton = true;
+ CHECK(GameProgramRefusal(root.string(), "Twelve.exe", vkd3d_kit, false).empty());
+ GameRecipe twelve_recipe;
+ std::string twelve_reason;
+ CHECK(GenerateGameRecipe(1091500, "Twelve", {{"", "", "Twelve.exe", "", ""}}, root.string(), &twelve_recipe,
+ &twelve_reason, vkd3d_kit));
+ CHECK(twelve_recipe.graphics == "dxvk" && twelve_recipe.defaults.at("d3d12") == "vkd3d-proton");
+ EffectiveSettings twelve_settings;
+ SettingsError twelve_error;
+ CHECK(BuildEffectiveSettings(twelve_recipe, nullptr, {}, vkd3d_kit, &twelve_settings, &twelve_error));
+ CHECK(twelve_settings.vkd3d_proton);
}
{ // A SteamStub variant Playden unpacks (BALL x PIT) is no reason to refuse; the recipe is made.
const auto root = fresh();