Play your Steam library's Windows games on a jailbroken PS5.
C++
Choose 120 Hz output before the kit update
Leonardo Lobato2b020f17f1f9
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex c76b034..bbc9081 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -3644,7 +3644,7 @@ void Simulation::rebuild_view() {};view_.subtitle = definition->effect;view_.subtitle += settings_custom || inherited.source != rt::ValueSource::kPlayden- ? std::string(" ") + source_label(inherited.source) + ": " + (modal.setting_id == "launch_option" ? launch_label(settings_game, inherited.value) : choice_label(*definition, inherited.value)) + "."+ ? std::string(" ") + source_label(inherited.source) + ": " + (modal.setting_id == "launch_option" ? launch_label(settings_game, inherited.value) : choice_label(*definition, rt::ChosenValue(inherited))) + ".": "";const auto closed = !game_closed(settings_game) && definition->apply == rt::ApplyMode::kGameClosed;// A game that was never prepared gets its bottle from these values on the next Play.@@ -3786,12 +3786,14 @@ void Simulation::rebuild_view() {else if (id == "program_folder")item.value = value.value.empty() ? "Program's folder" : value.value == "." ? "Game folder" : value.value;else if (definition->kind == rt::SettingKind::kText) item.value = value.value.empty() ? "Empty" : value.value;- else item.value = choice_label(*definition, value.value);+ // A choice that waits for the kit update shows as chosen; the subtitle says when it applies.+ else item.value = choice_label(*definition, rt::ChosenValue(value));item.badge = value.unlocked ? "Changed anyway" : value.locked ? "Required by this game": definition->apply == rt::ApplyMode::kGameClosed ? "Game must be closed": definition->apply == rt::ApplyMode::kPreparesBottle ? "Prepares bottle" : "";// A locked row opens "Change anyway"; the program type only follows the program.- item.enabled = value.available && id != "architecture";+ // A row the kit's runtime takes can be chosen before the title's update (it applies then).+ item.enabled = (value.available || value.waits_for_update) && id != "architecture";item.modified = value.source == rt::ValueSource::kUser || value.unlocked;if (value.unlocked) item.subtitle = value.reason;if (id == "architecture") item.subtitle = "Follows the program you choose.";@@ -3869,6 +3871,8 @@ void Simulation::rebuild_view() {if (auto why = rt::SettingChoiceUnavailable(settings_values, modal.setting_id, value); !why.empty()) {item.subtitle = std::move(why);item.enabled = false;+ } else if (rt::SettingChoiceWaitsForUpdate(settings_values, modal.setting_id, value)) {+ item.subtitle = rt::kAppliesAfterKitUpdate;}}const bool button = modal.setting_id.rfind("button.", 0) == 0;@@ -3878,9 +3882,9 @@ void Simulation::rebuild_view() {settings_values.launch->id == rt::kProgramEntryId &&BottlePath(settings_values.launch->executable) == BottlePath(recipe.launch_entries[index].executable);item.selected = button && index == 0 ? current.source != rt::ValueSource::kUser- : (value == current.value || picked_here) && !(button && current.source != rt::ValueSource::kUser);+ : (value == rt::ChosenValue(current) || picked_here) && !(button && current.source != rt::ValueSource::kUser);item.value = button ? (item.selected && index != 0 ? "Your choice" : "")- : value == inherited.value ? source_label(inherited.source) : item.selected ? "Your choice" : "";+ : value == rt::ChosenValue(inherited) ? source_label(inherited.source) : item.selected ? "Your choice" : "";} else if (settings_ready && action_key == "choice-custom") {item.kind = RowKind::Text;item.title = "Other key…";@@ -8270,13 +8274,13 @@ void Simulation::build_preset_comparison(GameId id, const std::string& preset_idconst auto& value = values.values.at(definition.id);if (definition.id == "launch_option") return values.launch ? values.launch->label : value.value;if (definition.kind == rt::SettingKind::kText) return value.value.empty() ? std::string("Empty") : value.value;- auto text = choice_label(definition, value.value);+ auto text = choice_label(definition, rt::ChosenValue(value));if (value.locked || (definition.id == "graphics" && value.source == rt::ValueSource::kRecipe)) text += " (game)";return text;};int changes = 0, buttons = 0;for (const auto& definition : rt::SettingsCatalogue()) {- const bool differs = current.values.at(definition.id).value != after.values.at(definition.id).value;+ const bool differs = rt::ChosenValue(current.values.at(definition.id)) != rt::ChosenValue(after.values.at(definition.id));if (definition.id.rfind("button.", 0) == 0) { buttons += differs ? 1 : 0; continue; }const bool key = definition.id == "controller" || definition.id == "resolution" ||definition.id == "performance_overlay" || definition.id == "graphics";@@ -8303,7 +8307,7 @@ void Simulation::open_setting(const std::string& id) {rt::EffectiveSettings values;if (!definition || !EffectiveSettingsFor(state_.navigation.selected_game_id, &values)) return;const auto& value = values.values.at(id);- if (!value.available || id == "architecture" ||+ if ((!value.available && !value.waits_for_update) || id == "architecture" ||(definition->apply == rt::ApplyMode::kGameClosed && !game_closed(state_.navigation.selected_game_id))) {// Disabled rows stay focusable so their reason can be read; Cross does nothing.} else if (value.locked && !value.unlocked) {@@ -8353,7 +8357,7 @@ void Simulation::open_setting(const std::string& id) {in_folder(recipe.launch_entries[index].executable))continue;const auto& choice = launch ? recipe.launch_entries[index].id : definition->choices[index].value;- if (choice == value.value ||+ if (choice == rt::ChosenValue(value) ||(picked && BottlePath(recipe.launch_entries[index].executable) == BottlePath(values.launch->executable)))focused = static_cast<int>(actions.size());actions.push_back("choice-" + std::to_string(index));@@ -8521,7 +8525,7 @@ void Simulation::set_game_setting(const std::string& id, const std::string& valurt::SettingsError error;// Choosing the inherited value removes the override, so the row is no longer "changed".const bool inherited = rt::BuildEffectiveSettings(RecipeFor(game), preset_for(game), overrides, kit_for(game), &base, &error)- && base.values.at(id).value == value;+ && rt::ChosenValue(base.values.at(id)) == value;if (inherited) record.overrides.erase(id);else record.overrides[id] = value;++record.revision;diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 8e50d69..d5a551c 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -160,7 +160,7 @@ struct LiveRuntimeGame {// quits: the game is ready to play from Home, and Play quits there.bool awaiting_registration = false;// The title runs the installed kit's runtime (false while a Ready title waits for Update): settings only the- // newer runtime takes, such as 120 Hz output, are offered only then.+ // newer runtime takes, such as 120 Hz output, can be chosen before but apply only then.bool runtime_current = true;// Has a prepared title (Ready, perhaps with an update or repair to make): its Game// settings and maintenance apply to it.@@ -1129,7 +1129,7 @@ private:void build_preset_comparison(GameId id, const std::string& preset_id);[[nodiscard]] const playden::runtime::SettingsPreset* preset_for(GameId id) const;// The kit's capabilities as the game's PS5 title can use them: a title still on an earlier kit's runtime (Update- // pending) gets no 120 Hz output until it is updated (runtime::KitForTitleRuntime).+ // pending) gets no 120 Hz output until it is updated (runtime::KitForTitleRuntime); the rows wait for it.[[nodiscard]] playden::runtime::KitCapabilities kit_for(GameId id) const;void start_logs();void finish_logs();diff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cppindex 1ffa5a4..742ca13 100644--- a/src/runtime/game_settings.cpp+++ b/src/runtime/game_settings.cpp@@ -376,8 +376,9 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&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") {+ // The older runtime's OpenGL has no cap at all; the kit's display paces one once the title is updated.if (id == "frame_limit" && !dxvk && graphics == "opengl" && kit.display_120hz_needs_update)- return "Play this game once to update its runtime first.";+ return kAppliesAfterKitUpdate;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@@ -424,7 +425,7 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&}if (id == "refresh") {if (!display_graphics) return "Only with DXVK or OpenGL.";- if (kit.display_120hz_needs_update) return "Play this game once to update its runtime first.";+ if (kit.display_120hz_needs_update) return kAppliesAfterKitUpdate;if (!kit.display_120hz) return "Needs a runtime kit with 120 Hz output.";}if (id == "pointer_speed") {@@ -478,19 +479,27 @@ bool IsUnlockKey(std::string_view key) {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) {+ if (!settings.display_120hz && !settings.display_120hz_needs_update) {// 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 ? "Play this game once to update its runtime first." : "Needs a runtime kit with 120 Hz output.";+ return high ? "Needs a runtime kit with 120 Hz output." : std::string();}+ // A title not on the kit's runtime yet is checked against the choices it gets with it: 120 Hz output as saved.const auto refresh = settings.values.find("refresh");- const bool at_120 = refresh != settings.values.end() && refresh->second.available && refresh->second.value == "120";+ const bool at_120 = refresh != settings.values.end() &&+ (refresh->second.available || refresh->second.waits_for_update) &&+ ChosenValue(refresh->second) == "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 SettingChoiceWaitsForUpdate(const EffectiveSettings& settings, std::string_view id, std::string_view value) {+ if (id != "frame_limit" || value == "off" || !settings.display_120hz_needs_update) return false;+ // The older runtime's OpenGL has no cap; with DXVK it caps 60 and 30 now, and only the display paces 120 and 40.+ return settings.graphics != "dxvk" || value == "120" || value == "40";+}+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);@@ -651,17 +660,37 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* presif (reason.empty()) continue;value.available = false;value.reason = reason;+ // A row the kit's runtime takes keeps the player's choice for the title's update; until then it is not applied.+ if (reason == kAppliesAfterKitUpdate) {+ value.waits_for_update = true;+ if (value.value != definition.playden_default) value.after_update = value.value;+ }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.+ // A choice that waits for the title's update (Frame limit 120 on an older runtime) is kept for then, and the+ // default applies until the update.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);+ const auto& fallback = FindSetting(id)->playden_default;+ if (!value.available) {+ if (value.after_update.empty()) continue;+ if (auto reason = SettingChoiceUnavailable(out, id, value.after_update); !reason.empty()) {+ value.after_update.clear();+ value.reason = std::move(reason);+ }+ continue;+ }+ if (auto reason = SettingChoiceUnavailable(out, id, value.value); !reason.empty()) {+ value.value = fallback;+ value.reason = std::move(reason);+ } else if (SettingChoiceWaitsForUpdate(out, id, value.value)) {+ value.after_update = value.value;+ value.value = fallback;+ value.reason = kAppliesAfterKitUpdate;+ value.waits_for_update = true;+ }}// The program: the chosen launch entry, or a program the player picked in the game folder.@@ -2976,8 +3005,9 @@ bool CommunityPresetSupported(const CommunityPreset& community, const KitCapabilelse if (feature == "input-tuning") { if (!kit.input_tuning) return false; }else if (feature == "input-wheel") { if (!kit.input_wheel) return false; }else if (feature == "audio-volume") { if (!kit.audio_volume) return false; }- // A runtime name, not a settings one: 120 Hz output counts only for a title on that runtime (KitForTitleRuntime).- else if (feature == "display-120hz") { if (!kit.display_120hz) return false; }+ // A runtime name, not a settings one: its values apply once the game's title runs the kit's runtime, like the+ // rows they set (KitForTitleRuntime), so a title that waits for its update may choose the preset too.+ else if (feature == "display-120hz") { if (!kit.display_120hz && !kit.display_120hz_needs_update) return false; }// Legacy PR references are informational sidecar provenance. Unknown feature// names or version requirements need verified support before a preset is shown.else if (feature.size() < 2 || feature.front() != '#' ||diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.hindex 3b3217e..f08028b 100644--- a/src/runtime/game_settings.h+++ b/src/runtime/game_settings.h@@ -173,8 +173,20 @@ struct EffectiveValue {bool unlocked = false; // locked by the recipe, but the player chose "Change anyway"bool available = true; // false: the row is disabled and the value is not appliedstd::string reason; // why it is unavailable or locked+ // The row needs the kit's runtime, which the game's title does not run yet (KitCapabilities::+ // display_120hz_needs_update): it can be chosen and saved now, but `value` stays what the title's runtime takes+ // until the title is updated. after_update is the saved choice that applies then, when it differs from `value`.+ bool waits_for_update = false;+ std::string after_update;};+// Why a row's saved choice waits: the title must move to the kit's runtime first.+inline constexpr const char* kAppliesAfterKitUpdate = "Applies after the kit update: Play or Maintenance › Update runtime.";+// The value a row shows and the player chose: the one that applies after the kit update, else the applied one.+inline const std::string& ChosenValue(const EffectiveValue& value) {+ return value.after_update.empty() ? value.value : value.after_update;+}+struct EffectiveSettings {std::map<std::string, EffectiveValue> values;// The program that starts: a recipe launch entry, or the player's own program@@ -222,7 +234,12 @@ bool BuildEffectiveSettings(const GameRecipe& recipe, const SettingsPreset* pres// 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.+// On a title that still runs an older runtime, a choice that needs the kit's (Frame limit 120 with 120 Hz output+// chosen) is not unavailable: it waits for the update (SettingChoiceWaitsForUpdate).std::string SettingChoiceUnavailable(const EffectiveSettings& settings, std::string_view id, std::string_view value);+// Whether a choice SettingChoiceUnavailable allows applies only once the game's title runs the kit's runtime. It can+// be saved now; until then the row applies the Playden default (EffectiveValue::after_update).+bool SettingChoiceWaitsForUpdate(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);diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cppindex 9362595..97d7f50 100644--- a/tests/game_settings_test.cpp+++ b/tests/game_settings_test.cpp@@ -388,25 +388,68 @@ int main(int argc, char** argv) {CHECK(profile.text.find("env = DXVK_FRAME_RATE=60\n") != std::string::npos);// 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.+ // its DXVK behaviour, 120 Hz can be chosen but 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 == "Play this game once to update its runtime first.");+ {+ const auto& refresh = shown.values.at("refresh");+ CHECK(!refresh.available && refresh.waits_for_update && refresh.reason == kAppliesAfterKitUpdate);+ CHECK(refresh.value == "60" && refresh.after_update == "120" && ChosenValue(refresh) == "120");+ CHECK(refresh.source == ValueSource::kUser);+ }CHECK(shown.values.at("frame_limit").available && Value(shown, "frame_limit") == "60");+ 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 setCHECK(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));- CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "Play this game once to update its runtime first.");+ CHECK(Value(shown, "frame_limit") == "off" && shown.values.at("frame_limit").reason == "Only with 120 Hz output.");+ CHECK(shown.values.at("frame_limit").after_update.empty());+ CHECK(SettingChoiceUnavailable(shown, "frame_limit", "120") == "Only with 120 Hz output.");CHECK(RenderDxvkConfig(shown).find("maxFrameRate") == std::string::npos);+ for (const char* limit : {"120", "40"}) {+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", limit}}, stale, &shown, &error));+ const auto& row = shown.values.at("frame_limit");+ CHECK(row.available && row.waits_for_update && row.value == "off" && row.after_update == limit);+ CHECK(row.reason == kAppliesAfterKitUpdate && ChosenValue(row) == limit);+ CHECK(SettingChoiceUnavailable(shown, "frame_limit", limit).empty());+ CHECK(SettingChoiceWaitsForUpdate(shown, "frame_limit", limit));+ CHECK(!SettingChoiceWaitsForUpdate(shown, "frame_limit", "60") && !SettingChoiceWaitsForUpdate(shown, "frame_limit", "30"));+ 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));+ // 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());+ CHECK(!shown.values.at("frame_limit").waits_for_update && !shown.values.at("refresh").waits_for_update);+ CHECK(RenderProsperoProfile(hl2, shown, target, &profile, &reason));+ CHECK(profile.text.find("\nrefresh = 120\nframe_rate = " + std::string(limit) + "\n") != std::string::npos);+ }+ // 30 at 120 Hz output stays DXVK's cap, now and after Update.+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}}, stale, &shown, &error));+ CHECK(Value(shown, "frame_limit") == "30" && !shown.values.at("frame_limit").waits_for_update);+ CHECK(RenderDxvkConfig(shown).find("\ndxgi.maxFrameRate = 30\n") != std::string::npos);+ // OpenGL on the older runtime has no cap: every Frame limit waits for Update, and the profile keeps refresh = 60.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 == "Play this game once to update its runtime first.");+ {+ const auto& row = shown.values.at("frame_limit");+ CHECK(!row.available && row.waits_for_update && row.reason == kAppliesAfterKitUpdate && row.after_update == "60");+ CHECK(SettingChoiceWaitsForUpdate(shown, "frame_limit", "60"));+ CHECK(SettingChoiceUnavailable(shown, "frame_limit", "30") == "At 120 Hz output, only with DXVK.");+ }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);+ // A saved choice the kit's runtime would not take either is dropped with its reason.+ CHECK(BuildEffectiveSettings(opengl, nullptr, {{"refresh", "120"}, {"frame_limit", "30"}}, stale, &shown, &error));+ CHECK(shown.values.at("frame_limit").after_update.empty() &&+ shown.values.at("frame_limit").reason == "At 120 Hz output, only with DXVK.");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());@@ -825,7 +868,8 @@ int main(int argc, char** argv) {const auto display = KitCapabilitiesFromManifest({kKitDxvk, kKitDisplay120Hz}, false);CHECK(CommunityPresetSupported(needs_display, display));CHECK(!CommunityPresetSupported(needs_display, KitCapabilitiesFromManifest({kKitDxvk}, false)));- CHECK(!CommunityPresetSupported(needs_display, KitForTitleRuntime(display, false)));+ // A title that waits for its update may take the preset as well: its values wait with the rows they set.+ CHECK(CommunityPresetSupported(needs_display, KitForTitleRuntime(display, false)));}CHECK(BuildEffectiveSettings(hl2, &community.preset, {}, KitCapabilities{}, &settings, &error));CHECK(settings.values.at("controller").value == "keyboard");diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cppindex 7a9047d..54b3f83 100644--- a/tests/homebrew_live_model_test.cpp+++ b/tests/homebrew_live_model_test.cpp@@ -221,8 +221,8 @@ bool has_notice(const Simulation& model, const std::string& id) {return std::any_of(notices.begin(), notices.end(), [&id](const auto& notice) { return notice.id == id; });}-// 120 Hz output needs the game's title on a runtime that takes it: a title waiting for Update says so, and Frame-// limit choices that need 120 Hz output are disabled with their reason.+// 120 Hz output and the Frame limit choices it brings can be chosen while the game's title waits for its kit+// update: they are saved, show as chosen and say they apply after the update; Reset takes them back.void live_120hz_waits_for_the_title_update(const std::filesystem::path& base) {std::filesystem::create_directories(base);auto model = make_live(base);@@ -237,7 +237,7 @@ void live_120hz_waits_for_the_title_update(const std::filesystem::path& base) {model.UpdateInstalls({}, {{SteamId(220), 1024, "internal", true}});playden::homebrew::LiveRuntimeGame runtime;runtime.game_id = SteamId(220);- runtime.status = "Update available";+ runtime.status = "Kit update available";runtime.prepared = runtime.has_title = true;runtime.runtime_current = false;runtime.launch_entry_id = "game";@@ -247,25 +247,67 @@ void live_120hz_waits_for_the_title_update(const std::filesystem::path& base) {activate(model, "details-more");activate(model, "game-settings");activate(model, "section-more");- const auto* refresh = find_row(model, "setting-refresh");- check(refresh && !refresh->enabled && refresh->subtitle == "Play this game once to update its runtime first.",- "120 Hz output waits for the title's Update");+ const std::string after_update = playden::runtime::kAppliesAfterKitUpdate;+ const auto says_after_update = [&](const char* key) {+ const auto* row = find_row(model, key);+ return row && row->enabled && row->subtitle.rfind(after_update, 0) == 0;+ };+ check(says_after_update("setting-refresh") && find_row(model, "setting-refresh")->value == "60 Hz",+ "120 Hz output can be chosen before the title's update and says when it applies");activate(model, "setting-frame_limit");const auto* limit_120 = find_row(model, "choice-1");- check(limit_120 && limit_120->title == "120" && !limit_120->enabled && limit_120->subtitle == "Play this game once to update its runtime first.",- "Frame limit 120 waits for the title's Update");+ check(limit_120 && limit_120->title == "120" && !limit_120->enabled && limit_120->subtitle == "Only with 120 Hz output.",+ "Frame limit 120 needs 120 Hz output first");check(find_row(model, "choice-2") && find_row(model, "choice-2")->enabled, "Frame limit 60 stays available");check(model.action("circle"), "close the Frame limit picker");+ activate(model, "setting-refresh");+ activate(model, "choice-1");+ check(says_after_update("setting-refresh") && find_row(model, "setting-refresh")->value == "120 Hz" &&+ find_row(model, "setting-refresh")->modified,+ "the saved 120 Hz output shows as the player's choice, waiting for the update");+ activate(model, "setting-frame_limit");+ limit_120 = find_row(model, "choice-1");+ check(limit_120 && limit_120->enabled && limit_120->subtitle == after_update,+ "with 120 Hz output chosen, Frame limit 120 can be chosen and waits for the update");+ check(find_row(model, "choice-3") && find_row(model, "choice-3")->enabled, "Frame limit 40 can be chosen too");+ check(find_row(model, "choice-2")->subtitle.empty(), "Frame limit 60 applies now, as DXVK's cap");+ activate(model, "choice-1");+ check(says_after_update("setting-frame_limit") && find_row(model, "setting-frame_limit")->value == "120",+ "the saved Frame limit 120 shows as chosen, waiting for the update");+ const auto& saved = model.state().game_settings.at(SteamId(220)).overrides;+ check(saved.count("refresh") && saved.at("refresh") == "120" && saved.count("frame_limit") && saved.at("frame_limit") == "120",+ "both choices are saved at once");+ check(find_row(model, "preset-picker")->value == "Custom · from Playden default", "the sheet marks the settings as changed");+ activate(model, "setting-frame_limit");+ check(find_row(model, "choice-1")->selected && find_row(model, "choice-1")->value == "Your choice" &&+ !find_row(model, "choice-0")->selected,+ "the picker marks the saved choice, not the value that applies until the update");+ check(model.action("circle"), "close the Frame limit picker again");+runtime.status = "Ready";runtime.ready = true;runtime.runtime_current = true;model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {runtime});- refresh = find_row(model, "setting-refresh");- check(refresh && refresh->enabled, "an updated title offers 120 Hz output");+ const auto* refresh = find_row(model, "setting-refresh");+ check(refresh && refresh->enabled && refresh->value == "120 Hz" && refresh->subtitle.find(after_update) == std::string::npos,+ "an updated title applies the saved 120 Hz output");+ const auto* limit = find_row(model, "setting-frame_limit");+ check(limit && limit->value == "120" && limit->subtitle.find(after_update) == std::string::npos,+ "an updated title applies the saved Frame limit");activate(model, "setting-frame_limit");- const auto* at_60 = find_row(model, "choice-1");- check(at_60 && !at_60->enabled && at_60->subtitle == "Only with 120 Hz output.", "Frame limit 120 needs 120 Hz output");+ check(find_row(model, "choice-1")->enabled && find_row(model, "choice-1")->subtitle.empty(), "Frame limit 120 applies now");+ check(model.action("circle"), "close the Frame limit picker on the updated title");++ // Reset takes the waiting choices back.+ runtime.status = "Kit update available";+ runtime.ready = false;+ runtime.runtime_current = false;+ model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {runtime});+ activate(model, "reset-settings");+ check(model.state().game_settings.at(SteamId(220)).overrides.empty(), "Reset removes the waiting choices");+ check(find_row(model, "setting-refresh")->value == "60 Hz" && find_row(model, "setting-frame_limit")->value == "Off",+ "after Reset the rows show the preset's values");}// A prepared game's settings and maintenance: rows that need the game closed wait for thediff --git a/tests/homebrew_runtime_host_test.cpp b/tests/homebrew_runtime_host_test.cppindex a4c51b6..537febb 100644--- a/tests/homebrew_runtime_host_test.cpp+++ b/tests/homebrew_runtime_host_test.cpp@@ -2112,6 +2112,40 @@ void UpdateWithoutSavedSettingsKeepsThePublication() {host.Shutdown();}+// 120 Hz output and Frame limit 120 chosen while the title still runs the older runtime: saving them publishes nothing+// that runtime would refuse (no refresh, no frame_rate, and no DXVK cap at 120), and the Update before Play publishes+// them for the kit's runtime, so that same launch runs at 120 Hz.+void StaleTitleKeeps120HzChoicesForUpdate() {+ Fixture fixture;+ unsigned uuids = 0;+ GameSettingsRecord saved;+ auto config = DisplayConfig(fixture, &uuids, &saved);+ const auto display = PrepareStaleFor120Hz(fixture, config, &saved);+ const auto game = fixture.root / "data/homebrew/FAKE77031/games/220";+ const auto profile = fixture.root / "data/playden/games/steam-220/library/profiles/playden-steam-220.profile";+ config.admit_kit = [display](std::string*) { return std::optional<RuntimeKit>(display); };+ RuntimeHost host(config);+ CHECK(host.Start());+ const auto started = WaitFor(host, Started);+ CHECK(!started.installs[0].title_current && !started.installs[0].runtime_current);+ saved.revision = 2;+ saved.overrides = {{"refresh", "120"}, {"frame_limit", "120"}};+ const auto before = host.Snapshot().maintenance_handled;+ host.Maintain(220, RuntimeMaintenance::kApplySettings);+ const auto applied = WaitFor(host, [before](const RuntimeSnapshot& s) { return s.maintenance_handled > before; }, 60);+ if (!applied.maintenance.at(220).ok) std::fprintf(stderr, "stale apply: %s\n", applied.maintenance.at(220).message.c_str());+ CHECK(applied.maintenance.at(220).ok && applied.installs[0].settings_revision == 2);+ CHECK(Read(profile).find("frame_rate") == std::string::npos && Read(profile).find("refresh") == std::string::npos);+ CHECK(!fs::exists(game / "dxvk.conf") || Read(game / "dxvk.conf").find("maxFrameRate") == std::string::npos);+ const auto updated = UpdateHl2(host);+ if (updated.refusals.count(220)) std::fprintf(stderr, "Update refused: %s\n", updated.refusals.at(220).c_str());+ CHECK(!updated.refusals.count(220) && updated.installs[0].title_current && updated.installs[0].runtime_current);+ CHECK(updated.installs[0].settings_revision == 2);+ CHECK(Read(profile).find("\nrefresh = 120\nframe_rate = 120\n") != std::string::npos);+ CHECK(!fs::exists(game / "dxvk.conf") || Read(game / "dxvk.conf").find("maxFrameRate") == std::string::npos);+ host.Shutdown();+}+// A game prepared on a kit with 120 Hz output publishes its 120 Hz settings with the first profile.void FreshPrepareOn120HzKitPublishesIt() {Fixture fixture;@@ -5092,6 +5126,7 @@ int main(int argc, char** argv) {FreshPrepareOn120HzKitPublishesIt();UpdateFinishesAFailedRepublish();UpdateWithoutSavedSettingsKeepsThePublication();+ StaleTitleKeeps120HzChoicesForUpdate();RemovesTitleKeepingSaves();PreparesGameInstalledAgainElsewhere();SharedProfileKitOpensSaves();