From 95a1dc1183b9b84e1d7981411e2583bb58f385c1 Mon Sep 17 00:00:00 2001 From: Bushyon <43689053+Bushyon@users.noreply.github.com> Date: Wed, 2 Dec 2026 20:50:38 -0300 Subject: [PATCH] presets: the preset files in presets/ run..conf becomes presets/.conf; run.sh, the menu and the docs follow. VICTORY_PRESET is used as before. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 2 +- crates/victory-core/src/menu.rs | 16 +++++++++++----- run.high.conf => presets/high.conf | 0 run.low.conf => presets/low.conf | 0 run.medium.conf => presets/medium.conf | 0 run.potato.conf => presets/potato.conf | 0 run.ultra.conf => presets/ultra.conf | 0 run.conf.default | 2 +- run.sh | 6 +++--- 9 files changed, 16 insertions(+), 10 deletions(-) rename run.high.conf => presets/high.conf (100%) rename run.low.conf => presets/low.conf (100%) rename run.medium.conf => presets/medium.conf (100%) rename run.potato.conf => presets/potato.conf (100%) rename run.ultra.conf => presets/ultra.conf (100%) diff --git a/README.md b/README.md index 053d7243..7ecf60d1 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ shell line before `run.sh` are cleared; put them after the mode instead: ## Presets `VICTORY_PRESET=potato|low|medium|high|ultra` applies one of the presets in -`run..conf`. The F1 menu lists the same five. Settings in `run.conf`, +`presets/.conf`. The F1 menu lists the same five. Settings in `run.conf`, `local/menu.conf` or after the mode on the command line override the preset: ```bash diff --git a/crates/victory-core/src/menu.rs b/crates/victory-core/src/menu.rs index a27c08fd..bc7114de 100644 --- a/crates/victory-core/src/menu.rs +++ b/crates/victory-core/src/menu.rs @@ -147,7 +147,7 @@ pub fn enabled() -> bool { pub struct Menu { pub settings: Vec, values: Vec>, - /// `run..conf` values, by preset name. + /// `presets/.conf` values, by preset name. presets: Vec<(String, Vec<(String, String)>)>, /// Settings the game turned off at this start, and why. pub attention: Vec<(String, String)>, @@ -349,7 +349,7 @@ impl Menu { } } -/// Reads `run..conf` next to `run.conf.default` for each choice of +/// Reads `presets/.conf` next to `run.conf.default` for each choice of /// `VICTORY_PRESET`. fn load_presets(defs: &Path, settings: &[Setting]) -> Vec<(String, Vec<(String, String)>)> { let Some(choice) = settings.iter().find(|s| s.name == "VICTORY_PRESET") else { @@ -360,7 +360,8 @@ fn load_presets(defs: &Path, settings: &[Setting]) -> Vec<(String, Vec<(String, .choices .iter() .filter_map(|name| { - let text = std::fs::read_to_string(dir.join(format!("run.{name}.conf"))).ok()?; + let text = + std::fs::read_to_string(dir.join("presets").join(format!("{name}.conf"))).ok()?; Some((name.clone(), parse(settings, &text))) }) .collect() @@ -457,12 +458,17 @@ mod tests { let dir = tempfile::tempdir().unwrap(); let defs = dir.path().join("run.conf.default"); std::fs::write(&defs, PRESETS).unwrap(); + std::fs::create_dir(dir.path().join("presets")).unwrap(); std::fs::write( - dir.path().join("run.potato.conf"), + dir.path().join("presets/potato.conf"), "VICTORY_LOD_SCALE=0.05\nVICTORY_SMALL_CULL=16.0\n", ) .unwrap(); - std::fs::write(dir.path().join("run.low.conf"), "VICTORY_LOD_SCALE=0.1\n").unwrap(); + std::fs::write( + dir.path().join("presets/low.conf"), + "VICTORY_LOD_SCALE=0.1\n", + ) + .unwrap(); let settings = parse_defs(PRESETS); let presets = load_presets(&defs, &settings); assert_eq!(presets.len(), 2); diff --git a/run.high.conf b/presets/high.conf similarity index 100% rename from run.high.conf rename to presets/high.conf diff --git a/run.low.conf b/presets/low.conf similarity index 100% rename from run.low.conf rename to presets/low.conf diff --git a/run.medium.conf b/presets/medium.conf similarity index 100% rename from run.medium.conf rename to presets/medium.conf diff --git a/run.potato.conf b/presets/potato.conf similarity index 100% rename from run.potato.conf rename to presets/potato.conf diff --git a/run.ultra.conf b/presets/ultra.conf similarity index 100% rename from run.ultra.conf rename to presets/ultra.conf diff --git a/run.conf.default b/run.conf.default index 8d3aa8af..812bb88d 100644 --- a/run.conf.default +++ b/run.conf.default @@ -29,7 +29,7 @@ VICTORY_KBM_PC= VICTORY_FRAME_INTERVAL_MS= # Settings preset: potato, low, medium, high or ultra. Rows below override it; -# changing the preset resets the preset's rows. See run..conf. +# changing the preset resets the preset's rows. See presets/.conf. # choices: potato|low|medium|high|ultra VICTORY_PRESET= diff --git a/run.sh b/run.sh index 0713a0b1..42977654 100755 --- a/run.sh +++ b/run.sh @@ -57,13 +57,13 @@ for kv in "$@"; do case "$kv" in VICTORY_PRESET=*) preset=${kv#VICTORY_PRESET=}; case "$preset" in "") ;; potato|low|medium|high|ultra) - if [ -f "$root/run.$preset.conf" ]; then + if [ -f "$root/presets/$preset.conf" ]; then set -a - source "$root/run.$preset.conf" + source "$root/presets/$preset.conf" set +a echo "preset: $preset" else - echo "warning: preset '$preset' has no run.$preset.conf" >&2 + echo "warning: preset '$preset' has no presets/$preset.conf" >&2 fi ;; *) echo "warning: unknown preset '$preset' (potato, low, medium, high, ultra)" >&2;;