Repository navigation
Repair install state for games that are already on disk - #116
Closed
Code-Leafy wants to merge 1 commit into
Closed
Code-Leafy wants to merge 1 commit into
Code-Leafy wants to merge 1 commit into
Conversation
Steam treats a game as installed purely on the appmanifest being there. When it is missing, or present but blanked to StateFlags 1538 with an empty InstalledDepots, the payload is unreachable: the library entry is dead and Install re-downloads everything over files that are already complete. GetInstallDir could only report that state back, because it resolves the folder from the appmanifest and nothing ever writes one. The folder is found from appinfo instead (installdir + launch exe, matched on the normalized name and required to contain that exe), and the appmanifest is written against it under whatever name it actually has, so a renamed or unpacked folder does not have to be renamed back first. Guards for the ways this could otherwise bite: the app is skipped when a manifest already carries FullyInstalled, an existing manifest is backed up before being replaced, and an orphaned staging folder is cleared so Steam reconfigures instead of resuming a dead download. A shared depot the lua references is registered on the app that owns it, since a missing one aborts the depot dependency build with Invalid content configuration. Steam is stopped for the write and restarted after, the same way appinfo edits are applied. Two new strings are English-only for now and listed in PENDING_TRANSLATION.
Author
|
Test build for anyone who wants to poke at this without building it: https://github.com/Code-Leafy/LuaTools/releases/tag/test-adopt-install Commit If you would rather build it yourself, the branch is |
Author
|
Closing in favour of #117, which carries this as an issue instead of a PR. |
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.
Two games of mine had their files fully on disk and Steam wanted to pull both of them again. 3024040 had no appmanifest at all, so it was just invisible. 361420 had one blanked to
StateFlags 1538withSizeOnDisk 0and an emptyInstalledDepots, and Steam staged 3211445310 bytes intosteamapps\downloading\361420while the complete 3215764300 byte install sat incommon:Steam decides "installed" purely on the appmanifest existing, and
GetInstallDircan only mirror that: it builds the path out of the appmanifest and bails when it is missing (if (!File.Exists(acf)) continue;). Nothing in the app writes one back, so the state is reported and never repaired. Renaming the folder to matchinstalldirdoes not get you out of it either, I tried that first — it only ever works through the appmanifest, so with no appmanifest there is nothing to match against.What this does
The folder is located from appinfo (
config.installdirplus the launch exe), matched on the normalized name and required to contain that exe, then the appmanifest is written against it under the name it already has. Renaming is therefore optional, not a prerequisite. Depot ids, gids and sizes come from the pinned lua, including the commentedsetManifestidlines; a depot with no gid is left out rather than invented.Things that would otherwise bite, and what is done about them:
FullyInstalledis skipped, so this is idempotentFullyInstalledis backed up (<acf>.bak-<utc>) before being replaced, which is the broken shape being repaireddownloading\<appid>folder is cleared, otherwise Steam resumes a dead staging directory instead of reconfiguringBuildDepotDependencyaborts with Invalid content configuration and the entry never leaves "update"AutoUpdateBehavior 1(update on launch only), because the lua describes one build and the scheduler would otherwise chase another the moment the entry appearsSteam is stopped for the write and restarted after, the same as
LaunchOptionsServicedoes for appinfo edits.GetInstallDirgains the fallback too, so the fix flow,SteamlessServiceand the manifest job factory stop reporting a game that is plainly on disk as missing.Where it runs
FixesViewModel.OpenGame, once, when the resolved folder is null. A toast says it happened and the rows stop saying "not installed". Worth arguing about: that is a write nobody explicitly asked for. The alternative is a button, which needs a view change and more strings; say the word and I will move it.Notes
SteamLibraryService.GetLibraryRootsbecame public to reuse it. The rest is new surface:InstallDirMatcher(pure, no IO) andInstallStateRepairService.Steamworks Shared, right name but no exe, nothing to match), the manifest fields and escaping, and a round trip against a temp Steam install covering the backup, the skip, the staging clear, the shared depot and the library index entry.PENDING_TRANSLATION.check-i18n.pypasses; happy to do the 29 translations in this PR if you would rather not carry them.libraryfolders.vdfwith no entry for the library at all, and anything about DLC depots listed without a key.already-installedskip is what my own installs hit; the actual adoption only ran in tests.dotnet buildanddotnet testboth clean (316 passing), Windows 11, Steam 1794424036.