Skip to content

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

C++

Run every game's pixel shaders in wave32 by default

Leonardo Lobatocb52f468495f
diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md
index eccc8d0..1772ef2 100644
--- a/COMPATIBILITY.md
+++ b/COMPATIBILITY.md
@@ -123,7 +123,7 @@ uses: Direct3D 8–11 goes through DXVK to Vulkan, and Direct3D 12 through vkd3d
| [STAR WARS Knights of the Old Republic II: The Sith Lords](https://store.steampowered.com/app/208580) | ✅ Works | 0.10 | Odyssey · OpenGL · 32-bit | New game, cutscenes and the prologue with the controller. |
| [Star Wars: Battlefront II (Classic, 2005)](https://store.steampowered.com/app/6060) | ✅ Works | 0.10 | — · D3D9 · 32-bit | Use Controller preset = **Mouse**: the left stick moves the pointer, Cross clicks, Options is Enter. Menus and the first mission load. |
| [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. |
-| [Stray](https://store.steampowered.com/app/1332010) | ✅ Works | 0.12 | Unreal 4 · D3D11 · DXVK · 64-bit | Game settings › Pixel shaders = **Wave32** (Automatic picks it for Stray); with Wave64 loading a save freezes the console. Brightness screen, menus, a new game, loading a save and walking as the cat in the opening area with the controller. |
+| [Stray](https://store.steampowered.com/app/1332010) | ✅ Works | 0.12 | Unreal 4 · D3D11 · DXVK · 64-bit | Default settings. With Game settings › Pixel shaders = Wave64, loading a save freezes the console. Brightness screen, menus, a new game, loading a save and walking as the cat in the opening area with the controller. |
| [Super Hexagon](https://store.steampowered.com/app/221640) | ✅ Works | 0.10 | — · D3D11 · 32-bit | Menu and game at about 60 fps; the D-pad steers. |
| [Super Meat Boy](https://store.steampowered.com/app/40800) | ✅ Works | 0.10 | Tommunism · D3D9 · 32-bit | Intro, menus and play with the D-pad. |
| [Team Fortress 2](https://store.steampowered.com/app/440) | ✅ Works | 0.10 | Source · D3D9 · DXVK · 64-bit | Plays with a USB mouse and keyboard. Online play does not work: the game shows it is disconnected. The menu does not react to the DualSense, even with Controller preset = **Mouse**. Keep Game settings › Steam features on **Offline emulation**: with the game's own files it quits after about 18 seconds. On Steam accounts from before about 2010, Playden installed only the game's executables until the fix for [#58](https://github.com/leolobato/playden-ps5/issues/58). |
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index 095ba37..6e12101 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -193,14 +193,15 @@ std::vector<SettingDefinition> BuildCatalogue() {
{{"wine", "Wine", "Wine's own Direct3D 12."},
{"vkd3d-proton", "vkd3d-proton", "Direct3D 12 on Vulkan, as in Proton. Experimental."}},
"wine"));
- // RADV runs pixel shaders in wave64 on the PS5's GPU; some never finish there and the console freezes.
+ // RADV runs pixel shaders in wave64 on the PS5's GPU by default; some never finish there and the console freezes
+ // (Stray). Wave32 ran the same as wave64 in every game tested, so it is the default. A saved "auto" (the earlier
+ // Automatic choice) is dropped when the record loads (RecordFromValue).
list.push_back(Choice("pixel_shader_waves", "Pixel shaders",
- "How the GPU runs pixel shaders. Wave32 stops some games from freezing the console while loading.",
+ "How the GPU runs pixel shaders. Wave64 freezes the console in some games.",
"RADV_PERFTEST=pswave32", T::kCompatibility,
- {{"auto", "Automatic", "Wave32 for games known to freeze in wave64, wave64 for the rest."},
- {"wave64", "Wave64", "The driver's default."},
- {"wave32", "Wave32", "Fixes GPU freezes in some games; may be a little slower."}},
- "auto"));
+ {{"wave32", "Wave32", "Stops GPU freezes in some games, such as Stray."},
+ {"wave64", "Wave64", "The driver's own default. May freeze the console in some games."}},
+ "wave32"));
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."},
@@ -288,19 +289,6 @@ std::vector<SettingDefinition> BuildCatalogue() {
return list;
}
-// Steam games whose pixel shaders hang the PS5's GPU in wave64, RADV's default there: Pixel shaders "Automatic" runs
-// them in wave32 (RADV_PERFTEST=pswave32). The driver-side cause is not known yet. Matched by the recipe's Steam app
-// ID only: an imported copy of one of these games (another store) needs Wave32 chosen by hand.
-constexpr std::uint32_t kPixelShaderWave32Games[] = {
- 1332010, // Stray: the GPU hangs while the first save loads; with wave32 it loads and plays.
-};
-
-bool NeedsPixelShaderWave32(const GameRecipe& recipe) {
- const auto app = RecipeGame(recipe).steam_app();
- return app && std::find(std::begin(kPixelShaderWave32Games), std::end(kPixelShaderWave32Games), *app) !=
- std::end(kPixelShaderWave32Games);
-}
-
std::string TrimSpaces(std::string text) {
while (!text.empty() && text.front() == ' ') text.erase(0, 1);
while (!text.empty() && text.back() == ' ') text.pop_back();
@@ -312,7 +300,7 @@ std::string TrimSpaces(std::string text) {
// limits never drop it; a RADV_PS5_PS_WAVE64 of the player's is left out.
// - wave64: RADV_PS5_PS_WAVE64=1 goes first; pswave32 is taken out of the player's RADV_PERFTEST, which stays where it
// was (or is left out when nothing else is in it). A RADV_PERFTEST with "all" fails: it turns pswave32 on.
-// - empty (the driver's default): the player's text, unchanged.
+// - empty (the row is unavailable on this kit): the player's text, unchanged.
// debug_env: the variables go to [debug] env lines, whose values are shorter than [environment]'s. Fails with a reason
// when RADV_PERFTEST with pswave32 no longer fits there: the game must not start without it.
// Options are read as PS5_Mesa's parse_debug_string (src/util/u_debug.c) reads them.
@@ -797,11 +785,8 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres
}
}
- // Pixel shaders: Automatic is wave32 for the games known to hang in wave64, and the driver's default otherwise.
- if (const auto& waves = out.values["pixel_shader_waves"]; waves.available) {
- if (waves.value == "auto") out.pixel_shader_waves = NeedsPixelShaderWave32(recipe) ? "wave32" : "";
- else out.pixel_shader_waves = waves.value;
- }
+ // Pixel shaders: only where Environment variables can carry it; empty leaves the driver's default.
+ if (const auto& waves = out.values["pixel_shader_waves"]; waves.available) out.pixel_shader_waves = waves.value;
// The program: the chosen launch entry, or a program the player picked in the game folder.
// The player's folder and arguments apply to either.
@@ -1453,6 +1438,10 @@ bool RecordFromValue(const storage_json::Value& root, GameSettingsRecord* out) {
out->steam_app_id = ParseSteamAppId(app->text()).value_or(0);
if (const auto* launch = root.Find("steam_launch"); launch && launch->is_string())
out->steam_launch = steam::RelativeGamePath(launch->text()).value_or(std::string());
+ // Pixel shaders "auto" (Automatic) is gone; such a record takes the default, wave32.
+ if (const auto waves = out->overrides.find("pixel_shader_waves");
+ waves != out->overrides.end() && waves->second == "auto")
+ out->overrides.erase(waves);
// Settings this build does not know are dropped so an older record still loads.
for (auto it = out->overrides.begin(); it != out->overrides.end();)
it = FindSetting(it->first) || IsUnlockKey(it->first) ? std::next(it) : out->overrides.erase(it);
diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.h
index f86b52f..7112cb8 100644
--- a/src/runtime/game_settings.h
+++ b/src/runtime/game_settings.h
@@ -205,8 +205,8 @@ struct EffectiveSettings {
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;
- // Pixel shaders as the driver gets them: "wave32" or "wave64" adds a variable to the environment; empty (Automatic
- // for a game not known to hang, or a kit without environment variables) leaves the driver's default.
+ // Pixel shaders as the driver gets them: "wave32" or "wave64" adds a variable to the environment; empty (a kit
+ // without environment variables) leaves the driver's default.
std::string pixel_shader_waves;
// The title's runtime honors [display] refresh on every graphics path and paces [display] frame_rate itself
// (KitCapabilities::display_120hz); without it Frame limit is DXVK's maxFrameRate, as before.
diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cpp
index ee69abf..ac25b5d 100644
--- a/tests/game_settings_test.cpp
+++ b/tests/game_settings_test.cpp
@@ -299,8 +299,9 @@ int main(int argc, char** argv) {
CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", "60"}}, display, &shown, &error));
CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
CHECK(profile.text.find("\nrefresh = 120\nframe_rate = 60\n") != std::string::npos);
- CHECK(!CheckProsperoProfile(profile.text, &reason)); // a runtime without the capability refuses frame_rate
- CHECK(CheckProsperoProfile(profile.text, &reason, {.display_frame_rate = true}));
+ // A runtime without the capability refuses frame_rate (the [debug] env line is the default wave32).
+ CHECK(!CheckProsperoProfile(profile.text, &reason, {.debug_env = true}));
+ CHECK(CheckProsperoProfile(profile.text, &reason, {.debug_env = true, .display_frame_rate = true}));
CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
// 120 and 40 are paced at 120 Hz output.
for (const char* rate : {"120", "40"}) {
@@ -405,7 +406,7 @@ int main(int argc, char** argv) {
CHECK(shown.values.at("frame_limit").after_update.empty() && !shown.values.at("frame_limit").waits_for_update);
CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
CHECK(profile.text.find("frame_rate") == std::string::npos && profile.text.find("refresh") == std::string::npos);
- CHECK(CheckProsperoProfile(profile.text, &reason)); // the old key set
+ CHECK(CheckProsperoProfile(profile.text, &reason, {.debug_env = true})); // the old key set, and wave32's env line
CHECK(RenderDxvkConfig(shown).find("\ndxgi.maxFrameRate = 60\nd3d9.maxFrameRate = 60\n") != std::string::npos);
// 120 and 40 need 120 Hz output, chosen or not; with it they wait for Update and nothing caps the game until then.
CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", "40"}}, stale, &shown, &error));
@@ -424,7 +425,7 @@ int main(int argc, char** argv) {
CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
CHECK(profile.text.find("frame_rate") == std::string::npos && profile.text.find("refresh") == std::string::npos);
- CHECK(CheckProsperoProfile(profile.text, &reason));
+ CHECK(CheckProsperoProfile(profile.text, &reason, {.debug_env = true}));
// Once the title runs the kit's runtime, the same saved values apply.
CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", limit}}, display, &shown, &error));
CHECK(Value(shown, "frame_limit") == limit && shown.values.at("frame_limit").after_update.empty());
@@ -538,7 +539,9 @@ int main(int argc, char** argv) {
environment_kit.environment = true;
CHECK(BuildEffectiveSettings(hl2, nullptr, environment, environment_kit, &settings, &error));
CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));
- CHECK(profile.text.find("\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\nDXVK_FRAME_RATE = 45\n") != std::string::npos);
+ // Pixel shaders' wave32 (the default) comes first among the player's variables.
+ CHECK(profile.text.find("\n[environment]\nRADV_PERFTEST = pswave32\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\nDXVK_FRAME_RATE = 45\n") !=
+ std::string::npos);
CHECK(!CheckProsperoProfile(profile.text, &reason)); // a released runtime refuses it
CHECK(CheckProsperoProfile(profile.text, &reason, {.environment_section = true}));
// A Zink kit that also reads [environment] (kit H r5): CPU cores and the names [environment] takes go there, the
@@ -554,7 +557,8 @@ int main(int argc, char** argv) {
CHECK(RenderProsperoProfile(opengl, settings, target, &profile, &reason));
CHECK(profile.text.find("\n[debug]\nenv = PW_NATIVE_PROFILE=1\n") != std::string::npos);
CHECK(profile.text.find(
- "\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\nDXVK_FRAME_RATE = 60\nMESA_GL_VERSION_OVERRIDE = 3.3\n") !=
+ "\n[environment]\nWINE_CPU_TOPOLOGY = 4:0,1,2,3\nRADV_PERFTEST = pswave32\nDXVK_FRAME_RATE = 60\n"
+ "MESA_GL_VERSION_OVERRIDE = 3.3\n") !=
std::string::npos);
CHECK(profile.text.find("env = DXVK_") == std::string::npos && profile.text.find("env = MESA_") == std::string::npos);
CHECK(CheckProsperoProfile(profile.text, &reason, {.environment_section = true, .debug_env = true}));
@@ -577,18 +581,23 @@ int main(int argc, char** argv) {
for (auto at = text.find(what); at != std::string::npos; at = text.find(what, at + 1)) ++found;
return found;
};
- CHECK(FindSetting("pixel_shader_waves") && FindSetting("pixel_shader_waves")->playden_default == "auto" &&
+ CHECK(FindSetting("pixel_shader_waves") && FindSetting("pixel_shader_waves")->playden_default == "wave32" &&
FindSetting("pixel_shader_waves")->tier == SettingTier::kCompatibility);
CHECK(!ValidateSettingValue(hl2, "pixel_shader_waves", "wave16", &reason));
- // The Stray profile; it ends in its [environment] section.
- const std::string base = render(hl2, {}, environment_kit);
- CHECK(settings.pixel_shader_waves.empty() && base.find("[environment]") == std::string::npos);
+ CHECK(!ValidateSettingValue(hl2, "pixel_shader_waves", "auto", &reason));
+ // Every game runs wave32 by default; the profile ends in its [environment] section.
+ const std::string hl2_default = render(hl2, {}, environment_kit);
+ const auto environment_at = hl2_default.find("\n[environment]\n");
+ CHECK(environment_at != std::string::npos && settings.pixel_shader_waves == "wave32" &&
+ hl2_default.substr(environment_at) == "\n[environment]\nRADV_PERFTEST = pswave32\n");
+ const std::string base = hl2_default.substr(0, environment_at);
+ CHECK(base.find("[environment]") == std::string::npos);
CHECK(render(stray, {}, environment_kit) == base + "\n[environment]\nRADV_PERFTEST = pswave32\n");
CHECK(settings.values.at("pixel_shader_waves").available && settings.pixel_shader_waves == "wave32");
CHECK(CheckProsperoProfile(profile.text, &reason, {.environment_section = true}));
- if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- stray auto ---\n%s", profile.text.c_str());
- // Another game on Automatic: byte for byte the profile this build wrote before the row, conflicting variables of
- // the player's included (checked against the earlier build's output).
+ if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- stray default ---\n%s", profile.text.c_str());
+ // Another game on the default, with conflicting variables of the player's: pswave32 goes into the player's
+ // RADV_PERFTEST, and the player's RADV_PS5_PS_WAVE64 is left out.
const std::map<std::string, std::string> conflicting = {
{"environment", " ; RADV_PERFTEST = pswave32 , sam ;; RADV_PS5_PS_WAVE64=0;DXVK_FRAME_RATE = 45"},
{"cpu_topology", "4"}};
@@ -615,12 +624,11 @@ int main(int argc, char** argv) {
"options = escape\n"
"\n[environment]\n"
"WINE_CPU_TOPOLOGY = 4:0,1,2,3\n"
- "RADV_PERFTEST = pswave32 , sam\n"
- "RADV_PS5_PS_WAVE64 = 0\n"
+ "RADV_PERFTEST = pswave32,sam\n"
"DXVK_FRAME_RATE = 45\n";
CHECK(render(hl2, conflicting, environment_kit) == hl2_expected);
- CHECK(settings.pixel_shader_waves.empty());
- if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- hl2 auto ---\n%s", profile.text.c_str());
+ CHECK(settings.pixel_shader_waves == "wave32");
+ if (std::getenv("PLAYDEN_PRINT_PROFILES")) std::printf("--- hl2 default ---\n%s", profile.text.c_str());
// Wave32 wins: pswave32 once (spaces and empty options dropped), the player's RADV_PS5_PS_WAVE64 left out.
auto wave32 = conflicting;
wave32["pixel_shader_waves"] = "wave32";
@@ -687,9 +695,9 @@ int main(int argc, char** argv) {
too_long.record.overrides = {{"environment", perftest(119)}};
SettingsLaunchPlan refused;
CHECK(!BuildSettingsLaunchPlan(too_long, &refused, &reason) && reason.find("pswave32") != std::string::npos);
- // On Automatic for another game, or Wave64, the same long value is the player's to keep.
- CHECK(render(hl2, {{"environment", perftest(119)}}, environment_kit).find(std::string(119, 'x') + "\n") !=
- std::string::npos);
+ // On Wave64 the same long value is the player's to keep.
+ CHECK(render(hl2, {{"environment", perftest(119)}, {"pixel_shader_waves", "wave64"}}, environment_kit)
+ .find(std::string(119, 'x') + "\n") != std::string::npos);
CHECK(!render(stray, {{"environment", perftest(119)}, {"pixel_shader_waves", "wave64"}}, environment_kit).empty());
// A kit without either: the row is unavailable for the same reason, and nothing is written.
CHECK(render(stray, {{"pixel_shader_waves", "wave32"}}, KitCapabilities{}).find("RADV_") == std::string::npos);
@@ -779,7 +787,8 @@ int main(int argc, char** argv) {
CHECK(profile.text.find("\n[audio]\nvolume = 50\n") != std::string::npos);
CHECK(!CheckProsperoProfile(profile.text, &reason)); // a released runtime refuses both
CHECK(CheckProsperoProfile(profile.text, &reason,
- {.input_tuning = true, .input_wheel = true, .audio_section = true}));
+ {.environment_section = true, .input_tuning = true, .input_wheel = true, .audio_section = true,
+ .debug_env = true}));
CHECK(BuildEffectiveSettings(hl2, nullptr, {{"volume", "100"}, {"wheel_stick", "none"}}, all_kit, &settings, &error));
CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));
CHECK(profile.text.find("[audio]") == std::string::npos && profile.text.find("wheel") == std::string::npos);
@@ -1158,6 +1167,13 @@ int main(int argc, char** argv) {
R"({"preset":"","revision":18446744073709551616,"overrides":{}})", &loaded, &reason));
CHECK(ParseGameSettingsRecord(R"({"preset":"","overrides":{"future_setting":"x","vsync":"on"}})", &loaded, &reason));
CHECK(loaded.overrides.size() == 1 && loaded.overrides.count("vsync"));
+ // Pixel shaders "auto" (the removed Automatic choice) gives way to the default, wave32; a real choice stays.
+ loaded = {};
+ CHECK(ParseGameSettingsRecord(R"({"preset":"","overrides":{"pixel_shader_waves":"auto","vsync":"on"}})", &loaded, &reason));
+ CHECK(loaded.overrides.size() == 1 && loaded.overrides.count("vsync"));
+ loaded = {};
+ CHECK(ParseGameSettingsRecord(R"({"preset":"","overrides":{"pixel_shader_waves":"wave64"}})", &loaded, &reason));
+ CHECK(loaded.overrides.at("pixel_shader_waves") == "wave64");
CHECK(!ParseGameSettingsRecord("[]", &loaded, &reason));
// The bundled data loads through the recipe list, as the console title reads it.