From 761de52baf876fc4c29ad73432f60f0a5e8ac9df Mon Sep 17 00:00:00 2001 From: fromrivertothesea <345018979+fromrivertothesea@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:50:09 +0100 Subject: [PATCH] preload: --jobs / VICTORY_PRELOAD_JOBS to leave the rest of the PC free The preload passed no thread count to any of its three steps, so it took every core to translate and two thirds of them to make pipelines, with no way to play or work beside it. `victory preload --jobs N` (or the switch VICTORY_PRELOAD_JOBS=N, which the launcher's -More and the F1 menu's restart carry) now gives each step N threads or processes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FsQtBz4aDhUTip3jBagKEX (cherry picked from commit 3692a28bd7e561abd133495873543150f389aad8) --- apps/victory/src/main.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/victory/src/main.rs b/apps/victory/src/main.rs index f14d755..1b7ca05 100644 --- a/apps/victory/src/main.rs +++ b/apps/victory/src/main.rs @@ -300,6 +300,11 @@ enum Command { Preload { /// The title's folder (default: the configured game folder). paths: Vec, + /// Threads and processes for each of its steps, to leave the rest of + /// the PC free (default: `VICTORY_PRELOAD_JOBS`, else each step's + /// own: every core to translate, two thirds of them to make). + #[arg(long)] + jobs: Option, }, /// Play: the title with this fork's settings, as a start with no /// command at all does (a double click on the program beside the @@ -475,11 +480,18 @@ fn main() -> Result<()> { #[cfg(windows)] Command::Warm { jobs, limit, again, used, these } => warm::run(jobs, limit, again, used, these), #[cfg(windows)] - Command::Preload { paths } => { + Command::Preload { paths, jobs } => { + // The launcher and the F1 menu's restart pass it as a switch. + let jobs = jobs + .or_else(|| std::env::var("VICTORY_PRELOAD_JOBS").ok()?.trim().parse().ok()) + .filter(|&n| n > 0); + if let Some(n) = jobs { + println!("Preloading on {n} threads at a time (VICTORY_PRELOAD_JOBS / --jobs)."); + } play::explain_preload(); - translate::precompile(paths, None)?; - warm::run(None, None, false, false, None)?; - warm::into_library(None) + translate::precompile(paths, jobs)?; + warm::run(jobs, None, false, false, None)?; + warm::into_library(jobs) } #[cfg(windows)] Command::Play(_) => unreachable!("handled above"),