WIP: [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) #140

Draft
Jesper-A wants to merge 1 commit from Jesper-A/Darner:up-preload-resume into main
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

Refs #128 (step 1 of the plan in that issue: "a partial mark or remaining count").

Today a preload that is stopped early (Play now, Quit, or a preload process that fails) leaves no trace. The next start opens the window again with no hint of how far the last one got.

New switch DARNER_PRELOAD_RESUME=1, off by default. With it on:

  • A preload that stops early writes warmed/<hash>.partial beside the usual mark (temporary file, then rename). It holds the step, the count done, the count of the step, and whether the preload's last line ("N of N in the pipeline library in S s") was seen.
  • At the next start, a record that saw that last line writes the done mark and opens no window.
  • Any other whole record opens the window, and its step line says "resuming: N files were left" or "resuming: N pipelines were left" (or "resuming an earlier preload" when no count is known). English and zh-CN strings are added.
  • A half-written or unreadable record counts for nothing. No record, or the switch off: the start behaves as today. A preload that finishes normally removes the record.

Honest limits:

  • The record is a hint taken from the preload's own lines, not a recount of what is still unmade. A step whose count is complete still has the steps after it, so no count is claimed then.
  • Skipping the window happens only when the stop came after the library was saved. So the main value is honest progress text.
  • It does not make a resumed run shorter. Other steps in #128 do that (skip shader files an earlier run finished, keep the done marks across translator changes, marks without the exe path). They are separate PRs.
  • A later PR that weights the time left (blazecoding2009's point 2 on #128) would touch the same apps/darner/src/preload_ui.rs code.

Files: apps/darner/src/preload_resume.rs (new), preload_ui.rs, play.rs, main.rs, locales/en.json, locales/zh-CN.json, a README table row, a docs/findings.md note.

How it was tested

  • Tested revision: a948451a4 (one commit on 57dea7f23, current main when written).
  • Commands and results (cargo, this commit):
    • cargo test --locked -p darner --bin darner preload: 11 passed, 1 ignored (a window demo).
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
    • cargo xtask policy: ok.
  • Not run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, and cargo test --workspace --locked (full). There is no CI upstream, so nothing else has checked this.
  • Gameplay: none. No game run.
  • Before and after: none.
  • Shader wave sizes: not relevant.
  • Coverage gaps:
    • Not run in a game: whether the record is written on a real Play now, Quit and failed child.
    • Window text width is not checked, especially zh-CN.
    • A start with the record present has only been tested by unit tests (a_record_that_saw_the_end_writes_the_mark_and_another_opens_the_window).
    • When a record says the library was saved, the start still prints the "preload incomplete" hint before preload_needed decides (play.rs ~2556); not tested, may print once needlessly.
    • Not checked on other PCs.

Spec dependence

Likely general: the change is in the launcher and the preload window, with no GPU dependence. Untested in the game on any hardware.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for the same problem. Open PRs that touch apps/darner/src/play.rs (so a rebase may be needed): #132, #130, #80, #75, #59, #36, #16, #12, #9; locales/en.json: #80, #75, #47. Related issue: #128.

Drafted with AI assistance (Claude Code).

<!-- Refs #128 (partial change, not a full fix). Draft: WIP until tested in a game. --> ## Contributor role (optional) - Fluxer ID: ## What it changes Refs #128 (step 1 of the plan in that issue: "a partial mark or remaining count"). Today a preload that is stopped early (**Play now**, **Quit**, or a preload process that fails) leaves no trace. The next start opens the window again with no hint of how far the last one got. New switch `DARNER_PRELOAD_RESUME=1`, **off by default**. With it on: - A preload that stops early writes `warmed/<hash>.partial` beside the usual mark (temporary file, then rename). It holds the step, the count done, the count of the step, and whether the preload's last line ("N of N in the pipeline library in S s") was seen. - At the next start, a record that saw that last line writes the done mark and opens no window. - Any other whole record opens the window, and its step line says "resuming: N files were left" or "resuming: N pipelines were left" (or "resuming an earlier preload" when no count is known). English and zh-CN strings are added. - A half-written or unreadable record counts for nothing. No record, or the switch off: the start behaves as today. A preload that finishes normally removes the record. Honest limits: - The record is a hint taken from the preload's own lines, not a recount of what is still unmade. A step whose count is complete still has the steps after it, so no count is claimed then. - Skipping the window happens only when the stop came after the library was saved. So the main value is honest progress text. - **It does not make a resumed run shorter.** Other steps in #128 do that (skip shader files an earlier run finished, keep the done marks across translator changes, marks without the exe path). They are separate PRs. - A later PR that weights the time left (blazecoding2009's point 2 on #128) would touch the same `apps/darner/src/preload_ui.rs` code. Files: `apps/darner/src/preload_resume.rs` (new), `preload_ui.rs`, `play.rs`, `main.rs`, `locales/en.json`, `locales/zh-CN.json`, a README table row, a `docs/findings.md` note. ## How it was tested - Tested revision: `a948451a4` (one commit on `57dea7f23`, current `main` when written). - Commands and results (cargo, this commit): - `cargo test --locked -p darner --bin darner preload`: 11 passed, 1 ignored (a window demo). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo xtask policy`: ok. - Not run: `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, and `cargo test --workspace --locked` (full). There is no CI upstream, so nothing else has checked this. - Gameplay: **none.** No game run. - Before and after: none. - Shader wave sizes: not relevant. - Coverage gaps: - Not run in a game: whether the record is written on a real Play now, Quit and failed child. - Window text width is not checked, especially zh-CN. - A start with the record present has only been tested by unit tests (`a_record_that_saw_the_end_writes_the_mark_and_another_opens_the_window`). - When a record says the library was saved, the start still prints the "preload incomplete" hint before `preload_needed` decides (`play.rs` ~2556); not tested, may print once needlessly. - Not checked on other PCs. ## Spec dependence Likely general: the change is in the launcher and the preload window, with no GPU dependence. Untested in the game on any hardware. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for the same problem. Open PRs that touch `apps/darner/src/play.rs` (so a rebase may be needed): #132, #130, #80, #75, #59, #36, #16, #12, #9; `locales/en.json`: #80, #75, #47. Related issue: #128. Drafted with AI assistance (Claude Code).
Play now, Quit or a failed preload process left no trace, so the next start
opened the window again with no hint of how far the last one got. With the
switch on, such a stop writes warmed/<hash>.partial (temp file, then rename):
step, count done, count of the step, and whether the last line (library
saved) was seen. The next start's window says how many files or pipelines
were left; a record that saw the library saved writes the mark and opens no
window. No record, or the switch off: as before.

Refs #128

This change was made with AI assistance (Claude Code).
Jesper-A changed title from [pr-feature][startup] WIP: Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) to WIP: [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) 2026-12-03 23:04:57 +00:00
Jesper-A changed title from WIP: [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) to [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) 2026-12-04 00:20:13 +00:00
Jesper-A changed title from [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) to WIP: [pr-feature][startup] Preload window: remember an unfinished preload and say what is left (DARNER_PRELOAD_RESUME, off by default) 2026-12-04 02:24:37 +00:00
Owner

Second-opinion review: no bug found. Only a record that saw the final library save line skips the window, preload_needed still falls through to the empty-library check, records go through temp file + rename, and a partial record is ignored. It has unit tests only, so hold until it has been run in game (a preload stopped with Play now and Quit, then the next start). Merging it after #153 and #184 resolves the play.rs and preload_ui.rs conflicts once.

Second-opinion review: no bug found. Only a record that saw the final library save line skips the window, `preload_needed` still falls through to the empty-library check, records go through temp file + rename, and a partial record is ignored. It has unit tests only, so hold until it has been run in game (a preload stopped with Play now and Quit, then the next start). Merging it after #153 and #184 resolves the play.rs and preload_ui.rs conflicts once.
First-time contributor

Both requested interruption paths passed on the unmodified PR head a948451a4593 (Windows 11 build 28000, i5-13600KF, RTX 4070 Ti SUPER, driver 617.14). I built the release executable with locked dependencies and used the actual preload window.

  1. With DARNER_PRELOAD_RESUME=1, I clicked Quit at 28/35 shader files. Darner exited normally before gameplay. The saved record read step=1, done=28, total=35, finished=0.
  2. Starting again with the same profile showed “resuming: 7 files were left”. I clicked Play now. The game reached its first world frame and exited normally using the timed in-game exit. The record was rewritten at this interruption and still showed 28/35.
  3. The next launch again displayed “resuming: 7 files were left”, already visible while the window said “Getting started”.
  4. As a control, I clicked Quit at 28/35 with the switch set to 0 in a fresh profile. That process exited normally and created no partial record.

This covers the two buttons and the English file-count hint on the submitted head. The failed-child path, completed-library shortcut and Chinese layout remain untested here.

Both requested interruption paths passed on the unmodified PR head `a948451a4593` (Windows 11 build 28000, i5-13600KF, RTX 4070 Ti SUPER, driver 617.14). I built the release executable with locked dependencies and used the actual preload window. 1. With `DARNER_PRELOAD_RESUME=1`, I clicked **Quit** at 28/35 shader files. Darner exited normally before gameplay. The saved record read `step=1, done=28, total=35, finished=0`. 2. Starting again with the same profile showed **“resuming: 7 files were left”**. I clicked **Play now**. The game reached its first world frame and exited normally using the timed in-game exit. The record was rewritten at this interruption and still showed 28/35. 3. The next launch again displayed **“resuming: 7 files were left”**, already visible while the window said “Getting started”. 4. As a control, I clicked **Quit** at 28/35 with the switch set to `0` in a fresh profile. That process exited normally and created no partial record. This covers the two buttons and the English file-count hint on the submitted head. The failed-child path, completed-library shortcut and Chinese layout remain untested here.
Author
Contributor

This is the first in-game run of this PR, thanks @akimfomin.

On the unmodified head a948451a4, it settles two items: the record is written on a real Quit and a real Play now, and the next start shows "resuming: 7 files were left" (28 of 35) both times. That meets the maintainer's hold condition (a preload stopped with Play now and Quit, then the next start) for the English file-count text. Your control with the switch set to 0 wrote no record.

Still open: a preload process that fails, the shortcut for a record that saw the library saved, the zh-CN window text width, and the extra "preload incomplete" line printed before preload_needed decides. None of these were part of your run.

Drafted with AI assistance (Claude Code).

This is the first in-game run of this PR, thanks @akimfomin. On the unmodified head a948451a4, it settles two items: the record is written on a real **Quit** and a real **Play now**, and the next start shows "resuming: 7 files were left" (28 of 35) both times. That meets the maintainer's hold condition (a preload stopped with Play now and Quit, then the next start) for the English file-count text. Your control with the switch set to 0 wrote no record. Still open: a preload process that fails, the shortcut for a record that saw the library saved, the zh-CN window text width, and the extra "preload incomplete" line printed before `preload_needed` decides. None of these were part of your run. Drafted with AI assistance (Claude Code).
This pull request has changes conflicting with the target branch.
  • apps/darner/src/preload_ui.rs
  • docs/findings.md
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 'up-preload-resume:Jesper-A-up-preload-resume'
git switch 'Jesper-A-up-preload-resume'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'Jesper-A-up-preload-resume'
git switch 'Jesper-A-up-preload-resume'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Jesper-A-up-preload-resume'
git switch 'Jesper-A-up-preload-resume'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Jesper-A-up-preload-resume'
git switch 'main'
git merge --squash 'Jesper-A-up-preload-resume'
git switch 'main'
git merge --ff-only 'Jesper-A-up-preload-resume'
git switch 'main'
git merge 'Jesper-A-up-preload-resume'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!140
No description provided.