WIP: feat(runtime): one list of the game's switches, host/switches.def, kept in step with the reads #62
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!62
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:feat/switch-list"
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?
Why
The game reads 935 switches and nothing lists them: a new one goes unnoticed, a removed one stays in the docs, and
longshot_env.txt's safety rules keep their own hand-written table of the switches a shared file must not set. This adds one list that a check keeps in step with the code.What changed
host/switches.def(new): one X-macro line per switch thathost/,gpu/vk,gpu/renderandgpu/compatread,SWITCH(NAME, TYPE, SCOPE, "area", "what").FLAG,INT,FLOAT,TEXT,PATH, orANYwhere the reads don't make it certain yet.GAME(may be set inlongshot_env.txt),LOCAL(from the environment only: it names a file or presses inputs on a timer), orSYSTEM(the OS's or a library's variable).""until someone who knows the switch writes one (auto-drafting them from nearby comments was tried, and was wrong too often to keep).env_line_allowedinhost/hos_main.cbuilds its table from the list (listed, throughSWITCH_LOCAL_GAME/LOCAL/SYSTEM) and refuses itsLOCALswitches, in place of its ownby_nametable and the two names it checked apart (RX_VK_FRAME_LOG,HOS_PRESENT_TRACE). Otherwise unchanged: the names it refused before areLOCAL; a_FILEor_DIRname not listed yet is still refused;RX_VK_DLSS_DIR, paths in values and the system's names behave as before.scripts/switch_list.py(new, standard library):reads,listedandcomparelist what's read and not listed, and what's listed and read nowhere;--update(update,certain_type,line_for) writes the missing lines (the type where the reads make it certain), drops the dead ones, and moves an area when that file no longer reads the switch. A switch is read throughgetenv,env_on,env_int,env_float,menu_env_onorenv_overridewith its name written out, or named in a table as a string literal of its own.nx2/build.pycountshost/*.defamong the host's dependencies (host_deps), so an edit to the list compileshos_main.cagain. Host objects compile once after this change; the lifted game does not.tests/test_switch_list.py(new);tests/test_env_file.py's fixture compilesenv_line_allowedwithhost/on the include path.The cost for everyone: a new switch needs its line (
python -I scripts/switch_list.py --update, then the description), ortest_switch_listfails and names it.Flags and settings
No switch is added or changed.
scripts/check_pr_description.pyfinds the nine names below becausehost/switches.defnames them in backquotes in other switches' descriptions; each is an existing switch with its own line in the list.HOS_PROFILEGAME)RX_VK_DUMP_DIRLOCAL)RX_VK_DUMPwrites toRX_VK_HANG_SECGAME)RX_VK_HANG_DUMPwritesRX_VK_PRESENTS_AHEADGAME)RX_VK_PRESENT_AHEADGAME)RX_VK_SHOT_EVERYGAME)RX_VK_SHOTS' PNGsRX_VK_SHOT_WGAME)RX_VK_SHOTS' widthRX_VK_SHOT_HGAME)RX_VK_SHOTS' heightRX_VK_TRANSLATE_WAIT_MSGAME)HOS_GONE,HOS_KEPT,HOS_MOVED,HOS_NEW_LEVEL,RX_NEW_DUMP_DIR,RX_VK_FROM_A_TABLE,RX_NOT_LISTED_YET_DIR,RX_NOT_LISTED_YET_FILE,RX_VK_SOMETHINGtests/test_switch_list.py's fixtures; the game reads none of them. The test's cases also name existing switches (RX_VK_NOOPT,RX_VK_PACE,HOS_WINDOW_SIZE,HOS_SAMPLE_FILE,RX_VK_DLSS_DIR,HOS_ENV_FILE)scripts/switch_list.py [--update]--updatefixes the listMeasurements
Run on a Longshot build of this branch (this PR was made on Longshot; there is no GitHub original). There is no main-side measurement: the game run is a behaviour check of
longshot_env.txt's allow-list, with nothing to time.main:
82de567a(2026-11-12) (this branch's base; nothing was run on it in the game)this PR: feat/switch-list @
5255a001Hardware: RTX 3080 (NVIDIA 621.14), Ryzen 9 3900X, 64 GB, Windows 11
Scene: one launch, from a save into Kokiri Forest
Method: one launch with the
longshot_env.txtbelow; what the log names as left out, and whether the files were writtenHow to reproduce: put these five lines in
longshot_env.txtbeside the game, start it, and readlongshot_log.txtlongshot_env.txtHOS_AUDIO_DUMP=test.wavtest.wavnot writtenHOS_INPUT_SCRIPT=0:ARX_VK_FRAME_LOG=frames.csvframes.csvnot writtenRX_E1_NOT_LISTED_FILE=x.txt_FILEname not listedRX_VK_PACE=1The log names exactly the first four as left out. The game reached play from a save, Kokiri Forest at 23-28 fps, with no errors in the log.
Testing
Tested: the runs under Measurements (on this branch) and the game-free checks this description names. Checked but not measured: the game on Windows (above), a behaviour check.
Not tested: Linux (the same C; the check runs there).
Needs other testers:
HOS_AUDIO_DUMP), expecting it logged as left out and no file written (request to open)Screenshots
Nothing on screen.
Risk and rollback
LOCALby mistake is refused fromlongshot_env.txt, so a shared file loses that setting; one markedGAMEby mistake that writes a file would be let through. The names refused before are heldLOCALbytest_switch_list, and an unlisted_FILEor_DIRname is still refused.host/switches.def, ortest_switch_listfails.host/*.definhost_deps).Reviewer notes
run_all.py): every check that reads the changed files (56), throughrun_all.pywith the Builder's tools, Windows: 51 pass. The 5 that fail (nx2/test_dll.py,test_driver_cache_folder,test_fpx_sticky,test_linux_update,test_udmabuf_warning) fail the same way on Longshot'smainon this PC.tests/test_switch_list.py: the list against the reads, both ways; its lines well formed and in order; each area a file that reads it;build.pycounting it among the host's dependencies;env_line_allowedcut out, compiled with the list and run (everyLOCALswitch refused, the names refused before stillLOCAL, the backstop for unlisted_FILE/_DIR, and the earlier cases);--updateon a copy (a missing line added, a dead one dropped, an area moved, the file's head kept). Two deliberate breaks fail it: a read switch removed from the list, and an old refused name madeGAME.Issues
None.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested-configurations.mdfor each measured run.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
feat(runtime): one list of the game's switches, host/switches.def, kept in step with the readsto WIP: feat(runtime): one list of the game's switches, host/switches.def, kept in step with the readsBack to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.
Description brought to Longshot's PR template (#48). Still WIP: it has a game run on this branch but no main-against-this-PR measurement yet, and it isn't rebased on current main.
Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.