From c22cd85edb9fc97c9b5c1145b7c1e55b420197a7 Mon Sep 17 00:00:00 2001 From: OreoFR <29048345+OreoFR@users.noreply.github.com> Date: Thu, 3 Dec 2026 02:55:45 +0100 Subject: [PATCH] launcher: a missing game folder is a box on the Play page with Choose game folder Without a game folder holding game_scarlett_master.exe, the Play card showed one muted line ("Choose your game folder in Settings") that players missed. It is now a box under the state, outlined in the warning colour: "Where is your game?", what to pick, and a Choose game folder button. The picker's folder is saved at once (the same field as Settings' Game folder); one without the executable says so in the box in red and changes nothing. PLAY without a folder opens the same picker instead of a warning and a jump to Settings, and starts once a folder with the game is chosen. New texts in de/es/fr/pt; the two old ones removed. docs/launcher.md says it. Tests: tests/test_leonida_launcher.py (87 OK), test_text_write_line_endings; a real-window check (isolated APPDATA, patched picker): the box shows with no folder, a wrong folder shows the error and saves nothing, a right one is saved to launcher.json and in Settings' field, and the box goes away. Co-Authored-By: Claude Opus 5.5 --- docs/launcher.md | 5 +-- tools/launcher_i18n/de.json | 7 +++-- tools/launcher_i18n/es.json | 7 +++-- tools/launcher_i18n/fr.json | 7 +++-- tools/launcher_i18n/pt.json | 7 +++-- tools/leonida_launcher.py | 62 +++++++++++++++++++++++++++++++++---- 6 files changed, 75 insertions(+), 20 deletions(-) diff --git a/docs/launcher.md b/docs/launcher.md index bc683a5b1..009623c4d 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -37,8 +37,9 @@ needs its line in every file, which `tests/test_leonida_launcher.py` checks (sam - **Play**: three cards. - *Play*: the PLAY pill runs `powershell -NoProfile -ExecutionPolicy Bypass -File scripts\play-d3d12.ps1 -Game -Data ` plus the switches chosen in Settings (on Linux `scripts/play-linux.sh - /game_scarlett_master.exe`, with `--series-x` if chosen). Under it: the state, the game folder (or where - to choose it), a one-line warning while the profile the next PLAY runs is Series X and the commit limit is under + /game_scarlett_master.exe`, with `--series-x` if chosen). Under it: the state, the game folder (while none + holding the game is set, a box with **Choose game folder**, the same picker as Settings', saved at once; PLAY + without one opens that picker and starts once a folder with the game is chosen), a one-line warning while the profile the next PLAY runs is Series X and the commit limit is under 64 GiB (as in Settings, below; that profile is the launcher's when it was changed since the last PLAY, otherwise the F1 menu's `LEONIDA_MENU_CONSOLE` when the menu saved one, as the scripts decide it, below), the options PLAY passes and what the in-game F1 menu saved (below). The state reads a diff --git a/tools/launcher_i18n/de.json b/tools/launcher_i18n/de.json index c0da8b41a..fbd80a872 100644 --- a/tools/launcher_i18n/de.json +++ b/tools/launcher_i18n/de.json @@ -58,7 +58,6 @@ "the runtime build": "Runtime-Build", "PLAY": "SPIELEN", "Runs your own copy of GTA VI · Unofficial": "Startet deine eigene Kopie von GTA VI · Inoffiziell", - "{exe} is not in the game folder.\nChoose the folder of your own copy in Settings.": "{exe} ist nicht im Spielordner.\nWähle den Ordner deiner eigenen Kopie unter Einstellungen.", "Something is already running. Stop it first.": "Es läuft bereits etwas. Stoppe es zuerst.", "Stopped with an error (code {code}).": "Mit einem Fehler beendet (Code {code}).", "Update Mandy": "Mandy aktualisieren", @@ -105,7 +104,6 @@ "Open the screenshots folder": "Screenshot-Ordner öffnen", "The F4 menu's screenshots, else the F9 captures": "Die Screenshots des F4-Menüs, sonst die F9-Aufnahmen", "This downloads about 70 MB from NVIDIA's GitHub (DLSS and Streamline, under NVIDIA's own licences).\n\nContinue?": "Das lädt etwa 70 MB von NVIDIAs GitHub (DLSS und Streamline, unter NVIDIAs eigenen Lizenzen).\n\nFortfahren?", - "Choose your game folder in Settings": "Wähle deinen Spielordner unter Einstellungen", "The game closed.": "Das Spiel wurde geschlossen.", "Done.": "Fertig.", "Diagnostic run over: the logs folder is {folder}": "Diagnoselauf beendet: Der Log-Ordner ist {folder}", @@ -323,5 +321,8 @@ "Git is not installed: install it with your package manager, then press Update Mandy again.": "Git ist nicht installiert: Installiere es mit deinem Paketmanager und drücke dann erneut Mandy aktualisieren.", "This copy was downloaded as a zip, so it cannot update itself. Update Mandy makes this folder a git copy of the repository: it downloads the repository, keeps a copy of every file that differs in {folder}, puts the current version in their place, then rebuilds the runtime (a few minutes). Your settings, saves and builds are not touched.": "Diese Kopie wurde als ZIP heruntergeladen und kann sich daher nicht selbst aktualisieren. Mandy aktualisieren macht diesen Ordner zu einer Git-Kopie des Repositorys: Es lädt das Repository herunter, legt von jeder abweichenden Datei eine Kopie in {folder} ab, setzt die aktuelle Version an ihre Stelle und baut dann die Laufzeit neu (einige Minuten). Deine Einstellungen, Spielstände und Builds bleiben unberührt.", "Git is not installed: it is installed first, with winget (Windows may ask for permission).": "Git ist nicht installiert: Es wird zuerst mit winget installiert (Windows fragt eventuell nach der Erlaubnis).", - "Continue?": "Fortfahren?" + "Continue?": "Fortfahren?", + "Where is your game?": "Wo ist dein Spiel?", + "Choose the folder of your own copy, the one with {exe}.": "Wähle den Ordner deiner eigenen Kopie, den mit {exe}.", + "Choose game folder": "Spielordner wählen" } diff --git a/tools/launcher_i18n/es.json b/tools/launcher_i18n/es.json index e70a173a4..fc2d99cfa 100644 --- a/tools/launcher_i18n/es.json +++ b/tools/launcher_i18n/es.json @@ -58,7 +58,6 @@ "the runtime build": "la compilación del runtime", "PLAY": "JUGAR", "Runs your own copy of GTA VI · Unofficial": "Ejecuta tu propia copia de GTA VI · No oficial", - "{exe} is not in the game folder.\nChoose the folder of your own copy in Settings.": "{exe} no está en la carpeta del juego.\nElige la carpeta de tu propia copia en Ajustes.", "Something is already running. Stop it first.": "Ya hay algo en ejecución. Detenlo primero.", "Stopped with an error (code {code}).": "Detenido con un error (código {code}).", "Update Mandy": "Actualizar Mandy", @@ -105,7 +104,6 @@ "Open the screenshots folder": "Abrir la carpeta de capturas", "The F4 menu's screenshots, else the F9 captures": "Las capturas del menú F4; si no, las capturas F9", "This downloads about 70 MB from NVIDIA's GitHub (DLSS and Streamline, under NVIDIA's own licences).\n\nContinue?": "Esto descarga unos 70 MB del GitHub de NVIDIA (DLSS y Streamline, bajo las licencias propias de NVIDIA).\n\n¿Continuar?", - "Choose your game folder in Settings": "Elige la carpeta del juego en Ajustes", "The game closed.": "El juego se cerró.", "Done.": "Hecho.", "Diagnostic run over: the logs folder is {folder}": "Ejecución de diagnóstico terminada: la carpeta de registros es {folder}", @@ -323,5 +321,8 @@ "Git is not installed: install it with your package manager, then press Update Mandy again.": "Git no está instalado: instálalo con tu gestor de paquetes y vuelve a pulsar Actualizar Mandy.", "This copy was downloaded as a zip, so it cannot update itself. Update Mandy makes this folder a git copy of the repository: it downloads the repository, keeps a copy of every file that differs in {folder}, puts the current version in their place, then rebuilds the runtime (a few minutes). Your settings, saves and builds are not touched.": "Esta copia se descargó como zip, así que no puede actualizarse sola. Actualizar Mandy convierte esta carpeta en una copia git del repositorio: descarga el repositorio, guarda una copia de cada archivo distinto en {folder}, pone la versión actual en su lugar y luego recompila el runtime (unos minutos). Tus ajustes, partidas guardadas y compilaciones no se tocan.", "Git is not installed: it is installed first, with winget (Windows may ask for permission).": "Git no está instalado: primero se instala con winget (Windows puede pedir permiso).", - "Continue?": "¿Continuar?" + "Continue?": "¿Continuar?", + "Where is your game?": "¿Dónde está tu juego?", + "Choose the folder of your own copy, the one with {exe}.": "Elige la carpeta de tu propia copia, la que tiene {exe}.", + "Choose game folder": "Elegir la carpeta del juego" } diff --git a/tools/launcher_i18n/fr.json b/tools/launcher_i18n/fr.json index 18bc91398..8a53a9dca 100644 --- a/tools/launcher_i18n/fr.json +++ b/tools/launcher_i18n/fr.json @@ -58,7 +58,6 @@ "the runtime build": "la compilation du runtime", "PLAY": "JOUER", "Runs your own copy of GTA VI · Unofficial": "Lance votre propre copie de GTA VI · Non officiel", - "{exe} is not in the game folder.\nChoose the folder of your own copy in Settings.": "{exe} n'est pas dans le dossier du jeu.\nChoisissez le dossier de votre propre copie dans Réglages.", "Something is already running. Stop it first.": "Une tâche est déjà en cours. Arrêtez-la d'abord.", "Stopped with an error (code {code}).": "Arrêté avec une erreur (code {code}).", "Update Mandy": "Mettre à jour Mandy", @@ -105,7 +104,6 @@ "Open the screenshots folder": "Ouvrir le dossier des captures d'écran", "The F4 menu's screenshots, else the F9 captures": "Les captures d'écran du menu F4, sinon les captures F9", "This downloads about 70 MB from NVIDIA's GitHub (DLSS and Streamline, under NVIDIA's own licences).\n\nContinue?": "Cela télécharge environ 70 Mo depuis le GitHub de NVIDIA (DLSS et Streamline, sous les licences propres de NVIDIA).\n\nContinuer ?", - "Choose your game folder in Settings": "Choisissez votre dossier de jeu dans Réglages", "The game closed.": "Le jeu s'est fermé.", "Done.": "Terminé.", "Diagnostic run over: the logs folder is {folder}": "Session de diagnostic terminée : le dossier des journaux est {folder}", @@ -323,5 +321,8 @@ "Git is not installed: install it with your package manager, then press Update Mandy again.": "Git n'est pas installé : installez-le avec votre gestionnaire de paquets, puis cliquez de nouveau sur Mettre à jour Mandy.", "This copy was downloaded as a zip, so it cannot update itself. Update Mandy makes this folder a git copy of the repository: it downloads the repository, keeps a copy of every file that differs in {folder}, puts the current version in their place, then rebuilds the runtime (a few minutes). Your settings, saves and builds are not touched.": "Cette copie a été téléchargée en zip, elle ne peut donc pas se mettre à jour. Mettre à jour Mandy fait de ce dossier une copie git du dépôt : il télécharge le dépôt, garde une copie de chaque fichier différent dans {folder}, met la version actuelle à leur place, puis recompile le runtime (quelques minutes). Vos réglages, sauvegardes et compilations ne sont pas touchés.", "Git is not installed: it is installed first, with winget (Windows may ask for permission).": "Git n'est pas installé : il est d'abord installé avec winget (Windows peut demander l'autorisation).", - "Continue?": "Continuer ?" + "Continue?": "Continuer ?", + "Where is your game?": "Où est votre jeu ?", + "Choose the folder of your own copy, the one with {exe}.": "Choisissez le dossier de votre propre copie, celui qui contient {exe}.", + "Choose game folder": "Choisir le dossier du jeu" } diff --git a/tools/launcher_i18n/pt.json b/tools/launcher_i18n/pt.json index 18bd64260..5423f2636 100644 --- a/tools/launcher_i18n/pt.json +++ b/tools/launcher_i18n/pt.json @@ -58,7 +58,6 @@ "the runtime build": "a compilação do runtime", "PLAY": "JOGAR", "Runs your own copy of GTA VI · Unofficial": "Roda a sua própria cópia de GTA VI · Não oficial", - "{exe} is not in the game folder.\nChoose the folder of your own copy in Settings.": "{exe} não está na pasta do jogo.\nEscolha a pasta da sua própria cópia em Configurações.", "Something is already running. Stop it first.": "Algo já está em execução. Pare-o primeiro.", "Stopped with an error (code {code}).": "Parou com um erro (código {code}).", "Update Mandy": "Atualizar Mandy", @@ -105,7 +104,6 @@ "Open the screenshots folder": "Abrir a pasta de capturas de tela", "The F4 menu's screenshots, else the F9 captures": "As capturas de tela do menu F4; senão, as capturas F9", "This downloads about 70 MB from NVIDIA's GitHub (DLSS and Streamline, under NVIDIA's own licences).\n\nContinue?": "Isto baixa cerca de 70 MB do GitHub da NVIDIA (DLSS e Streamline, sob as licenças da própria NVIDIA).\n\nContinuar?", - "Choose your game folder in Settings": "Escolha a pasta do jogo em Configurações", "The game closed.": "O jogo fechou.", "Done.": "Concluído.", "Diagnostic run over: the logs folder is {folder}": "Execução de diagnóstico concluída: a pasta de logs é {folder}", @@ -323,5 +321,8 @@ "Git is not installed: install it with your package manager, then press Update Mandy again.": "O Git não está instalado: instale-o com o seu gerenciador de pacotes e clique de novo em Atualizar Mandy.", "This copy was downloaded as a zip, so it cannot update itself. Update Mandy makes this folder a git copy of the repository: it downloads the repository, keeps a copy of every file that differs in {folder}, puts the current version in their place, then rebuilds the runtime (a few minutes). Your settings, saves and builds are not touched.": "Esta cópia foi baixada como zip, então não consegue se atualizar. Atualizar Mandy transforma esta pasta em uma cópia git do repositório: baixa o repositório, guarda uma cópia de cada arquivo diferente em {folder}, coloca a versão atual no lugar deles e depois recompila o runtime (alguns minutos). Suas configurações, saves e compilações não são tocados.", "Git is not installed: it is installed first, with winget (Windows may ask for permission).": "O Git não está instalado: ele é instalado primeiro, com o winget (o Windows pode pedir permissão).", - "Continue?": "Continuar?" + "Continue?": "Continuar?", + "Where is your game?": "Onde está o seu jogo?", + "Choose the folder of your own copy, the one with {exe}.": "Escolha a pasta da sua própria cópia, a que tem {exe}.", + "Choose game folder": "Escolher a pasta do jogo" } diff --git a/tools/leonida_launcher.py b/tools/leonida_launcher.py index 950b4c713..e3c962eb0 100644 --- a/tools/leonida_launcher.py +++ b/tools/leonida_launcher.py @@ -2664,6 +2664,27 @@ def run_gui() -> int: justify="left", wraplength=px(420)).grid(row=play.next_row, column=0, columnspan=2, sticky="ew", padx=px(16), pady=(px(4), 0)) play.next_row += 1 + # While no game folder with the executable is set: a box that says so where PLAY is, with the button that + # picks it (refresh_hint shows or hides it; the same field as Settings' Game folder). + self.folder_box = tk.Frame(play, bg=PANEL2, highlightthickness=1, highlightbackground=WARN) + self.folder_box.grid(row=play.next_row, column=0, columnspan=2, sticky="ew", padx=px(16), + pady=(px(12), px(4))) + self.folder_box.columnconfigure(0, weight=1) + tk.Label(self.folder_box, text=t("Where is your game?"), bg=PANEL2, fg=TEXT, font=("Segoe UI", 10), + anchor="w").grid(row=0, column=0, sticky="ew", padx=px(12), pady=(px(10), 0)) + tk.Label(self.folder_box, text=t("Choose the folder of your own copy, the one with {exe}.", + exe=EXPECTED_EXE), + bg=PANEL2, fg=MUTED, font=("Segoe UI", 8), anchor="w", justify="left", + wraplength=px(380)).grid(row=1, column=0, sticky="ew", padx=px(12), pady=(px(2), 0)) + self.folder_error = tk.StringVar() + self.folder_error_label = tk.Label(self.folder_box, textvariable=self.folder_error, bg=PANEL2, fg=DANGER, + font=("Segoe UI", 8), anchor="w", justify="left", wraplength=px(380)) + self.folder_error_label.grid(row=2, column=0, sticky="ew", padx=px(12), pady=(px(2), 0)) + self.folder_error_label.grid_remove() + PrimaryButton(self.folder_box, t("Choose game folder"), self.choose_game_folder, self.k, + bg=PANEL2).grid(row=3, column=0, sticky="w", padx=px(12), pady=(px(10), px(12))) + self.folder_box.grid_remove() + play.next_row += 1 # One line while the saved profile is Series X and Windows' commit limit is under what it needs # (memory_note); refresh_hint shows or hides it. A warning only: PLAY stays as it is. self.memory_line = tk.Label(play, text="", bg=PANEL, fg=WARN, font=("Segoe UI", 8), anchor="w", @@ -3028,9 +3049,42 @@ def run_gui() -> int: if self.process is not None: self.hint_var.set("") elif not game_exe_present(self.settings["game_dir"]): - self.hint_var.set(t("Choose your game folder in Settings")) + self.hint_var.set("") else: self.hint_var.set(self.settings["game_dir"]) + box = getattr(self, "folder_box", None) + if box is not None: + if self.process is None and not game_exe_present(self.settings["game_dir"]): + box.grid() + else: + box.grid_remove() + self.folder_error.set("") + self.folder_error_label.grid_remove() + + def choose_game_folder(self): + """The Play page's Choose game folder (and PLAY without one): the folder picker; a folder with the + executable is saved at once, as Settings' Game folder; another one says so in the box and changes nothing. + True when a folder with the executable is set.""" + start = self.settings.get("game_dir") or os.path.expanduser("~") + chosen = filedialog.askdirectory(title=t("Where is your game?"), initialdir=start, mustexist=True) + if not chosen: + return False + folder = os.path.normpath(chosen) + if not game_exe_present(folder): + self.folder_error.set(t("{exe} is not in this folder", exe=EXPECTED_EXE) + ": " + folder) + self.folder_error_label.grid() + return False + if "game_dir" in self.vars: + self.vars["game_dir"].set(folder) + self.settings["game_dir"] = folder + try: + save_settings(self.settings) + except OSError as exc: + self.folder_error.set(t("Could not save: {error}", error=exc)) + self.folder_error_label.grid() + return False + self.refresh_hint() + return True def append(self, text): self.log.configure(state="normal") @@ -3054,11 +3108,7 @@ def run_gui() -> int: if self.process is not None: return self.collect_settings() - if not game_exe_present(self.settings["game_dir"]): - messagebox.showwarning(t("Game folder"), t( - "{exe} is not in the game folder.\nChoose the folder of your own copy in Settings.", - exe=EXPECTED_EXE)) - self.show("Settings") + if not game_exe_present(self.settings["game_dir"]) and not self.choose_game_folder(): return settings, extra = dict(self.settings), None if diagnostic: