"""Gallery support for converted games; never changes scripts or story progress.""" from app.translation import file_json def available(manifest: dict | None) -> bool: if not manifest or "game.json" not in manifest.get("files", {}): return False game = file_json(manifest, "game.json") if game.get("engine") not in (None, "renpy") or game.get("runtime"): return False screens = game.get("screens", {}) if game.get("build", {}).get("name") == "MIST" and "rewatchgirlselectscreen" in screens: return True def uses_gallery(value): if isinstance(value, dict): if value.get("k") == "call" and value.get("f", {}).get("k") == "name" and value["f"].get("id") in {"Gallery", "Replay"}: return True return any(uses_gallery(item) for item in value.values()) return isinstance(value, list) and any(uses_gallery(item) for item in value) return uses_gallery(game.get("init", [])) or uses_gallery(screens) or uses_gallery(game.get("defaults", []))