From c4477c3411eb1f4f6c42010156e8ece686249cc8 Mon Sep 17 00:00:00 2001 From: evrydayjunglist Date: Wed, 11 Nov 2026 13:10:02 -0800 Subject: [PATCH 01/11] feat: a release always runs from its own copy of the game client The setup guide no longer offers "Use this folder itself instead of a copy": a release is always given a copy (--client-mode copy). A release that was set up that way runs from the user's own Path of Exile folder, where LocalExile writes Game.exe, Game.patched.exe and the login list, and where a game update leaves it without the client it needs. That is not supported any more. Its Play page says so, and every Play asks for a copy of its own (Copy now, Open folder, Play anyway). Nothing is refused, so a user without the room for the copy can still play. The move (OwnClient) never leaves the release without a client: - the copy is made beside the link, which keeps working meanwhile; - only a copy that is whole and still matches the user's folder takes the link's place, by renames that are undone if one fails; - the user's folder is only read; removing the link removes nothing in it; - a stop or a failure leaves the release as it was, and the next try goes on from what was copied; a move cut short at the swap is finished at startup. A link to another LocalExile folder's client (a shared client) is left alone, and a source copy is never asked. Co-Authored-By: Claude Fable 5.2 --- docs/launcher.md | 41 ++- src/Launcher.Core/ClientCopy.cs | 12 +- src/Launcher.Core/OwnClient.cs | 252 ++++++++++++++ src/Launcher.Core/Resources/Strings.resx | 66 +++- src/Launcher.Core/Resources/Strings.ru.resx | 66 +++- .../Resources/Strings.zh-CN.resx | 66 +++- src/Waypoint.Linux/Views/InstallTab.axaml.cs | 89 ++++- src/Waypoint.Linux/Views/SetupWizard.axaml | 1 - src/Waypoint.Linux/Views/SetupWizard.axaml.cs | 6 +- src/Waypoint/InstallTab.xaml.cs | 89 ++++- src/Waypoint/SetupWizard.xaml | 3 - src/Waypoint/SetupWizard.xaml.cs | 12 +- tests/Waypoint.Tests/OwnClientTests.cs | 310 ++++++++++++++++++ 13 files changed, 977 insertions(+), 36 deletions(-) create mode 100644 src/Launcher.Core/OwnClient.cs create mode 100644 tests/Waypoint.Tests/OwnClientTests.cs diff --git a/docs/launcher.md b/docs/launcher.md index fc5ab23..a78ff4a 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -619,8 +619,8 @@ Waypoint still needs a checkout, so the plain chooser follows. Its second page chooses the route. **The ready-to-play release**, the default, asks for a new or empty folder (or an existing install), the client, and an account when the install has no saves. Its run is two steps: the zip, as an update does it, then -`LocalExile.exe setup --json`, shown by its events' stage and progress. The client is copied unless the player chooses to use the -folder itself. A stop waits out a step that writes the client or the keys. A `needs-input` answer returns to the page that gives +`LocalExile.exe setup --json`, shown by its events' stage and progress. The client is always copied (`--client-mode copy`): the guide no +longer offers to run a release from the chosen folder itself ([A release's own client](#a-releases-own-client)). A stop waits out a step that writes the client or the keys. A `needs-input` answer returns to the page that gives that option, and the run starts again from where it was. **The source code** is everything below. Until **Start setup** it only looks. It checks .NET 10, Git, Python and Node (a missing one has a button for its download page, @@ -768,6 +768,42 @@ under Proton, and Next waits until it is found. The source route's tools include The client's folder goes to `LocalExile.exe` as a `Z:\` path: Proton gives the install a drive letter of its own, so an unqualified Unix path would land on that drive, while `Z:` is the root in every prefix. +### A release's own client + +LocalExile's own setup can link a release's `Client` to the folder it was given instead of copying it (`--client-mode link`), +and the guide used to offer that as "Use this folder itself instead of a copy". Such a release runs from the user's own Path +of Exile folder: LocalExile writes `Game.exe`, `Game.patched.exe` and the login list there, and a game update in that folder +leaves LocalExile without the client it needs. The guide no longer offers it, and running that way is not supported any +more: a release that was set up so is told on its Play page (`OwnClient.Notice`) and asked for a copy of its own on every +Play until it has one (`OwnClient`, `src/Launcher.Core/OwnClient.cs`). Nothing is refused, because a user without the room +for the copy would have no way to play: + +- **When**: on a release's Play, after the build check above found that the client fits, with nothing running. Only when + `Client` is a link to a folder with a client that is not another LocalExile folder's `Client` (a shared client is that + folder's, and stays), and the release is not inside the folder the link leads to. A source copy is never asked. +- **The question**, on every Play: that this is no longer supported and why, then a box with both folders (the user's: only + read; the copy and its size), **Copy now**, **Open folder** and **Play anyway**. Play anyway changes nothing and the game + starts as before. Enter and Esc press Play anyway, so a box that opens while its user types cannot start the copy by + accident. Without the room for the copy (what is left to copy and 2 GB more) the box says so, with the two numbers, and + has only Play anyway. +- **The copy** goes into `.waypoint-new-client` beside the link, with the resumable copy the guide uses, the patched + executable included (it was patched for this folder's keys, and `IsSetUp` needs it). The link keeps working meanwhile. The + page shows the progress and **Stop the copy**; a stop or a failure leaves the release as it was, and the next try goes on + from what was copied. A file an earlier try copied counts only while it still has the size and time of the one in the + user's folder. +- **The swap** happens only for a copy that is whole and matches the user's folder as it is then (every file's size and + time, and the build): `.waypoint-complete` is written into it, the link is set aside as `.waypoint-old-link` (a rename, so + it can be put back; on Linux the link is removed and made again if needed), the copy is renamed to `Client`, and the link + is removed, which removes nothing it leads to. A rename that fails puts the link back. A move cut short between those + steps is finished when Waypoint next opens the folder (`OwnClient.Finish`, before the page decides whether the release is + set up), forward when the copy is whole and back to the link otherwise. A `Client` that is a folder of its own is never + replaced. +- **Afterwards** a box names the files LocalExile left in the user's folder, for the user to delete (`Game.exe`, + `Game.patched.exe`, and `config.json` only when it is the one naming LocalExile's own settings). Waypoint deletes nothing + there and does not put that folder's login list back. +- A copy begun for a link that is gone since is removed (`OwnClient.Discard`): only Waypoint's own folder, and never while + `Client` is a link. + ### Setup The requirements come from the adapter's inspection, each with what to do about it. **Prepare client** creates what is @@ -1302,6 +1338,7 @@ adapter does not know can be browsed but not changed. | `DevHost.cs`, `AccountList.cs` | the dev host and its account list | | `SetupChecks.cs`, `Settings.cs` | the setup checks, the per-user settings | | `SetupWizard.xaml`, `PortCheck.cs` | the setup guide; what holds a server's port, and the question about it | +| `src/Launcher.Core/OwnClient.cs` | a release that runs from the user's own game folder gets a copy of its own | | `src/Launcher.Core/SetupGuide.cs`, `ClientLocator.cs`, `ClientCopy.cs` | the guide's engine: tools that can be stopped, the prerequisites, the steps, finding a client, the resumable copy | | `src/Launcher.Core/SwitchToSource.cs` | moving from a release to a source copy: what the choices will do, the older version (`TestedCommit`), Frida, removing the release | | `Tray.cs` | the tray icon (Windows Forms' NotifyIcon) | diff --git a/src/Launcher.Core/ClientCopy.cs b/src/Launcher.Core/ClientCopy.cs index 75376ec..6062ed9 100644 --- a/src/Launcher.Core/ClientCopy.cs +++ b/src/Launcher.Core/ClientCopy.cs @@ -21,13 +21,15 @@ public static class ClientCopy { const int BufferSize = 4 * 1024 * 1024; /// Room left over on the drive, so a copy does not end with a full disk. - const long Margin = 2_000_000_000; + internal const long Margin = 2_000_000_000; /// A patched client only works with the keys it was patched for: they come with it when the checkout has none - /// yet, and otherwise it stays behind and the client is patched again. - public static ClientCopyPlan Plan(string source, string checkout) + /// yet, and otherwise it stays behind and the client is patched again. is another folder than + /// the checkout's Client to copy into; brings the patched executable whatever the keys + /// (: the client the folder already runs from, patched for its own keys). + public static ClientCopyPlan Plan(string source, string checkout, string? target = null, bool keepPatched = false) { - string target = Path.Combine(checkout, "Client"); + target ??= Path.Combine(checkout, "Client"); string keys = Path.Combine(checkout, "data", "login-keys.json"); string? sourceData = Path.GetDirectoryName(Path.TrimEndingDirectorySeparator(source)) is { } parent ? Path.Combine(parent, "data") : null; bool withKeys = ClientLocator.Classify(source) == ClientKind.Ready && !File.Exists(keys) @@ -39,7 +41,7 @@ public static ClientCopyPlan Plan(string source, string checkout) string relative = Path.GetRelativePath(root, file.FullName); // The client's own logs are not part of the game; a leftover .partial is another copy's. if (relative.StartsWith("logs" + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) || relative.EndsWith(".partial", StringComparison.OrdinalIgnoreCase)) continue; - if (!withKeys && relative.Equals("Game.patched.exe", StringComparison.OrdinalIgnoreCase)) continue; + if (!withKeys && !keepPatched && relative.Equals("Game.patched.exe", StringComparison.OrdinalIgnoreCase)) continue; files.Add(new(file.FullName, Path.Combine(target, relative), file.Length)); } files = files.OrderBy(f => Path.GetFileName(f.Target).Equals("Content.ggpk", StringComparison.OrdinalIgnoreCase)).ToList(); diff --git a/src/Launcher.Core/OwnClient.cs b/src/Launcher.Core/OwnClient.cs new file mode 100644 index 0000000..ab6e94b --- /dev/null +++ b/src/Launcher.Core/OwnClient.cs @@ -0,0 +1,252 @@ +namespace Launcher.Core; + +/// +/// A release whose Client is a link to the user's own Path of Exile folder (LocalExile's "use the folder itself", which +/// Waypoint no longer offers) runs from that folder: LocalExile writes Game.exe, Game.patched.exe and the login list there, and +/// a game update in it leaves LocalExile without the client it needs. This gives the release a copy of its own, and at no +/// moment is the release without a client: +/// +/// the copy is made beside the link (), which keeps working meanwhile; +/// only a copy that is whole, and still matches the folder it came from, takes the link's place; +/// the folder the link led to is only ever read, and removing the link removes nothing in it; +/// a stop or a failure leaves the release as it was, and the next try goes on from what was copied. +/// +/// A link to another LocalExile folder's client (a shared client) is that folder's, and is left alone. +/// Running from the user's own folder is not supported any more, and Waypoint says so on every Play until the copy is made; +/// it does not refuse to start, because a user without the room for the copy would have no way to play. +/// +public static class OwnClient +{ + /// Beside Client while the copy is made. + public const string NewFolder = ".waypoint-new-client"; + /// The link, set aside on Windows while the copy takes its place, so that it can be put back as it was. + public const string OldLink = ".waypoint-old-link"; + /// Written into once the copy is whole: from then on only goes forward. + public const string Complete = ".waypoint-complete"; + + /// The folder the link leads to: only read. + /// Free bytes on the release's drive; null when it cannot be told. + public sealed record Plan(string Folder, string Source, ClientCopyPlan Copy, long? Free) + { + public bool HasSpace => Free is not { } free || free >= Copy.Remaining + ClientCopy.Margin; + /// What an earlier try already copied. + public long Copied => Copy.Total - Copy.Remaining; + } + + public enum Outcome + { + /// Nothing to do, or the user chose to play anyway: the folder starts as it is. + None, + /// The release has its own client now. + Moved, + /// The copy failed; the release is as it was and still starts. + Failed, + /// The user stopped the copy; the release is as it was. + Stopped, + } + + public sealed record Result(Outcome Outcome, Plan? Plan = null, string? Reason = null); + + /// The copy this folder needs; null when its client is a folder of its own, a link to another LocalExile's client, + /// or a link that leads to no client Waypoint can copy (the setup guide's to replace). + public static Plan? Check(string folder) + { + try + { + string client = Path.Combine(folder, "Client"); + if (!ClientSettings.IsLink(client)) return null; + string source = Path.TrimEndingDirectorySeparator(Path.GetFullPath(ClientLocator.RealPath(client))); + if (ClientLocator.Classify(source) is not (ClientKind.Ready or ClientKind.Standalone) || InLocalExile(source)) return null; + // A release set up inside the game's own folder would be copied into itself. + if (Path.GetFullPath(folder).StartsWith(source + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)) return null; + var copy = ClientCopy.Plan(source, folder, Path.Combine(folder, NewFolder), keepPatched: true); + return new(Path.TrimEndingDirectorySeparator(Path.GetFullPath(folder)), source, copy, ClientCopy.FreeSpace(copy.Target)); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException or System.Security.SecurityException) { return null; } + } + + /// The Client folder of a LocalExile checkout or release: shared with it, and that folder's to look after. + static bool InLocalExile(string source) => + Path.GetDirectoryName(source) is { Length: > 0 } parent && (RepositoryDiscovery.IsLocalExile(parent) || LocalExileReleases.IsInstall(parent)); + + public static string Title => L.Text("LocalExile needs its own copy of the game"); + + /// The standing line on a release's Play page while it runs from the user's own folder. + public static string Notice => L.Text("Not supported: this LocalExile runs from your own Path of Exile folder. Press Play to give it a copy of its own."); + + /// The question, kept short, and the two folders set apart so that a long path does not push the words away. + public static (string Message, string Details) Text(Plan plan) + { + string lead = L.Text("This LocalExile runs from your own Path of Exile folder. That is no longer supported: LocalExile changes files there, and a game update in that folder would stop it working."); + string offer = (plan.HasSpace + ? L.Text("Waypoint can copy the game into this LocalExile folder now. Your saves, accounts and login keys are kept.") + + (plan.Copied >= 100_000_000 ? " " + L.Text("The copy goes on from the {0:0.#} GB made earlier.", plan.Copied / 1e9) : "") + : L.Text("Waypoint can copy the game into this LocalExile folder, but the drive is too full: the copy needs {0:0.#} GB, and {1:0.#} GB is free. Free some space, then press Play again.", + (plan.Copy.Remaining + ClientCopy.Margin) / 1e9, (plan.Free ?? 0) / 1e9)) + + "\n\n" + L.Text("Play anyway: nothing changes, and Waypoint asks again the next time you press Play."); + string details = L.Text("Your Path of Exile folder (only read):") + "\n " + plan.Source + "\n" + + L.Text("The copy ({0:0.#} GB):", plan.Copy.Total / 1e9) + "\n " + Path.Combine(plan.Folder, "Client"); + return (lead + " " + offer, details); + } + + /// The question: Copy now (true), or Play anyway (false, also for a box closed without an answer); Open folder + /// shows the user's folder and asks again. Without the room for the copy there is nothing to agree to, only to know. + /// shows a question (title, message, details, buttons) and answers the button chosen. + public static bool Ask(Plan plan, Func show, Action open) + { + var (message, details) = Text(plan); + if (!plan.HasSpace) + { + show(Title, message, details, [L.Text("Play anyway")]); + return false; + } + string[] buttons = [L.Text("Copy now"), L.Text("Open folder"), L.Text("Play anyway")]; + while (true) + { + int chosen = show(Title, message, details, buttons); + if (chosen != 1) return chosen == 0; + open(plan.Source); + } + } + + /// What LocalExile added to the user's folder while it ran from it, and their normal game does not need: for the + /// user to delete, never Waypoint. config.json only when it is the one that names LocalExile's own settings. + public static string[] Leftovers(string source) + { + var names = new List(); + foreach (string name in new[] { "Game.exe", "Game.patched.exe" }) + if (File.Exists(Path.Combine(source, name))) names.Add(name); + if (File.Exists(Path.Combine(source, "config.json")) && ClientSettings.Read(source, linked: false).Kind == ClientSettingsKind.Separate) names.Add("config.json"); + return [.. names]; + } + + public static string DoneTitle => L.Text("LocalExile has its own copy of the game"); + + public static string DoneText(Plan plan) + { + string text = L.Text("LocalExile now runs from {0}, and no longer uses {1}.", Path.Combine(plan.Folder, "Client"), plan.Source); + var left = Leftovers(plan.Source); + return left.Length == 0 ? text + : text + "\n\n" + L.Text("LocalExile left these files in your Path of Exile folder. Your normal game does not need them, and you can delete them: {0}", string.Join(", ", left)); + } + + public static string FailedTitle => L.Text("The copy did not finish"); + + public static string FailedText(Plan plan, string reason) => + reason + "\n\n" + L.Text("Nothing was changed: LocalExile still runs from {0}. Press Play to try again; the copy goes on from where it stopped.", plan.Source); + + /// Before a release starts the game: first what an earlier move left (), then the folder. The + /// copy is asked on every start until it is made (, true to go on). It is made + /// while holds the folder (false: something else holds it). Whatever the outcome, the folder + /// still starts: only is the user's word not to. + public static async Task EnsureAsync(string folder, Func ask, Action? progress, + Func, Task> exclusive, CancellationToken stop) + { + var plan = await Task.Run(() => + { + try + { + Finish(folder); + Discard(folder); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + return Check(folder); + }); + if (plan is null) return new(Outcome.None); + if (!ask(plan)) return new(Outcome.None, plan); + Exception? failure = null; + bool stopped = false; + bool ran = await exclusive(async () => + { + try { await Task.Run(() => MoveAsync(folder, progress, stop), CancellationToken.None); } + catch (OperationCanceledException) { stopped = true; } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { failure = e; } + }); + if (stopped) return new(Outcome.Stopped, plan); + if (!ran) return new(Outcome.Failed, plan, L.Text("Something else is using LocalExile. Try again when it is done.")); + return failure is null ? new(Outcome.Moved, plan) : new(Outcome.Failed, plan, failure.Message); + } + + /// Copies the client the folder's link leads to into , checks the copy against that folder as + /// it is now, and only then lets it take the link's place. Throws with the release as it was. + public static async Task MoveAsync(string folder, Action? progress, CancellationToken stop) + { + var plan = Check(folder) ?? throw new IOException(L.Text("This folder's game client is no longer a link, so there is nothing to copy.")); + // What an earlier try copied counts only while it is still what the folder holds: the official launcher may have + // updated the game in between. + bool stale = false; + foreach (var file in plan.Copy.Files) + if (File.Exists(file.Target) && !Same(file)) + { + File.Delete(file.Target); + stale = true; + } + if (stale) plan = Check(folder) ?? throw new IOException(L.Text("This folder's game client is no longer a link, so there is nothing to copy.")); + await ClientCopy.RunAsync(plan.Copy, progress, stop); + stop.ThrowIfCancellationRequested(); + var now = ClientCopy.Plan(plan.Source, folder, plan.Copy.Target, keepPatched: true); + if (now.Files.Length != plan.Copy.Files.Length || now.Files.Any(f => !Same(f)) + || ClientLocator.BuildOf(plan.Copy.Target) != ClientLocator.BuildOf(plan.Source)) + throw new IOException(L.Text("The game folder changed while it was copied, so the copy was not used.")); + File.WriteAllText(Path.Combine(plan.Copy.Target, Complete), ""); + if (!Finish(folder)) throw new IOException(L.Text("The copy is ready, but it could not take the link's place.")); + } + + /// A copy begun for a link that is gone since (the client was replaced another way) is of no use: Waypoint's own + /// folder, removed. Never while Client is a link, or the copy is whole. + public static void Discard(string folder) + { + string client = Path.Combine(folder, "Client"), copy = Path.Combine(folder, NewFolder); + if (!Directory.Exists(copy) || ClientSettings.IsLink(copy) || File.Exists(Path.Combine(copy, Complete))) return; + if (ClientSettings.IsLink(client) || ClientSettings.IsLink(Path.Combine(folder, OldLink))) return; + Directory.Delete(copy, recursive: true); + } + + /// A copied file is the source's while it has its length and time (the copy keeps the time; some drives round it). + static bool Same(ClientCopyFile file) + { + FileInfo source = new(file.Source), target = new(file.Target); + return source.Exists && target.Exists && source.Length == target.Length + && Math.Abs((source.LastWriteTimeUtc - target.LastWriteTimeUtc).TotalSeconds) <= 2; + } + + /// Lets a whole copy () take the link's place, also after a move that was cut short there; + /// true when the folder's client is the copy now. A link set aside without a whole copy goes back. Nothing is done to a + /// Client that is a folder of its own, and a copy that cannot be renamed leaves the link where it was. + public static bool Finish(string folder) + { + string client = Path.Combine(folder, "Client"), copy = Path.Combine(folder, NewFolder), aside = Path.Combine(folder, OldLink); + bool present = Directory.Exists(client) || ClientSettings.IsLink(client); + if (!File.Exists(Path.Combine(copy, Complete))) + { + if (!present && ClientSettings.IsLink(aside)) Directory.Move(aside, client); + return false; + } + string? target = null; + if (present) + { + if (!ClientSettings.IsLink(client)) return false; + target = new DirectoryInfo(client).LinkTarget; + if (OperatingSystem.IsWindows()) + { + // Renamed, not removed: a junction cannot be made again without a tool, and a rename can be undone. + if (ClientSettings.IsLink(aside)) Directory.Delete(aside); + Directory.Move(client, aside); + } + else File.Delete(client); // a Unix link is a file + } + try { Directory.Move(copy, client); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + if (present) + { + if (OperatingSystem.IsWindows()) Directory.Move(aside, client); + else if (target is not null) Directory.CreateSymbolicLink(client, target); + } + throw; + } + File.Delete(Path.Combine(client, Complete)); + if (ClientSettings.IsLink(aside)) Directory.Delete(aside); + return true; + } +} diff --git a/src/Launcher.Core/Resources/Strings.resx b/src/Launcher.Core/Resources/Strings.resx index 94a61c5..58e602b 100644 --- a/src/Launcher.Core/Resources/Strings.resx +++ b/src/Launcher.Core/Resources/Strings.resx @@ -267,6 +267,9 @@ pid {0} + + Waypoint can copy the game into this LocalExile folder now. Your saves, accounts and login keys are kept. + Stay on a tested version (recommended) @@ -378,6 +381,9 @@ Layers + + The copy ({0:0.#} GB): + Python {0} is installed in {1} but not on PATH. Waypoint uses it anyway, for itself and the scripts it runs. @@ -579,6 +585,9 @@ Tattoos + + Not supported: this LocalExile runs from your own Path of Exile folder. Press Play to give it a copy of its own. + Ruby @@ -600,6 +609,9 @@ Package status + + LocalExile has its own copy of the game + Voyage @@ -973,6 +985,9 @@ Close the game and anything else using that folder, then try again. Checkbox marks + + LocalExile now runs from {0}, and no longer uses {1}. + Hidden from new characters @@ -2218,6 +2233,9 @@ This checkout has modified tracked files. the mod is larger than {0} files or 64 MB; nothing was installed + + The game folder changed while it was copied, so the copy was not used. + Nothing was changed. Press Play to try again. @@ -2230,6 +2248,9 @@ This checkout has modified tracked files. Stop and switch + + This LocalExile runs from your own Path of Exile folder. That is no longer supported: LocalExile changes files there, and a game update in that folder would stop it working. + Restore stashed changes @@ -2311,6 +2332,9 @@ This checkout has modified tracked files. Language saved. + + Play anyway + Rules @@ -2527,6 +2551,9 @@ This checkout has modified tracked files. Shows this copy in Advanced mode: every section, with branches and pull requests under Versions. A release keeps the mode you chose there. + + Stop the copy + League created. It becomes available after the next server start. @@ -3298,6 +3325,9 @@ Search limits reached; other checkouts may exist. Browse to any location. No update + + Copy now + Waiting… @@ -3343,6 +3373,9 @@ Search limits reached; other checkouts may exist. Browse to any location. Gold + + Play anyway: nothing changes, and Waypoint asks again the next time you press Play. + Status banner @@ -3783,6 +3816,9 @@ Switching to it builds and runs that code on this computer with your rights, liv (deleted fork) + + The copy was stopped, and nothing was changed. Press Play to go on with it. + Setup @@ -4137,6 +4173,9 @@ Switching to it builds and runs that code on this computer with your rights, liv live.ps1 selects the local gateway itself; step 6 keeps a backup + + The copy is ready, but it could not take the link's place. + extract-data.ps1 -List: which extracted files are missing or stale @@ -4638,6 +4677,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Learning + + LocalExile needs its own copy of the game + {0} mods · {1} installed · {2} updates · read {3:t} @@ -4800,6 +4842,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Game client + + LocalExile left these files in your Path of Exile folder. Your normal game does not need them, and you can delete them: {0} + Mods are add-ons installed for this checkout. Enable, update and configure them in Mods. @@ -4839,6 +4884,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Start capture + + Waypoint can copy the game into this LocalExile folder, but the drive is too full: the copy needs {0:0.#} GB, and {1:0.#} GB is free. Free some space, then press Play again. + Boots @@ -5304,9 +5352,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Port held by another - - Use this folder itself instead of a copy. It saves the space, but LocalExile then changes that client. - No modifier is worded like this @@ -5745,6 +5790,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys The servers are not running + + The copy goes on from the {0:0.#} GB made earlier. + Snake @@ -6177,6 +6225,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Nothing was switched. + + This folder's game client is no longer a link, so there is nothing to copy. + the release holds an unsafe path, {0}; nothing was changed @@ -6333,6 +6384,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys This feature needs Frida. Frida is optional for normal play. + + The copy did not finish + Window behavior saved. @@ -6426,6 +6480,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Flask + + Nothing was changed: LocalExile still runs from {0}. Press Play to try again; the copy goes on from where it stopped. + Beacon @@ -8034,6 +8091,9 @@ Dependencies: {2} Choose color: {0} + + Your Path of Exile folder (only read): + Looking for updates diff --git a/src/Launcher.Core/Resources/Strings.ru.resx b/src/Launcher.Core/Resources/Strings.ru.resx index bc1331a..f8834cf 100644 --- a/src/Launcher.Core/Resources/Strings.ru.resx +++ b/src/Launcher.Core/Resources/Strings.ru.resx @@ -267,6 +267,9 @@ PID {0} + + Waypoint может сейчас скопировать игру в папку LocalExile. Сохранения, аккаунты и ключи входа сохранятся. + Остаться на проверенной версии (рекомендуется) @@ -378,6 +381,9 @@ Слои + + Копия ({0:0.#} ГБ): + Python {0} установлен в {1}, но не добавлен в PATH. Waypoint всё равно использует его — для себя и для запускаемых им скриптов. @@ -579,6 +585,9 @@ Татуировки + + Не поддерживается: этот LocalExile запускается из вашей папки Path of Exile. Нажмите «Играть», чтобы сделать для него собственную копию. + Рубин @@ -600,6 +609,9 @@ Состояние пакета + + У LocalExile теперь собственная копия игры + Путешествие @@ -973,6 +985,9 @@ Отметки флажков + + Теперь LocalExile запускается из {0} и больше не использует {1}. + Скрыта для новых персонажей @@ -2218,6 +2233,9 @@ в моде больше {0} файлов или больше 64 МБ; ничего не установлено + + Папка игры изменилась во время копирования, поэтому копия не использована. + Ничего не изменилось. Нажмите «Играть», чтобы попробовать снова. @@ -2230,6 +2248,9 @@ Остановить и переключить + + Этот LocalExile запускается прямо из вашей папки Path of Exile. Это больше не поддерживается: LocalExile изменяет в ней файлы, а после обновления игры в этой папке он перестанет работать. + Вернуть отложенные изменения @@ -2311,6 +2332,9 @@ Язык сохранён. + + Всё равно играть + Правила @@ -2527,6 +2551,9 @@ Показывает эту копию в расширенном режиме: все разделы, ветки и запросы на слияние в разделе «Версии». Релиз сохраняет режим, выбранный для него. + + Остановить копирование + Лига создана. Она станет доступна после следующего запуска сервера. @@ -3298,6 +3325,9 @@ Обновлений нет + + Скопировать сейчас + Ожидание… @@ -3343,6 +3373,9 @@ Золото + + «Всё равно играть»: ничего не меняется, и Waypoint спросит снова при следующем нажатии «Играть». + Панель состояния @@ -3783,6 +3816,9 @@ (форк удалён) + + Копирование остановлено, ничего не изменилось. Нажмите «Играть», чтобы продолжить. + Подготовка @@ -4137,6 +4173,9 @@ live.ps1 сам выбирает локальный шлюз; шаг 6 сохраняет резервную копию + + Копия готова, но поставить её на место ссылки не удалось. + extract-data.ps1 -List: какие извлечённые файлы отсутствуют или устарели @@ -4638,6 +4677,9 @@ Обучение + + LocalExile нужна собственная копия игры + Модов: {0} · установлено: {1} · обновлений: {2} · прочитано в {3:t} @@ -4800,6 +4842,9 @@ Игровой клиент + + LocalExile оставил эти файлы в вашей папке Path of Exile. Вашей обычной игре они не нужны, их можно удалить: {0} + Моды — дополнения, установленные для этой копии. Включайте, обновляйте и настраивайте их в разделе «Моды». @@ -4839,6 +4884,9 @@ Начать запись + + Waypoint может скопировать игру в папку LocalExile, но на диске мало места: для копии нужно {0:0.#} ГБ, а свободно {1:0.#} ГБ. Освободите место и снова нажмите «Играть». + Сапоги @@ -5304,9 +5352,6 @@ Порт занят - - Использовать саму эту папку вместо копии. Это экономит место, но LocalExile будет изменять этот клиент. - Нет свойства с таким текстом @@ -5745,6 +5790,9 @@ Серверы не запущены + + Копирование продолжится с уже скопированных {0:0.#} ГБ. + Змея @@ -6177,6 +6225,9 @@ Переключение не выполнено. + + Клиент игры в этой папке больше не ссылка, поэтому копировать нечего. + в выпуске есть небезопасный путь {0}; ничего не изменено @@ -6333,6 +6384,9 @@ Для этой функции нужна Frida. Для обычной игры она не требуется. + + Копирование не завершено + Настройки поведения окна сохранены. @@ -6426,6 +6480,9 @@ Флакон + + Ничего не изменилось: LocalExile по-прежнему запускается из {0}. Нажмите «Играть», чтобы попробовать снова; копирование продолжится с того места, где остановилось. + Маяк @@ -8034,6 +8091,9 @@ Выбор цвета: {0} + + Ваша папка Path of Exile (только чтение): + Поиск обновлений diff --git a/src/Launcher.Core/Resources/Strings.zh-CN.resx b/src/Launcher.Core/Resources/Strings.zh-CN.resx index 28007dc..04dce36 100644 --- a/src/Launcher.Core/Resources/Strings.zh-CN.resx +++ b/src/Launcher.Core/Resources/Strings.zh-CN.resx @@ -267,6 +267,9 @@ PID {0} + + Waypoint 现在可以把游戏复制到这个 LocalExile 文件夹中。你的存档、账号和登录密钥都会保留。 + 保持使用经过测试的版本(推荐) @@ -378,6 +381,9 @@ 图层 + + 副本({0:0.#} GB): + Python {0} 已安装在 {1},但不在 PATH 中。Waypoint 仍会使用它,供自身和它运行的脚本使用。 @@ -579,6 +585,9 @@ 纹身 + + 不受支持:这个 LocalExile 从你自己的流放之路文件夹运行。点击“开始游戏”为它创建自己的副本。 + 红宝石 @@ -600,6 +609,9 @@ 安装包状态 + + LocalExile 已拥有自己的游戏副本 + 航行 @@ -973,6 +985,9 @@ 复选框勾选标记 + + LocalExile 现在从 {0} 运行,不再使用 {1}。 + 对新角色隐藏 @@ -2218,6 +2233,9 @@ 模组超过 {0} 个文件或 64 MB;未安装任何内容 + + 游戏文件夹在复制过程中发生了变化,因此未使用该副本。 + 没有做任何更改。点击“开始游戏”重试。 @@ -2230,6 +2248,9 @@ 停止并切换 + + 这个 LocalExile 直接从你自己的流放之路文件夹运行。这种方式已不再受支持:LocalExile 会修改那里的文件,而且该文件夹中的游戏一旦更新,它就无法运行。 + 恢复贮藏的更改 @@ -2311,6 +2332,9 @@ 语言已保存。 + + 仍然游玩 + 规则 @@ -2527,6 +2551,9 @@ 以高级模式显示此副本:显示所有部分,分支和拉取请求在“版本”部分。发布版保留你在那里选择的模式。 + + 停止复制 + 联赛已创建,将在下次启动服务器后可用。 @@ -3298,6 +3325,9 @@ 没有更新 + + 立即复制 + 等待中… @@ -3343,6 +3373,9 @@ 金色 + + “仍然游玩”:不做任何更改,下次点击“开始游戏”时 Waypoint 会再次询问。 + 状态横幅 @@ -3783,6 +3816,9 @@ (已删除的复刻) + + 复制已停止,没有做任何更改。点击“开始游戏”可继续复制。 + 安装 @@ -4137,6 +4173,9 @@ live.ps1 会自行选择本地网关;第 6 步会保留备份 + + 副本已就绪,但未能替换链接。 + extract-data.ps1 -List:列出缺失或过期的已提取文件 @@ -4638,6 +4677,9 @@ 学习 + + LocalExile 需要自己的游戏副本 + {0} 个模组 · 已安装 {1} 个 · {2} 个更新 · 读取于 {3:t} @@ -4800,6 +4842,9 @@ 游戏客户端 + + LocalExile 在你的流放之路文件夹中留下了这些文件。你平时的游戏不需要它们,可以删除:{0} + 模组是为此副本安装的扩展。可在“模组”中启用、更新和配置。 @@ -4839,6 +4884,9 @@ 开始采集 + + Waypoint 可以把游戏复制到这个 LocalExile 文件夹中,但驱动器空间不足:复制需要 {0:0.#} GB,而可用空间只有 {1:0.#} GB。请释放一些空间,然后再次点击“开始游戏”。 + 靴子 @@ -5304,9 +5352,6 @@ 端口被其他程序占用 - - 直接使用此文件夹,而不是副本。这样可以节省空间,但 LocalExile 随后会修改该客户端。 - 没有词缀的文本与此相符 @@ -5745,6 +5790,9 @@ 服务器未运行 + + 复制会从之前已完成的 {0:0.#} GB 继续。 + 蛇 @@ -6177,6 +6225,9 @@ 没有进行切换。 + + 此文件夹的游戏客户端已不再是链接,因此无需复制。 + 发行版包含不安全的路径 {0};未做任何更改 @@ -6333,6 +6384,9 @@ 此功能需要 Frida。正常游戏不需要 Frida。 + + 复制未完成 + 窗口行为已保存。 @@ -6426,6 +6480,9 @@ 药剂瓶 + + 没有做任何更改:LocalExile 仍从 {0} 运行。点击“开始游戏”重试;复制会从中断处继续。 + 灯塔 @@ -8034,6 +8091,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 选择颜色:{0} + + 你的流放之路文件夹(只读取): + 正在检查更新 diff --git a/src/Waypoint.Linux/Views/InstallTab.axaml.cs b/src/Waypoint.Linux/Views/InstallTab.axaml.cs index 7082f0f..9e5af92 100644 --- a/src/Waypoint.Linux/Views/InstallTab.axaml.cs +++ b/src/Waypoint.Linux/Views/InstallTab.axaml.cs @@ -57,6 +57,18 @@ public void Show(SetupState state, string detail) long? _current, _total; /// The words shown, as functions, so that a language change says them again. Func? _headline, _note; + /// While the game client is copied into this release (): Stop ends the copy. + CancellationTokenSource? _copyStop; + /// This release runs from the user's own Path of Exile folder, which is not supported: the page says so until + /// Play has given it a copy of its own (). Looked for in the background. + bool _ownFolder; + + async Task LookForOwnFolderAsync() + { + string folder = Folder; + _ownFolder = await Task.Run(() => OwnClient.Check(folder) is not null); + Show(); + } readonly ObservableCollection _steps = []; readonly StringBuilder _log = new(); /// The step that runs now. @@ -97,6 +109,11 @@ public void Attach(Shared shared) _shared = shared; if (!Repo.IsInstall) return; _ = LookForOlderAsync(); + // A move to a client of its own that was cut short as the copy took the link's place is finished first: until then the + // folder has no client, and this page would send the user to the setup guide. + try { OwnClient.Finish(Folder); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { shared.Logs.Write($"the game client's move was not finished: {e.Message}", Severity.Warning); } + _ = LookForOwnFolderAsync(); StepList.ItemsSource = _steps; shared.Monitor.Sampled += _ => Dispatcher.UIThread.Post(Show); shared.LiveRunning += _ => Dispatcher.UIThread.Post(Show); @@ -110,6 +127,7 @@ internal void InstallChanged(Func? note = null) { if (!Repo.IsInstall) return; _ = LookForOlderAsync(); + _ = LookForOwnFolderAsync(); _needsSetup = false; _failed = false; _note = note; @@ -146,12 +164,13 @@ void Show() Working.IsVisible = busy && (_shared.Settings.Appearance?.ReduceMotion != true || _total is > 0); Working.IsIndeterminate = _total is not > 0; if (_total is > 0 and { } total) Working.Value = 100d * (_current ?? 0) / total; - string? note = _note?.Invoke() ?? (_olderBuild is { } older ? ClientUpdate.OlderNoteFor(older) : null); + string? note = _note?.Invoke() ?? (_ownFolder ? OwnClient.Notice : _olderBuild is { } older ? ClientUpdate.OlderNoteFor(older) : null); Note.Text = note ?? ""; Note.IsVisible = note is not null; DetailsLink.IsVisible = _failed && !busy; // A step that writes the client or the keys is not cut short. - StopLink.IsVisible = !_stopping && !LocalExileReleases.MustFinish(_stage) && (_working || AnythingRunning); + StopLink.IsVisible = !_stopping && !LocalExileReleases.MustFinish(_stage) && (_working || AnythingRunning || _copyStop is not null); + StopLink.Content = _copyStop is not null ? L.Text("Stop the copy") : L.Text("Stop playing"); Elapsed.Text = _working ? L.Text("Running for {0}", _clock.Elapsed.ToString(@"m\:ss")) : ""; VersionText.Text = LocalExileReleases.Installed(Folder) is { } version ? L.Text("LocalExile {0}", version) : ""; string? from = _bringLater ? null : Editions.BringFrom(_shared.Settings); @@ -237,6 +256,66 @@ void RunSetupClicked(object? sender, RoutedEventArgs e) } } + /// A release that runs from the user's own Path of Exile folder (a link, which the setup guide no longer makes) gets + /// a copy of its own, asked on every Play until it is made (): that way of running is not supported + /// any more, but nothing is refused. The link works until a whole copy takes its place, so whatever comes of it the game + /// still starts, as before or from the copy; false only when the user stopped the copy. + async Task OwnClientAsync() + { + if (AnythingRunning) return true; + var owner = ViewTools.Owner(this); + using var stop = new CancellationTokenSource(); + var clock = new Stopwatch(); + long? startedAt = null; + var result = await OwnClient.EnsureAsync(Folder, + // Play anyway is the button Enter presses: a box that opens while its user types must not start a long copy by accident. + plan => OwnClient.Ask(plan, (title, message, details, buttons) => Dialog.Show(owner, DialogKind.Question, title, message, details, buttons, buttons.Length - 1), ViewTools.Open), + copied => Dispatcher.UIThread.Post(() => + { + if (_copyStop is null) return; + startedAt ??= copied.Done; + double rate = (copied.Done - startedAt.Value) / Math.Max(clock.Elapsed.TotalSeconds, .1); + _current = copied.Done; + _total = copied.Total; + _note = () => L.Text("{0:0.0} of {1:0.0} GB · {2:0} MB/s · {3}", copied.Done / 1e9, copied.Total / 1e9, rate / 1e6, copied.File); + Show(); + }), + work => + { + _copyStop = stop; + clock.Start(); + _headline = () => L.Text("Copying the game client"); + _note = null; + Show(); + return _shared.RunExclusiveAsync(L.Text("Copying the game client"), work); + }, + stop.Token); + _copyStop = null; + _headline = null; + _note = null; + _current = _total = null; + _ownFolder = result.Outcome != OwnClient.Outcome.Moved && result.Plan is not null; + switch (result.Outcome) + { + case OwnClient.Outcome.Moved: + _shared.Logs.Write($"the game client was copied from {result.Plan!.Source}; this release has its own now", Severity.Info); + Show(); + Dialog.Tell(owner, DialogKind.Info, OwnClient.DoneTitle, OwnClient.DoneText(result.Plan)); + break; + case OwnClient.Outcome.Failed: + _shared.Logs.Write($"the game client was not copied: {result.Reason}", Severity.Warning); + Show(); + Dialog.Tell(owner, DialogKind.Warning, OwnClient.FailedTitle, OwnClient.FailedText(result.Plan!, result.Reason ?? "")); + break; + case OwnClient.Outcome.Stopped: + _note = () => L.Text("The copy was stopped, and nothing was changed. Press Play to go on with it."); + Show(); + return false; + } + Show(); + return true; + } + /// This release onto LocalExile's newest, with the steps on this page: the client the player has is newer than it. async Task UpdateRelease(ClientUpdate.Plan plan) { @@ -289,6 +368,7 @@ async Task RunAsync(string[] arguments, bool withClient) try { client = withClient ? await ClientFits() : []; + if (withClient && client is { Length: 0 } && !await OwnClientAsync()) client = null; if (client is not null && !await BackUp()) client = null; } finally { _checking = false; } @@ -444,6 +524,11 @@ void Write(string line) async void StopClicked(object? sender, RoutedEventArgs e) { + if (_copyStop is { } copy) + { + copy.Cancel(); + return; + } if (_stopping) return; _stopping = true; _note = null; diff --git a/src/Waypoint.Linux/Views/SetupWizard.axaml b/src/Waypoint.Linux/Views/SetupWizard.axaml index cd1cb82..cbe1b96 100644 --- a/src/Waypoint.Linux/Views/SetupWizard.axaml +++ b/src/Waypoint.Linux/Views/SetupWizard.axaml @@ -142,7 +142,6 @@ - @@ -122,7 +124,9 @@ - + + + diff --git a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs index 2b68472..5080c8a 100644 --- a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs +++ b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs @@ -14,6 +14,8 @@ sealed class FolderRow(KnownFolder folder) { public KnownFolder Folder { get; } = folder; public string Title => Folder.Title; + /// Which version of the game the folder's client is, beside its title; empty when that is not known. + public string Client => Folder.ClientText ?? ""; public string Path => Folder.Path; /// The row has room for about this much of a path; the tooltip has all of it. public string ShortPath => FolderList.Short(Folder.Path, 52); @@ -27,7 +29,7 @@ sealed class FolderRow(KnownFolder folder) public string Tip => Folder.Path; public string Spoken => Folder.Current ? L.Text("{0}, {1}, in use", Folder.Title, Folder.Path) : Folder.Kind == FolderKind.Missing ? L.Text("{0}, {1}, not found", Folder.Title, Folder.Path) - : $"{Folder.Title}, {Folder.Path}"; + : Folder.ClientText is { } client ? $"{Folder.Title}, {client}, {Folder.Path}" : $"{Folder.Title}, {Folder.Path}"; /// What a screen reader is given for the row as an item of the list. public override string ToString() => Spoken; } @@ -68,11 +70,33 @@ internal void ShowCurrent() CurrentIcon.Kind = IconOf(folder.Kind); CurrentTitle.Text = folder.Title; CurrentPath.Text = FolderList.Short(folder.Path); + ShowCurrentClient(_client.Path == folder.Path ? _client.Version : null); + _ = ReadCurrentClientAsync(folder); // The box may be too narrow for a long branch name or path: all of both is here. ToolTip.SetTip(Current, $"{folder.Title}\n{folder.Path}\n{L.Text("Click for your other LocalExile folders")}"); AutomationProperties.SetName(Current, L.Text("LocalExile folder: {0}, {1}", folder.Title, folder.Path)); } + /// The version of the client in the folder in use, as last read: shown at once while it is read again. + (string Path, string? Version) _client = ("", null); + + /// The client's version under the folder's name, once it is read (off the UI thread: the first reading hashes + /// the executable). + async Task ReadCurrentClientAsync(KnownFolder folder) + { + string? version = await Task.Run(() => FolderList.ClientOf(folder.Path)); + if (!FolderList.Same(folder.Path, Environment.CurrentDirectory)) return; + _client = (folder.Path, version); + ShowCurrentClient(version); + } + + void ShowCurrentClient(string? version) + { + string? client = FolderList.ClientText(version); + CurrentClient.Text = client ?? ""; + CurrentClient.IsVisible = client is not null; + } + async void OpenList(object? sender, RoutedEventArgs e) { // A click outside the list closes it and goes no further, so this is always a click to open. @@ -95,7 +119,7 @@ async Task FillAsync() { string current = Environment.CurrentDirectory; var paths = FolderList.Paths(_shared.Settings, current); - var folders = await Task.Run(() => FolderList.Read(paths, current)); + var folders = await Task.Run(() => FolderList.Read(paths, current, client: true)); Rows.ItemsSource = folders.Select(folder => new FolderRow(folder)).ToArray(); } diff --git a/src/Waypoint.Linux/Views/InstallTab.axaml b/src/Waypoint.Linux/Views/InstallTab.axaml index f0dc23f..559872f 100644 --- a/src/Waypoint.Linux/Views/InstallTab.axaml +++ b/src/Waypoint.Linux/Views/InstallTab.axaml @@ -17,6 +17,8 @@ HorizontalContentAlignment="Center" VerticalContentAlignment="Center" /> + +