Scripts: VICTORY_HOME is kept and followed, as victory.exe does (#751) #774

Merged
kibagami-nc merged 3 commits from upstream-pr/774 into main 2026-11-29 08:16:58 +00:00
kibagami-nc commented 2026-11-28 05:36:30 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T05:36:30Z.


Fixes the script side of #751, from Jesper-Andersson's finding there.

What happens

play.ps1 and play-foxhound.ps1 clear the VICTORY_* switches left over in the window and keep the path settings. VICTORY_HOME was not among those kept, so a start through them lost it, and so did a start through PLAY_FRAMEGEN.cmd. The preload's victory warm workers, victory preload and the game then wrote their caches and saves to %LOCALAPPDATA%\victory while VICTORY_HOME was set.

The launcher itself has kept it since #472 (KEPT in apps/victory/src/play.rs). The scripts did not.

Three paths that the scripts build themselves did not follow it either:

  • The script's log. play-foxhound.ps1 wrote its log to %LOCALAPPDATA%\victory\logs, while victory.exe writes its own to VICTORY_HOME\logs.
  • The saves backup. play-gta6-framegen.ps1 backed up the saves from %LOCALAPPDATA%\victory\data\7952987A. With VICTORY_HOME set, it backed up the old folder, if there was one, and printed "Saves backed up and checked". The saves actually in use were not backed up.
  • The MFG Unlocker download. get-mfg-unlocker.ps1, run by hand, put the mod under %LOCALAPPDATA%. victory.exe passes -To itself, so its own fetch was already right.

The change

  • Kept switches: play.ps1 and play-foxhound.ps1 keep what KEPT keeps: VICTORY_HOME, VICTORY_ADAPTER, VICTORY_CONFIG, the four folders and VICTORY_LOG. Every other left-over switch is still cleared.
  • The script's log: play-foxhound.ps1 writes it under VICTORY_HOME\logs when that is set.
  • The saves backup: play-gta6-framegen.ps1 backs up from VICTORY_DATA_DIR, else VICTORY_HOME\data, else %LOCALAPPDATA%\victory\data, in the order config.rs uses. It now says when there is nothing to back up. It still does not read a data_dir set in victory.toml.
  • MFG Unlocker: get-mfg-unlocker.ps1 defaults to VICTORY_HOME\mfg-unlocker when that is set.

Tests

A check script, not added to the repository, parses the four scripts. It then takes the changed lines out of the files themselves and runs them under several environments. Every check passed on both Windows PowerShell 5.1 and PowerShell 7.7:

  • Kept switches: play.ps1 and play-foxhound.ps1 keep VICTORY_HOME, VICTORY_ADAPTER, VICTORY_LOG and VICTORY_DATA_DIR, and clear a stale switch.
  • The script's log: the right folder with and without VICTORY_HOME.
  • The saves backup: the right source with neither variable set, with VICTORY_HOME, and with VICTORY_DATA_DIR, which comes first.
  • MFG Unlocker: the right folder with neither, with VICTORY_HOME, and with -To, which comes first.

On main's scripts, the checks for VICTORY_HOME, VICTORY_ADAPTER and VICTORY_LOG fail.

Other checks:

  • cargo test -p victory --locked passes; it embeds get-mfg-unlocker.ps1.
  • cargo test -p xtask --locked passes, including repository_passes_policy.
  • The scripts stay ASCII, with CRLF line ends.

Not run with the game here.

Review fixes (1f3fb37, ad778fb6)

ANDREANIADS found that a data folder with brackets in its name (Profile [QA]) was reported missing by the framegen launcher, so its saves were not backed up. play-gta6-framegen.ps1 now passes -LiteralPath to its path cmdlets: the save backup (source checks, copy, listing, hashes) and the game-folder search, which missed a folder like Game [v1.0.2.1] the same way. Checked on six temporary folders in PowerShell 5.1 and 7.7, before and after: see the comment below.

ANDREANIADS then found that the check after the copy listed only visible files: Copy-Item -Recurse -Force copies hidden files and the contents of hidden folders, but Get-ChildItem without -Force skips them, so a damaged hidden copy passed. The listing now has -Force (ad778fb6). Checked on Windows with real Hidden attributes, in PowerShell 5.1 and 7.7: 3 of 3 files checked, and a changed hidden copy now fails the check.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5537115704 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/774). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T05:36:30Z. --- Fixes the script side of #751, from Jesper-Andersson's finding there. ## What happens `play.ps1` and `play-foxhound.ps1` clear the `VICTORY_*` switches left over in the window and keep the path settings. `VICTORY_HOME` was not among those kept, so a start through them lost it, and so did a start through `PLAY_FRAMEGEN.cmd`. The preload's `victory warm` workers, `victory preload` and the game then wrote their caches and saves to `%LOCALAPPDATA%\victory` while `VICTORY_HOME` was set. The launcher itself has kept it since #472 (`KEPT` in `apps/victory/src/play.rs`). The scripts did not. Three paths that the scripts build themselves did not follow it either: - **The script's log.** `play-foxhound.ps1` wrote its log to `%LOCALAPPDATA%\victory\logs`, while victory.exe writes its own to `VICTORY_HOME\logs`. - **The saves backup.** `play-gta6-framegen.ps1` backed up the saves from `%LOCALAPPDATA%\victory\data\7952987A`. With `VICTORY_HOME` set, it backed up the old folder, if there was one, and printed "Saves backed up and checked". The saves actually in use were not backed up. - **The MFG Unlocker download.** `get-mfg-unlocker.ps1`, run by hand, put the mod under `%LOCALAPPDATA%`. victory.exe passes `-To` itself, so its own fetch was already right. ## The change - **Kept switches:** `play.ps1` and `play-foxhound.ps1` keep what `KEPT` keeps: `VICTORY_HOME`, `VICTORY_ADAPTER`, `VICTORY_CONFIG`, the four folders and `VICTORY_LOG`. Every other left-over switch is still cleared. - **The script's log:** `play-foxhound.ps1` writes it under `VICTORY_HOME\logs` when that is set. - **The saves backup:** `play-gta6-framegen.ps1` backs up from `VICTORY_DATA_DIR`, else `VICTORY_HOME\data`, else `%LOCALAPPDATA%\victory\data`, in the order config.rs uses. It now says when there is nothing to back up. It still does not read a `data_dir` set in `victory.toml`. - **MFG Unlocker:** `get-mfg-unlocker.ps1` defaults to `VICTORY_HOME\mfg-unlocker` when that is set. ## Tests A check script, not added to the repository, parses the four scripts. It then takes the changed lines out of the files themselves and runs them under several environments. Every check passed on both Windows PowerShell 5.1 and PowerShell 7.7: - **Kept switches:** `play.ps1` and `play-foxhound.ps1` keep `VICTORY_HOME`, `VICTORY_ADAPTER`, `VICTORY_LOG` and `VICTORY_DATA_DIR`, and clear a stale switch. - **The script's log:** the right folder with and without `VICTORY_HOME`. - **The saves backup:** the right source with neither variable set, with `VICTORY_HOME`, and with `VICTORY_DATA_DIR`, which comes first. - **MFG Unlocker:** the right folder with neither, with `VICTORY_HOME`, and with `-To`, which comes first. On `main`'s scripts, the checks for `VICTORY_HOME`, `VICTORY_ADAPTER` and `VICTORY_LOG` fail. Other checks: - `cargo test -p victory --locked` passes; it embeds `get-mfg-unlocker.ps1`. - `cargo test -p xtask --locked` passes, including `repository_passes_policy`. - The scripts stay ASCII, with CRLF line ends. Not run with the game here. ## Review fixes (1f3fb37, ad778fb6) ANDREANIADS found that a data folder with brackets in its name (`Profile [QA]`) was reported missing by the framegen launcher, so its saves were not backed up. `play-gta6-framegen.ps1` now passes `-LiteralPath` to its path cmdlets: the save backup (source checks, copy, listing, hashes) and the game-folder search, which missed a folder like `Game [v1.0.2.1]` the same way. Checked on six temporary folders in PowerShell 5.1 and 7.7, before and after: see the comment below. ANDREANIADS then found that the check after the copy listed only visible files: `Copy-Item -Recurse -Force` copies hidden files and the contents of hidden folders, but `Get-ChildItem` without `-Force` skips them, so a damaged hidden copy passed. The listing now has `-Force` (ad778fb6). Checked on Windows with real Hidden attributes, in PowerShell 5.1 and 7.7: 3 of 3 files checked, and a changed hidden copy now fails the check.
ANDREANIADS commented 2026-11-28 20:02:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ANDREANIADS on 2026-11-28T20:02:27Z.


At 7cda805, the backup source is selected correctly, but an existing directory named Profile [QA] is reported missing. I exercised the source selection and existence check in play-gta6-framegen.ps1 using PowerShell 7.4 on Linux and six empty temporary directories. The default, VICTORY_HOME, and VICTORY_DATA_DIR cases all passed with Plain Profile and all three missed Profile [QA]. Test-Path -LiteralPath $src found all six. Please consider literal paths for both source checks and for the subsequent copy, enumeration and hash operations. This test covered directory detection only. No launcher or real saves were used.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244990309 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/774#issuecomment-7244990309). Originally posted by [ANDREANIADS](https://github.com/ANDREANIADS) on 2026-11-28T20:02:27Z. --- At `7cda805`, the backup source is selected correctly, but an existing directory named `Profile [QA]` is reported missing. I exercised the source selection and existence check in `play-gta6-framegen.ps1` using PowerShell 7.4 on Linux and six empty temporary directories. The default, `VICTORY_HOME`, and `VICTORY_DATA_DIR` cases all passed with `Plain Profile` and all three missed `Profile [QA]`. `Test-Path -LiteralPath $src` found all six. Please consider literal paths for both source checks and for the subsequent copy, enumeration and hash operations. This test covered directory detection only. No launcher or real saves were used.
kibagami-nc commented 2026-11-28 20:09:33 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T20:09:33Z.


@ANDREANIADS, thanks, confirmed and fixed in 1f3fb37: play-gta6-framegen.ps1 now passes -LiteralPath everywhere a path could hold brackets:

  • the source checks, the copy, the listing and both hashes of the save backup;
  • the game-folder search too (Test-GameDir, game_dir.txt and the drive walk). A game folder named like Game [v1.0.2.1] was not found either, for the same reason.

I reran your case on Windows, on six temporary folders with one save file each: the default, VICTORY_HOME and VICTORY_DATA_DIR cases, for Plain Profile and Profile [QA]. I ran only the backup block, with its destination moved to a temporary folder, and no launcher.

Plain Profile Profile [QA]
before, PowerShell 5.1 and 7.7 backed up and checked reported missing (3 of 3 cases)
after, PowerShell 5.1 and 7.7 backed up and checked backed up and checked (3 of 3)

Test-GameDir on a folder Game [v1.0.2.1] holding the two files it looks for: False before, True after.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245078627 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/774#issuecomment-7245078627). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T20:09:33Z. --- @ANDREANIADS, thanks, confirmed and fixed in 1f3fb37: `play-gta6-framegen.ps1` now passes `-LiteralPath` everywhere a path could hold brackets: - the source checks, the copy, the listing and both hashes of the save backup; - the game-folder search too (`Test-GameDir`, `game_dir.txt` and the drive walk). A game folder named like `Game [v1.0.2.1]` was not found either, for the same reason. I reran your case on Windows, on six temporary folders with one save file each: the default, `VICTORY_HOME` and `VICTORY_DATA_DIR` cases, for `Plain Profile` and `Profile [QA]`. I ran only the backup block, with its destination moved to a temporary folder, and no launcher. | | `Plain Profile` | `Profile [QA]` | |---|---|---| | before, PowerShell 5.1 and 7.7 | backed up and checked | reported missing (3 of 3 cases) | | after, PowerShell 5.1 and 7.7 | backed up and checked | backed up and checked (3 of 3) | `Test-GameDir` on a folder `Game [v1.0.2.1]` holding the two files it looks for: `False` before, `True` after.
ANDREANIADS commented 2026-11-28 20:31:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ANDREANIADS on 2026-11-28T20:31:11Z.


One remaining mismatch in the backup block at 1f3fb37: Copy-Item -Force copied all three synthetic files (one visible file, .aux, and .nested/child), but Get-ChildItem -LiteralPath $src -Recurse -File enumerated only one for hashing. Changing the copied .aux before verification still produced “backed up and checked”. Adding -Force to that single enumeration gave three verified files on a clean copy and a failed check (1 of 3) on the changed copy. Tested with PowerShell 7.4 on Linux in temporary directories. Windows Hidden attributes still need a native check.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245344822 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/774#issuecomment-7245344822). Originally posted by [ANDREANIADS](https://github.com/ANDREANIADS) on 2026-11-28T20:31:11Z. --- One remaining mismatch in the backup block at `1f3fb37`: `Copy-Item -Force` copied all three synthetic files (one visible file, `.aux`, and `.nested/child`), but `Get-ChildItem -LiteralPath $src -Recurse -File` enumerated only one for hashing. Changing the copied `.aux` before verification still produced “backed up and checked”. Adding `-Force` to that single enumeration gave three verified files on a clean copy and a failed check (1 of 3) on the changed copy. Tested with PowerShell 7.4 on Linux in temporary directories. Windows Hidden attributes still need a native check.
kibagami-nc commented 2026-11-28 20:42:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T20:42:58Z.


@ANDREANIADS, confirmed on Windows and fixed in ad778fb6: the listing that the check hashes now has -Force.

The native check, on a data folder with one visible save, one file with the Hidden attribute, and a Hidden folder holding a file. Only the backup block ran, with its destination in a temporary folder. In each run, one copy was changed between the copy and the check:

Changed copy before (1f3fb37) after
none 3 copied, 1 checked 3 copied, 3 checked
the Hidden file "backed up and checked" check failed (1 of 3)
the file in the Hidden folder "backed up and checked" check failed (1 of 3)
the visible save check failed (1 of 1) check failed (1 of 3)

The results are the same in PowerShell 5.1 and 7.7. So Copy-Item -Recurse -Force does take hidden files and the contents of hidden folders on Windows, as on Linux, and only the check missed them.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245487766 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/774#issuecomment-7245487766). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T20:42:58Z. --- @ANDREANIADS, confirmed on Windows and fixed in ad778fb6: the listing that the check hashes now has `-Force`. The native check, on a data folder with one visible save, one file with the Hidden attribute, and a Hidden folder holding a file. Only the backup block ran, with its destination in a temporary folder. In each run, one copy was changed between the copy and the check: | Changed copy | before (1f3fb37) | after | |---|---|---| | none | 3 copied, 1 checked | 3 copied, 3 checked | | the Hidden file | "backed up and checked" | check failed (1 of 3) | | the file in the Hidden folder | "backed up and checked" | check failed (1 of 3) | | the visible save | check failed (1 of 1) | check failed (1 of 3) | The results are the same in PowerShell 5.1 and 7.7. So `Copy-Item -Recurse -Force` does take hidden files and the contents of hidden folders on Windows, as on Linux, and only the check missed them.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!774
No description provided.