Repository navigation
Description
Background
PR #224 moved the settings that the launcher and the in-game menu save into the game's state folder
(wronggpu-setup\settings.ini, clean/wgshared/include/wg_state.h). It made WrongGPU's files there recognisable by their
bytes, their name and the install's id, and made a failed install, repair or update take back only what that run made (a
run journal). Three smaller points remain.
1. The run journal is in memory only
clean/installer/src/wg_core/record.h (RunJournal) and install.cpp write down each create before it happens, but only
in memory:
- A crash in the middle of an install loses the journal. A WrongGPU file the run created then has no record of being
WrongGPU's, so it is kept and listed as if it were the player's (safe, but untidy). - An entry is a path, not the created object. If another program makes or replaces that path between the create and a
rollback, the rollback deletes by path (a narrow interleaving). RollbackCreated's list of what it kept is logged, not shown to the player in the result.
Proposed:
- Write the journal to a file in the state folder, flushed before each create, and read it on the next run to finish or
undo an interrupted one. - Keep each created file's identity (volume serial and file index) or hold it open, and delete only that object.
- Return the kept list to the operation's result as a warning.
2. The settings save's last check is not atomic with the replace
wg_state.h UpdateSettings holds the file from the read to just before the move. It lets go, checks the file's
identity and last write once more (StillIdentity), then replaces it by path (MoveFileExW). An editor that saves in the
moment after the check and before the move can still lose its bytes. (A file made where none was is never replaced: that
move does not replace.)
Proposed: replace through a handle so that the check and the replace are one step. For example, rename the held file
aside through its own handle, move the new file in only where nothing is, and put the old one back if the move fails. Or
use ReplaceFileW with a backup name and compare the backup's identity afterwards. Add a test for an editor save between
the check and the move.
3. The C++ test seams are compiled into release builds
The environment-variable hooks (WRONGGPU_TEST_STOP_AT, WRONGGPU_TEST_FAIL_AT, WRONGGPU_TEST_CREATE_AT,
WRONGGPU_TEST_FAIL_AFTER_RESTORE) exist only in WRONGGPU_TESTING builds. The function-pointer seams they sit beside
are still in release builds:
wg_state.hTestFault()/Faulted();record.cppSetRestoreStepHook/RestoreStepandSetFaultHook/TestFault.
Nothing in a release build sets them, so they do nothing there, but they are code a release build does not need.
Proposed: compile them only into WRONGGPU_TESTING builds and the unit-test targets (an empty inline RestoreStep /
Faulted otherwise), with a release-build check that their names are not in the launcher.
Done when
- An interrupted install leaves a journal that the next run uses, and a rollback deletes only the objects it created
(unit tests: a crash after a create; a path replaced before the rollback). - A settings save cannot replace bytes an editor saved after WrongGPU's last check (unit test for that interleaving).
- Release builds carry none of the test seams (checked on the built launcher).
Activity
Launcher: settings in the game's state folder, WrongGPU's state files…
phantoslayer21 commentedon Nov 15, 2026
One more point for 0.6.6, from #224's backup change:
4. A downgrade ignores the new
backuprecord line. Since #224, a backup that would land on a file already inwronggpu-setup\backup(one an earlier uninstall kept) goes to the first freebackup\<rel>.<n>, and the record names it in abackupline. An older uninstaller (0.5.x, 0.6.0) does not know that line: it keeps it as an unknown line and restores frombackup\<rel>, which is the kept file, not this install's backup. This only happens after a downgrade, with a kept file at that name.Proposed: a record that has
backuplines also gets a version marker that older uninstallers refuse (so they stop with the plain message instead of restoring the wrong file), or the newer launcher leaves an explicit note in the state folder; plus a test with a record that has abackupline read by the 0.6.0 record parser.