SDL may coerce a resolution request: SDL_GetClosestFullscreenDisplayMode picks the nearest real mode, the borderless fallback is desktop-sized, and mode switches are asynchronous on some window managers. The apply path trusted the requested size, so config.ini and the combo could claim a mode the display never adopted. MuApplyWindowResolution now settles the request with SDL_SyncWindow and feeds the size the window really ended up with (SDL_GetWindowSize - logical units, the same thing SDL_EVENT_WINDOW_RESIZED carries) into HandleWindowResize, so WindowWidth/Height and everything saved from them reflect reality. On top of that: - ApplyResolution snaps the combo back to the resulting mode when it is a listed one (SyncResolutionComboToWindow); an unlisted result keeps the selection but config still records the real size. - The windowed/fullscreen toggle had the same bug from the other side: it saved config before applying the mode, so a coerced fullscreen size never reached disk. It now applies first and persists mode + actual size together, extracted to ApplyWindowModeToggle following the existing handler pattern of the file. - FindCurrentResolutionIndex and the new sync helper share one table scan (FindListedResolutionIndex), and the default-index magic number got a name. - docs/options-window.md documents the resulting behaviour. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3 KiB
Options Window and Config
Behaviour changes that landed in PR
#335 for the options window
and the config.ini it writes to.
For the camera architecture see camera-system.md.
What changed
The options window is now the same window in every scene (login, character select, gameplay) - it shares one layout, one apply path, and one backing config object. There is no separate per-scene options dialog.
What was added on top of that:
- Resolution and windowed/fullscreen toggle apply without restarting. Switch them at any time from the options window.
- Volume and render-level sliders round to the nearest level instead of truncating, so the slider endpoints actually reach 0 (mute) and the configured maximum.
- Resolution combo-box clicks no longer leak through to the checkboxes behind the dropdown.
- Resolution changes go through SDL (PR
#530), which makes the live
apply actually work in windowed mode on Windows. Windowed resizes re-center
the window on the display. Fullscreen picks the closest real display mode
(or borderless desktop when nothing matches), and the combo and
config.inirecord the mode that actually resulted, not the one requested.
What it stores in config.ini
Settings are written next to the executable as config.ini. The options
window writes to these sections:
[Window]- width, height, windowed flag.[Graphics]- render levels, vsync, fps limit.[Audio]- volumes.[Login]- language, and the remembered-credential keys (RememberMe,SavePassword,EncryptedUsername,EncryptedPassword); see "Remembering login credentials" below.[ConnectionSettings][Camera]- orbital wheel-zoom radius (Zoom). New in this PR, the only key the camera rework added.
Missing keys fall back to compile-time defaults from
src/source/Data/GameConfig/GameConfigConstants.h. If config.ini doesn't exist,
it's created the first time anything calls Save().
Remembering login credentials
The login screen has two separate checkboxes:
- Remember Username - fills in your account name next time. Safe to leave on; only the username is stored.
- Remember Password - also stores the password. Because a saved password lets anyone using the same computer log into your account, ticking it opens a confirmation dialog first; the box only stays ticked if you accept it. Leave this off on shared machines (e.g. an internet cafe).
Editing the account or password field clears any stored credentials and turns Remember Password back off, so an out-of-date password is never left behind.
Stored credentials are obfuscated (not plaintext) and tied to the current
machine and user account, so copying config.ini to another machine does not
reveal them. This is protection against a casual reader of the file, not a
determined attacker - which is why saving the password is opt-in.