diff --git a/docs/launcher.md b/docs/launcher.md index 32007a1cd..2cd372da2 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -75,6 +75,10 @@ needs its line in every file, which `tests/test_leonida_launcher.py` checks (sam `game_scarlett_master.exe` is in it), the data folder (empty = the script's default) and the mods folder. `-Capture` is in the diagnostics card. + A control another choice makes pointless is greyed (its value is kept, and comes back when that choice is undone): + frame generation's mode and limit with hardware ray tracing (the scripts leave frame generation off with it; a note + says so), the DLSS mode with DLSS off, the resolution with a DLSS mode, the frame limit with frame generation off, + and shader preparation, kept on, while every pipeline is precompiled. On Linux only the game folder and Series X are used. - **Run in diagnostic mode** (Play, Settings and Tools): PLAY with `-Log` and `LEONIDA_D3D12_DRED=1`; when the game ends the logs folder opens, for the newest file to go with a report. diff --git a/tools/launcher_i18n/de.json b/tools/launcher_i18n/de.json index b9d1b7cb7..c67153f1b 100644 --- a/tools/launcher_i18n/de.json +++ b/tools/launcher_i18n/de.json @@ -205,5 +205,6 @@ "Performance": "Leistung", "Ultra performance": "Ultra-Leistung", "Series X: pick one for DLSS": "Series X: für DLSS einen wählen", - "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S nutzt DLSS von selbst, Series X den Upscaler des Spiels. Ein Modus lässt DLSS das Bild aus diesem Anteil der Zeilen zeichnen, auch auf Series X (-Dlss)." + "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S nutzt DLSS von selbst, Series X den Upscaler des Spiels. Ein Modus lässt DLSS das Bild aus diesem Anteil der Zeilen zeichnen, auch auf Series X (-Dlss).", + "Off with ray tracing for now.": "Mit Raytracing vorerst aus." } diff --git a/tools/launcher_i18n/es.json b/tools/launcher_i18n/es.json index bae27fae9..58d7be951 100644 --- a/tools/launcher_i18n/es.json +++ b/tools/launcher_i18n/es.json @@ -205,5 +205,6 @@ "Performance": "Rendimiento", "Ultra performance": "Ultra rendimiento", "Series X: pick one for DLSS": "Series X: elige uno para DLSS", - "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S usa DLSS por sí sola, Series X el reescalador del juego. Un modo hace que DLSS dibuje la imagen a partir de esa parte de las líneas, también en Series X (-Dlss)." + "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S usa DLSS por sí sola, Series X el reescalador del juego. Un modo hace que DLSS dibuje la imagen a partir de esa parte de las líneas, también en Series X (-Dlss).", + "Off with ray tracing for now.": "Desactivada con el trazado de rayos por ahora." } diff --git a/tools/launcher_i18n/fr.json b/tools/launcher_i18n/fr.json index 4e9f41600..d0ffa94ae 100644 --- a/tools/launcher_i18n/fr.json +++ b/tools/launcher_i18n/fr.json @@ -205,5 +205,6 @@ "Performance": "Performance", "Ultra performance": "Ultra performance", "Series X: pick one for DLSS": "Series X : à choisir pour DLSS", - "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto : la Series S utilise DLSS d'elle-même, la Series X l'upscaler du jeu. Un mode fait dessiner l'image par DLSS à partir de cette part des lignes, en Series X aussi (-Dlss)." + "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto : la Series S utilise DLSS d'elle-même, la Series X l'upscaler du jeu. Un mode fait dessiner l'image par DLSS à partir de cette part des lignes, en Series X aussi (-Dlss).", + "Off with ray tracing for now.": "Désactivée avec le ray tracing pour l'instant." } diff --git a/tools/launcher_i18n/pt.json b/tools/launcher_i18n/pt.json index edcfe9a7e..9fb5818be 100644 --- a/tools/launcher_i18n/pt.json +++ b/tools/launcher_i18n/pt.json @@ -205,5 +205,6 @@ "Performance": "Desempenho", "Ultra performance": "Ultra desempenho", "Series X: pick one for DLSS": "Series X: escolha um para o DLSS", - "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: a Series S usa o DLSS sozinha, a Series X o upscaler do próprio jogo. Um modo faz o DLSS desenhar a imagem a partir dessa parte das linhas, também na Series X (-Dlss)." + "Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: a Series S usa o DLSS sozinha, a Series X o upscaler do próprio jogo. Um modo faz o DLSS desenhar a imagem a partir dessa parte das linhas, também na Series X (-Dlss).", + "Off with ray tracing for now.": "Desligada com o ray tracing por enquanto." } diff --git a/tools/leonida_launcher.py b/tools/leonida_launcher.py index ca97dd4b9..e65c5924e 100644 --- a/tools/leonida_launcher.py +++ b/tools/leonida_launcher.py @@ -792,6 +792,7 @@ def run_gui() -> int: takefocus=1) self.var = var self.focused = False + self.active = True self.bind("", lambda _e: self.flip()) self.bind("", lambda _e: self.flip()) self.bind("", lambda _e: self.set_focus(True)) @@ -804,14 +805,33 @@ def run_gui() -> int: self.draw() def flip(self): + if not self.active: + return self.focus_set() self.var.set(not self.var.get()) + def enabled(self, flag): + """Greyed and deaf to clicks and the space bar when off; the value stays as it is.""" + flag = bool(flag) + if flag != self.active: + self.active = flag + self.configure(cursor="hand2" if flag else "arrow", takefocus=1 if flag else 0) + self.draw() + def draw(self): self.delete("all") on = bool(self.var.get()) w, h = self.w, self.h r = h // 2 + if not self.active: + track = blend(VIOLET, PANEL, 0.55) if on else "#2a2547" + self.create_oval(0, 0, h - 1, h - 1, fill=track, outline="") + self.create_oval(w - h, 0, w - 1, h - 1, fill=track, outline="") + self.create_rectangle(r, 0, w - r, h - 1, fill=track, outline="") + pad = max(3, h // 7) + x = w - h + pad if on else pad + self.create_oval(x, pad, x + h - 2 * pad, h - pad, fill="#6b6590", outline="") + return if on: self.create_oval(0, 0, h - 1, h - 1, fill=VIOLET, outline="") self.create_oval(w - h, 0, w - 1, h - 1, fill=PINK, outline="") @@ -835,21 +855,35 @@ def run_gui() -> int: def __init__(self, parent, var, options, k): super().__init__(parent, bg=LINE) self.var = var + self.active = True self.labels: dict = {} for index, (value, text) in enumerate(options): label = tk.Label(self, text=text, bg=PANEL, fg=MUTED, font=("Segoe UI", 9), padx=int(10 * k), pady=int(3 * k), cursor="hand2") label.pack(side="left", padx=(1 if index == 0 else 0, 1), pady=1) - label.bind("", lambda _e, v=value: var.set(v)) + label.bind("", lambda _e, v=value: self.active and var.set(v)) self.labels[value] = label var.trace_add("write", lambda *_: self.draw()) self.draw() + def enabled(self, flag): + """Greyed and deaf to clicks when off; the choice stays as it is.""" + flag = bool(flag) + if flag != self.active: + self.active = flag + for label in self.labels.values(): + label.configure(cursor="hand2" if flag else "arrow") + self.draw() + def draw(self): current = self.var.get() for value, label in self.labels.items(): chosen = value == current - label.configure(bg=VIOLET if chosen else PANEL, fg=ON_ACCENT if chosen else MUTED) + if self.active: + label.configure(bg=VIOLET if chosen else PANEL, fg=ON_ACCENT if chosen else MUTED) + else: + label.configure(bg=blend(VIOLET, PANEL, 0.55) if chosen else PANEL, + fg=blend(ON_ACCENT, PANEL, 0.4) if chosen else "#6b6590") class Tip: """The longer text of an option, shown when the pointer rests on it ("Hover any option for what it does").""" @@ -955,6 +989,7 @@ def run_gui() -> int: self.language_shown = self.settings["language"] self.vars: dict = {} self.choices: dict = {} # a drop-down's shown text -> its value, by setting + self.controls: dict = {} # the Settings control of a setting, for apply_rules self.nav_buttons: dict = {} self.current = "" self.style() @@ -996,7 +1031,8 @@ def run_gui() -> int: s.map("Accent.TButton", background=[("active", ACCENT_HOVER), ("disabled", LINE)]) s.configure("TEntry", insertcolor=TEXT, padding=px(5)) s.configure("TCombobox", arrowcolor=TEXT, padding=px(4), fieldbackground=PANEL2, background=PANEL2) - s.map("TCombobox", fieldbackground=[("readonly", PANEL2)], foreground=[("readonly", TEXT)], + s.map("TCombobox", fieldbackground=[("disabled", PANEL), ("readonly", PANEL2)], + foreground=[("disabled", "#6b6590"), ("readonly", TEXT)], arrowcolor=[("disabled", "#6b6590")], selectbackground=[("readonly", PANEL2)], selectforeground=[("readonly", TEXT)], background=[("readonly", PANEL2)]) self.root.option_add("*TCombobox*Listbox.background", PANEL2) @@ -1655,12 +1691,15 @@ def run_gui() -> int: def toggle(self, card, key, label, small=None, tip=None): var = tk.BooleanVar(value=self.settings[key]) self.vars[key] = var - return self.option(card, label, small, lambda parent: Toggle(parent, var, self.k), tip) + self.controls[key] = self.option(card, label, small, lambda parent: Toggle(parent, var, self.k), tip) + return self.controls[key] def segmented(self, card, key, value, label, options, small=None, tip=None): var = tk.StringVar(value=value) self.vars[key] = var - return self.option(card, label, small, lambda parent: Segmented(parent, var, options, self.k), tip) + self.controls[key] = self.option(card, label, small, lambda parent: Segmented(parent, var, options, + self.k), tip) + return self.controls[key] def select(self, card, key, value, label, options, small=None, tip=None, width=12): """A drop-down list; `options` are (value, label) and collect_settings reads the value back.""" @@ -1668,9 +1707,10 @@ def run_gui() -> int: var = tk.StringVar(value=names.get(value, options[0][1])) self.vars[key] = var self.choices[key] = {text: v for v, text in options} - return self.option(card, label, small, lambda parent: ttk.Combobox( + self.controls[key] = self.option(card, label, small, lambda parent: ttk.Combobox( parent, textvariable=var, state="readonly", width=width, values=[text for _v, text in options]), tip) + return self.controls[key] def folder(self, card, key, label, tip): var = tk.StringVar(value=self.settings[key]) @@ -1736,6 +1776,12 @@ def run_gui() -> int: "frames shown to it; No limit leaves them free.")) self.toggle(frames, "smooth_motion", "Smooth Motion", "RTX 40 / 50", t("NVIDIA's driver doubles the frames shown (RTX 40 and 50). A trial.")) + # Shown with hardware ray tracing: the scripts leave frame generation off with it (LEONIDA_FG_WITH_RT=1 in + # the advanced options starts it anyway). + self.fg_note = tk.Label(frames, text=t("Off with ray tracing for now."), bg=PANEL, fg=WARN, anchor="w", + justify="left", font=("Segoe UI", 8)) + self.fg_note.grid(row=frames.next_row, column=0, columnspan=2, sticky="w", padx=px(16)) + frames.next_row += 1 self.card_end(frames) rays = self.card(inner, 2, 0, t("Ray tracing"), "\u2726", t("Off by default.")) @@ -1772,6 +1818,8 @@ def run_gui() -> int: self.vars["precompile_all"].trace_add("write", precompile_all_changed) self.vars["precompile"].trace_add( "write", lambda *_: self.vars["precompile"].get() or self.vars["precompile_all"].set(False)) + for key in ("rt", "dlss", "dlss_mode", "fg_mode", "precompile_all", "precompile"): + self.vars[key].trace_add("write", lambda *_: self.apply_rules()) diag = self.card(inner, 3, 0, t("General, diagnostics & advanced"), "\u2301", t("For bug reports. Nothing here changes how the game looks."), wide=True) @@ -1843,6 +1891,41 @@ def run_gui() -> int: legend.bind("", lambda e: e.widget.configure(wraplength=max(px(200), e.width - 4))) self.check_game() self.check_advanced() + self.apply_rules() + + def set_enabled(self, key, flag): + control = self.controls.get(key) + if control is None: + return + if isinstance(control, ttk.Combobox): + control.state(["!disabled"] if flag else ["disabled"]) + else: + control.enabled(flag) + + def apply_rules(self): + """Greys what the other choices make pointless, from the controls' values: only the controls change, never + a value, so turning the other choice back brings the earlier one back. + - hardware ray tracing: frame generation's mode and limit (the scripts leave it off with ray tracing); + - DLSS off: the DLSS mode; DLSS with a mode: the resolution (switch_args leaves it out); + - frame generation off: its limit; + - every pipeline precompiled: shader preparation stays on (it needs it).""" + v = self.vars + if "rt" not in v or "precompile_all" not in v: + return + hw = v["rt"].get() == "hw" + fg_off = v["fg_mode"].get() == "off" + dlss_on = bool(v["dlss"].get()) + mode = self.choices.get("dlss_mode", {}).get(v["dlss_mode"].get(), "") + self.set_enabled("fg_mode", not hw) + self.set_enabled("fg_limit", not hw and not fg_off) + self.set_enabled("dlss_mode", dlss_on) + self.set_enabled("resolution", not (dlss_on and mode)) + self.set_enabled("precompile", not v["precompile_all"].get()) + if getattr(self, "fg_note", None) is not None: + if hw: + self.fg_note.grid() + else: + self.fg_note.grid_remove() def browse(self, var): chosen = filedialog.askdirectory(initialdir=var.get() or os.path.expanduser("~"))