Skip to content

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

C++

Offer 120 Hz output and display-paced frame limits

Leonardo Lobato9eadc7b3bbff
diff --git a/README.md b/README.md
index 69302a0..c1b063d 100644
--- a/README.md
+++ b/README.md
@@ -312,7 +312,7 @@ build/homebrew-host/playden-homebrew --simulation --scenario signed-out
happening, use Settings › Account › **Sign in again**: it keeps your library, favorites and settings.
- Godot games (Slay the Spire 2) need `--rendering-driver opengl3` in Game settings › Extra arguments. Playden picks
Godot's Vulkan renderer, which did not work on this kit.
-- Two game settings, "120 Hz output" and "OpenGL worker thread", are not available with this kit.
+- The "120 Hz output" game setting needs a newer runtime kit; it is not available with this kit.
- When you close a game from the PS5 menu, it can stay suspended. Pressing Play again resumes it instead of starting
it again.
- Downloads can be slow (about 1 MB/s) on some networks, far from a fast Steam server. Turn on Settings › Storage ›
diff --git a/runtime/presets.json b/runtime/presets.json
index a5acf32..d6915c6 100644
--- a/runtime/presets.json
+++ b/runtime/presets.json
@@ -35,8 +35,7 @@
"try_when": "Older engines that draw with OpenGL, such as id Tech and GoldSrc games.",
"short_hint": "Older engines",
"settings": {
- "refresh": "60",
- "opengl_thread": "off"
+ "refresh": "60"
}
}
]
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cpp
index 88f5df8..cc01a51 100644
--- a/src/homebrew/simulation.cpp
+++ b/src/homebrew/simulation.cpp
@@ -3768,6 +3768,8 @@ void Simulation::rebuild_view() {
item.kind = definition->kind == rt::SettingKind::kText ? RowKind::Text : RowKind::Choice;
item.title = definition->label;
item.subtitle = value.available ? definition->effect : value.reason;
+ // A saved choice that cannot apply now (Frame limit 120 at 60 Hz) fell back; the row says why.
+ if (value.available && !value.locked && !value.reason.empty()) item.subtitle = value.reason;
if (modal.id == "button-mapping") item.subtitle.clear(); // the sheet title says it once
if (id == "graphics" && value.source == rt::ValueSource::kRecipe) {
const auto detected = rt::DetectedLabel(RecipeFor(settings_game).detected);
@@ -3862,6 +3864,11 @@ void Simulation::rebuild_view() {
value = choice.value;
item.title = choice.label;
item.subtitle = choice.explanation;
+ // A choice the other settings rule out (Frame limit 120 without 120 Hz output) says why.
+ if (auto why = rt::SettingChoiceUnavailable(settings_values, modal.setting_id, value); !why.empty()) {
+ item.subtitle = std::move(why);
+ item.enabled = false;
+ }
}
const bool button = modal.setting_id.rfind("button.", 0) == 0;
const auto& current = settings_values.values.at(modal.setting_id);
diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cpp
index a416d47..a8770a7 100644
--- a/src/runtime/game_settings.cpp
+++ b/src/runtime/game_settings.cpp
@@ -103,9 +103,12 @@ std::vector<SettingDefinition> BuildCatalogue() {
"fps", 2));
list.push_back(Text("extra_arguments", "Extra arguments", "Added after the arguments the game needs.",
"[application] arguments", T::kBasic));
+ // With a display-120hz runtime the display paces the cap ([display] frame_rate); otherwise DXVK does.
list.push_back(Choice("frame_limit", "Frame limit", "Caps the frame rate for steadier motion and less heat.",
- "dxgi.maxFrameRate · d3d9.maxFrameRate", T::kBasic,
- {{"off", "Off", "No cap."}, {"30", "30", ""}, {"60", "60", ""}}, "off", 2));
+ "[display] frame_rate · dxgi.maxFrameRate · d3d9.maxFrameRate", T::kBasic,
+ {{"off", "Off", "No cap."}, {"120", "120", ""}, {"60", "60", ""}, {"40", "40", ""},
+ {"30", "30", ""}},
+ "off", 2));
list.push_back(Choice("vsync", "VSync", "Waits for the TV before showing a frame. Stops tearing, adds some delay.",
"dxgi.syncInterval · d3d9.presentInterval", T::kBasic,
{{"game", "Game default", "The game's own setting."},
@@ -166,10 +169,15 @@ std::vector<SettingDefinition> BuildCatalogue() {
list.push_back(Choice("window_view", "Window view", "Show only game windows, or the whole Windows desktop.",
"[display] view", T::kCompatibility,
{{"window", "Game windows", ""}, {"desktop", "Entire desktop", ""}}, "window"));
- list.push_back(Choice("refresh", "120 Hz output", "Sends 120 frames per second to the TV when it supports it.",
- "[display] refresh", T::kCompatibility, {{"60", "60 Hz", ""}, {"120", "120 Hz", ""}}, "60"));
- list.push_back(Choice("opengl_thread", "OpenGL worker thread", "Runs OpenGL work on a second thread.",
- "[display] opengl_thread", T::kCompatibility, {{"off", "Off", ""}, {"on", "On", ""}}, "off"));
+ list.push_back(Choice("refresh", "120 Hz output",
+ "Sends up to 120 frames per second to a 120 Hz TV. Some older games run too fast at 120 Hz: "
+ "if so, set it back to 60 Hz.",
+ "[display] refresh", T::kCompatibility,
+ {{"60", "60 Hz", "The TV refreshes 60 times a second."},
+ {"120", "120 Hz", "Needs a TV with 120 Hz and the PS5's 120 Hz output on."}},
+ "60"));
+ // "OpenGL worker thread" ([display] opengl_thread) was the PS5 OpenGL SDK's; Zink has none, so the row is gone.
+ // Saved values for it are dropped when the record loads (RecordFromValue).
list.push_back(Choice("graphics", "Graphics", "How Direct3D is drawn on the PS5 GPU.", "[application] graphics",
T::kCompatibility,
{{"auto", "Automatic", ""}, {"gdi", "GDI", "2D only."}, {"dxvk", "DXVK", "Direct3D 9-11 on Vulkan."},
@@ -334,16 +342,34 @@ const EffectiveValue& OptionalValue(const EffectiveSettings& settings, const cha
return found == settings.values.end() ? missing : found->second;
}
+// The Frame limit a software limiter applies (DXVK's maxFrameRate, vkd3d-proton's VKD3D_FRAME_RATE), or empty. That
+// is every cap without a display-120hz runtime; with one, the display paces the cap ([display] frame_rate) and only 30
+// at 120 Hz output, four vblanks a frame, is left to software. Never both: two pacers at one rate miss vblanks.
+std::string SoftwareFrameLimit(const EffectiveSettings& settings) {
+ const auto& limit = OptionalValue(settings, "frame_limit");
+ if (!limit.available || limit.value == "off") return {};
+ if (!settings.display_120hz) return limit.value;
+ const auto& refresh = OptionalValue(settings, "refresh");
+ return limit.value == "30" && refresh.available && refresh.value == "120" ? limit.value : std::string();
+}
+
std::string Unavailable(const SettingDefinition& definition, const std::string& graphics, const KitCapabilities& kit,
const std::map<std::string, EffectiveValue>& values) {
const auto& id = definition.id;
const bool dxvk = graphics == "dxvk";
- if (id == "frame_limit" || id == "vsync" || id == "frame_latency" || id == "reported_vram" || id == "reported_gpu") {
+ const bool display_graphics = dxvk || graphics == "opengl";
+ // A display-120hz runtime paces the frame limit itself on every Vulkan path (DXVK, vkd3d-proton, Zink).
+ if (id == "frame_limit" && kit.display_120hz) {
+ if (!display_graphics) return "Only with DXVK or OpenGL.";
+ } else if (id == "frame_limit" || id == "vsync" || id == "frame_latency" || id == "reported_vram" ||
+ id == "reported_gpu") {
+ if (id == "frame_limit" && !dxvk && graphics == "opengl" && kit.display_120hz_needs_update)
+ return "Update this game to use it.";
if (!dxvk) return "Only available with DXVK.";
if (!kit.dxvk_config) return "Needs a runtime that reads dxvk.conf.";
// Checked on the console (results/20261005-dxvk-conf-probe): the cap works, DXVK applies
- // latency and VRAM, VSync off does not change the 60 Hz pacing.
- if (id == "vsync" && !kit.dxvk_present) return "The PS5 display paces frames at 60 Hz; VSync cannot be turned off yet.";
+ // latency and VRAM, VSync off does not change the display's pacing.
+ if (id == "vsync" && !kit.dxvk_present) return "The PS5 display always waits for the TV; VSync cannot be turned off yet.";
}
if ((id == "windows_version" || id == "text_scale") && !kit.registry)
return "Needs a verified runtime kit with access to the game's bottle.";
@@ -366,22 +392,28 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&
// Wine reads WINE_CPU_TOPOLOGY from the [environment] section; [debug] env does not take WINE_ names.
if (id == "cpu_topology" && !kit.environment) return "Needs a prospero-win update that reads [environment].";
if (id == "performance_overlay" && graphics == "gdi") return "Only available with DXVK or OpenGL.";
+ // DXVK's overlay is drawn by its Direct3D 9-11 presenter, not by vkd3d-proton's swapchain. The Direct3D 12 row comes
+ // later in the catalogue, so its value here is not checked yet: the same test it gets below.
+ const auto d3d12 = values.find("d3d12");
+ const bool vkd3d_proton = kit.vkd3d_proton && dxvk && d3d12 != values.end() && d3d12->second.value == "vkd3d-proton";
+ if ((id == "performance_overlay" || id == "overlay_detail") && vkd3d_proton) return "Not shown for Direct3D 12 games.";
if (id == "overlay_detail") {
if (!dxvk) return "Only available with DXVK.";
if (!kit.dxvk_config) return "Needs a runtime that reads dxvk.conf.";
const auto overlay = values.find("performance_overlay");
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.";
+ if (id == "scaling" && dxvk) return "DXVK games always fit the screen and keep their shape.";
// 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)
- return "Not available with this runtime: OpenGL now draws through Zink.";
+ if (id == "refresh") {
+ if (!display_graphics) return "Only with DXVK or OpenGL.";
+ if (kit.display_120hz_needs_update) return "Update this game to use it.";
+ if (!kit.display_120hz) return "Needs a runtime kit with 120 Hz output.";
+ }
if (id == "pointer_speed") {
const auto stick = values.find("pointer_stick");
if (stick == values.end() || stick->second.value == "none") return "Choose a pointer stick first.";
@@ -430,6 +462,22 @@ bool IsUnlockKey(std::string_view key) {
return definition != nullptr;
}
+std::string SettingChoiceUnavailable(const EffectiveSettings& settings, std::string_view id, std::string_view value) {
+ if (id != "frame_limit" || value == "off") return {};
+ const bool high = value == "120" || value == "40";
+ if (!settings.display_120hz) {
+ // Without a runtime that paces it, the cap is DXVK's maxFrameRate: 30 and 60 as before.
+ if (!high) return {};
+ return settings.display_120hz_needs_update ? "Update this game to use it." : "Needs a runtime kit with 120 Hz output.";
+ }
+ const auto refresh = settings.values.find("refresh");
+ const bool at_120 = refresh != settings.values.end() && refresh->second.available && refresh->second.value == "120";
+ if (high && !at_120) return "Only with 120 Hz output.";
+ // 30 at 120 Hz takes four vblanks per frame, which the display cannot pace; DXVK's and vkd3d-proton's limiters can.
+ if (value == "30" && at_120 && settings.graphics != "dxvk") return "At 120 Hz output, only with DXVK.";
+ return {};
+}
+
bool ValidateSettingValue(const GameRecipe& recipe, std::string_view id, std::string_view value, std::string* reason) {
const auto fail = [&](std::string why) {
if (reason) *reason = std::move(why);
@@ -563,6 +611,8 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres
out.graphics = out.values["graphics"].value;
out.environment_as_debug_env = !kit.environment && kit.opengl_zink;
out.debug_env_lines = kit.opengl_zink;
+ out.display_120hz = kit.display_120hz;
+ out.display_120hz_needs_update = kit.display_120hz_needs_update;
// A controller preset (runtime/input/<name>.input) brings its own mode, pointer stick and speed. Rows set less
// deliberately than the preset show the preset's values, so the sheet tells the truth and Pointer speed can be tuned.
@@ -590,6 +640,16 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres
value.reason = reason;
value.value = definition.playden_default;
}
+ // A choice that needs other values (Frame limit 120 needs 120 Hz output) falls back to the default, and the row
+ // says why. The refresh row comes after Frame limit in the catalogue, so this runs once every row is resolved.
+ for (const char* id : {"frame_limit"}) {
+ auto& value = out.values[id];
+ if (!value.available) continue;
+ auto reason = SettingChoiceUnavailable(out, id, value.value);
+ if (reason.empty()) continue;
+ value.value = FindSetting(id)->playden_default;
+ value.reason = std::move(reason);
+ }
// 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.
@@ -818,9 +878,16 @@ bool RenderProsperoProfile(const GameRecipe& recipe, const EffectiveSettings& se
// own DXVK_HUD=fps would override it, so show_fps stays false.
const bool hud_in_config = settings.values.at("overlay_detail").available;
text += std::string("show_fps = ") + (hud_in_config ? "false" : on("performance_overlay")) + "\n";
- if (settings.graphics == "opengl") {
+ // An OpenGL game always names its rate, as before (60 unless the runtime takes 120 Hz). opengl_thread is no longer
+ // written: it was the PS5 OpenGL SDK's, and runtimes default it to off.
+ if (settings.values.at("refresh").available || settings.graphics == "opengl")
text += "refresh = " + value("refresh") + "\n";
- text += std::string("opengl_thread = ") + on("opengl_thread") + "\n";
+ // Only for a title whose runtime takes it: an older runtime refuses the whole profile for this key.
+ const auto& limit = OptionalValue(settings, "frame_limit");
+ const bool frame_rate = settings.display_120hz && limit.available;
+ if (frame_rate) {
+ const bool paced = limit.value != "off" && SoftwareFrameLimit(settings).empty();
+ text += "frame_rate = " + (paced ? limit.value : std::string("0")) + "\n";
}
text += "\n[input]\n";
@@ -932,6 +999,7 @@ bool RenderProsperoProfile(const GameRecipe& recipe, const EffectiveSettings& se
features.input_tuning = tuned_deadzone || tuned_rumble || tuned_triggers;
features.input_wheel = wheel;
features.audio_section = audio_section;
+ features.display_frame_rate = frame_rate;
if (!CheckProsperoProfile(text, &why, features)) return fail("generated profile is invalid: " + why);
*profile = {target.id, std::move(text)};
return true;
@@ -942,9 +1010,8 @@ constexpr const char* kDxvkHeader = "# Generated by Playden from this game's set
std::string RenderDxvkConfig(const EffectiveSettings& settings) {
const auto option = [&](const char* id) -> const EffectiveValue& { return settings.values.at(id); };
std::string text;
- const auto& limit = option("frame_limit");
- if (limit.available && limit.value != "off")
- text += "dxgi.maxFrameRate = " + limit.value + "\nd3d9.maxFrameRate = " + limit.value + "\n";
+ if (const auto limit = SoftwareFrameLimit(settings); !limit.empty())
+ text += "dxgi.maxFrameRate = " + limit + "\nd3d9.maxFrameRate = " + limit + "\n";
const auto& vsync = option("vsync");
if (vsync.available && vsync.value != "game") {
const char* interval = vsync.value == "on" ? "1" : "0";
@@ -2171,6 +2238,10 @@ std::vector<RegistryValue> RenderBottleEnvironment(const EffectiveSettings& sett
while (!item.empty() && item.back() == ' ') item.pop_back();
if (IsBottleEnvironmentEntry(name, item)) listed[name] = item;
}
+ // Frame limit 30 at 120 Hz output is vkd3d-proton's own limiter, since the display cannot pace it. It wins over a
+ // VKD3D_FRAME_RATE typed in Environment variables, as the row the player sees.
+ if (settings.display_120hz && settings.vkd3d_proton)
+ if (const auto limit = SoftwareFrameLimit(settings); !limit.empty()) listed["VKD3D_FRAME_RATE"] = limit;
std::vector<RegistryValue> values;
for (const char* name : kBottleEnvironmentNames) {
const auto found = listed.find(name);
@@ -2592,8 +2663,8 @@ namespace playden::runtime {
const std::vector<std::string>& SettingsKitCapabilityNames() {
// Sorted, as a kit manifest lists them.
- static const std::vector<std::string> names = {kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent,
- kKitInputTuning, kKitInputWheel, kKitEnvironment};
+ static const std::vector<std::string> names = {kKitDisplay120Hz, kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent,
+ kKitInputTuning, kKitInputWheel, kKitEnvironment};
return names;
}
@@ -2617,10 +2688,19 @@ KitCapabilities KitCapabilitiesFromManifest(const std::vector<std::string>& capa
kit.opengl_zink = has(kKitOpenGLZink);
kit.wine_mono = has(kKitWineMono);
kit.vkd3d_proton = has(kKitVkd3dProton);
+ kit.display_120hz = has(kKitDisplay120Hz);
kit.registry = bottle_access;
return kit;
}
+KitCapabilities KitForTitleRuntime(KitCapabilities kit, bool title_runtime_current) {
+ if (!title_runtime_current && kit.display_120hz) {
+ kit.display_120hz = false;
+ kit.display_120hz_needs_update = true;
+ }
+ return kit;
+}
+
bool BuildSettingsLaunchPlan(const SettingsLaunchInput& input, SettingsLaunchPlan* plan, std::string* reason) {
const auto fail = [&](std::string why) {
if (reason) *reason = std::move(why);
diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.h
index de7e4de..2b8a0b3 100644
--- a/src/runtime/game_settings.h
+++ b/src/runtime/game_settings.h
@@ -48,6 +48,10 @@ struct KitCapabilities {
bool opengl_zink = false; // OpenGL games draw through Mesa's Zink, not the PS5 OpenGL SDK
bool 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
+ // [display] refresh on every graphics path and [display] frame_rate (paced by the display). Counts only for a title
+ // that runs this kit's runtime: an older runtime refuses a profile with frame_rate (KitForTitleRuntime).
+ bool display_120hz = false;
+ bool display_120hz_needs_update = false; // the kit has it, but the game's title still runs an older runtime
};
struct SettingChoice {
@@ -189,6 +193,10 @@ 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;
+ // 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.
+ bool display_120hz = false;
+ bool display_120hz_needs_update = false;
};
// The launch entry id of a program the player chose from the game folder.
@@ -212,6 +220,10 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres
const std::map<std::string, std::string>& overrides, const KitCapabilities& kit,
EffectiveSettings* settings, SettingsError* error);
+// Why one choice of a row cannot apply with the other effective values (Frame limit 120 and 40 need 120 Hz output),
+// or empty when it can. BuildEffectiveSettings turns such a saved choice into the Playden default, with this reason.
+std::string SettingChoiceUnavailable(const EffectiveSettings& settings, std::string_view id, std::string_view value);
+
// Checks one player value for one setting; used by the UI before saving an override.
bool ValidateSettingValue(const GameRecipe& recipe, std::string_view id, std::string_view value, std::string* reason);
@@ -450,12 +462,21 @@ 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";
+// The runtime honors [display] refresh = 60|120 on every graphics path (Wine reports the rate it asked for) and
+// [display] frame_rate = 0|120|60|40|30, which the display paces. Runtimes without it refuse a profile with frame_rate.
+inline constexpr const char* kKitDisplay120Hz = "display-120hz";
const std::vector<std::string>& SettingsKitCapabilityNames();
// Settings gates from a verified kit's capabilities. bottle_access: the adapter can edit the
// stopped bottle's user.reg (decision D2); it is not a kit property.
KitCapabilities KitCapabilitiesFromManifest(const std::vector<std::string>& capabilities, bool bottle_access);
+// The installed kit's capabilities for one game's title. A prepared title keeps its own copy of the runtime until
+// Update, so a capability that adds profile keys counts only when the title runs this kit's runtime
+// (title_runtime_current: the title's owner markers name this kit, PackageInstaller::TitleCurrent). Otherwise
+// display_120hz is off and display_120hz_needs_update says why.
+KitCapabilities KitForTitleRuntime(KitCapabilities kit, bool title_runtime_current);
+
// Everything one game's settings put on disk for its next launch.
struct SettingsLaunchPlan {
std::uint32_t app_id = 0;
diff --git a/src/runtime/kit_trust.cpp b/src/runtime/kit_trust.cpp
index e8fdb29..a247ff4 100644
--- a/src/runtime/kit_trust.cpp
+++ b/src/runtime/kit_trust.cpp
@@ -13,7 +13,8 @@ KitAdmissionConfig DevelopmentKitAdmission() {
config.known_capabilities = {"dxvk", "offline_bottle", "per_game_title", "wow64_i386", kKitSharedSections,
kKitTitleAnyId, kKitGameRootUnowned, kKitBottleProfileShared, kKitOpenGLZink,
kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent, kKitInputTuning,
- kKitInputWheel, kKitEnvironment, kKitWineMono, kKitVkd3dProton};
+ kKitInputWheel, kKitEnvironment, kKitWineMono, kKitVkd3dProton,
+ kKitDisplay120Hz};
std::sort(config.known_capabilities.begin(), config.known_capabilities.end());
return config;
}
diff --git a/src/runtime/prospero_profile.cpp b/src/runtime/prospero_profile.cpp
index 9727ffc..976f7e8 100644
--- a/src/runtime/prospero_profile.cpp
+++ b/src/runtime/prospero_profile.cpp
@@ -310,6 +310,8 @@ bool CheckProsperoProfile(std::string_view text, std::string* reason, ProsperoPr
if (!OneOf(value, {"true", "false"})) return bad("not true or false");
} else if (key == "refresh") {
if (value != "60" && value != "120") return bad("not 60 or 120");
+ } else if (features.display_frame_rate && key == "frame_rate") {
+ if (!OneOf(value, {"0", "120", "60", "40", "30"})) return bad("not 0, 120, 60, 40 or 30");
} else {
return fail("unknown [display] key " + key);
}
diff --git a/src/runtime/prospero_profile.h b/src/runtime/prospero_profile.h
index c92f8b8..499d478 100644
--- a/src/runtime/prospero_profile.h
+++ b/src/runtime/prospero_profile.h
@@ -78,6 +78,7 @@ struct ProsperoProfileFeatures {
bool input_wheel = false; // [input] wheel
bool audio_section = false; // [audio] volume
bool debug_env = false; // [debug] env = NAME=value (upstream prospero-win)
+ bool display_frame_rate = false; // [display] frame_rate = 0|120|60|40|30 (kit capability display-120hz)
};
// A [debug] env variable the runtime takes: PW_, DXVK_, MESA_, GALLIUM_, ZINK_, RADV_ or VK_ names, without the ones
// the title sets itself or the performance overlay owns.
diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cpp
index c7eaed7..af1d59d 100644
--- a/tests/game_settings_test.cpp
+++ b/tests/game_settings_test.cpp
@@ -250,21 +250,167 @@ int main(int argc, char** argv) {
CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));
CHECK(profile.text.find("show_fps = true\n") != std::string::npos); // no dxvk.conf: the title's HUD
- // OpenGL games get refresh and the worker thread; GDI cannot show the overlay.
+ // OpenGL games name their rate (60 without a 120 Hz runtime); the OpenGL worker thread row is gone.
auto opengl = hl2;
opengl.graphics = "opengl";
+ CHECK(!FindSetting("opengl_thread"));
CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}, {"scaling", "integer"}}, KitCapabilities{}, &settings, &error));
CHECK(RenderProsperoProfile(opengl, settings, target, &profile, &reason));
CHECK(profile.text.find("scaling = integer\n") != std::string::npos);
- CHECK(profile.text.find("refresh = 120\nopengl_thread = false\n") != std::string::npos);
- // A Zink kit ignores both, so the rows say so and the profile keeps their defaults.
+ CHECK(profile.text.find("show_fps = false\nrefresh = 60\n\n[input]") != std::string::npos);
+ CHECK(profile.text.find("opengl_thread") == std::string::npos && profile.text.find("frame_rate") == std::string::npos);
KitCapabilities zink;
zink.opengl_zink = true;
CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}}, zink, &settings, &error));
- CHECK(!settings.values.at("refresh").available && !settings.values.at("opengl_thread").available);
- CHECK(settings.values.at("refresh").reason.find("Zink") != std::string::npos);
+ CHECK(!settings.values.at("refresh").available);
+ CHECK(settings.values.at("refresh").reason == "Needs a runtime kit with 120 Hz output.");
CHECK(RenderProsperoProfile(opengl, settings, target, &profile, &reason));
CHECK(profile.text.find("refresh = 60\n") != std::string::npos);
+
+ // 120 Hz output and Frame limit with a display-120hz runtime.
+ {
+ const auto display = KitCapabilitiesFromManifest({kKitDxvk, kKitOpenGLZink, kKitVkd3dProton, kKitDisplay120Hz}, true);
+ CHECK(display.display_120hz && !display.display_120hz_needs_update);
+ CHECK(!KitCapabilitiesFromManifest({kKitDxvk, kKitOpenGLZink}, true).display_120hz);
+ // A capability this build does not know is ignored.
+ CHECK(!KitCapabilitiesFromManifest({kKitDxvk, "display-240hz"}, true).display_120hz);
+ CHECK(std::find(SettingsKitCapabilityNames().begin(), SettingsKitCapabilityNames().end(), kKitDisplay120Hz) !=
+ SettingsKitCapabilityNames().end());
+ EffectiveSettings shown;
+ // The row: DXVK and OpenGL, not GDI; the reason names what is missing.
+ for (const char* graphics : {"dxvk", "opengl"}) {
+ auto game = hl2;
+ game.graphics = graphics;
+ CHECK(BuildEffectiveSettings(game, nullptr, {{"refresh", "120"}}, display, &shown, &error));
+ CHECK(shown.values.at("refresh").available && Value(shown, "refresh") == "120");
+ CHECK(shown.values.at("frame_limit").available);
+ }
+ auto gdi = hl2;
+ gdi.graphics = "gdi";
+ CHECK(BuildEffectiveSettings(gdi, nullptr, {{"refresh", "120"}, {"frame_limit", "60"}}, display, &shown, &error));
+ CHECK(!shown.values.at("refresh").available && shown.values.at("refresh").reason == "Only with DXVK or OpenGL.");
+ CHECK(!shown.values.at("frame_limit").available && shown.values.at("frame_limit").reason == "Only with DXVK or OpenGL.");
+ CHECK(RenderProsperoProfile(gdi, shown, target, &profile, &reason));
+ CHECK(profile.text.find("refresh") == std::string::npos && profile.text.find("frame_rate") == std::string::npos);
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}}, KitCapabilities{}, &shown, &error));
+ CHECK(shown.values.at("refresh").reason == "Needs a runtime kit with 120 Hz output.");
+
+ // DXVK at 120 Hz with Frame limit 60: the display paces it, so dxvk.conf has no maxFrameRate.
+ 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}));
+ CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
+ // 120 and 40 are paced at 120 Hz output.
+ for (const char* rate : {"120", "40"}) {
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", rate}}, display, &shown, &error));
+ CHECK(Value(shown, "frame_limit") == rate && shown.values.at("frame_limit").reason.empty());
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
+ CHECK(profile.text.find(std::string("\nframe_rate = ") + rate + "\n") != std::string::npos);
+ // At 60 Hz they fall back to Off, and the row says why.
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", rate}}, display, &shown, &error));
+ CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "Only with 120 Hz output.");
+ CHECK(SettingChoiceUnavailable(shown, "frame_limit", rate) == "Only with 120 Hz output.");
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nrefresh = 60\nframe_rate = 0\n") != std::string::npos);
+ }
+ // Off is no cap; 60 and 30 at 60 Hz output are paced by the display as well.
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {}, display, &shown, &error));
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nrefresh = 60\nframe_rate = 0\n") != std::string::npos);
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", "30"}}, display, &shown, &error));
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nframe_rate = 30\n") != std::string::npos && RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
+ // 30 at 120 Hz output takes four vblanks, which the display cannot pace: DXVK's limiter does it, and the profile
+ // asks for no cap.
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}}, display, &shown, &error));
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nrefresh = 120\nframe_rate = 0\n") != std::string::npos);
+ CHECK(RenderDxvkConfig(shown).find("\ndxgi.maxFrameRate = 30\nd3d9.maxFrameRate = 30\n") != std::string::npos);
+ bool frame_rate_env = false;
+ for (const auto& value : RenderBottleEnvironment(shown))
+ frame_rate_env |= value.name == "VKD3D_FRAME_RATE" && !value.data.empty();
+ CHECK(!frame_rate_env); // not a vkd3d-proton game
+ // OpenGL has no software limiter: 30 at 120 Hz falls back to Off.
+ CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}}, display, &shown, &error));
+ CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "At 120 Hz output, only with DXVK.");
+ CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}, {"frame_limit", "40"}}, display, &shown, &error));
+ CHECK(RenderProsperoProfile(opengl, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nrefresh = 120\nframe_rate = 40\n") != std::string::npos);
+ CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
+
+ // A Direct3D 12 game on vkd3d-proton (a recipe default since automatic Direct3D 12): 30 at 120 Hz is
+ // vkd3d-proton's own limiter, through the bottle's Environment key. It has no performance overlay.
+ auto d3d12 = hl2;
+ d3d12.defaults["d3d12"] = "vkd3d-proton";
+ CHECK(BuildEffectiveSettings(d3d12, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}, {"performance_overlay", "on"}},
+ display, &shown, &error));
+ CHECK(shown.vkd3d_proton);
+ CHECK(!shown.values.at("performance_overlay").available &&
+ shown.values.at("performance_overlay").reason == "Not shown for Direct3D 12 games.");
+ CHECK(!shown.values.at("overlay_detail").available);
+ std::string vkd3d_rate;
+ for (const auto& value : RenderBottleEnvironment(shown))
+ if (value.name == "VKD3D_FRAME_RATE") vkd3d_rate = value.data;
+ CHECK(vkd3d_rate == "\"30\"");
+ CHECK(RenderProsperoProfile(d3d12, shown, target, &profile, &reason));
+ CHECK(profile.text.find("\nshow_fps = false\nrefresh = 120\nframe_rate = 0\n") != std::string::npos);
+ // Paced by the display at 60: no VKD3D_FRAME_RATE.
+ CHECK(BuildEffectiveSettings(d3d12, nullptr, {{"refresh", "120"}, {"frame_limit", "60"}}, display, &shown, &error));
+ vkd3d_rate.clear();
+ for (const auto& value : RenderBottleEnvironment(shown))
+ if (value.name == "VKD3D_FRAME_RATE") vkd3d_rate = value.data;
+ CHECK(vkd3d_rate.empty());
+
+ // Mixed versions: the kit has the capability, the game's title still runs an older runtime. Frame limit keeps
+ // its DXVK behaviour, 120 Hz waits for Update, and the profile has no frame_rate an older runtime would refuse.
+ const auto stale = KitForTitleRuntime(display, false);
+ CHECK(!stale.display_120hz && stale.display_120hz_needs_update);
+ CHECK(KitForTitleRuntime(display, true).display_120hz);
+ CHECK(!KitForTitleRuntime(KitCapabilities{}, false).display_120hz_needs_update);
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", "60"}}, stale, &shown, &error));
+ CHECK(!shown.values.at("refresh").available && shown.values.at("refresh").reason == "Update this game to use it.");
+ CHECK(shown.values.at("frame_limit").available && Value(shown, "frame_limit") == "60");
+ 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(RenderDxvkConfig(shown).find("\ndxgi.maxFrameRate = 60\nd3d9.maxFrameRate = 60\n") != std::string::npos);
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", "40"}}, stale, &shown, &error));
+ CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "Update this game to use it.");
+ CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);
+ CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}, {"frame_limit", "60"}}, stale, &shown, &error));
+ CHECK(!shown.values.at("frame_limit").available && shown.values.at("frame_limit").reason == "Update this game to use it.");
+ CHECK(RenderProsperoProfile(opengl, shown, target, &profile, &reason));
+ CHECK(profile.text.find("frame_rate") == std::string::npos && profile.text.find("\nrefresh = 60\n") != std::string::npos);
+ CHECK(BuildEffectiveSettings(d3d12, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}}, stale, &shown, &error));
+ for (const auto& value : RenderBottleEnvironment(shown))
+ CHECK(value.name != "VKD3D_FRAME_RATE" || value.data.empty());
+ // Without the capability: 30 and 60 through maxFrameRate, 120 and 40 need a newer kit.
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", "120"}}, dxvk_kit, &shown, &error));
+ CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "Needs a runtime kit with 120 Hz output.");
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"frame_limit", "30"}}, dxvk_kit, &shown, &error));
+ CHECK(RenderDxvkConfig(shown).find("\ndxgi.maxFrameRate = 30\n") != std::string::npos);
+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason) && profile.text.find("frame_rate") == std::string::npos);
+
+ // Other display rows.
+ CHECK(BuildEffectiveSettings(hl2, nullptr, {}, display, &shown, &error));
+ CHECK(shown.values.at("scaling").reason == "DXVK games always fit the screen and keep their shape.");
+ CHECK(shown.values.at("vsync").reason == "The PS5 display always waits for the TV; VSync cannot be turned off yet.");
+ }
+
+ // A record saved while the OpenGL worker thread row existed still loads, without it.
+ {
+ GameSettingsRecord old_record;
+ CHECK(ParseGameSettingsRecord(R"({"preset":"opengl-game","overrides":{"opengl_thread":"on","refresh":"120"}})",
+ &old_record, &reason));
+ CHECK(old_record.overrides.count("opengl_thread") == 0 && old_record.overrides.at("refresh") == "120");
+ const SettingsPreset* opengl_preset = nullptr;
+ for (const auto& preset : presets)
+ if (preset.id == "opengl-game") opengl_preset = &preset;
+ CHECK(opengl_preset && opengl_preset->settings == (std::map<std::string, std::string>{{"refresh", "60"}}));
+ CHECK(BuildEffectiveSettings(opengl, opengl_preset, old_record.overrides, zink, &settings, &error));
+ }
// A Zink kit's runtime reads Environment variables as [debug] env lines; names it does not take are left out.
CHECK(!settings.values.at("environment").reason.size());
CHECK(BuildEffectiveSettings(opengl, nullptr,
@@ -387,7 +533,7 @@ 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}));
+ {.input_tuning = true, .input_wheel = true, .audio_section = true, .display_frame_rate = 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);
diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cpp
index 87f8ccd..d0032da 100644
--- a/tests/homebrew_live_model_test.cpp
+++ b/tests/homebrew_live_model_test.cpp
@@ -297,7 +297,7 @@ void live_settings_follow_the_prepared_title(const std::filesystem::path& base)
check(find_row(model, "setting-locale") && !find_row(model, "setting-locale")->enabled,
"unbuilt rows stay listed and disabled");
check(model.action("focus:setting-frame_limit") &&
- find_row(model, "setting-frame_limit")->subtitle.find("Also called dxgi.maxFrameRate") != std::string::npos,
+ find_row(model, "setting-frame_limit")->subtitle.find("Also called [display] frame_rate · dxgi.maxFrameRate") != std::string::npos,
"the focused row names its technical keys");
activate(model, "setting-resolution");
diff --git a/tests/homebrew_simulation_test.cpp b/tests/homebrew_simulation_test.cpp
index fb360b8..1ea9f32 100644
--- a/tests/homebrew_simulation_test.cpp
+++ b/tests/homebrew_simulation_test.cpp
@@ -379,7 +379,7 @@ void t08b_settings_sheet_rules(const std::filesystem::path& fixtures, const std:
const auto* graphics = find_row(simulation, "setting-graphics");
check(graphics && graphics->enabled && graphics->badge == "Required by this game", "T08b graphics is locked by the recipe");
const auto* scaling = find_row(simulation, "setting-scaling");
- check(scaling && !scaling->enabled && scaling->subtitle == "Not available with DXVK output yet.", "T08b scaling shows its reason");
+ check(scaling && !scaling->enabled && scaling->subtitle == "DXVK games always fit the screen and keep their shape.", "T08b scaling shows its reason");
activate(simulation, "setting-graphics");
check(simulation.state().navigation.modals.back().title == "Change anyway?", "T08b a locked row asks before it changes");
simulation.action("circle");
diff --git a/tests/prospero_profile_test.cpp b/tests/prospero_profile_test.cpp
index e75cc7d..c811602 100644
--- a/tests/prospero_profile_test.cpp
+++ b/tests/prospero_profile_test.cpp
@@ -168,6 +168,13 @@ int main(int argc, char** argv) {
CHECK(!CheckProsperoProfile(base + "graphics = gdi\n", &reason)); // duplicate key
CHECK(!CheckProsperoProfile(base + "[display]\ndesktop = 4096x2160\n", &reason));
CHECK(!CheckProsperoProfile(base + "[display]\nrefresh = 90\n", &reason));
+ // [display] frame_rate needs a display-120hz runtime; older ones refuse the key. opengl_thread still parses.
+ CHECK(!CheckProsperoProfile(base + "[display]\nframe_rate = 60\n", &reason));
+ for (const char* rate : {"0", "120", "60", "40", "30"})
+ CHECK(CheckProsperoProfile(base + "[display]\nrefresh = 120\nframe_rate = " + rate + "\n", &reason,
+ {.display_frame_rate = true}));
+ CHECK(!CheckProsperoProfile(base + "[display]\nframe_rate = 50\n", &reason, {.display_frame_rate = true}));
+ CHECK(CheckProsperoProfile(base + "[display]\nopengl_thread = true\n", &reason));
CHECK(!CheckProsperoProfile(base + "[input]\nmouse_speed = 0\n", &reason));
CHECK(!CheckProsperoProfile(base + "[input]\nrumble = 50\n", &reason)); // released runtimes refuse it
CHECK(CheckProsperoProfile(base + "[input]\nstick_deadzone = 50\nrumble = 0\n", &reason, {.input_tuning = true}));
diff --git a/tests/runtime_kit_trust_test.cpp b/tests/runtime_kit_trust_test.cpp
index 4962417..5e7fdf6 100644
--- a/tests/runtime_kit_trust_test.cpp
+++ b/tests/runtime_kit_trust_test.cpp
@@ -1,3 +1,4 @@
+#include "runtime/game_settings.h"
#include "runtime/kit_admission.h"
#include "runtime/kit_trust.h"
#include "steam/backend/json.h"
@@ -37,6 +38,8 @@ int main(int argc, char** argv) {
for (const auto& item : Get(kit, "capabilities").array())
CHECK(std::find(config.known_capabilities.begin(), config.known_capabilities.end(), item.text()) !=
config.known_capabilities.end());
+ // A kit with 120 Hz output is admitted with that capability, not as an ignored one.
+ CHECK(std::count(config.known_capabilities.begin(), config.known_capabilities.end(), kKitDisplay120Hz) == 1);
const std::filesystem::path root = argv[2];
if (!std::filesystem::exists(root / "manifest.json")) {