Repository navigation
Conversation
The System menu's Apply button ran vid_restart whatever was changed, also
when nothing was. In a game that loads the whole map again. Most of the
menu's settings need no restart, and a player who changes one of them sees
it take effect at once, then clicks Apply and waits for the game to come
back.
Apply now restarts only for a change that needs it: the video mode, as
before, or one of the settings the renderer reads only as it starts
(CVAR_LATCH in the engine) and the look's packs (fs_modernPacks, read as
each image loads). A ui module can't ask the engine for a cvar's flags, and
its sets go past the latch, so ui_main.c keeps those twenty names
(uiRestartCvars) and compares their values with the ones at the last
restart it knows of: the game's start and each Apply that restarted. That
baseline is a cvar (ui_RQ3_restartBase, read-only, not archived), because a
map load starts the ui again while the renderer keeps its extension
settings (texture compression, anisotropic filtering) from its last full
start.
After an Apply that needed no restart the menu says so under the button:
"Applied. No restart was needed" (ui_RQ3_applyNote), until the pointer
leaves the button or the menu is opened again. Without it the click would
seem to do nothing.
The in-game Setup opens the same menu, so it holds there too.
Limits: a vid_restart typed at the console is not seen, so the next Apply
may restart once more than it had to. A setting typed at the console and
still pending ("will be changed upon restarting") is no longer applied by
Apply, since its value has not changed yet; vid_restart applies it, as the
console says.
Checked in a real client (the QVM, main menu and in a game on urban), by
running the button's own script after changing one setting at a time
through the ui module: of the 30 cvars of the Graphics tab that were tried
(r_textureMode holds a word and was not), the 19 the engine's cvarlist
marks latched and fs_modernPacks restart, also when set back; the 10
others, no change at all, and a change taken back do not, and the note
cvar says which it was. Before: every one of those Applies restarted.
Cost: twenty cvar reads on an Apply click, one string at the ui's start.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The System menu's Apply button ran
vid_restartwhatever was changed, also when nothing was. In a game that loads thewhole map again. Many of the menu's settings need no restart: the ui sets them at once and they show at once. A player
who changes one of those, sees it work, and then clicks Apply waits for the game to come back for nothing.
What changed
code/ui(ui_main.c,ui_local.h) anduifiles/system.menu, 97 lines added.only as it starts. A ui module can't ask the engine for a cvar's flags, and its own sets go past the latch, so
ui_main.ckeeps those names in one list (uiRestartCvars: the menu'sCVAR_LATCHcvars) and compares their valueswith the ones at the last restart it knows of: the game's start and each Apply that restarted.
ui_RQ3_restartBase, read-only, not archived). The ui's own memory is new at every start ofthe ui, and a map load starts the ui too while the renderer keeps its extension settings (texture compression,
anisotropic filtering) from its last full start.
the click would seem to do nothing. The note goes when the pointer leaves the button or the menu is opened again.
The list also names
fs_modernPacks, the cvar of #37 (the Look switch). Without #37 the engine has no such cvar andthe name reads the same value every time, so the two pull requests can go in either order.
Limits
vid_restarttyped at the console is not seen, so the next Apply may restart once more than it had to.since its value has not changed yet.
vid_restartapplies it, as the console says.uiRestartCvars, or Apply will not restart for it.Cost
Twenty cvar reads on an Apply click, and one string set when the ui starts.
Proof
A real client running the QVMs, at the main menu and in a game on urban. One setting at a time is changed through the
ui module, as a click changes it, and the Apply button's own script is run; the log shows whether the renderer started
again, and the engine's
cvarlistsays which cvars are latched.r_textureModeholds a word, which the check cannot step, so it was not tried. Built as QVM and DLL, with GCC andVisual Studio 2022.
Not tested
A mouse click on the button itself: the checks run its script. The resolution and fullscreen road of Apply, which is
unchanged.
🤖 Generated with Claude Code