Launcher et doc : sprites HD (personnages et objets)
- settings.ini : hd_decors et hd_sprites, sous l'interrupteur Pack HD
- carte Mods : Pack HD > Décors / Personnages et objets ; nombre de sprites
HD par mod ; « Créer le pack » avec décors et/ou sprites ; bouton
« + sprites HD » / « Compléter les sprites HD » qui reprend le modèle
Upscayl du pack (mod.ini model=, sinon déduit de hd_upscayl_<modèle>)
- TEXTURES (FR/EN) : section I sur les sprites HD, un seul modèle par pack
- guide, README, captures de la carte Mods mis à jour
- MODS.en.md, SETTINGS.en.md alignés sur les versions françaises (629c139)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
629c139e2b
commit
8fee466e72
13 files changed
+340
-79
No files matched your search
+69
-14
@@ -612,6 +612,9 @@ struct App {
|
||||
upscayl_models: Vec<String>,
|
||||
upscayl_model: String,
|
||||
new_mod_name: String,
|
||||
/// contenu du pack HD à créer
|
||||
pack_decors: bool,
|
||||
pack_sprites: bool,
|
||||
mod_msg: Option<(bool, String)>,
|
||||
/// dossier à ouvrir quand la tâche en cours réussit
|
||||
open_after: Option<PathBuf>,
|
||||
@@ -676,6 +679,8 @@ impl App {
|
||||
upscayl_models: Vec::new(),
|
||||
upscayl_model: mods::DEFAULT_MODEL.to_string(),
|
||||
new_mod_name: String::new(),
|
||||
pack_decors: true,
|
||||
pack_sprites: true,
|
||||
mod_msg: None,
|
||||
open_after: None,
|
||||
art: Art::default(),
|
||||
@@ -750,9 +755,9 @@ impl App {
|
||||
self.art.hd_key.clear();
|
||||
}
|
||||
|
||||
/// décors HD à charger : mods actifs et décors HD activés
|
||||
/// décors HD à charger : mods actifs, pack HD et décors HD activés
|
||||
fn hd_active(&self) -> bool {
|
||||
self.gs.mods_enabled && self.gs.hd_pack
|
||||
self.gs.mods_enabled && self.gs.hd_pack && self.gs.hd_decors
|
||||
}
|
||||
|
||||
/// visibles en jeu : le filtre CRT affiche toujours les décors d'origine
|
||||
@@ -799,17 +804,27 @@ impl App {
|
||||
.collect();
|
||||
}
|
||||
|
||||
fn create_hd_pack(&mut self) {
|
||||
/// crée ou complète un pack Upscayl : décors et/ou sprites (planches PCX + fichiers SPR), avec un seul
|
||||
/// modèle pour tout le pack (deux modèles n'agrandissent pas les couleurs pareil : voir docs/MODS.md)
|
||||
fn create_hd_pack(&mut self, target: Option<PathBuf>, model: String, decors: bool, sprites: bool) {
|
||||
let (Some(game), Some(mdir)) = (self.checks.game_dir.clone(), self.mods_dir()) else { return };
|
||||
let id = mods::pack_id(&self.upscayl_model);
|
||||
let target = mdir.join(&id);
|
||||
mods::write_mod_ini(&target, &self.upscayl_model);
|
||||
if !decors && !sprites {
|
||||
return;
|
||||
}
|
||||
let target = target.unwrap_or_else(|| mdir.join(mods::pack_id(&model)));
|
||||
mods::write_mod_ini(&target, &model);
|
||||
let mut cmd = format!(
|
||||
"python -I tools\\hd_export.py \"{}\" \"{}\" --upscayl {}",
|
||||
"python -I tools\\hd_export.py \"{}\" \"{}\"",
|
||||
game.display(),
|
||||
target.join("hd").display(),
|
||||
self.upscayl_model
|
||||
target.join("hd").display()
|
||||
);
|
||||
if !decors {
|
||||
cmd.push_str(" --sans-decors");
|
||||
}
|
||||
if sprites {
|
||||
cmd.push_str(" --planches --sprites");
|
||||
}
|
||||
cmd.push_str(&format!(" --upscayl {model}"));
|
||||
if let Some(bin) = &self.upscayl {
|
||||
cmd.push_str(&format!(" --upscayl-bin \"{}\"", bin.display()));
|
||||
}
|
||||
@@ -825,6 +840,7 @@ impl App {
|
||||
let mut open_dir = false;
|
||||
let mut refresh = false;
|
||||
let mut create = false;
|
||||
let mut add_sprites: Option<(PathBuf, String)> = None;
|
||||
let mut export = false;
|
||||
let mut new_mod = false;
|
||||
card(ui, |ui| {
|
||||
@@ -833,7 +849,14 @@ impl App {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.checkbox(&mut self.gs.mods_enabled, tr("Activer les mods", "Enable mods"));
|
||||
ui.add_enabled_ui(self.gs.mods_enabled, |ui| {
|
||||
ui.checkbox(&mut self.gs.hd_pack, tr("Décors HD", "HD backgrounds"));
|
||||
ui.checkbox(&mut self.gs.hd_pack, tr("Pack HD", "HD pack"));
|
||||
});
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.add_space(24.0);
|
||||
ui.add_enabled_ui(self.gs.mods_enabled && self.gs.hd_pack, |ui| {
|
||||
ui.checkbox(&mut self.gs.hd_decors, tr("Décors", "Backgrounds"));
|
||||
ui.checkbox(&mut self.gs.hd_sprites, tr("Personnages et objets", "Characters and objects"));
|
||||
});
|
||||
});
|
||||
if self.gs.filter == 3 && self.gs.hd_pack {
|
||||
@@ -856,6 +879,29 @@ impl App {
|
||||
if m.hd_images > 0 {
|
||||
ui.label(RichText::new(format!("HD · {} {}", m.hd_images, tr("décors", "backgrounds"))).color(ACCENT).small());
|
||||
}
|
||||
if m.hd_sprites > 0 {
|
||||
ui.label(RichText::new(format!("{} {}", m.hd_sprites, tr("sprites", "sprites"))).color(ACCENT).small());
|
||||
}
|
||||
// pack de décors sans sprites (ou incomplet) : les créer avec le même modèle
|
||||
if let (Some(model), true, true) = (&m.model, m.hd_images > 0 && !m.hd_sprites_complete, self.upscayl.is_some()) {
|
||||
let label = match (m.hd_sprites, en) {
|
||||
(0, false) => "+ sprites HD",
|
||||
(0, true) => "+ HD sprites",
|
||||
(_, false) => "Compléter les sprites HD",
|
||||
(_, true) => "Complete the HD sprites",
|
||||
};
|
||||
if ui
|
||||
.add_enabled(can_create, egui::Button::new(label).small())
|
||||
.on_hover_text(if en {
|
||||
format!("Creates the characters, objects and cursor in HD with the same model as the backgrounds ({model}). Takes a while.")
|
||||
} else {
|
||||
format!("Crée les personnages, objets et curseur en HD avec le même modèle que les décors ({model}). Prend du temps.")
|
||||
})
|
||||
.clicked()
|
||||
{
|
||||
add_sprites = Some((m.path.clone(), model.clone()));
|
||||
}
|
||||
}
|
||||
if m.files > 0 {
|
||||
ui.label(RichText::new(format!("{} {}", m.files, tr("fichiers", "files"))).color(OK).small());
|
||||
}
|
||||
@@ -888,13 +934,19 @@ impl App {
|
||||
ui.selectable_value(&mut self.upscayl_model, m.clone(), m);
|
||||
}
|
||||
});
|
||||
if ui.add_enabled(can_create, egui::Button::new(tr("Créer le pack", "Create pack"))).clicked() {
|
||||
ui.checkbox(&mut self.pack_decors, tr("Décors", "Backgrounds"));
|
||||
ui.checkbox(&mut self.pack_sprites, tr("Personnages et objets", "Characters and objects"));
|
||||
let some = self.pack_decors || self.pack_sprites;
|
||||
if ui.add_enabled(can_create && some, egui::Button::new(tr("Créer le pack", "Create pack"))).clicked() {
|
||||
create = true;
|
||||
}
|
||||
});
|
||||
ui.label(RichText::new(format!(
|
||||
"{} mods\\{}",
|
||||
tr("122 décors agrandis ×4, quelques secondes à quelques minutes. Dossier :", "122 backgrounds upscaled ×4, seconds to minutes. Folder:"),
|
||||
tr(
|
||||
"Tout le pack avec le même modèle. Décors : 122 images, quelques minutes ; personnages et objets : plusieurs milliers d'images, nettement plus long. Dossier :",
|
||||
"The whole pack with one model. Backgrounds: 122 images, a few minutes; characters and objects: thousands of images, much longer. Folder:"
|
||||
),
|
||||
mods::pack_id(&self.upscayl_model)
|
||||
)).weak().small());
|
||||
} else {
|
||||
@@ -949,7 +1001,7 @@ impl App {
|
||||
}
|
||||
});
|
||||
if running {
|
||||
ui.label(RichText::new(tr("En jeu : « Décors HD » se change aussi avec F12.", "In game: toggle « HD backgrounds » with F12.")).weak());
|
||||
ui.label(RichText::new(tr("En jeu : le pack HD se règle aussi avec F12.", "In game: the HD pack can also be set with F12.")).weak());
|
||||
}
|
||||
});
|
||||
if open_dir {
|
||||
@@ -961,7 +1013,10 @@ impl App {
|
||||
self.reload_mods();
|
||||
}
|
||||
if create {
|
||||
self.create_hd_pack();
|
||||
self.create_hd_pack(None, self.upscayl_model.clone(), self.pack_decors, self.pack_sprites);
|
||||
}
|
||||
if let Some((path, model)) = add_sprites {
|
||||
self.create_hd_pack(Some(path), model, false, true);
|
||||
}
|
||||
if export {
|
||||
self.export_originals();
|
||||
|
||||
+29
-7
@@ -1,7 +1,7 @@
|
||||
//! Mods et pack HD, côté launcher : voir docs/MODS.md.
|
||||
//! - un mod = un sous-dossier de mods/ (ignoré s'il commence par « _ » ou « . ») ;
|
||||
//! - mod.ini [mod] name / author / description, lu seulement par le launcher ;
|
||||
//! - hd/*.png : décors HD ; files/** : fichiers remplacés.
|
||||
//! - hd/*.png : décors HD ; hd/SHEETS/*.png, hd/SPRITES/*.png : sprites HD ; files/** : fichiers remplacés.
|
||||
//! Les mods s'appliquent dans l'ordre alphabétique : pour un même fichier, le dernier l'emporte.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -13,6 +13,12 @@ pub struct Mod {
|
||||
pub author: String,
|
||||
pub description: String,
|
||||
pub hd_images: usize,
|
||||
/// planches et fichiers SPR en HD (hd/SHEETS, hd/SPRITES)
|
||||
pub hd_sprites: usize,
|
||||
/// tous les fichiers SPR du jeu ont leur planche HD (au moins une page par fichier)
|
||||
pub hd_sprites_complete: bool,
|
||||
/// modèle Upscayl du pack (mod.ini model=, sinon déduit du nom hd_upscayl[_modèle])
|
||||
pub model: Option<String>,
|
||||
pub files: usize,
|
||||
}
|
||||
|
||||
@@ -46,8 +52,8 @@ fn count_png(d: &Path) -> usize {
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
fn read_ini(path: &Path) -> (String, String, String) {
|
||||
let (mut name, mut author, mut desc) = (String::new(), String::new(), String::new());
|
||||
fn read_ini(path: &Path) -> (String, String, String, String) {
|
||||
let (mut name, mut author, mut desc, mut model) = (String::new(), String::new(), String::new(), String::new());
|
||||
if let Ok(text) = std::fs::read_to_string(path) {
|
||||
let mut in_mod = false;
|
||||
for line in text.lines() {
|
||||
@@ -64,12 +70,21 @@ fn read_ini(path: &Path) -> (String, String, String) {
|
||||
"name" => name = v.trim().to_string(),
|
||||
"author" => author = v.trim().to_string(),
|
||||
"description" => desc = v.trim().to_string(),
|
||||
"model" => model = v.trim().to_string(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(name, author, desc)
|
||||
(name, author, desc, model)
|
||||
}
|
||||
|
||||
/// modèle d'un pack créé par le launcher, d'après son nom de dossier
|
||||
fn model_from_id(id: &str) -> Option<String> {
|
||||
if id == "hd_upscayl" {
|
||||
return Some(DEFAULT_MODEL.into());
|
||||
}
|
||||
id.strip_prefix("hd_upscayl_").filter(|m| !m.is_empty()).map(str::to_string)
|
||||
}
|
||||
|
||||
pub fn list(mods_dir: &Path) -> Vec<Mod> {
|
||||
@@ -83,12 +98,16 @@ pub fn list(mods_dir: &Path) -> Vec<Mod> {
|
||||
return None;
|
||||
}
|
||||
let path = e.path();
|
||||
let (name, author, description) = read_ini(&path.join("mod.ini"));
|
||||
let (name, author, description, model) = read_ini(&path.join("mod.ini"));
|
||||
Some(Mod {
|
||||
name: if name.is_empty() { id.clone() } else { name },
|
||||
author,
|
||||
description,
|
||||
hd_images: count_png(&path.join("hd")),
|
||||
hd_sprites: count_png(&path.join("hd").join("SHEETS")) + count_png(&path.join("hd").join("SPRITES")),
|
||||
hd_sprites_complete: count_png(&path.join("hd").join("SHEETS")) > 0
|
||||
&& count_png(&path.join("hd").join("SPRITES")) >= SPR_FILES,
|
||||
model: if model.is_empty() { model_from_id(&id) } else { Some(model) },
|
||||
files: count_files(&path.join("files")),
|
||||
id,
|
||||
path,
|
||||
@@ -186,6 +205,9 @@ pub fn upscayl_models(bin: &Path) -> Vec<String> {
|
||||
|
||||
pub const DEFAULT_MODEL: &str = "digital-art-4x";
|
||||
|
||||
/// nombre de fichiers SPRITES\*.SPR du jeu (version française)
|
||||
pub const SPR_FILES: usize = 654;
|
||||
|
||||
/// dossier des décors d'origine exportés en PNG : commence par « _ », donc ignoré par le jeu
|
||||
pub const EXPORT_DIR: &str = "_decors_originaux";
|
||||
|
||||
@@ -256,8 +278,8 @@ pub fn write_mod_ini(mod_dir: &Path, model: &str) {
|
||||
let _ = std::fs::write(
|
||||
p,
|
||||
format!(
|
||||
"[mod]\nname=Décors HD (Upscayl, {model})\nauthor=créé par le launcher\n\
|
||||
description=Décors du jeu agrandis ×4 avec Upscayl (Real-ESRGAN, modèle {model})\n"
|
||||
"[mod]\nname=Pack HD (Upscayl, {model})\nauthor=créé par le launcher\nmodel={model}\n\
|
||||
description=Images du jeu agrandies ×4 avec Upscayl (Real-ESRGAN, modèle {model})\n"
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -14,7 +14,10 @@ pub struct GameSettings {
|
||||
pub filter: usize,
|
||||
pub aspect_43: bool,
|
||||
pub vsync: bool,
|
||||
/// interrupteur général du pack HD ; hd_decors / hd_sprites en coupent une partie
|
||||
pub hd_pack: bool,
|
||||
pub hd_decors: bool,
|
||||
pub hd_sprites: bool,
|
||||
pub vol: [u32; 4],
|
||||
pub mods_enabled: bool,
|
||||
/// dossier des mods ; vide = détection automatique par le jeu
|
||||
@@ -33,6 +36,8 @@ impl Default for GameSettings {
|
||||
aspect_43: true,
|
||||
vsync: false,
|
||||
hd_pack: true,
|
||||
hd_decors: true,
|
||||
hd_sprites: true,
|
||||
vol: [100; 4],
|
||||
mods_enabled: true,
|
||||
mods_dir: String::new(),
|
||||
@@ -98,6 +103,8 @@ impl GameSettings {
|
||||
("display", "aspect_43") => s.aspect_43 = parse_bool(v).unwrap_or(s.aspect_43),
|
||||
("display", "vsync") => s.vsync = parse_bool(v).unwrap_or(s.vsync),
|
||||
("display", "hd_pack") => s.hd_pack = parse_bool(v).unwrap_or(s.hd_pack),
|
||||
("display", "hd_decors") => s.hd_decors = parse_bool(v).unwrap_or(s.hd_decors),
|
||||
("display", "hd_sprites") => s.hd_sprites = parse_bool(v).unwrap_or(s.hd_sprites),
|
||||
("mods", "enabled") => s.mods_enabled = parse_bool(v).unwrap_or(s.mods_enabled),
|
||||
("mods", "dir") => s.mods_dir = v.to_string(),
|
||||
("mods", "disabled") => {
|
||||
@@ -123,6 +130,8 @@ impl GameSettings {
|
||||
("display", "aspect_43", b(self.aspect_43)),
|
||||
("display", "vsync", b(self.vsync)),
|
||||
("display", "hd_pack", b(self.hd_pack)),
|
||||
("display", "hd_decors", b(self.hd_decors)),
|
||||
("display", "hd_sprites", b(self.hd_sprites)),
|
||||
];
|
||||
for (i, k) in VOLUMES.iter().enumerate() {
|
||||
e.push(("audio", k, self.vol[i].to_string()));
|
||||
|
||||
Reference in new issue
Block a user