From f41f6f4e6a52299cf4fea7d7186b90c24b4cd6db Mon Sep 17 00:00:00 2001 From: evrydayjunglist Date: Thu, 12 Nov 2026 16:31:48 -0800 Subject: [PATCH 1/4] fix: catch a game client LocalExile refuses, and open Game client from the folder list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A source copy updated past its client (LocalExile main runs 3.29.3c and 3.29.3d; the folder still held 3.29.3b) failed at Start servers with LocalExile's stack trace, and its user had no way to the Game client window: the link was only on a release's Play page, which Advanced mode leaves out. - Game client… is a row of the sidebar's folder list: one place, for a release and a source copy, in Simple and in Advanced mode. The Play page's standing link is gone; it shows there only when LocalExile refused the client in the last run. - The sidebar marks a client its LocalExile does not run (warning sign and colour in the box, "does not fit" on the list's row). - The Game client window says "does not fit this LocalExile" on such a client, names the versions LocalExile runs, and offers "Use another client…" when one that fits is on this PC: the move a Play would make, with nothing started after it. On a source copy the window lists the clients; it has no Steam download there yet (the adapter prepares only a standalone client) and no copy of a linked client. - Start servers on a source copy gets the client check Play has, since live.ps1 reads the game data from the client first. Not with Skip data check; after a Not now it goes on and does not ask again. - LocalExile's refusal is recognized in live.ps1's output (wrapped by PowerShell) and in a release launcher's error: the run's last line, Control's status line and the Play page say it in plain words. Co-Authored-By: Claude Fable 5.2 --- docs/launcher.md | 27 +++++++- src/Launcher.Core/ClientExtractionFailure.cs | 17 +++++ src/Launcher.Core/Resources/Strings.resx | 27 ++++++++ src/Launcher.Core/Resources/Strings.ru.resx | 27 ++++++++ .../Resources/Strings.zh-CN.resx | 27 ++++++++ src/Waypoint.Linux/Views/ControlTab.axaml.cs | 28 ++++++-- src/Waypoint.Linux/Views/InstallTab.axaml.cs | 1 + src/Waypoint.Linux/Views/PlayTab.axaml.cs | 1 + src/Waypoint/ClientVersionsWindow.cs | 65 ++++++++++++++++--- src/Waypoint/ControlTab.xaml | 4 +- src/Waypoint/ControlTab.xaml.cs | 43 ++++++++++-- src/Waypoint/FolderList.cs | 21 +++++- src/Waypoint/FolderPicker.xaml | 20 +++++- src/Waypoint/FolderPicker.xaml.cs | 51 +++++++++++---- src/Waypoint/InstallTab.xaml | 3 +- src/Waypoint/InstallTab.xaml.cs | 42 ++++++++++-- src/Waypoint/LiveScript.cs | 4 ++ src/Waypoint/MainWindow.xaml.cs | 23 +++++++ src/Waypoint/PlayTab.xaml.cs | 1 + .../ClientExtractionFailureTests.cs | 19 ++++++ 20 files changed, 407 insertions(+), 44 deletions(-) diff --git a/docs/launcher.md b/docs/launcher.md index 93a4f73..98e374e 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -165,6 +165,11 @@ client's version beside its name, and a click on one starts Waypoint again on it LocalExile gives that build ([Game client builds](#game-client-builds)); a folder with no client, or a client of a build nothing names, shows none. A release's Play page says the same beside LocalExile's version. A click on a folder starts Waypoint again on it ([Copies and changing folder](#copies-and-changing-folder)). +A client of a version the folder's LocalExile does not run (`FolderList.ClientFits`: after an update of LocalExile that left +the client behind) shows in the warning colour, with a warning sign in the box and "does not fit" on its row of the list. +**Game client…** under the list opens the Game client window for the folder in use +([The game client from Steam](#the-game-client-from-steam)): the one way to it, the same for a release and a source copy, +in Simple and in Advanced mode. **Add a folder you already have…** under the list takes a checkout or a release install that is already on this PC. **Change folder…** on a release's Versions and **Change…** on Control do the same. **Set up a new copy…** in the list, on Control and on a release's Versions opens the setup guide on its source route, which clones LocalExile with git into a @@ -672,7 +677,15 @@ LocalExile runs that one, and otherwise the newest it runs. The rule: a player who has a client of a version current LocalExile runs (3.29.3c or 3.29.3d) plays on it; one who has only 3.29.3b keeps the last LocalExile for it. Waypoint -looks when a folder is about to start the game (Play, and Control's Play or Start game; not Start servers, a restart or a stop). +looks when a folder is about to start the game (Play, and Control's Play or Start game), and before a source copy's Start +servers, because `live.ps1` first reads the game data from the client and LocalExile refuses a client it does not run. Start +servers is not checked with **Skip data check** (nothing is read from the client then), and after a Not now it goes on and +is not asked again while Waypoint runs: the servers can run without the game, and LocalExile's own check has the last word. +A restart of one server and a stop are never checked. +When LocalExile refuses the client all the same (`ClientExtractionFailure.IsBuildRefusal`: its allowed-builds sentence in +`live.ps1`'s output, which PowerShell wraps, or a release launcher's error), the run's last line and Control's status line +say so in plain words and point to **Game client** in the folder list; a release's Play page says it under Play, with a +**Game client…** link that shows only then. It looks at that folder's client and, when it matters, takes a quick look (two seconds: the player's other LocalExile folders and the usual places first, a plain client before one another LocalExile prepared) for a client of another build. Clients it merely finds are never changed. `ClientUpdate` decides: @@ -790,9 +803,19 @@ unqualified Unix path would land on that drive, while `Z:` is the root in every ### The game client from Steam The official launcher only ever gives the newest game, so once the game moves on, the versions LocalExile runs can no -longer be had from it. Steam still serves them, and a release's **Game client…** (under Play; `ClientVersionsWindow`) gets +longer be had from it. Steam still serves them, and **Game client…** (in the sidebar's folder list; `ClientVersionsWindow`) +gets, for a release, one with the user's own Steam account. Windows on x64 only for now. +- **A source copy** has the window too, with its list. It gets no Steam download yet (the line beside the button says so): + the adapter prepares only a standalone client for a checkout (`Prepare-Client` in `scripts/RuntimeBridge.ps1`). Its + linked client gets no warning and no **Make a copy…**: those are the release launcher's, and a developer links on purpose. +- **A client that is no version this LocalExile runs** (none of the builds it lists; for a LocalExile with no list, a + version it does not name) says "does not fit this LocalExile" on its line, and the line under the list names the versions + it runs. When a quick look finds a client that fits on this PC (`ClientUpdate.Check`, as before a Play), that line says + where, and **Use another client…** is the primary button: the window closes and the move a Play would make is carried out + with nothing started after it (`ControlTab.MoveClientAsync` on a source copy, where the setup guide brings the client; + `InstallTab.MoveClientAsync` on a release, where LocalExile's own setup copies it in). Its question names both folders. - **The window says little by itself.** Its title and its list carry what it is; no sentence explains it. A button beside the list shows only for the line it applies to; the one button that is the likely next step has the primary style (`Enable`, `Lead`: the chosen line's own action when it can run, else **Make a copy…**, else **Download a diff --git a/src/Launcher.Core/ClientExtractionFailure.cs b/src/Launcher.Core/ClientExtractionFailure.cs index 4e64382..52e7357 100644 --- a/src/Launcher.Core/ClientExtractionFailure.cs +++ b/src/Launcher.Core/ClientExtractionFailure.cs @@ -8,6 +8,23 @@ public static class ClientExtractionFailure public static bool IsHncFailure(string? message) => message?.Contains("HNC mask not found", StringComparison.OrdinalIgnoreCase) == true; + /// LocalExile's own refusal of a game client that is no build it runs: the sentence of its allowed-builds + /// check (ClientBuilds.Require, which live.ps1's data extraction and the Auth tools go through), and + /// those of a release's launcher (ClientInstall.FindExecutable, ClientFiles.Problem). The words are + /// LocalExile's, so a change of them there is a change here. PowerShell wraps live.ps1's error at the width of + /// its console, so the sentence arrives in pieces: the exception's name and either end of the sentence each count. + public static bool IsBuildRefusal(string? message) => + message is not null && BuildRefusals.Any(words => message.Contains(words, StringComparison.OrdinalIgnoreCase)); + + static readonly string[] BuildRefusals = + [ + "UnknownClientBuildException", "is not a Path of Exile executable", "refuses any other build", + "other versions do not work", "is a Steam install of another build", "mixes two builds", + ]; + + /// What a refused client is, in plain words; the view that says it adds where its user changes the client. + public static string Refused => L.Text("This folder's game client is not a version this LocalExile runs."); + public static string RecoveryHint => L.Text("Client setup needs attention. Run setup guide below to recheck and refresh it, then try Play again."); public static string Describe(string checkout, string failure) diff --git a/src/Launcher.Core/Resources/Strings.resx b/src/Launcher.Core/Resources/Strings.resx index 53d1a15..7f7274c 100644 --- a/src/Launcher.Core/Resources/Strings.resx +++ b/src/Launcher.Core/Resources/Strings.resx @@ -1261,6 +1261,9 @@ Close the game and anything else using that folder, then try again. Could not verify services before exiting. + + {0}: does not fit + {0}, {1:0.#} GB, is deleted for good. The version in use is not touched. @@ -2539,6 +2542,9 @@ This checkout has modified tracked files. Power symbols + + This folder's game client is not a version this LocalExile runs. + Gold door @@ -3249,6 +3255,9 @@ Current saves are unchanged. This backup will no longer be available to restore. The league card links contain a cycle. + + Choose Game client in the folder list to change it. + Set up again… @@ -4173,6 +4182,9 @@ Switching to it builds and runs that code on this computer with your rights, liv The one client becomes the other version. Only what differs is downloaded and it needs no more room, but the version it was is gone. + + This LocalExile runs Path of Exile {0}. + Commands go through the game client (scripts/dev/client_control.py): start the game and enter an area first. @@ -4563,6 +4575,9 @@ Switching to it builds and runs that code on this computer with your rights, liv LocalExile v0.4.2-beta, which this Waypoint is known to work with. You can move to the newest changes later from Versions. + + Use another client… + Done: {0} ({1:0} s). @@ -5309,6 +5324,9 @@ Dependencies: {3} Bring your characters to Latest? + + Waypoint cannot prepare a client from Steam for a source copy yet. + Exit stops this checkout’s services before closing Waypoint. If the game is open, you can cancel or leave everything running. @@ -6258,6 +6276,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Original module icons + + The game clients of this LocalExile folder: which version it uses, and the way to another + {0} checkouts match upstream HEAD. Choose one below, or Browse elsewhere. @@ -7136,6 +7157,9 @@ Client: {2} Save league settings before applying module choices. + + A {0} client is on this PC: {1} + Close the game and stop your current LocalExile first. @@ -8196,6 +8220,9 @@ Dependencies: {2} Select a LocalExile checkout in Settings. + + does not fit this LocalExile + No branches or PRs match. Clear or change your search, or use a PR number below. diff --git a/src/Launcher.Core/Resources/Strings.ru.resx b/src/Launcher.Core/Resources/Strings.ru.resx index 377de09..cb4574d 100644 --- a/src/Launcher.Core/Resources/Strings.ru.resx +++ b/src/Launcher.Core/Resources/Strings.ru.resx @@ -1261,6 +1261,9 @@ Не удалось проверить службы перед выходом. + + {0}: не подходит + {0}, {1:0.#} ГБ, будет удалена безвозвратно. Используемая версия не затрагивается. @@ -2539,6 +2542,9 @@ Символы силы + + Клиент игры в этой папке — не та версия, с которой работает этот LocalExile. + Золотая дверь @@ -3249,6 +3255,9 @@ Связи карточек лиг образуют цикл. + + Чтобы сменить его, выберите «Клиент игры» в списке папок. + Настроить заново… @@ -4173,6 +4182,9 @@ Единственный клиент становится другой версией. Загружаются только отличия, дополнительное место не нужно, но прежняя версия не сохраняется. + + Этот LocalExile работает с Path of Exile {0}. + Команды проходят через игровой клиент (scripts/dev/client_control.py): сначала запустите игру и войдите в область. @@ -4563,6 +4575,9 @@ LocalExile v0.4.2-beta, с которым точно работает этот Waypoint. Перейти на последние изменения можно позже в разделе «Версии». + + Использовать другой клиент… + Готово: {0} ({1:0} с). @@ -5309,6 +5324,9 @@ Перенести персонажей в «Новейшую»? + + Waypoint пока не умеет подготавливать клиент из Steam для копии исходного кода. + При выходе Waypoint сначала остановит службы этой рабочей копии. Если игра открыта, можно отменить выход или оставить всё работающим. @@ -6258,6 +6276,9 @@ Исходные значки модулей + + Клиенты игры этой папки LocalExile: какая версия используется и как перейти на другую + Репозиториев с HEAD LocalExile: {0}. Выберите один ниже или укажите другую папку. @@ -7136,6 +7157,9 @@ Сохраните настройки лиги перед применением выбора модулей. + + На этом ПК есть клиент {0}: {1} + Сначала закройте игру и остановите текущий LocalExile. @@ -8196,6 +8220,9 @@ Выберите репозиторий LocalExile в настройках. + + не подходит к этому LocalExile + Ветки и PR не найдены. Очистите или измените поиск либо введите номер PR ниже. diff --git a/src/Launcher.Core/Resources/Strings.zh-CN.resx b/src/Launcher.Core/Resources/Strings.zh-CN.resx index 8a429bf..ca7719d 100644 --- a/src/Launcher.Core/Resources/Strings.zh-CN.resx +++ b/src/Launcher.Core/Resources/Strings.zh-CN.resx @@ -1261,6 +1261,9 @@ 退出前无法验证服务状态。 + + {0}:不匹配 + {0}({1:0.#} GB)将被永久删除。正在使用的版本不受影响。 @@ -2539,6 +2542,9 @@ 力量符文 + + 此文件夹中的游戏客户端不是这个 LocalExile 支持的版本。 + 金色之门 @@ -3249,6 +3255,9 @@ 联赛卡片的关联存在循环。 + + 要更换它,请在文件夹列表中选择“游戏客户端”。 + 重新设置… @@ -4173,6 +4182,9 @@ 现有的这一个客户端变为另一个版本。只下载有差异的部分,不需要额外空间,但原来的版本不再保留。 + + 这个 LocalExile 支持 Path of Exile {0}。 + 命令通过游戏客户端发送(scripts/dev/client_control.py):请先启动游戏并进入一个区域。 @@ -4563,6 +4575,9 @@ LocalExile v0.4.2-beta,已知可与此 Waypoint 正常配合。之后可以在“版本”部分改用最新更改。 + + 使用其他客户端… + 完成:{0}({1:0} 秒)。 @@ -5309,6 +5324,9 @@ 把你的角色迁移到最新版? + + Waypoint 目前还无法为源代码副本准备来自 Steam 的客户端。 + 退出时会先停止此源码副本的服务,再关闭 Waypoint。如果游戏处于打开状态,你可以取消,或让一切保持运行。 @@ -6258,6 +6276,9 @@ 原始模块图标 + + 此 LocalExile 文件夹的游戏客户端:正在使用哪个版本,以及如何换成另一个 + {0} 个源码副本与上游 HEAD 一致。请在下方选择一个,或“浏览”其他位置。 @@ -7136,6 +7157,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 请先保存赛季设置,再应用模块选择。 + + 此电脑上有 {0} 客户端:{1} + 请先关闭游戏并停止当前的 LocalExile。 @@ -8196,6 +8220,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 请在“设置”中选择 LocalExile 源码副本。 + + 与此 LocalExile 不匹配 + 没有匹配的分支或 PR。请清除或更改搜索,或使用下方的 PR 编号。 diff --git a/src/Waypoint.Linux/Views/ControlTab.axaml.cs b/src/Waypoint.Linux/Views/ControlTab.axaml.cs index c054875..3e735bf 100644 --- a/src/Waypoint.Linux/Views/ControlTab.axaml.cs +++ b/src/Waypoint.Linux/Views/ControlTab.axaml.cs @@ -243,11 +243,14 @@ async Task PortsFree(LiveRequest request) /// A start of the game with a client of another build than the checkout's LocalExile would fail at the login /// (). A move to a client found elsewhere is asked once: an older client in this copy is then taken /// out and the guide brings the found one; a copy on an older version of its own goes to the newest changes. A player who has - /// nothing newer than an older client is asked about the older version. Starts without the game (servers, a restart, a stop) - /// go on as before. + /// nothing newer than an older client is asked about the older version. Start servers is checked as well, because + /// live.ps1 reads the game data from the client first and LocalExile refuses a client it does not run; not with Skip data + /// check, which reads nothing from it, and only until its user has answered once (). A + /// restart of one server and a stop go on as before. async Task ClientFits(LiveRequest request, bool again = false) { - if (request.Mode is not (LiveMode.All or LiveMode.Client)) return true; + bool servers = request.Mode == LiveMode.Servers && !request.NoExtract && !_serversAnswered; + if (request.Mode is not (LiveMode.All or LiveMode.Client) && !servers) return true; if (_checking) return false; _checking = true; try { return await ClientFitsNow(request, again); } @@ -257,6 +260,10 @@ async Task ClientFits(LiveRequest request, bool again = false) /// A Play is being checked (): a second one waits for nothing and starts nothing. bool _checking; + /// The user said no to what the check offered before a Start servers. The servers can run without the game, so + /// that start goes on, LocalExile's own check has the last word, and Start servers does not ask again while Waypoint runs. + bool _serversAnswered; + async Task ClientFitsNow(LiveRequest request, bool again) { var owner = Owner; @@ -293,6 +300,11 @@ async Task ClientFitsNow(LiveRequest request, bool again) Dialog.Tell(owner, DialogKind.Warning, ClientUpdate.Title(plan!), ClientUpdate.Explain(plan!) + "\n\n" + ClientUpdate.HowToUpdateCopy); return false; default: + if (request.Mode == LiveMode.Servers) + { + _serversAnswered = true; + return true; + } Say(() => L.Text("Not started: the game client does not fit this LocalExile.")); return false; } @@ -318,13 +330,15 @@ void OpenGuideWith(string? client) Append($"> {request.Describe()}"); Say(() => L.Text("Running {0} …", request.Describe())); var started = Stopwatch.StartNew(); - int clientSetupFailure = 0; + int clientSetupFailure = 0, clientRefused = 0; int? code = await run(request, line => { if (ClientExtractionFailure.IsHncFailure(line)) Interlocked.Exchange(ref clientSetupFailure, 1); + if (ClientExtractionFailure.IsBuildRefusal(line)) Interlocked.Exchange(ref clientRefused, 1); Dispatcher.UIThread.Post(() => Append(line)); }); ClientSetupFailed = code is not (null or 0) && clientSetupFailure != 0; + ClientRefused = code is not (null or 0) && clientRefused != 0; // The game started on this copy: the release its user wanted removed later is asked about once the game is closed. if (code == 0 && request.Mode is (LiveMode.All or LiveMode.Client) && Editions.PlayedOn(_shared.Settings, Environment.CurrentDirectory)) _shared.Settings.Save(); double seconds = started.Elapsed.TotalSeconds; @@ -332,6 +346,8 @@ void OpenGuideWith(string? client) { null => L.Text("live.ps1 is already running."), 0 => L.Text("Done: {0} ({1:0} s).", request.Describe(), seconds), + // LocalExile's own check refused the client: said in plain words, the stack trace stays in the output. + _ when ClientRefused => ClientExtractionFailure.Refused, _ => L.Text("Failed: {0} exited with {1}; see the output and the Logs section.", request.Describe(), code), }); Append(code is null ? "" : $"(exit {code})"); @@ -347,6 +363,10 @@ async void Play(object? sender, RoutedEventArgs e) /// The last Play attempt failed with the recognized client preparation error. internal bool ClientSetupFailed { get; private set; } + /// The last run failed because LocalExile refused the folder's game client as a build it does not run + /// (). + internal bool ClientRefused { get; private set; } + /// Play: also what the Versions section starts after a switch, and Simple mode's Play. The exit code of the run; /// null when none ran. internal async Task PlayAsync() diff --git a/src/Waypoint.Linux/Views/InstallTab.axaml.cs b/src/Waypoint.Linux/Views/InstallTab.axaml.cs index b660ed6..b9e6ada 100644 --- a/src/Waypoint.Linux/Views/InstallTab.axaml.cs +++ b/src/Waypoint.Linux/Views/InstallTab.axaml.cs @@ -526,6 +526,7 @@ void Finished(LocalExileResult? result, string? failure) _row?.Show(SetupState.Failed, reason ?? ""); _note = ClientExtractionFailure.IsHncFailure(failure ?? result?.Error) ? () => ClientExtractionFailure.RecoveryHint + : ClientExtractionFailure.IsBuildRefusal(failure ?? result?.Error) ? () => ClientExtractionFailure.Refused : () => L.Text("The game didn't start.") + (reason is null ? "" : "\n" + reason); } diff --git a/src/Waypoint.Linux/Views/PlayTab.axaml.cs b/src/Waypoint.Linux/Views/PlayTab.axaml.cs index df96e39..01481e3 100644 --- a/src/Waypoint.Linux/Views/PlayTab.axaml.cs +++ b/src/Waypoint.Linux/Views/PlayTab.axaml.cs @@ -145,6 +145,7 @@ async Task PlayAsync() _failed = code is not (null or 0); if (_failed) _note = _control.ClientSetupFailed ? () => ClientExtractionFailure.RecoveryHint + : _control.ClientRefused ? () => ClientExtractionFailure.Refused : () => L.Text("The game didn't start."); } finally diff --git a/src/Waypoint/ClientVersionsWindow.cs b/src/Waypoint/ClientVersionsWindow.cs index a2c42ea..61c2da0 100644 --- a/src/Waypoint/ClientVersionsWindow.cs +++ b/src/Waypoint/ClientVersionsWindow.cs @@ -19,6 +19,10 @@ namespace Waypoint; /// QR code () or, from there, by its own password prompt. With a client already there, how /// to move is asked each time (update the one client where it is, or keep both) unless Settings names one. Nothing here /// runs while the game or a server runs, and LocalExile's own setup prepares a client that just came in. +/// It opens from the sidebar's folder list, for a release and for a source copy, in every mode. A client that is +/// no version its LocalExile runs says so on its line, and when a client that fits is on this PC, "Use another +/// client…" hands over to the move that comes before a Play (). A source copy gets no Steam +/// download: Waypoint's adapter prepares only a standalone client for it. /// sealed class ClientVersionsWindow : FormWindow { @@ -58,7 +62,13 @@ sealed record Row(KnownFolder Folder, string Client, ClientLayout Files, bool In readonly TextBlock _note = new() { Margin = new Thickness(12, 0, 0, 0), Visibility = Visibility.Collapsed, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center }; /// The Steam account a download uses, once there is one. readonly TextBlock _steam = new() { Margin = new Thickness(0, 0, 10, 0), VerticalAlignment = VerticalAlignment.Center }; - readonly Button _use, _copy, _delete, _open, _download, _forget, _stopButton, _close; + readonly Button _use, _move, _copy, _delete, _open, _download, _forget, _stopButton, _close; + /// The folder in use is a source copy: no Steam download and no copy of a linked client, which are a release's. + readonly bool _source = !Repo.IsInstall; + /// The versions the folder's LocalExile runs, oldest first; empty when nothing says. + IReadOnlyList _runs = []; + /// For a client in use that is no version its LocalExile runs: the move to one found on this PC, when there is one. + ClientUpdate.Plan? _plan; /// The copy the folder in use can have in place of a link to a game folder outside LocalExile (). OwnClient.Plan? _linked; IReadOnlyList? _builds; @@ -84,6 +94,10 @@ sealed record Row(KnownFolder Folder, string Client, ClientLayout Files, bool In /// question and progress, once this window is closed. public bool CopyRequested { get; private set; } + /// The user asked for another client in place of one this LocalExile does not run: what opened this window + /// carries the move out once it is closed, with the question and the steps a Play would have. + public bool MoveRequested { get; private set; } + static ClientVersionsWindow() { DepotTool.Bundled ??= () => typeof(ClientVersionsWindow).Assembly.GetManifestResourceStream("Bundled/DepotDownloader.zip"); @@ -140,11 +154,12 @@ public ClientVersionsWindow(Window? owner, Shared shared, bool downloadNewest = // Beside the list: only the buttons the chosen line has a use for. _use = Action(L.Text("Use this version"), () => _ = UseAsync()); + _move = Action(L.Text("Use another client…"), () => { MoveRequested = true; Close(); }); _copy = Action(L.Text("Make a copy…"), () => { CopyRequested = true; Close(); }); _delete = Action(L.Text("Delete this copy…"), () => _ = DeleteAsync()); _open = Action(L.Text("Open folder"), OpenFolder); var buttons = new StackPanel { Width = 170 }; - foreach (var button in new[] { _use, _copy, _delete, _open }) + foreach (var button in new[] { _use, _move, _copy, _delete, _open }) { button.Visibility = Visibility.Collapsed; buttons.Children.Add(button); @@ -221,7 +236,7 @@ async Task RefreshAsync() { string? chosen = Selected?.Client; var paths = FolderList.Paths(_shared.Settings, _folder); - var (layout, current, unfinished, builds, rows, started, linked, tooOld) = await Task.Run(() => + var (layout, current, unfinished, builds, rows, started, linked, tooOld, runs, plan) = await Task.Run(() => { // In the background, with its user looking: a launcher that failed to answer earlier is asked once more. var listed = LocalExileBuilds.Of(_folder, again: true); @@ -256,11 +271,16 @@ async Task RefreshAsync() or System.ComponentModel.Win32Exception or System.Security.SecurityException or AggregateException) { } } string next = Path.Combine(_folder, ClientVersions.NextFolder); + // A client that is no version this LocalExile runs: a quick look for one that is, as before a Play. + var mine = found.FirstOrDefault(r => r.Here && r.InUse); + IReadOnlyList versions = [.. ClientLocator.Supported(_folder).Reverse()]; + var move = mine is not null && !Fits(mine, listed, versions) ? ClientUpdate.Check(_folder) : null; return (ClientVersions.Layout(_folder), FolderList.ClientOf(_folder), ClientVersions.UnfinishedBuild(_folder), listed, found, - Directory.Exists(next) ? ClientVersions.SizeOf(next) : 0, OwnClient.Check(_folder), LocalExileBuilds.TooOld(_folder)); + Directory.Exists(next) ? ClientVersions.SizeOf(next) : 0, _source ? null : OwnClient.Check(_folder), LocalExileBuilds.TooOld(_folder), versions, move); }); _started = started; _linked = linked; + (_runs, _plan) = (runs, plan); (_layout, _current, _unfinished, _unfinishedHash, _builds) = (layout, current, unfinished?.Version, unfinished?.ExecutableSha256, builds); _currentBuild = rows.FirstOrDefault(r => r.Here && r.InUse)?.Build; // A copy set aside half-way is not that build whole: the build stays on offer. @@ -281,7 +301,8 @@ async Task RefreshAsync() _list.SelectedItem = lines.FirstOrDefault(item => ((Row)item.Tag).Client == chosen) ?? lines.FirstOrDefault(item => ((Row)item.Tag).Here); // Beside the download button: only why it is off, or what it will go on from. - string note = !DepotTool.Supported ? L.Text("The Steam download works on 64-bit Windows only for now.") + string note = _source ? L.Text("Waypoint cannot prepare a client from Steam for a source copy yet.") + : !DepotTool.Supported ? L.Text("The Steam download works on 64-bit Windows only for now.") // No list is a LocalExile from before it had one, or one that did not answer just now: not the same thing. : builds is null ? (tooOld ? L.Text("This LocalExile lists no versions to download. LocalExile v0.5.0-beta and later do.") : L.Text("Waypoint could not read the versions this LocalExile runs. Open this window again.")) @@ -292,6 +313,18 @@ async Task RefreshAsync() Enable(); } + /// Whether a client in use is a version its folder's LocalExile runs: one of the builds it lists, or, for a + /// LocalExile with no list, a version it names. A client half-way to another version says that instead, and one + /// nothing can be said about counts as fitting: LocalExile's own check has the last word. + static bool Fits(Row row, IReadOnlyList? builds, IReadOnlyList runs) => + row.HalfWayTo is not null || (builds is not null ? row.Build is not null : row.Version is null || runs.Count == 0 || runs.Contains(row.Version)); + + /// The client the folder in use takes is no version its LocalExile runs. + bool Unfit(Row? row) => row is { Here: true, InUse: true } && !Fits(row, _builds, _runs); + + /// The versions this LocalExile runs, as a line says them: "3.29.3c, 3.29.3d". + string Runs => string.Join(", ", _runs); + /// A line of the list that is no client: the heading of the other folders, or the word that this one has none. static ListBoxItem Heading(string text, FontWeight weight, double top) { @@ -308,6 +341,7 @@ static ListBoxItem Heading(string text, FontWeight weight, double top) if (!row.Here) parts.Add((row.Folder.Title, false)); if (row.Kept is { } kept) parts.Add((L.Text("kept, {0:0.#} GB", kept.Bytes / 1e9), false)); if (row.Unfinished is { } unfinished) parts.Add((L.Text("half-way to {0}", Version(unfinished)), row.Here)); + if (Unfit(row)) parts.Add((L.Text("does not fit this LocalExile"), true)); if (row.LinkTarget is not null) parts.Add((row.Shared ? L.Text("shares another LocalExile folder's client") : L.Text("linked to a game folder"), false)); // Two kept copies that read the same are told apart by their folders' names. if (row is { Here: true, Kept: { } twin } && here.Any(o => o != row && o.Kept is not null && o.Version == row.Version @@ -402,9 +436,14 @@ string Detail(Row? row) if (row.Kept is not null) return _unfinished is not null ? L.Text("The game client in use is half-way to another version. Finish that switch first.") : _layout == ClientLayout.Link ? LinkReason() : ""; + // What stops it from being played comes before what is only worth knowing about it. + if (Unfit(row)) + return (_runs.Count > 0 ? L.Text("This LocalExile runs Path of Exile {0}.", Runs) : ClientExtractionFailure.Refused) + + (_plan is { Kind: ClientUpdate.Kind.Replace, Found: { } found } ? " " + L.Text("A {0} client is on this PC: {1}", _plan.Need, found) : ""); if (row.LinkTarget is { } target) return row.Shared ? L.Text("This folder shares the game client of another LocalExile folder: what changes there changes here.") - : OwnClient.Notice(target); + // LocalExile's warning is its release launcher's: a source copy links on its developer's own word. + : _source ? "" : OwnClient.Notice(target); return row.HalfWayTo is not null ? L.Text("This client is incomplete and cannot be used.") : ""; } @@ -427,22 +466,28 @@ void Enable() _use.Visibility = kept || resume || finish ? Visibility.Visible : Visibility.Collapsed; _use.IsEnabled = free && canUse; _use.Content = resume ? L.Text("Finish the switch") : half ? L.Text("Finish this copy") : L.Text("Use this version"); - _copy.Visibility = row is { Here: true, InUse: true } && _linked is not null ? Visibility.Visible : Visibility.Collapsed; + // A client this LocalExile does not run is not worth a copy: the way on is one that fits, when this PC has it. + bool unfit = Unfit(row); + bool canMove = unfit && _plan is { Kind: ClientUpdate.Kind.Replace, Found: not null }; + _move.Visibility = canMove ? Visibility.Visible : Visibility.Collapsed; + _move.IsEnabled = free; + _copy.Visibility = row is { Here: true, InUse: true } && _linked is not null && !unfit ? Visibility.Visible : Visibility.Collapsed; _copy.IsEnabled = free; _delete.Visibility = row is { Here: true, Kept: not null } ? Visibility.Visible : Visibility.Collapsed; _delete.IsEnabled = free; _open.Visibility = row is not null ? Visibility.Visible : Visibility.Collapsed; _detail.Text = Detail(row); _detail.Visibility = _detail.Text.Length > 0 ? Visibility.Visible : Visibility.Collapsed; - bool canDownload = !link && DepotTool.Supported && _offered.Count > 0; + bool canDownload = !link && !_source && DepotTool.Supported && _offered.Count > 0; _download.IsEnabled = free && canDownload; - _download.ToolTip = canDownload ? null : link ? LinkReason() : _note.Text.Length > 0 ? _note.Text : null; + _download.ToolTip = canDownload ? null : link && !_source ? LinkReason() : _note.Text.Length > 0 ? _note.Text : null; _steam.Text = Account is { } account ? L.Text("Steam: signed in as {0}", account) : ""; _steam.Visibility = _forget.Visibility = Account is null ? Visibility.Collapsed : Visibility.Visible; _forget.IsEnabled = free; _blocked.Visibility = !_busy && Running ? Visibility.Visible : Visibility.Collapsed; Lead(_ready && !_busy ? _close : _use.Visibility == Visibility.Visible && canUse ? _use + : canMove ? _move : _copy.Visibility == Visibility.Visible ? _copy : canDownload ? _download : null); } @@ -450,7 +495,7 @@ void Enable() /// The one button that is the likely next step: it guides in place of a sentence. void Lead(Button? lead) { - foreach (var button in new[] { _use, _copy, _download, _close }) + foreach (var button in new[] { _use, _move, _copy, _download, _close }) { if (button == lead) button.SetResourceReference(StyleProperty, "Primary"); else button.ClearValue(StyleProperty); diff --git a/src/Waypoint/ControlTab.xaml b/src/Waypoint/ControlTab.xaml index 3caf3d9..3bfde35 100644 --- a/src/Waypoint/ControlTab.xaml +++ b/src/Waypoint/ControlTab.xaml @@ -68,7 +68,9 @@