Launcher : reprendre sa partie au démarrage, bouton Jouer par sauvegarde

- case « Reprendre ma partie » à côté de « Passer l'intro » : la dernière jouée
  par défaut, ou une autre au choix (liste avec miniature) ; la partie chargée
  est affichée sous JOUER
- carte Sauvegardes : bouton Jouer sur chaque partie
- passe --sans-intro --charger N au jeu, seulement si le tucker.exe compilé
  connaît --charger (sinon message clair, lancement normal)
- guide FR/EN et feuille de route

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
linkatplugandClaude Opus 5.5 committed 2026-12-05 06:41:56 +01:00
1 parent 83e60d38ba
commit d9882d0ba2
5 files changed
+155 -6

No files matched your search

+10 -1
View File
@@ -151,6 +151,9 @@ time.
<p align="center"><img src="images/launcher-en-carte-jouer.jpg" alt="Ready to play card" width="900"></p>
- **Sound**, **Skip intro**, **Verbose log**: launch options.
- **Resume my game**: starts straight on a saved game, skipping the intro and the game menu. The last
one played by default; the list below lets you pick another one (with its thumbnail), and the
launcher shows under **PLAY** which game will be loaded.
- **Display**: full screen, filter, 4:3 format, vertical sync, window size.
- **Volume**: master, music, voices, sound effects.
- **PLAY** starts the game. The launcher stays open and refreshes when you quit.
@@ -207,6 +210,7 @@ Main options (the option names are French; full list in [SETTINGS.md](SETTINGS.m
| `--saves FOLDER` | saved games folder (default: `saves`) |
| `--son` | enables sound |
| `--sans-intro` / `--intro` | skips the intro / plays only the intro |
| `--charger N` | starts on save `SAVEGM.N` (depending on the engine version, see section 11) |
| `--plein`, `--fenetre`, `--echelle N` | full screen, window, ×N size |
| `--filtre nearest\|smooth\|xbr\|crt` | picture filter |
| `--sans-mods`, `--sans-hd` | no mods, no HD backgrounds |
@@ -334,7 +338,12 @@ It also lets you:
- **delete** a game: a copy is kept, and later games are renumbered the way the game expects;
- make a **backup** of all games (`saves\backups\`);
- **restore** a backup: the current saves are copied first;
- **open the folder**.
- **open the folder**;
- **play** a game: the yellow button starts the game straight on that save.
Loading at startup (that button and **Resume my game**) needs an engine that knows the `--charger`
option: if the compiled game is older, the launcher says so; just rebuild it after updating the
project.
These actions are locked while the game runs. To keep your games, back up the `saves\` folder.
+10 -1
View File
@@ -156,6 +156,9 @@ Cliquez alors sur **Replier la configuration** (en bas à droite) : la page prin
<p align="center"><img src="images/launcher-fr-carte-jouer.jpg" alt="Carte Prêt à jouer" width="900"></p>
- **Son**, **Passer l'intro**, **Journal détaillé** : options du lancement.
- **Reprendre ma partie** : démarre directement sur une sauvegarde, sans l'intro ni le menu du jeu.
Par défaut la dernière jouée ; la liste en dessous permet d'en choisir une autre (avec sa
miniature), et le launcher affiche sous **JOUER** la partie qui sera chargée.
- **Affichage** : plein écran, filtre, format 4:3, synchronisation verticale, taille de la fenêtre.
- **Volumes** : général, musique, voix, bruitages.
- **JOUER** lance le jeu. Le launcher reste ouvert et se met à jour quand vous quittez la partie.
@@ -212,6 +215,7 @@ Options principales (liste complète dans [SETTINGS.md](SETTINGS.md)) :
| `--saves DOSSIER` | dossier des sauvegardes (défaut : `saves`) |
| `--son` | active le son |
| `--sans-intro` / `--intro` | saute l'intro / ne joue que l'intro |
| `--charger N` | démarre sur la sauvegarde `SAVEGM.N` (selon la version du moteur, voir section 11) |
| `--plein`, `--fenetre`, `--echelle N` | plein écran, fenêtre, taille ×N |
| `--filtre nearest\|smooth\|xbr\|crt` | filtre d'image |
| `--sans-mods`, `--sans-hd` | sans mods, sans décors HD |
@@ -342,7 +346,12 @@ Elle permet aussi de :
le jeu les attend ;
- créer une **copie de sécurité** de toutes les parties (`saves\backups\`) ;
- **restaurer** une copie : les sauvegardes du moment sont elles-mêmes copiées avant ;
- **ouvrir le dossier**.
- **ouvrir le dossier** ;
- **jouer** une partie : le bouton jaune lance le jeu directement sur cette sauvegarde.
Le chargement au démarrage (ce bouton et **Reprendre ma partie**) demande un moteur qui connaît
l'option `--charger` : si le jeu compilé est plus ancien, le launcher le signale, et il suffit de le
recompiler après la mise à jour du projet.
Ces actions sont bloquées pendant que le jeu tourne. Pour garder vos parties, sauvegardez le
dossier `saves\`.
+2
View File
@@ -59,6 +59,8 @@ INTRO.EXE stays local (`build/`). Mods replace files at runtime, never touching
- [ ] Show hotspots while holding Space
- [ ] Double-click an exit to change location instantly
- [ ] Skip dialogue lines with a click; speed up Bud's walking
- [ ] Start on a saved game (`--charger N`): launcher ready ("Resume my game", a Play button per
save); the engine option is still to do
- [ ] Autosave; unlimited save slots with thumbnails
- [ ] Gamepad: joystick cursor, verb wheel
- [ ] Always-on subtitles
+2
View File
@@ -62,6 +62,8 @@ jamais modifier les originaux.
- [ ] Afficher les zones cliquables en maintenant Espace
- [ ] Double-clic sur une sortie pour changer de lieu instantanément
- [ ] Passer les dialogues au clic ; accélérer les déplacements de Bud
- [ ] Démarrer sur une sauvegarde (`--charger N`) : launcher prêt (« Reprendre ma partie », bouton
Jouer par sauvegarde) ; reste l'option dans le moteur
- [ ] Sauvegarde automatique ; emplacements illimités avec miniature
- [ ] Manette : curseur au joystick, roue des verbes
- [ ] Sous-titres toujours affichés
+131 -4
View File
@@ -48,6 +48,10 @@ struct Config {
install_dir: String,
sound: bool,
skip_intro: bool,
/// démarrer directement sur une sauvegarde (--charger N)
resume: bool,
/// sauvegarde choisie ; 0 = la dernière jouée
resume_slot: u32,
verbose: bool,
/// taille de la fenêtre (points), retenue d'une fois sur l'autre ; 0 = taille par défaut
win_w: u32,
@@ -63,6 +67,8 @@ impl Default for Config {
install_dir: String::new(),
sound: true,
skip_intro: false,
resume: false,
resume_slot: 0,
verbose: false,
win_w: 0,
win_h: 0,
@@ -89,6 +95,8 @@ impl Config {
"install_dir" => c.install_dir = v.to_string(),
"sound" => c.sound = b,
"skip_intro" => c.skip_intro = b,
"resume" => c.resume = b,
"resume_slot" => c.resume_slot = v.parse().unwrap_or(0),
"verbose" => c.verbose = b,
"window_width" => c.win_w = v.parse().unwrap_or(0),
"window_height" => c.win_h = v.parse().unwrap_or(0),
@@ -106,13 +114,15 @@ impl Config {
}
let b = |x: bool| if x { "1" } else { "0" };
let text = format!(
"lang={}\ngame_path={}\ninstall_dir={}\nsound={}\nskip_intro={}\nverbose={}\n\
"lang={}\ngame_path={}\ninstall_dir={}\nsound={}\nskip_intro={}\nresume={}\nresume_slot={}\nverbose={}\n\
window_width={}\nwindow_height={}\nmaximized={}\n",
if self.lang == Lang::En { "en" } else { "fr" },
self.game_path,
self.install_dir,
b(self.sound),
b(self.skip_intro),
b(self.resume),
self.resume_slot,
b(self.verbose),
self.win_w,
self.win_h,
@@ -135,6 +145,8 @@ struct Checks {
game_dir: Option<PathBuf>,
game_error: Option<String>,
built: bool,
/// tucker.exe accepte --charger N (moteur assez récent)
can_load: bool,
}
impl Checks {
@@ -260,9 +272,15 @@ fn run_checks(root: &Path, cfg: &Config) -> Checks {
game_dir,
game_error,
built: root.join("build").join("tucker.exe").is_file(),
can_load: engine_can_load(&root.join("build").join("tucker.exe")),
}
}
/// le moteur annonce l'option --charger dans son aide : on la cherche dans l'exécutable
fn engine_can_load(exe: &Path) -> bool {
std::fs::read(exe).is_ok_and(|b| b.windows(10).any(|w| w == b"--charger "))
}
// ------------------------------------------------------------------ tâches de fond
enum Msg {
@@ -527,6 +545,7 @@ enum SaveAct {
AskRestore(PathBuf),
Restore(PathBuf),
OpenFolder,
Play(u32),
}
// heure locale : décalage du fuseau Windows (bias, en minutes, UTC = local + bias)
@@ -994,6 +1013,10 @@ impl App {
saves::open_folder(&dir);
return;
}
SaveAct::Play(s) => {
self.play_slot(Some(s));
return;
}
SaveAct::Delete(s) => saves::delete(&dir, s).map(|_| {
if en { format!("Save {s} removed (a copy was kept in backups).") }
else { format!("Partie {s} retirée (une copie est gardée dans backups).") }
@@ -1092,6 +1115,7 @@ impl App {
let confirm = self.save_confirm;
let restore_confirm = self.restore_confirm.clone();
let msg = self.save_msg.clone();
let can_play = self.checks.can_load && self.checks.built && self.checks.game_dir.is_some() && self.busy == Busy::No;
let mut act: Option<SaveAct> = None;
card(ui, |ui| {
title(ui, tr("Sauvegardes", "Saved games"));
@@ -1124,8 +1148,18 @@ impl App {
if ui.button(RichText::new(tr("Confirmer", "Confirm")).color(BAD)).clicked() {
act = Some(SaveAct::Delete(*slot));
}
} else if ui.small_button(tr("Supprimer", "Delete")).clicked() {
act = Some(SaveAct::AskDelete(*slot));
} else {
if ui.small_button(tr("Supprimer", "Delete")).clicked() {
act = Some(SaveAct::AskDelete(*slot));
}
if can_play
&& ui
.add(egui::Button::new(RichText::new(tr("Jouer", "Play")).strong().color(Color32::BLACK)).fill(ACCENT))
.on_hover_text(tr("Lance le jeu directement sur cette sauvegarde.", "Starts the game straight on this save."))
.clicked()
{
act = Some(SaveAct::Play(*slot));
}
}
});
});
@@ -1250,7 +1284,29 @@ impl App {
game_dir.to_path_buf()
}
/// sauvegarde sur laquelle démarrer : celle choisie si elle existe encore, sinon la dernière
/// jouée, sinon la plus récente ; None si l'option est coupée ou qu'il n'y a aucune sauvegarde
fn resume_target(&self) -> Option<u32> {
if !self.cfg.resume {
return None;
}
let s = &self.saves.saves;
let has = |n: u32| n != 0 && s.iter().any(|x| x.slot == n);
if has(self.cfg.resume_slot) {
return Some(self.cfg.resume_slot);
}
if has(self.saves.last_used) {
return Some(self.saves.last_used);
}
s.iter().max_by_key(|x| x.modified).map(|x| x.slot)
}
fn play(&mut self) {
let slot = if self.checks.can_load { self.resume_target() } else { None };
self.play_slot(slot);
}
fn play_slot(&mut self, slot: Option<u32>) {
let (Some(root), Some(dir)) = (self.root.clone(), self.checks.game_dir.clone()) else { return };
let hd = self.install_dir(&dir);
let hd_root = hd.parent().map(Path::to_path_buf).unwrap_or_else(|| hd.clone());
@@ -1264,7 +1320,9 @@ impl App {
.arg("--root").arg(&hd_root)
.arg("--saves").arg(&saves);
if self.cfg.sound { cmd.arg("--son"); }
if self.cfg.skip_intro { cmd.arg("--sans-intro"); }
// une sauvegarde se charge dans le jeu : l'intro n'a pas lieu d'être
if self.cfg.skip_intro || slot.is_some() { cmd.arg("--sans-intro"); }
if let Some(n) = slot { cmd.arg("--charger").arg(n.to_string()); }
if self.cfg.verbose { cmd.arg("-v"); }
cmd.stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::piped());
self.log.push(format!("> {:?}", cmd));
@@ -1624,6 +1682,64 @@ impl App {
});
}
/// ligne sous « Reprendre ma partie » : quelle sauvegarde, avec sa vignette
fn resume_row(&mut self, ui: &mut egui::Ui) {
let en = self.cfg.lang == Lang::En;
let tr = |fr: &'static str, e: &'static str| if en { e } else { fr };
if self.checks.done && self.checks.built && !self.checks.can_load {
ui.label(RichText::new(tr(
"Le moteur compilé ne sait pas encore charger une sauvegarde au démarrage : recompilez-le \
quand il sera à jour. En attendant, le jeu démarre normalement.",
"The compiled engine cannot load a save at startup yet: rebuild it once it is updated. \
Until then, the game starts normally.",
)).color(ACCENT).small());
return;
}
if self.saves.saves.is_empty() {
ui.label(RichText::new(tr("Aucune sauvegarde : la partie commencera depuis le début.", "No saved game: the game will start from the beginning.")).weak().small());
return;
}
let last = self.saves.last_used;
let name = |slot: u32, loc: u32| {
if slot == 0 {
tr("La dernière jouée", "The last one played").to_string()
} else if en {
format!("Save {slot} · location {loc}")
} else {
format!("Partie {slot} · lieu {loc}")
}
};
let rows: Vec<(u32, u32)> = self.saves.saves.iter().map(|s| (s.slot, s.location)).collect();
let target = self.resume_target();
let target_loc = rows.iter().find(|r| Some(r.0) == target).map(|r| r.1);
let tex = target_loc.and_then(|l| self.thumb(l));
ui.horizontal(|ui| {
ui.add_space(26.0);
if let Some(t) = &tex {
let (r, _) = ui.allocate_exact_size(egui::vec2(64.0, 34.0), egui::Sense::hover());
paint_cover(ui.painter(), r, t, 1.0, 0.0);
ui.painter().rect_stroke(r, CornerRadius::ZERO, Stroke::new(1.5, Color32::BLACK), egui::StrokeKind::Inside);
}
let cur = if self.cfg.resume_slot != 0 && rows.iter().any(|r| r.0 == self.cfg.resume_slot) { self.cfg.resume_slot } else { 0 };
let shown = rows.iter().find(|r| r.0 == cur).map(|r| name(r.0, r.1)).unwrap_or_else(|| name(0, 0));
egui::ComboBox::from_id_salt("resume_slot")
.selected_text(shown)
.width(220.0)
.show_ui(ui, |ui| {
let mut pick = cur;
ui.selectable_value(&mut pick, 0, name(0, 0));
for (slot, loc) in &rows {
let mut label = name(*slot, *loc);
if *slot == last {
label += tr(" (dernière)", " (last)");
}
ui.selectable_value(&mut pick, *slot, label);
}
self.cfg.resume_slot = pick;
});
});
}
fn play_column(&mut self, ui: &mut egui::Ui) {
let busy = self.busy != Busy::No;
let c = self.checks.clone();
@@ -1635,8 +1751,16 @@ impl App {
ui.horizontal_wrapped(|ui| {
ui.checkbox(&mut self.cfg.sound, tr("Son", "Sound"));
ui.checkbox(&mut self.cfg.skip_intro, tr("Passer l'intro", "Skip intro"));
ui.checkbox(&mut self.cfg.resume, tr("Reprendre ma partie", "Resume my game"))
.on_hover_text(tr(
"Démarre directement sur une sauvegarde, sans l'intro ni le menu du jeu.",
"Starts straight on a saved game, skipping the intro and the game menu.",
));
ui.checkbox(&mut self.cfg.verbose, tr("Journal détaillé", "Verbose log"));
});
if self.cfg.resume {
self.resume_row(ui);
}
ui.add_space(4.0);
// réglages partagés avec le jeu : figés pendant une partie (le menu F12 écrit le même fichier)
let running = self.game_running;
@@ -1684,6 +1808,9 @@ impl App {
ui.add_space(6.0);
if !c.built && c.done {
ui.label(RichText::new(tr("Compilez d'abord le jeu (étape 3).", "Build the game first (step 3).")).color(BAD));
} else if let (Some(n), true, false) = (self.resume_target(), c.can_load, self.game_running) {
let loc = self.saves.saves.iter().find(|s| s.slot == n).map(|s| s.location).unwrap_or(0);
ui.label(RichText::new(if en { format!("Starts on save {n} (location {loc}).") } else { format!("Démarre sur la partie {n} (lieu {loc}).") }).color(ACCENT));
} else if let Some(code) = self.last_exit.filter(|&c| c != 0) {
ui.label(RichText::new(format!("{} {code}", tr("Le jeu s'est arrêté avec le code", "The game stopped with code"))).color(BAD));
} else {