run.sh: update automatically before every run (AUTO_UPDATE) #210

Open
github-bot wants to merge 2 commits from github-bot/gh-210 into main AGit
Owner

@⁠PedroRBC on GitHub · 2026-12-02 16:49 UTC · original
PedroRBC:feat/auto-update → main · +125 −0 · 4 files · 2 commits · open

Why

From the Discord:

SwanSong (7800xt/i9 19000kf): BTW lobo
Is there a good way to update xmem that doesnt involve a complete redownload?

There is now. You never have to download it all again, and you don't need to know any git.

For players: what changes for you

Nothing to learn. Keep starting the game the way you do now:

./run.sh play

Before each run, it now:

  1. Checks whether there is a new version.
  2. Downloads only what changed if there is one, and shows a short list of the changes.
  3. Rebuilds whatever needs rebuilding. This happens once per update and can take a few minutes. Your Mesa/vkd3d builds and shader caches are reused.
  4. Starts the game.

You don't need git pull, and you don't have to re-run ./setup.sh after an update.

Getting this update itself (only once)

  • You got the project with git clone: open a terminal in the project folder and run git pull, once. After that, every update installs itself.
  • You downloaded a zip: a zip can't update itself. Do one last fresh download with git clone https://github.com/lobomfz/VIctory-xmem, copy your run.conf and your local/ folder into it, and run ./setup.sh. That's the last full download you'll need.

What you might see

Message What it means What to do
Up to date. You already have the latest version Nothing
Downloading N new change(s) Updating Wait. The game opens afterwards
Could not reach origin (offline?) No internet Nothing. The game starts with the version you have
files here were changed by hand You edited a project file Run git checkout -- . to throw your edits away and update, or leave it as it is
has commits of its own You made your own commits (you know git) Run git pull yourself
Not a git clone (downloaded as a zip?) A zip download can't update See "You downloaded a zip" above
The new version did not build The build failed The game starts with your old version, and the next run tries again. Log: local/update-build.log

To turn updates off, put AUTO_UPDATE=0 in run.conf, or switch it off in the in-game menu (F1).

Your run.conf, saves and caches (local/) are never touched.

For reviewers

  • New tools/update.sh, which run.sh calls after it validates the mode. It does a fetch with a 20 s timeout and no credential prompt, then a fast-forward only merge, and only on a branch that tracks a remote and has no tracked changes. Detached HEAD, commits that are only local, a dirty tree, a zip download or being offline mean it skips the update and says why.
  • What gets rebuilt depends on which files changed:
    • setup.sh, env.sh or patches/ → the full setup.sh (plus fsr4 if that was installed).
    • crates/, xtask/, Cargo files or build.sh → setup.sh victory.
    • The pending step is kept in local/update-pending, so a failed build is retried on the next run. If deps/ doesn't exist, it skips the build, and run.sh still tells the user to run setup.
  • After an update, run.sh restarts itself (exec) so the new files are used. UPDATE_CHECKED=1 is exported so it can't loop, and the in-game menu's restart doesn't check again.
  • The AUTO_UPDATE setting is in run.conf.default, so it shows up in the menu. Order of precedence is run.conf < menu.conf < command line, the same as in run.sh. There's also a README row and paragraph.

Tested

In throwaway clones with a local bare remote and a stub setup.sh: up to date (exit 0); behind with a crate change (fast-forwards, rebuilds victory, exit 3); behind with a patch change (full rebuild); dirty tree; local commits; offline; detached HEAD; AUTO_UPDATE=0 from the argument and from menu.conf. All skip cases exit without touching the tree. I have not tested a real game run with a real rebuild.

🤖 Generated with Claude Code

**@⁠PedroRBC** on GitHub · 2026-12-02 16:49 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/210) `PedroRBC:feat/auto-update` → `main` · +125 −0 · 4 files · 2 commits · open ## Why From the Discord: > **SwanSong (7800xt/i9 19000kf):** BTW lobo > Is there a good way to update xmem that doesnt involve a complete redownload? There is now. You never have to download it all again, and you don't need to know any git. ## For players: what changes for you **Nothing to learn.** Keep starting the game the way you do now: ```sh ./run.sh play ``` Before each run, it now: 1. Checks whether there is a new version. 2. Downloads **only what changed** if there is one, and shows a short list of the changes. 3. Rebuilds whatever needs rebuilding. This happens once per update and can take a few minutes. Your Mesa/vkd3d builds and shader caches are reused. 4. Starts the game. You don't need `git pull`, and you don't have to re-run `./setup.sh` after an update. ### Getting this update itself (only once) - **You got the project with `git clone`:** open a terminal in the project folder and run `git pull`, once. After that, every update installs itself. - **You downloaded a zip:** a zip can't update itself. Do one last fresh download with `git clone https://github.com/lobomfz/VIctory-xmem`, copy your `run.conf` and your `local/` folder into it, and run `./setup.sh`. That's the last full download you'll need. ### What you might see | Message | What it means | What to do | |---|---|---| | `Up to date.` | You already have the latest version | Nothing | | `Downloading N new change(s)` | Updating | Wait. The game opens afterwards | | `Could not reach origin (offline?)` | No internet | Nothing. The game starts with the version you have | | `files here were changed by hand` | You edited a project file | Run `git checkout -- .` to throw your edits away and update, or leave it as it is | | `has commits of its own` | You made your own commits (you know git) | Run `git pull` yourself | | `Not a git clone (downloaded as a zip?)` | A zip download can't update | See "You downloaded a zip" above | | `The new version did not build` | The build failed | The game starts with your old version, and the next run tries again. Log: `local/update-build.log` | To turn updates off, put `AUTO_UPDATE=0` in `run.conf`, or switch it off in the in-game menu (F1). Your `run.conf`, saves and caches (`local/`) are never touched. ## For reviewers - New `tools/update.sh`, which `run.sh` calls after it validates the mode. It does a fetch with a 20 s timeout and no credential prompt, then a **fast-forward only** merge, and only on a branch that tracks a remote and has no tracked changes. Detached HEAD, commits that are only local, a dirty tree, a zip download or being offline mean it skips the update and says why. - What gets rebuilt depends on which files changed: - `setup.sh`, `env.sh` or `patches/` → the full `setup.sh` (plus `fsr4` if that was installed). - `crates/`, `xtask/`, Cargo files or `build.sh` → `setup.sh victory`. - The pending step is kept in `local/update-pending`, so a failed build is retried on the next run. If `deps/` doesn't exist, it skips the build, and `run.sh` still tells the user to run setup. - After an update, `run.sh` restarts itself (`exec`) so the new files are used. `UPDATE_CHECKED=1` is exported so it can't loop, and the in-game menu's restart doesn't check again. - The `AUTO_UPDATE` setting is in `run.conf.default`, so it shows up in the menu. Order of precedence is run.conf < menu.conf < command line, the same as in run.sh. There's also a README row and paragraph. ### Tested In throwaway clones with a local bare remote and a stub `setup.sh`: up to date (exit 0); behind with a crate change (fast-forwards, rebuilds `victory`, exit 3); behind with a patch change (full rebuild); dirty tree; local commits; offline; detached HEAD; `AUTO_UPDATE=0` from the argument and from menu.conf. All skip cases exit without touching the tree. I have not tested a real game run with a real rebuild. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tools/update.sh fetches, fast-forwards a clean clone, rebuilds what changed
(victory, or the drivers when setup.sh, env.sh or a patch changed) and
run.sh starts again with the new files. Local changes, own commits, other
branches and offline runs are left alone. AUTO_UPDATE=0 turns it off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 18:55:44 +00:00
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:01 UTC · original

No, and I do not think this is worth keeping, for one reason above the rest: it puts a network fetch, a git merge and a multi-minute rebuild before the game starts, on every launch, by default (run.conf.default:109-112), and it mutates the checkout outside local/ on its own — the one thing the project's layout promises it will not do.

Two more:

  • Version skew is silent. If the merge succeeds and the rebuild fails or is interrupted, the tree is new and the binary is old; the next run sees no new commits, says "up to date", and starts a binary that does not match its own source. Nothing prints which version is running, so the bug report describes code that did not run.
  • ./update.sh already does the fetch, merge, save backup and build, explicitly, when the user chooses. A second hidden copy in run.sh will drift.
  • The AUTO_UPDATE block in run.conf.default also lacks the # label:/# choices: lines the rest of the file uses, so the F1 menu shows an unnamed row.

The version worth having is a one-line "N commits behind, run ./update.sh" notice at startup, with no merge and no build in the launch path.

**@⁠Luxuride** on GitHub · 2026-12-04 12:01 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/210#issuecomment-7410867549) No, and I do not think this is worth keeping, for one reason above the rest: it puts a network fetch, a `git merge` and a multi-minute rebuild *before the game starts*, on every launch, by default (`run.conf.default:109-112`), and it mutates the checkout outside `local/` on its own — the one thing the project's layout promises it will not do. Two more: - Version skew is silent. If the merge succeeds and the rebuild fails or is interrupted, the tree is new and the binary is old; the next run sees no new commits, says "up to date", and starts a binary that does not match its own source. Nothing prints which version is running, so the bug report describes code that did not run. - `./update.sh` already does the fetch, merge, save backup and build, explicitly, when the user chooses. A second hidden copy in `run.sh` will drift. - The `AUTO_UPDATE` block in `run.conf.default` also lacks the `# label:`/`# choices:` lines the rest of the file uses, so the F1 menu shows an unnamed row. The version worth having is a one-line "N commits behind, run ./update.sh" notice at startup, with no merge and no build in the launch path.
This pull request has changes conflicting with the target branch.
  • README.md
  • run.conf.default
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/210/head:github-bot/gh-210'
git switch 'github-bot/gh-210'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-210'
git switch 'github-bot/gh-210'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-210'
git switch 'github-bot/gh-210'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-210'
git switch 'main'
git merge --squash 'github-bot/gh-210'
git switch 'main'
git merge --ff-only 'github-bot/gh-210'
git switch 'main'
git merge 'github-bot/gh-210'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.