Repository navigation
Offer a current VC++ runtime in the game prefix for USVFS 0.5.7+ - #66
Merged
Merged
Conversation
From 0.5.7, USVFS links the VC++ runtime dynamically. MO2 injects it into the programs it starts (the game, SKSE, tools), where it uses that process's runtime: the game folder's or the prefix's system32. A Skyrim prefix usually has the 2016 msvcp140.dll from the game's own redistributable plus Wine's built-in vcruntime140_1.dll; there the injected USVFS dies on its first C++ exception (seen on a Steam Frame with usvfs#93's 0.5.7.2 build: Skyrim and Explorer++ died right after `inithooks called`, with a jump to address 0 inside vcruntime140_1.dll). The copy next to ModOrganizer.exe (#60) can't help there. - vcruntime: detect the problem (msvcp140/vcruntime140/vcruntime140_1 missing, Wine's built-in stand-in, or older than 14.40) when the instance's usvfs_x64.dll is 0.5.7+; back up the runtime DLLs; cache the pinned, checksummed VC_redist.x64.exe. - launch.run_in_prefix: run a Windows program to completion in the game prefix through the same Proton and Steam Linux Runtime as MO2 (flatpak-spawn from the Flatpak). - service: prefix_runtime_problems() and install_prefix_runtime() (backup, /install /quiet /norestart, re-check; refuses while MO2 runs; exit codes 0/3010/1638 are success). - Dashboard: a warning row with "Install Visual C++ runtime…" in the MO2 card, only when needed, behind a confirmation. Nothing installs without a click. - doctor: each instance's USVFS version and, for 0.5.7+, the prefix check. Tested on the Frame: detection flags the pre-install prefix backup (msvcp140/vcruntime140 14.0.24215.1, Wine's vcruntime140_1) and passes the current prefix; the install path ran through Steam's ARM64 Proton both from source and from inside the aarch64 Flatpak (about 15 s, clean re-check). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 3, 2026
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.
Why
From 0.5.7, USVFS links the VC++ runtime dynamically (0.5.6.1, shipped with MO2 2.5.2, had it built in). MO2 injects USVFS into the programs it starts, so it uses their runtime: the game folder's, or the Proton prefix's
system32. A Skyrim prefix usually has the 2016msvcp140.dllfrom the game's own redistributable plus Wine's built-invcruntime140_1.dll. On a Steam Frame with ModOrganizer2/usvfs#93's 0.5.7.2 build, Skyrim and Explorer++ started from MO2 died right afterinithooks called, with a jump to address 0 insidevcruntime140_1.dll. Installing Microsoft's redistributable into the prefix fixed it, and modded Skyrim then ran. #60's copy next toModOrganizer.execan't reach the game process. This matters on every platform once MO2 ships USVFS 0.5.7+, and on the Frame as soon as #93 lands.What
vcruntime.prefix_runtime_problems,usvfs_needs_prefix_runtime): only when the instance'susvfs_x64.dllis 0.5.7+, and any ofmsvcp140/vcruntime140/vcruntime140_1is missing, Wine's built-in stand-in (marker in its DOS stub), or older than 14.40. On the Frame's pre-install prefix the oldvcruntime140_1reported 14.42 but was Wine's, so version alone isn't enough.service.install_prefix_runtime): back up the runtime DLLs todata/modsync/backups/, fetch the pinned and checksummedVC_redist.x64.exe(same pin as Give MO2 its own current Visual C++ runtime before launching it #60, cached), and run/install /quiet /norestartthrough the game's Proton and Steam Linux Runtime via the newlaunch.run_in_prefix(withflatpak-spawn --hostfrom the Flatpak). Then re-check. It refuses while MO2 runs, and failures name the backup.doctor: each instance's USVFS version, plus this check for 0.5.7+.Testing
uv run pytest -q: 362 passed, 18 skipped.system32backup and passes the current prefix. The real install path ran through Steam's ARM64 Proton from source and from inside the aarch64 Flatpak (about 15 s each, clean re-check, backups written).doctorshowsusvfs 0.5.6.1andusvfs 0.5.7.2: game prefix has a current VC++ runtimefor the two test instances.🤖 Generated with Claude Code