feat(mods)!: mods ship ReShade presets and load while the game runs, and copied mods start off #3105
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
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
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3105
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:feat/mods-reshade-live"
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?
Summary
Three related changes to mods.
1. Mods can ship ReShade presets. A mod with the
gfx.shaderpermission and areshade/folder adds its presets tothe ReShade preset row, with no code. Longshot's 25 presets move out of C++ headers into the built-in mod
system/reshade-presets, in the same layout. Presets, shaders and textures reload while the game runs; an edit thatdoes not compile keeps the effect already on screen. The choice is saved by id; choices saved before are converted.
2. Mods of scripts or ReShade presets can be added and removed while the game runs. Mods with code, their own save
folder, a game language, game files, textures or the emulators' layout still apply at the next start, and the Mods tab
says why and offers Restart now.
3. A mod copied into
mods/by hand starts off. Emulator-layout mods used to start on. The first time Longshot goesthrough a profile's mods, each one already there keeps its switch; only mods copied in after that start off. Installing
through Longshot still switches a mod on. The switch of a hand-copied mod is now written to
profile.json, so itsurvives a confined game, which used to drop it.
Read first:
game/crates/api/src/reshade.rs,game/crates/api/src/loader/arrive.rs,game/crates/modtool/src/record.rs,gpu/vk/reshade/fx_packs.cppandfx_runtime.cpp. One commit per change.Known gaps:
main(the toolbar is still the old C++ drawing) and is not fixed here.gpu/vk/reshade/) and #3021 (profile.jsonwrites under the edit lock).
Testing
Tested: one headless game run on the head (
582d285dbb39, onmain@76092c5e), Linux, NVIDIA RTX 3090, driver620.70.06, from a repository save, with a test mod of presets alone:
error X3000andkept the green effect; fixing it turned it blue;
profile.jsonremoved the tint and back on restored it; deleting its folder removed it andcopying it back restored it, with no restart;
emulator-layout folder copied in was listed as Off, with Restart now offered.
Checks, Linux, no full suite. After the rebase:
cargo testofapi,longshot-game,host-sys,schema,build-compile,build-driver,launcher-profileandmodtoolpasses (2 ignored), as doreshade_hot_reload,i18n_completeandmenu_ini_keys.cargo clippyandcargo fmt --checkreport onlybuilder/crates/build-core, which this PR does not touch. Before the rebase:cargo testofapi,longshot-game,host-sys,schema,build-compile,build-driver,launcher-profileandmodtool(without its stand-in game tests);cargo clippy -D warningsof thesame;
cargo fmt --check;schema-genandffi-gen --check; the Python checks that read the changed files(
reshade_hot_reloadwith g++ and clang++,reshade_fx,program_hooks,i18n_complete,menu_i18nand others);the system mods' TypeScript tests except
menu's; llvm-mingw syntax checks of the changed C and C++ files.the_typescript_system_mods_pass_their_testsdoes not finish onmaineither (stuck inmenu's tests after 10minutes).
After the review fixes: the
apicrate's tests,modtool'srecordtests,build-driver's tests,reshade_hot_reload(g++ and clang++) and a llvm-mingw syntax check offx_packs.cppandfx_runtime.cpp.Still to test:
into
mods/, which may not inherit the sandbox's permission; expecting each to apply without a restart (by hand).mods/folder: add one while the game runs; the sandbox may not grant it (by hand)..lsmodwhile the game runs; a mod switched from the Mods tab; a script mod's permissionprompt for a late mod (by hand).
Measurements
Nothing to measure: no change aims at speed.
A preset list change recompiles the preset in use only when its own pack's files changed. No switch is added:
HOS_MOD_TESTS, which a new line reads, is the existing test mode's.Risks
profile.jsongainsmods_recordedandcopiedkeys. After recording,mod remove mods/<folder>is refused for a recorded copy (remove it by id). Thesaved ReShade choice becomes an id, so going back to an older Longshot loses it.
does not see a late one.
MKWVK_API_VERSIONis 90.gfx.effecthas one); chosen deliberately for now.Checklist
Ready for review
main; the title is a Conventional Commit. (Three related topics in one on purpose.)mise run testpasses. (Not run on this branch.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.MKWVK_API_VERSIONbumped (MkwVkHostorMkwVkRendereringpu/vk/vk_api.hchanged).mainand here, for a change that shows on screen. (Not taken.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
Tested in game: RTX 3090, driver 620.70.06, Linux, headless, before the rebase: reached play, built-in presets loaded, mods switched, removed and added live. Mod presets not exercised.
WIP: feat(mods)!: mods ship ReShade presets and load while the game runs, and copied mods start offto feat(mods)!: mods ship ReShade presets and load while the game runs, and copied mods start off@review
Recommendation: Approve. An unreadable preset folder can remove the active effect, and the profile migration can disable previously active mods. The new preset workflow also has not been exercised in game on this head. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change adds mod-provided ReShade presets and live mod discovery, and records manually copied mods so their switches persist. It also changes migration and reload behavior across the builder, game and renderer, with correctness and validation gaps.
Should fix (3): not blocking, but worth doing before merging.
game/crates/api/src/loader/mod.rs:3510: A directory read failure is treated as an empty directory, bypassing the path that preserves the previous presets. (more on the line) Do: Propagate directory listing errors to keep_presets, and distinguish an intentionally removed directory from an unreadable one.game/crates/modtool/src/record.rs:38: The migration guesses whether an existing profile was played and can permanently record previously enabled emulator-layout mods as off. (more on the line) Do: Use a reliable migration marker or preserve existing emulator mod behavior when the profile's history is ambiguous, while marking newly copied mods separately.tests/test_reshade_hot_reload.py:19: The new test forces g++ instead of using the compiler selected by the test runner. (more on the line) Do: Use the runner's {cxx} placeholder and honor CXX for direct invocation.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixdoes its part first: Avoid copying unchanged pack contents and avoid recompiling the active preset when its inputs did not change.)@fixcan do L1, L2, L3 and L5.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The reported pre-rebase Linux run loaded built-in presets and exercised some live mod changes, but did not exercise mod presets; there is no game run on the current head and no performance measurements.
Other systems: The changes affect Windows and Linux file access, profile migration, builder launches, script permissions, renderer compilation and GPU resource lifetime. Windows, AMD, Steam Deck, store installs and live preset edits remain untested in the reported runs.
Switches: No switch added or changed. The new read of HOS_MOD_TESTS uses the existing test-mode switch.
Reviewed:
ed5522ef01against0aeb685893: Read the repository rules, PR template, commit messages, key preset and mod-arrival paths, preset ABI, memory-backed file access, profile recording, relevant settings changes and the new hot-reload test. Skimmed the diff and standards. The full set of changed code, generated files, translations and preset assets was not completely reviewed; ../Tooling/AGENTS.md and docs/review-checklist.md were absent.; nothing run (a code review).Checked and fine:
Testing: No code, scripts or tests were run, as requested. The author's reported run and checks are described in the pull request; CI is still running.
Overlaps and merge order: The description identifies possible overlaps with #2911 and #3021; their current diffs and merge order could not be checked offline.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -3307,0 +3507,4 @@let mut folders = vec![String::from("reshade")];let mut seen = 0usize;while let Some(folder) = folders.pop() {for e in disk.list(&root.join(&folder)).unwrap_or_default() {L1 (should fix): A directory read failure is treated as an empty directory, bypassing the path that preserves the previous presets.
When: If an enabled mod's reshade directory becomes temporarily unreadable during a reload, reshade_files returns an empty pack; the caller drops the pack and the selected effect is turned off instead of retaining its previous files.
Do: Propagate directory listing errors to keep_presets, and distinguish an intentionally removed directory from an unreadable one.
@ -0,0 +35,4 @@Err(_) => false,})})}L2 (should fix): The migration guesses whether an existing profile was played and can permanently record previously enabled emulator-layout mods as off.
When: A player who used Longshot before the mod API, has no save and changed no setting has none of these markers. On the first build or play after updating, the existing emulator mods are recorded off and no longer apply.
Do: Use a reliable migration marker or preserve existing emulator mod behavior when the profile's history is ambiguous, while marking newly copied mods separately.
@ -0,0 +16,4 @@sys.path.insert(0, str(Path(__file__).resolve().parent)) # (python -I leaves the check's own folder off the path)from srccut import block # noqa: E402RUN_ALL_ARGS = ["--cxx", "g++"]L3 (should fix): The new test forces g++ instead of using the compiler selected by the test runner.
When: On a supported setup with only Clang or LLVM-MinGW, run_all cannot use its selected CXX for this check and skips or fails it because g++ is unavailable.
Do: Use the runner's {cxx} placeholder and honor CXX for direct invocation.
ed5522ef0135c9529d95Review fixes pushed, folded into the commits they belong to.
reshade/folder that is there and cannot be listed is now an error, so the presets before are kept. A test makes one unreadable (it failed before the fix).{cxx}, andCXXwhen run directly.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
35c9529d95582d285dbb@review
Recommendation: Approve. The code is ready: only testing is left. The live-loading and mod-preset paths still need game runs on the current head, and the cost of rebuilding preset lists remains unmeasured. Recommend approval; not approved on the forge.
The change lets mods provide ReShade presets and load some content during play, while preserving existing emulator-mod switches during migration. The renderer now reuses unchanged packs, though the game still rereads them on each change.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixdoes its part first: Avoid copying unchanged pack contents and avoid recompiling the active preset when its inputs did not change.)@fixcan do L5.Since the last review (on
ed5522ef01)Resolved: L1 (A directory read failure is treated as an empty directory, bypassing the path that preserv…); L2 (The migration guesses whether an existing profile was played and can permanently record pr…); L3 (The new test forces g++ instead of using the compiler selected by the test runner.)
Still open: L4 (The new mod-preset and live-loading paths need game runs on the current head and the suppo…); L5 (The remaining cost of rebuilding the preset list has not been measured.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The reported Linux NVIDIA run predates the rebase and did not exercise a mod preset; there are no measurements of preset-list update cost.
Other systems: Windows, AMD and Steam Deck remain untested. The change affects renderer pack lifetime, shader compilation, mod loading and profile migration; the reported headless run does not cover those paths end to end on the current head.
Switches: No switch added or changed. The new read of HOS_MOD_TESTS uses the existing test mode.
Reviewed:
582d285dbbagainst76092c5e5a: Read AGENTS.md, CONTRIBUTING.md, record.rs, fx_packs.cpp and fx_packs.h in full; inspected the relevant loader, runtime, test and profile-migration sections and the change summary. The remaining changed files, generated assets and translations were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports game-free checks after the fixes; CI is still running, and the current-head game runs remain outstanding.
Overlaps and merge order: The description identifies possible overlap with #2911 and #3021; merge order was not established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
L4: the game run on
582d285dbb39has run (Linux, RTX 3090, driver 620.70.06, headless). A mod's preset showed, reloaded after an edit, kept the old effect through a broken edit, went with a switch off or a deleted folder and came back, all without a restart. Late copies were listed as Off, with Restart now for the emulator-layout one. Details in the description. Windows, AMD, Steam Deck, store installs and updating an existing profile are still untested.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e1rSeTzGtqzZNG1YZH
llun referenced this pull request2026-12-03 21:42:52 +00:00