Repository navigation
Launcher: the RR plugin's own rr_mode save keeps WrongGPU\wronggpu.ini WrongGPU's - #224
Merged
Merged
Conversation
…i WrongGPU's The RR plugin saves the mode picked in OptiScaler's menu into WrongGPU\wronggpu.ini (rr_panel.cpp: the [wronggpu] rr_mode line becomes "rr_mode=<mode>", CRLF). That changed the file's bytes away from the record's hash, so the next repair took the file for the player's and backed it up, and the uninstall then ended "partly" and kept that generation in WrongGPU-originals. WhatIsThere now treats the file as WrongGPU's when its only change since the launcher last wrote it is that line in the plugin's exact form (rr.h RrSettingsPluginEdit: the recorded bytes with the line set back to one of the three modes). Any other change (another key or line, spaces around "=", other line ends) is still the player's. The "left in place" warning no longer calls that file another setup's OptiScaler (the header WrongGPU writes in it names OptiScaler's menu). Tests: launcher-core checks of both directions (RrSettingsPluginEdit and WhatIsThere); test_rr's in-game switch writes what the plugin writes; launcher_rr_owner_cases.py (called from test_rr) covers plugin save + repair + uninstall (removed, nothing kept) and a hand edit with and without a repair (the player's bytes stay or come back). Refs #219 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…n-edit-219 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 15, 2026 01:36
…n-edit-219 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as draft
November 15, 2026 01:45
This was referenced Nov 15, 2026
Open
…n-edit-219 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…d WrongGPU's files (#219) Replaces this branch's earlier approach (recognising the plugin's save by its content) with the state-folder design: - wronggpu.ini and WrongGPU\wronggpu.ini keep the install's defaults and are never rewritten after the install. What the launcher and the in-game menu save goes into wronggpu-setup\settings.ini (wg_state.h SetSettings), which the FSR front end, the RR plugin and the launcher read over the files. Uninstall removes the state files; repair and update keep them. An install whose WrongGPU\wronggpu.ini differs from the record carries its rr_mode/rr_overlay over once. - Uninstall, repair, update and roll back hold the record's WrongGPU binaries (wg_state.h OperationGuard): refused, nothing changed, while the game or another program has one open. Binaries the operation writes are renamed in and held; an unrecorded file at the path is taken under the same rule; originals go back unheld. - The Preset K build's wronggpu-asi.ini seed is a recorded install file; a re-install writes the same wronggpu.ini (no second model item); a settings file that is the player's after the restore is kept and not recorded. - LoadRecord starts from an empty record (a second load listed every entry again); the gate holds each file once. - Tests: launcher-core-tests (state keys, migration, gate), launcher_state_cases.py (e2e: in-game save then uninstall, player edits, refusal while a file is open or loaded, upgrade, the asi seed), test_hook_dll (menu save into the state folder), the FSR front end's state settings; README. Refs #219 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 15, 2026 18:21
phantoslayer21
marked this pull request as draft
November 15, 2026 18:26
… never overwritten Review fixes (#224): - settings.ini, model-choice.ini and their temporary files are WrongGPU's only while they end with WrongGPU's stamp line ("; wronggpu-written <check>", a check of every byte before it). An uninstall deletes them only then; an edited, unknown or player-made file stays and is listed. A write keeps the stamp only on a file that was WrongGPU's (or new). - The settings file is read tolerantly (UTF-8 BOM, comments in any UTF-8, spaces around '=', sections, unknown lines) and every line is written back. Text WrongGPU cannot keep as it is (a control character, a CR outside CRLF, bytes that are not UTF-8) is never replaced: a save is refused (Unparseable) with the reason in words. - wronggpu-asi.ini and WrongGPU\wronggpu.ini are created only where nothing is (fail-if-exists). One that appears after the check or after the record is written stays as it is, out of the record, and the result says so. Test hooks create such a file at either step. - The RR mode is decided under the state lock from the file as it is then (UpdateSettings): a refresh never changes a saved mode, an apply writes it only when the launcher's own choice changed; the unlocked equality check is gone. - A UTF-8 BOM before [wronggpu] in a 0.6.0 RR settings file is skipped. Tests: the tolerant format and its byte-for-byte write back, the refusal, the stamp, a forced interleaving under the lock (wg_state and launcher), negative controls for every state file, the BOM with LF and CRLF, seeds appearing at each install step, and an update over a 0.6.0 record without the seed entry. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…f only what a run made Re-check fixes (#224): - A failed install, repair or update takes back only what that run made: a run journal is written before each create, and the rollback deletes those files and removes those folders when empty. Everything else in the state folder stays and is listed; the cleanup by name and the removal of the whole folder are gone. - WrongGPU's stamp now covers the file's own name and this install's id (the record's new install-id line, kept by repair and update): a copy under another name (temporary files among them) or from another install is not WrongGPU's and stays. - A settings save holds the file (reads shared, no writes, deletes or replace) from the read to just before the move, checks its identity once more right before the move, and creates a new file only where nothing is: a change made meanwhile refuses the save (Changed) and the other program's bytes stay. - The tolerant save keeps every line with its own line end, takes off only the valid terminal stamp (a stamp-like comment stays), and adds no final line end to a file that had none. - The tests' hooks (WRONGGPU_TEST_FAIL_AT, WRONGGPU_TEST_CREATE_AT/_CREATE_FILE) exist in WRONGGPU_TESTING builds only; a unit test checks that a release build ignores them. Tests: the journal's rollback, copy controls for every stamp binding, both save interleavings, line ends and stamp-like comments, failed runs keeping the player's state files (suite), the 0.6.0 fixture citing the 0.6.0 source it follows, and its asi file listed once per uninstall. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…setup\backup Every backup copy is created only where nothing is (CopyFileW fail-if-exists, CopyBackup). When a file is already at backup\<name> (one an earlier uninstall kept), the new backup takes the first free backup\<name>.<n>; the name goes into the record (a "backup" line) and the restore reads it. The kept file stays and is listed. The same rule for the backup made when an earlier direct install is adopted, the 0.5.x record's .v1 copy, and the Engine.ini fix's copy in rr-config\ (created only where nothing is; otherwise the setting is not added and the result says why). Tests: a kept backup\wronggpu.ini and an install keep both files, the kept bytes unchanged, the record names the new backup and the uninstall restores from it (unit and suite). Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 15, 2026 21:14
phantoslayer21
added a commit
that referenced
this pull request
Nov 15, 2026
…ply leaves wronggpu.ini Review of #213 (fifth round): - The host event compares the selection with the model the active context runs, not with the earlier record: it returns 1 whenever the selection differs from what runs (also when a launcher Apply changed the record while the game is open), so the host recreates. - The front end always takes the model choice route. Without the state folder (wronggpu-setup), or when it cannot be checked: the session's last choice, else wronggpu.ini's model item, else Model M. The host's stored entry and the plugin's saved entry never choose the model; the legacy host-entry route is removed. An event that cannot be saved returns "not saved". - Apply does not rewrite wronggpu.ini at all (the settings it applied there move to wronggpu-setup\settings.ini with #224). A missing or unreadable OptiScaler.ini: the record is still written and the player is told "OptiScaler's list couldn't be updated; the model choice is saved". - The launcher window's Apply builds its request in GuiApplyRequest (core); `set ... --gui-apply` runs that same request in test builds. Tests: running K, the launcher records M, the player selects the shown M: 1 and M runs; no state folder: wronggpu.ini's item on the hooked route and the custom slot, never the entry, and a selection is not saved; the launcher's Apply of an unchanged model wins over a newer choice made in OptiScaler's list; OptiScaler.ini missing; the upgrade migration (the record tool in its own process) against the REAL launcher apply holding the lock (test hook). The earlier tests that relied on an entry choosing the model now expect the model choice route's model. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
added a commit
that referenced
this pull request
Nov 15, 2026
Conflicts: - launcher.cpp ApplyProfile: one state-lock hold covers #224's settings (validated first, then settings.ini through the state keys), the model choice record, OptiScaler.ini's entry and #224's RR state, in that order. WriteLauncherModelChoice / GuiApplyRequest sit next to #224's FrontEndStateKeys / WithFrontEndState. - record.cpp: #224's version (model-choice.ini is WrongGPU's by its stamp, not by its name). Follow-ups for main's changes: - The model choice record is written with wgstate::WriteStamped (#224's stamp for model-choice.ini and the install's id), so an uninstall knows it as WrongGPU's; a test covers the stamp, a parse of a stamped record and a write without an install id. - A create no entry names, whose record names a model this build lacks, runs Model M, never the persisted sr_model (which an earlier session may have left on another model); test case (16). - wronggpu.ini's reader for the upgrade migration is a named callable class, not a lambda capturing the path by copy. - run_model_k_tests: since #224 the uninstall also removes the seeded, unchanged wronggpu-asi.ini, so the game folder is byte for byte as before. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
added a commit
that referenced
this pull request
Nov 15, 2026
…ays what was applied - model-choice.ini is written in place through #224's state-file updater (wg_state.h UpdateStateFile, the settings.ini updater generalised for any state file of the folder): only the record's three key lines change; comments, other lines and line ends stay; the stamp is put back only when the file was WrongGPU's and unedited (or new), so an edited or player-made record stays unstamped and the uninstall keeps it. A record that is not a valid record is never replaced: the choice is refused with one log line (the front end returns "refused", the plugin's entry says so, the launcher warns) and the model that runs stays. Tests: edited, player-made, corrupt. - wronggpu-asi.ini: the launcher's Apply changes only its selection line (wgasi::WithSelection) and keeps every other byte; a file whose bytes were WrongGPU's (the install record's hash) stays WrongGPU's under its new hash, the player's stays the player's. Tests: unit, and the Model L suite with a player's file (comments, selection=amd). - dllmain.cpp / win_util.h: the callables that keep a string of the configuration (model places, AMD's DLL, the comparison DLL) are named classes, not lambdas capturing the string by copy. - A partial apply: when the RR write fails after other settings were written, the message lists exactly what was applied and what was not (no "settings not applied" after some were), and the install record keeps the hashes of the files WrongGPU changed. Test: the launcher suite's RR group with the write failure injected (WRONGGPU_TEST_FAIL_RR_STATE, testing builds only). Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
What this changes and why
Refs #219: the
test_rrhalf. It was a code bug, not a stale check.WrongGPU's RR plugin saved the mode picked in OptiScaler's menu into
WrongGPU\wronggpu.ini, a file the install record lists by its hash. After that save the file no longer matched the record. The next repair took WrongGPU's own file for the player's and backed it up, and the uninstall ended "partly", leavingWrongGPU-originals\<time>\WrongGPU\wronggpu.inibehind.This PR follows the state-folder design (built on #226's
clean/wgshared/include/wg_state.h):wronggpu.iniandWrongGPU\wronggpu.inikeep the install's defaults and belong to the player. After the install, no launcher operation and no plugin rewrites them.<game>\wronggpu-setup\settings.iniand takes precedence over those files:upscalerand every managed runtime key (executor,output_filter,pre_exposure,sparkle_guard);rr_enabled,rr_modeandrr_exact_allowed.UpdateSettings/SetSettings). Only keys that differ are written.=, sections and unknown lines are kept and written back as they are, each line with its own line end. A file without a final line end gets none added, unless the file is WrongGPU's own.Changed), and the other program's bytes stay. A new file is moved in only where nothing is.Unparseable) with the reason in words, and the bytes stay.config.cppApplyStateSettings, called inwin_util.cppafterParseConfig);wg_settings_reader.hread_rr_settings,rr_enabled.h);EffectiveWronggpuIni,ReadRrSettings).SetSettings. A failed save is logged as "not saved: ..." with the reason.; wronggpu-written <check>. The check covers every byte before it, the file's own name and this install's id: the record's newinstall-id, which repair and update keep. A write keeps the stamp only on a file that was WrongGPU's, or new.settings.iniandmodel-choice.inionly while the stamp is valid for that name and this install.OperationGuardfor the whole operation (record.cppGuardOperation,PutBinary,PutBinaryFrom,DeleteHeldBinary). If the game has a binary loaded, or another program has one open without sharing writes, the operation stops before any change: "Nothing was changed: WrongGPU's files are in use by the game or another program (for example antivirus). Close the game and try again ()." A binary the operation writes is renamed in complete and held at once.WrongGPU\wronggpu.inidiffers from the record (an older plugin's save or the player's edit), the file is treated as the player's. Itsrr_modeandrr_overlayare copied intosettings.inionce, and the file is kept (MigrateRrState, LF and CRLF, with or without a UTF-8 BOM). The copy happens under the state lock, only while the state has no mode.wronggpu-asi.iniseed (Preset K builds) is recorded with its hash. Uninstall removes it when unchanged. When the player changed it, uninstall keeps it and lists it. A re-install keeps unrecorded player files as they are, including the unrecorded file a 0.6.0 install left.wronggpu-setup�ackupthat the install did not make. Every backup copy is created only where nothing is (CopyFileWfail-if-exists,CopyBackup). When a file is there already (one an earlier uninstall kept), the new backup takes the first free namebackup\<name>.<n>. That name goes into the record (abackupline), so the restore reads that file. The kept file stays and is listed.leftovers.cpp, the sameCopyBackup);.v1copy (only where nothing is, else.v1.<n>);rr-config\(rrconfig.cpp, and the relocation inlauncher.cpp). It is created only where nothing is; otherwise the setting is not added and the result says why, or the relocated copy is not written and the revert keeps Engine.ini's copy as it is.install.record,uninstall.exe,setup.log,owned-files.json) and the files written into the game folder, which were backed up first or are seeds.wronggpu.ini(written only where none is), and writes into WrongGPU's own application folders (the data folder, the launcher's program folder).wronggpu-asi.iniandWrongGPU\wronggpu.iniare created with fail-if-exists. One that appears after the check, or after the record is written, stays as it is and is taken out of the record, and the result says so.ApplyProfileno longer renderswronggpu.ini.rr.h/record.h/launcher.hcomments describe the new rules.The earlier approach on this branch (
RrSettingsPluginEdit, recognising the plugin's save by its content) is gone. The #224 review blocked it.Changed test expectations
run_launcher_tests.py, rc6 L4: an update fails after the earlier install was removed.previous\stay, and the earlier install's uninstaller (no record any more) is removed.previous\stay, and so does everything else the failed run did not make. That includes the earlier install'suninstall.exe,owned-files.jsonandsetup.log, each listed.Test hooks (testing builds only)
WRONGGPU_TEST_FAIL_AT(fail the operation at a named step, so its rollback runs) andWRONGGPU_TEST_CREATE_AT/WRONGGPU_TEST_CREATE_FILE(a file appears at a named step) are new. LikeWRONGGPU_TEST_STOP_AT,WRONGGPU_TEST_FAIL_AFTER_RESTOREand the store-access test layer, they exist only inWRONGGPU_TESTINGbuilds and are compiled out of release builds.-DWRONGGPU_TESTING=OFF, the suite's mock payload) contains none of the hook names:WRONGGPU_TEST_FAIL_AT,_CREATE_AT,_CREATE_FILE,_STOP_AT,_FAIL_AFTER_RESTORE. The testing launcher contains all five (the positive control).Follow-up (0.6.6): #246. It covers three points:
TestFault,RestoreStephooks) compiled out of release builds.Known and accepted
wronggpu-asi.inia 0.6.0 install left is never deleted, because nothing proves it is WrongGPU's. It is listed once in an uninstall's report, never at a status or launch.record.cppSaveRecord) writes noinstall-idline, and 0.6.0 wrote the seed without recording it (optiscaler.h). It is not a record captured from a 0.6.0 install.Relation to #222, #226 and #213
test_re9half.model-choice.ini. This PR never writesmodelintosettings.ini. Between this PR and OptiScaler plugin path honours the launcher's model choice (Model L, K) #213, a model choice made in the launcher does not reach the front end. The install'smodel=Mdefault is unchanged.What each new or substantially changed file is based on
Own design, following the architect's state-folder decision for #219, the README file-ownership rule and #226's
wg_state.h.clean/installer/tests/launcher_state_cases.pyis new and uses the suite's fixtures.How it was tested
Tested on this head, with main and #243 merged in (Windows, MSVC; APPDATA, LOCALAPPDATA, ProgramData and TMP redirected to scratch folders):
ci.ymlflags: Preset K off, and the release's model flags;WRONGGPU_TESTING=OFF) with CI's ctest filter: 9/9 tests pass in each. This includes the hook test's release half.launcher-core-tests,WRONGGPU_TESTINGbuild: 460 checks pass. They include:backup\wronggpu.inistays, the new backup iswronggpu.ini.1and is recorded, then the next free name);model-choice.ini, another install);clean/wgshared(test_wg_state): 5/5 pass. Covered:clean/rr_f/proxy/tools/build.py, CPU): every version builds and its tests pass (built with this round'swg_state.h).fsr_custom_slotfails the same way on this PC's build of main, so it is not from this change; CI runs it.run_launcher_tests.py, full suite, on this head with its testing launcher. The RR test game's rr-prepare was answered without the GPU.[isolation-verbs]pass, and no store library path appears in either log.backup\wronggpu.iniand an install: both files present, the kept bytes unchanged, the uninstall restores the game's file from the recorded new name;wronggpu-asi.ininot at a status, listed once by the uninstall);Not tested:
Checklist
Signed-off-by:line (git commit -s; Developer Certificate of Origin 1.1).REUSE.toml.