r"""Copie la documentation de docs/ vers un clone du wiki Gitea (les pages du wiki sont générées).
git clone https://git.linkatplug.be/linkatplug/DoubleTroubleRecomp.wiki.git ..\wiki
python tools/wiki_sync.py ..\wiki
cd ..\wiki && git add -A && git commit -m "Mise à jour depuis docs/" && git push
docs/ reste la source : on modifie les fichiers du dépôt, puis on relance ce script.
"""
import os
import re
import sys
REPO = "https://git.linkatplug.be/linkatplug/DoubleTroubleRecomp"
# fichier de docs/ -> page du wiki
PAGES = {
"GUIDE.md": "Guide",
"GUIDE.en.md": "Guide-EN",
"GUIDE.de.md": "Anleitung",
"GUIDE.es.md": "Guia",
"GUIDE.pl.md": "Poradnik",
"SETTINGS.md": "Reglages",
"SETTINGS.en.md": "Settings",
"MODS.md": "Mods",
"MODS.en.md": "Modding",
"TEXTURES.md": "Textures-HD",
"TEXTURES.en.md": "HD-Textures",
"TECHNIQUE.md": "Technique",
"ANALYSE.md": "Analyse-du-jeu",
"TECHNIQUE.en.md": "Technical",
"ANALYSE.en.md": "Game-analysis",
"ROADMAP.md": "Feuille-de-route",
"ROADMAP.en.md": "Roadmap",
}
HOME = """

# DoubleTroubleRecomp
**Bud Tucker in Double Trouble** (Merit Studios, 1996), recompilé en C natif : plus de DOSBox, une image
nette et fluide de 1080p à 4K, des filtres, un pack HD des décors et des mods.
*Static recompilation to native C: no DOSBox, a sharp and smooth picture from 1080p to 4K, filters,
an HD background pack and mods.*
> Il faut posséder le jeu original : le dépôt ne contient aucun fichier du jeu.
> *You must own the original game: the repository contains no game files.*
## 🇫🇷 Français
- **[Guide complet](Guide)** : outils à installer, launcher, compilation, jeu, filtres, pack HD,
mods, sauvegardes, dépannage.
- [Réglages](Reglages) : `settings.ini`, menu F12, options de ligne de commande.
- **[Textures HD](Textures-HD)** : installer Upscayl, exporter les décors, les agrandir, les retoucher.
- [Mods et pack HD](Mods) : format des mods et des décors HD.
- [Documentation technique](Technique) : ce qu'on sait du jeu, comment marche la recomp ; [analyse détaillée](Analyse-du-jeu).
- [Feuille de route](Feuille-de-route)
## 🇺🇸 English
- **[Complete guide](Guide-EN)**: tools to install, launcher, build, playing, filters, HD pack,
mods, saved games, troubleshooting.
- **[HD textures](HD-Textures)**: install Upscayl, export the backgrounds, upscale them, retouch them.
- [Settings](Settings): `settings.ini`, F12 menu, command-line options.
- [Mods and HD pack](Modding): mod format and HD backgrounds.
- [Technical documentation](Technical): what we know about the game, how the recomp works; [detailed analysis](Game-analysis).
- [Roadmap](Roadmap)
## 🇩🇪 Deutsch · 🇪🇸 Español · 🇵🇱 Polski
- **[Vollständige Anleitung](Anleitung)**: installieren, kompilieren, spielen. Technische Dokumente auf Englisch.
- **[Guía completa](Guia)**: instalar, compilar, jugar. Documentos técnicos en inglés.
- **[Pełny poradnik](Poradnik)**: instalacja, kompilacja, gra. Dokumenty techniczne po angielsku.
## En bref / In short
1. Installer / install **Visual Studio Build Tools 2022** (C++), **Python 3.12** (PATH), **Rust**.
2. `git clone {repo}.git`
3. `cd DoubleTroubleRecomp\\launcher` → `cargo build --release` → `target\\release\\DoubleTroubleLauncher.exe`
4. Choisir le jeu, **Générer et compiler**, **JOUER** / pick the game, **Generate and build**, **PLAY**.

Code : [{repo}]({repo})
"""
SIDEBAR = """**DoubleTroubleRecomp**
- [Accueil / Home](Home)
🇫🇷
- [Guide complet](Guide)
- [Textures HD](Textures-HD)
- [Réglages](Reglages)
- [Mods et pack HD](Mods)
- [Documentation technique](Technique)
- [Analyse du jeu](Analyse-du-jeu)
- [Feuille de route](Feuille-de-route)
🇺🇸
- [Complete guide](Guide-EN)
- [HD textures](HD-Textures)
- [Settings](Settings)
- [Mods and HD pack](Modding)
- [Technical documentation](Technical)
- [Game analysis](Game-analysis)
- [Roadmap](Roadmap)
🇩🇪 🇪🇸 🇵🇱
- [Anleitung](Anleitung)
- [Guía](Guia)
- [Poradnik](Poradnik)
[Code source]({repo})
"""
def convert(text, name):
def link(m):
target = m.group(1)
path, _, anchor = target.partition("#")
if path in PAGES:
return "](" + PAGES[path] + ("#" + anchor if anchor else "") + ")"
if path and not re.match(r"[a-z]+:", path):
# autre fichier du dépôt : lien vers sa version en ligne
return "](" + REPO + "/src/branch/main/docs/" + target + ")"
return m.group(0)
text = re.sub(r"\]\(([^)\s]+)\)", link, text)
# images : servies depuis le dépôt
text = text.replace('src="images/', 'src="' + REPO + "/raw/branch/main/docs/images/")
note = f"*Page générée depuis [docs/{name}]({REPO}/src/branch/main/docs/{name}).*\n\n"
return text.rstrip() + "\n\n---\n\n" + note
def main():
if len(sys.argv) != 2:
sys.exit(__doc__)
wiki = sys.argv[1]
docs = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "docs")
for src, page in PAGES.items():
with open(os.path.join(docs, src), encoding="utf-8") as f:
text = convert(f.read(), src)
with open(os.path.join(wiki, page + ".md"), "w", encoding="utf-8", newline="\n") as f:
f.write(text)
print(f"{src} -> {page}.md")
for page, text in (("Home", HOME), ("_Sidebar", SIDEBAR)):
with open(os.path.join(wiki, page + ".md"), "w", encoding="utf-8", newline="\n") as f:
f.write(text.format(repo=REPO))
print(f"{page}.md")
if __name__ == "__main__":
main()