feat(options): settings in the launcher's user folder, so an update keeps them #729
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!729
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:feat/user-settings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: medium · Tested on: Windows 11 and Linux (WSL Ubuntu), game-free checks only · Needs: Windows, any GPU (a launcher update in the game); Linux after the launcher PR
Why
After an update, Longshot starts from the default settings: the Insert menu's choices and the controls are lost. The launcher puts each version in a folder of its own, and
longshot_options.iniwas kept beside the game, so the new folder had none. Saves didn't have this problem because they were already shared through the launcher's user folder. This puts the settings there too, so every build the launcher starts reads and writes the same file.What changed
The settings file now follows
--user, the user folder the launcher already gives the game for the saves (%APPDATA%\Longshoton Windows, a portable launcher's own folder). Without--user(RecompLauncher, which sets its rows in the game folder's file and updates in place, a shortcut, the tools) it stays beside the game, as before. The first time a build runs this way, a game folder's file from before is copied into the user folder once.host/options_path.c(new) chooses the file once at the start:HOS_OPTIONS_FILE, else--user's folder (relative paths resolved the way the game itself resolves them), else beside the game. It has no side effects, so the crash window's helper and the Discord status, which start before the saves are set up, read the same file.hos_options_carry()runs after the user folder is made. It logsoptions: the settings file is <path>, then copies the game folder's file into the user folder when the user folder has none. A file holding onlycompile_shaders=, whichmake_game.pywrites into a new folder, is skipped. A user folder that can't be written keeps the game folder's file for that run.hos_options_file():hos_main.c(Aspect ratio),nn_applet.c(hos_ini_option),nn_audio.c,nn_hid.c(controls),prompts.c,discord_rpc.c.MkwVkHost.options_path(new,MKWVK_API_VERSION23);options_path()ingpu/vk/vk_paths.h/vk_main.cpp, used byini_path()(vk_menu.cpp),menu_env_on(vk_draw.cpp) and the mesh and Robust buffers reads (vk_main.cpp). The bug report takes the game folder fromgame_folder_path()instead of from the settings path.compile_shaders=is still read from the game folder's file (vk_draw.cppcompile_all), wheremake_game.pyand the launcher write it.hos_crash_dialog.hhos_crash_args), so the report's "Changes from the defaults" is the right file. Without it, the game folder's is read as before.nx2/pipeline_share.pyreads the file the log names (options_file), else the game folder's.docs/graphics-and-controls.md,docs/development.md(the options file,HOS_OPTIONS_FILE),docs/versioning.md.Measurements
Nothing to measure: the settings file's location changes, not the frame. The checks under Testing are what count.
Flags and settings
One new switch for test runs; no menu row or ini key changes.
HOS_OPTIONS_FILE=<path>HOS_ENV_FILEdoes forlongshot_env.txt. From the environment only (longshot_env.txttakes no paths)tests/test_options_path.py)Testing
Tested:
tests/test_options_path.py(new) buildshost/options_path.cas the game builds it, on Windows (llvm-mingw 20250402, Windows 11) and Linux (gcc, WSL Ubuntu 24.04), and runs it from a made-up game folder. It covers:HOS_OPTIONS_FILE,--user, beside the game;--romfs/--compile-shaderstaking their values;compile_shaders=-only file, never over an existing file, not withHOS_OPTIONS_FILE, not when the file is already the game folder's;python -I -B tests/run_all.pyon Windows, branch and a cleanmainworktree (e090cc48) side by side: the same 17 failures on both, none new. They fail onmainon this PC too: test_appimage_player_build, test_bake_portability, test_cpm_discovery, test_cpp_preflight, test_crash_dialog, test_env_on, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap, test_readback_late, test_tested_configurations, test_vk_pgo, test_vram_budget_row, test_walk_key.maintoo.mainat its first command-line check, before this PR's code. So the helper's new argument was checked with a standalone program againsthos_crash_dialog.h(good,-, empty and one-too-many arguments; watch and show), and those cases were added to the test.vk_main.cpp,vk_menu.cpp,vk_draw.cpp) with the build's flags on Windows: the same three__tryerrors asmainfrom a flag my check lacks, nothing else.Not tested:
%APPDATA%\Longshot, the crash window's report with the new argument.--useryet, so on Linux the file stays beside the game until the launcher PR (below).Must be tested:
%APPDATA%\Longshot\longshot_options.inipresent, andoptions: the settings in ... were copied to ...inlogs\longshot_log.txt. Then change a setting, start another build from the launcher, and expect the change there too (by hand).Risks
What could break: the settings of a launcher-started build on Windows now come from
%APPDATA%\Longshot. If the copy fails, the run keeps the game folder's file and logs why. Any reader of the file this PR missed would keep reading the game folder's file;grepfinds no other inhost/andgpu/. RecompLauncher, direct starts and the tools are unchanged: without--user, the file is where it was.Turning it off: revert the commit. For one run,
HOS_OPTIONS_FILE=<game folder>\longshot_options.inireads the old file.Compatibility:
longshot_options.iniinto%APPDATA%\Longshot, and from then on that file is used by every build the launcher starts; the game folder's copy is left in place and no longer read, apart fromcompile_shaders=. A build from before this PR started afterwards still reads its own folder's file.MKWVK_API_VERSION22 → 23, so the exe andlongshot_vk.dllmust come from the same build.Issues
See MagicBeanDev/LongshotLauncher#90 (settings lost between updates).
None found for this exact case. Related: LongshotLauncher#57 (an update in place), #224 (driver settings lost per update), #259 and #229 (several user profiles: these settings would move into a
defaultprofile).Follow-ups, in their own PRs:
--user ~/.local/share/longshoton Linux, and run a step on Play that brings an older build's settings file, the Windows per-app GPU preference and the NVIDIA profile over to a new build. Whether saving an NVIDIA profile needs admin is still an open question for that PR's discussion.Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
WIP: feat(options): settings in the launcher's user folder, so an update keeps themto feat(options): settings in the launcher's user folder, so an update keeps themzeldaootr referenced this pull request2026-11-15 17:11:55 +00:00
zeldaootr referenced this pull request2026-11-15 17:12:09 +00:00