diff --git a/README.md b/README.md index c080a4b..0e32a9c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ unchanged. It does not bundle Path of Exile or LocalExile, and does not offer a ## Install -Requirements: Windows 10/11 x64, the .NET 10 Desktop Runtime, and a PoE **3.29.3c** or **3.29.3d** client: your own standalone one, or for a release one Waypoint downloads from Steam +Requirements: Windows 10/11 x64, the .NET 10 Desktop Runtime, and a PoE **3.29.3c** or **3.29.3d** client: your own standalone or Steam install, or one Waypoint downloads from Steam with your own Steam account ([The game client from Steam](docs/launcher.md#the-game-client-from-steam)) (a player who has only 3.29.3b gets the last LocalExile made for it, see [Game client builds](docs/launcher.md#game-client-builds)). The setup guide offers two ways to get LocalExile: @@ -34,7 +34,7 @@ offers two ways to get LocalExile: | [Git](https://git-scm.com/downloads/win) | Branches and pull requests | | [Python 3.9+](https://www.python.org/downloads/windows/) | Data extraction, consistent save backups, the account tools. Tick the installer's *Add python.exe to PATH*; Waypoint also finds a Python installed without it | | [Node.js](https://nodejs.org/en/download) | The bundle-decompression dependency | -| Your own standalone PoE **3.29.3c** or **3.29.3d** client | A separate copy in the checkout's `Client` folder; Steam layout and other builds are unsupported | +| A PoE **3.29.3c** or **3.29.3d** client, standalone or from Steam | A separate copy in the checkout's `Client` folder; other builds are unsupported | Frida (`pip install frida`) is optional: it is needed for walk maps, the console and live mod control, not for ordinary play. The item crafter's Give item uses the Waypoint Tools mod instead, which it offers to install. @@ -55,7 +55,7 @@ where they are. Neither old file is changed. Linux has its own executable and interface (`src/Waypoint.Linux`, Avalonia) over the same engine, and the Windows app is built as before. It needs the .NET 10 SDK, [umu-launcher](https://github.com/Open-Wine-Components/umu-launcher) and your own -standalone PoE **3.29.3c** or **3.29.3d** client. A source checkout also needs PowerShell 7 (`dotnet tool install --global PowerShell`), Git, +PoE **3.29.3c** or **3.29.3d** client, standalone or from Steam. A source checkout also needs PowerShell 7 (`dotnet tool install --global PowerShell`), Git, Python 3.9+ and Node.js. ```bash diff --git a/docs/launcher.md b/docs/launcher.md index 93a4f73..dfe1e5c 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -20,13 +20,25 @@ folder ([Folders and tools](#folders-and-tools)), so a self-update, which replac `Workspace.cs` is the app's side of it. The adapter still has its own start, stop and branch-switch actions, covered by its tests; the app does not use them. -On a source checkout, the setup guide checks preparation again on every run. If the copied `PathOfExile.exe` matches the +On a source checkout, the setup guide checks preparation again on every run. If the copied `PathOfExile.exe` (a client +from Steam: `PathOfExileSteam.exe`, the same file) matches the known fingerprint for that checkout's declared client build, preparation can replace a stale `Game.exe` and rebuild its patched copy using the existing login keys. It finishes patching a temporary executable before replacing either existing file and keeps the previous executables under `data/client-preparation-backups/`. A linked client is never repaired here; unrecognized originals and other client builds do not authorize replacement. HNC extraction failures identify the actual `Client/Game.exe`, include both executable fingerprints, and point to `logs/extract-client-constants.log`. +**A checkout's client is prepared in either layout**, by the steps of LocalExile's own guide (`Prepare-Client` in +`scripts/RuntimeBridge.ps1`). The adapter tells the layout as LocalExile does (`Get-ClientLayout`: `Client\Content.ggpk` +first, else the loose files of a Steam install, known by `Client\Bundles2\_.index.bin`). `Game.exe` is a copy of +`PathOfExile.exe` or of Steam's `PathOfExileSteam.exe`; LocalExile's Auth tool makes the keys, which are kept when they are +there, and the patched copy, and makes a Steam install's copy read the loose files by itself; LocalExile's Patch tool +points the login list at the local server, in the archive for a standalone client and in the client folder +(`Client\gateway_list.txt`) for one from Steam, as `live.ps1` gives it. Whether a checkout's LocalExile runs a Steam +install is its own to say: its `live.ps1` accepts the index in place of `Content.ggpk` or does not +(`Test-SteamLayoutAccepted`), and for one that does not, the Setup section's **Client archive** line and the preparation +say that this LocalExile runs only a standalone client. + The Windows Tools section opens the map viewer when the selected source checkout has the terrain generator and extracted game data. Waypoint carries its own read-only map helper, builds it against that checkout's existing generator libraries, and closes it with the viewer. No LocalExile map-service hook or source changes are needed. The helper and all build outputs @@ -165,6 +177,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 @@ -546,6 +563,13 @@ to a user. - Only one `live.ps1` runs at a time; the buttons wait while one does (the status strip says so). The launcher runs it with Windows PowerShell and turns off MSBuild's reused nodes for it, the fix the server's troubleshooting table names for a script that never returns. It takes the script's end from the process's exit, not from the end of its output. +- Waypoint started from a PowerShell 7 shell (a terminal, an editor's) inherits that shell's `PSModulePath`, which names + PowerShell 7's own module folders first. Windows PowerShell, which `live.ps1` and the adapter run under, then cannot load + its built-in modules, and a script stops at a command as plain as `Get-FileHash` ("is not recognized"). PowerShell 7 takes + its own folders out when it starts Windows PowerShell itself, but not for a program in between, so Waypoint does the same + for its own process at its start (`Platform.UseWindowsPowerShellModules`): PowerShell 7's user folder, its shared folder + and the `Modules` folder beside a `pwsh` go; every other entry stays, and so everything Waypoint starts gets a path + Windows PowerShell can use. - The **Setup** list checks the server's one-time steps (**Guided setup** opens the Setup section): the client copy, the keys, the patched client, the gateway list, the extracted data, Node and ooz, whether the checkout has the launcher hooks, whether the game settings are separate from the normal game's, the network mode in the settings file this client really uses (Predictive is preferred; Lockstep or @@ -640,14 +664,20 @@ the one on PATH is too old. The start does the same once, as do the Setup and Co installed while Waypoint runs counts without a restart. It lists the LocalExile checkouts it finds, or offers to clone upstream into a new or empty folder, with the drive's free space. It lists the clients it finds (other checkouts' `Client` folders, what the installers recorded in the registry, the default folders, a time-limited walk of the fixed drives), -and when there is none it says where it looked. Steam and Epic installs are listed struck out, so a player sees why theirs was -passed over; they have no `Content.ggpk` and cannot be chosen. **Browse…** takes any folder. `PathOfExile.exe` has no version +and when there is none it says where it looked. A Steam install is a client like a standalone one (`ClientKind.Steam`: its game +files loose in `Bundles2`, known by `Bundles2\_.index.bin`, its executable `PathOfExileSteam.exe`; the same test as +LocalExile's `ClientFiles` and `ClientInstall`), copied and prepared the same way, for a LocalExile that runs one. Which +does is the folder's own to say (`ClientLocator.RunsSteamFiles`: its list names a Steam index); the last LocalExile made for +3.29.3b runs none, and the guide then says to update LocalExile or choose a standalone client. Steam files that are another +build's than their executable (a game update that did not finish) are warned about, not refused: LocalExile has the last word. +An Epic install, and a Steam one without its index, is listed struck out, so a player sees why theirs was passed over. +**Browse…** takes any folder. `PathOfExile.exe` has no version resource, so a build is recognized by its SHA-256 (`ClientLocator`), and the list shows it beside the size. A build the folder's LocalExile cannot use is refused with the reason ([Game client builds](#game-client-builds)); one Waypoint does not know is warned about before a 70 GB copy, but not refused. For a new folder the guide sets up what the client fits: the newest LocalExile when a 3.29.3c client was found, and only when the player has nothing but 3.29.3b, the last LocalExile made for it (release v0.1.0-beta, or a source copy on its own branch `waypoint-3.29.3b` at the head of the server's `3.29.3b` branch), with the quiet note below. -**Set up the rest now** goes on without a client. The guide itself never downloads the game: without a client, **Finish setup** on a release's Play page can get one from Steam ([The game client from Steam](#the-game-client-from-steam)), and the guide's note says so only where that holds (`ClientVersions.FirstDownload`). +**Set up the rest now** goes on without a client. The guide itself never downloads the game: without a client, **Finish setup** on a release's Play page can get one from Steam, and so can **Game client…** in the sidebar's folder list on a source copy ([The game client from Steam](#the-game-client-from-steam)); the guide's note names the one that applies, and only where it holds (`ClientVersions.FirstDownload`; for a source copy, a list that names a build Steam can deliver). ### Game client builds @@ -672,7 +702,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: @@ -729,7 +767,7 @@ another day all come down to running the same list again. | Step | Stop | Next time | |---|---|---| | Download | ends git, removes the unfinished folder | starts over; the folder must be new or empty, so nothing of the player's is ever in it | -| Copy | stops within one 4 MB block | goes on from `name.partial`, after checking its last block against the source. A file takes its real name only when complete, and `Content.ggpk` goes last, so a checkout that has it has the whole client | +| Copy | stops within one 4 MB block | goes on from `name.partial`, after checking its last block against the source. A file takes its real name only when complete, and the file a layout is known by goes last (`Content.ggpk`, or a Steam install's `Bundles2\_.index.bin`), so a checkout that has it has the whole client | | Dependency, build | ends the tool | run again | | Keys, patching, gateway list | finishes the stage, then stops before the next: a half-written `Game.patched.exe` or `Content.ggpk` would be worse than a few seconds' wait (`RuntimeClient.Interruptible`, `stop.request` in the adapter) | goes on from what exists | | Game data | ends the extraction | an entry is stamped only when complete, so one cut short runs again | @@ -790,12 +828,59 @@ 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 -one with the user's own Steam account. Windows on x64 only for now. - +longer be had from it. Steam still serves them, and **Game client…** (in the sidebar's folder list; `ClientVersionsWindow`) +gets one with the user's own Steam account, for a release and for a source copy. Windows on x64 only for now. + +- **A source copy** has the same window, list and download. What came in is prepared by the adapter (`PrepareClient`, the + setup guide's own step, which prepares either layout as the top of this file tells) where a release runs + `LocalExile.exe setup`; when the preparation stops, the line under the list says why, and **Prepare client** on Setup + tries again. What Waypoint keeps beside `Client` (`Clients\`, and the `.waypoint-…` folders a download, a copy or a + removal works in) is its own, and in a checkout git would list it as new files, and a switch of the checkout, which + stashes what is not committed, would take a client apart. So before Waypoint makes one of them there, it names them in + the checkout's own `info/exclude` (`CheckoutIgnores`: `/Clients/` and `/.waypoint-*`), git's place for what one clone + ignores: no commit holds it, so it stays whichever revision the copy is on, and nothing tracked is changed. A source + copy's linked client gets no warning: that is the release launcher's, and a developer links on purpose. +- **The window is a chooser.** Any line that is not the client in use has one button, **Use this client**, and it + always means that the folder in use will run that client: the words name what the folder in use gets, because the line + chosen is often another folder's. It works the same for a release and a source copy, and for a folder with no client + yet, which starts on the first client it could take. Nothing is deleted by any of it. + - **A client the folder set aside** (`Clients\`) is swapped in at once, by two renames + (`ClientVersions.Use`). In Advanced mode it also takes a link's place: only the link goes, once the kept client is + there (`Use(overLink)`), and the folder it led to is not touched. + - **A client of another folder** (**Use this client…**, in use there or kept) is asked about first, and only when the + LocalExile of the folder in use runs it (`RunsHere`: a build it lists, a client from Steam with the index listed for + it); otherwise the line under the list names the versions it runs. **Browse for a client…**, beside the download, + takes a folder that is in no list the same way. + - **The question** (`TakeAsync`) names both ends, "This client" and "The folder in use", says what becomes of the + client in use (a copy "is kept, not deleted": it goes to `Clients\`; a link is removed and the folder it leads to is + not changed), and gives the ways there are. Enter is Cancel. + - **A copy**, in every mode (`ClientVersions.CopyInAsync`): made beside the client in use with the copy the setup + guide uses (`.waypoint-copied-client`), so the client in use works meanwhile, a stop leaves what was copied and the + same copy goes on from it. Only a whole copy is swapped in, then prepared the folder's own way (LocalExile's setup, + or the adapter's `PrepareClient`). The folder copied from is only read; its patched executable comes along only + with the keys it was patched for. Without the room for it the question only says so. + - **A link**, in Advanced mode only (`ClientVersions.LinkAsync`): Simple mode never links. The client in use is + set aside first and comes back if the link cannot be made. A game folder of the user's own, for a release, is + linked by LocalExile itself (`LocalExile.exe setup --client --client-mode link`, its developers' option, + which checks the folder, prepares it and warns), and its refusal is shown in its own words. A client another + LocalExile uses, and any client for a source copy, must be prepared for this folder's login keys already + (`ClientCopy.SharedKeys`, as when the setup guide shares one), because Waypoint never changes a linked client and + LocalExile would patch it for the wrong keys; where it is not, the question says that a link is not possible here. + A client another folder only keeps, and one the link in use already leads to, has no link either. + - **Make a copy…** on a linked client in use changes how the same client is held: the copy `OwnClient` makes + ([A client linked to the user's game](#a-client-linked-to-the-users-game)), beside the link, which works until the + copy is whole, with the folder it leads to only read. A release's link to the user's own game folder has it in every + mode, on its Play page; Advanced mode adds a source copy's link and a link to another LocalExile's client + (`OwnClient.Check(folder, shared: true)`), copied from this window with its own progress and **Stop**. +- **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 + style (`Enable`, `Lead`: the chosen line's own action when it can run, else **Make a copy…** on a release linked to the user's own game, else **Download a version…**, and **Close** after a download that ended ready to play); a sentence appears only where something is blocked or not safe, or when a thing happens. Its English is short, whole sentences, so that it translates cleanly. - **The list** is the game clients this PC has for LocalExile, drawn as the sidebar's folder list draws its folders. The @@ -806,17 +891,17 @@ one with the user's own Steam account. Windows on x64 only for now. version** (`ClientVersions.FilesOf`) and what is particular about it (a kept one's size, half-way, linked), then where it is. The path keeps its end and loses its start behind dots when the line is too narrow (`PathLine`); the tooltip has all of it and the build's name. A folder with no client says so in the list's first line. - Only the folder in use is changed here: **Use this version** brings a kept one back by two renames, **Delete this + Only the folder in use is changed here: **Use this client** brings a kept one back by two renames, **Delete this copy…** deletes a kept one (a deletion that was cut short is finished when the window opens, - `ClientVersions.FinishDeletes`), and a client of another folder only opens its folder (the line under the list says to - choose that folder in the sidebar; a source copy looks after its own). Nothing here runs while the game or a server + `ClientVersions.FinishDeletes`), and a client of another folder is only read (**Use this client…** above, and **Open + folder**). Nothing here runs while the game or a server does: the window says so on a line above the list. - **A linked client** is shown where it is used, as the link and then where it leads. One that leads to another LocalExile folder's `Client` reads "shares another LocalExile folder's client"; one that leads to a game folder outside LocalExile (`OwnClient.InLocalExile` says which) reads "linked to a game folder", and for the folder in use the line under the list is LocalExile's warning and **Make a copy…** is the primary button: the Play page's own copy - ([A client linked to the user's game](#a-client-linked-to-the-users-game)). A linked `Client` is neither replaced by - a kept one nor downloaded over; the download button's tooltip says why it is off. + ([A client linked to the user's game](#a-client-linked-to-the-users-game)). A linked `Client` is never downloaded + over (the download button's tooltip says why it is off), and outside Advanced mode a kept one does not take its place. - **A client half-way to another version** (it carries `.waypoint-switching`) says so on its line, in the warning colour for the folder in use. The one in use is finished by **Finish the switch**. A kept copy in that state cannot be used; **Finish this copy** makes it whole where it is, as the build it was on its way to @@ -888,7 +973,7 @@ one with the user's own Steam account. Windows on x64 only for now. - **Afterwards** Waypoint runs `LocalExile.exe setup`, which makes `Game.exe` and the copy patched for the folder's keys from the client that came in (Waypoint removes the ones made for the build before it, and the client's `config.json`, which names LocalExile's own game settings, goes with it). A folder that still needs an account is finished from Play. -- **Kept versions.** `Client` is all LocalExile ever looks at; `Clients\` is Waypoint's own. **Use this version** on a kept +- **Kept versions.** `Client` is all LocalExile ever looks at; `Clients\` is Waypoint's own. **Use this client** on a kept one swaps it with the one in use, two renames and no download, with what LocalExile prepared for it still there. **Delete this copy…** asks first. @@ -904,7 +989,8 @@ the game data is shared, so a game update in that folder can break the install. - **The warning.** LocalExile warns at every start when `Client` is a link to anything but another LocalExile's `Client` (the folder above it holds a `GameServer.slnx` or a `release.json`). Waypoint tells such a link by the same test (`OwnClient.Check`) and shows the same words on the release's Play page (`OwnClient.Notice`), and LocalExile's own warning - is in the run's output. Nothing is refused, and Play starts the game as before. A source copy is not looked at. + is in the run's output. Nothing is refused, and Play starts the game as before. A source copy is not looked at; in + Advanced mode the Game client window still offers its link a copy ([The game client from Steam](#the-game-client-from-steam)). - **Make a copy…**, under that line, is the way out LocalExile's warning names, done safely (`OwnClient`, `src/Launcher.Core/OwnClient.cs`). It asks first: a box with both folders (the user's: only read; the copy and its size), **Copy now**, **Open folder** and **Cancel**. Enter and Esc press Cancel, so a box that opens while its user types cannot @@ -1463,7 +1549,7 @@ adapter does not know can be browsed but not changed. | `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/LocalExileBuilds.cs` | the client builds a LocalExile folder runs, asked of that LocalExile (`builds`, or a checkout's `ClientBuilds.cs`) | -| `ClientVersionsWindow.cs`, `SteamSignInWindow.cs`, `src/Launcher.Core/SteamDownload.cs`, `ClientVersions.cs` | a release's game client from Steam: the window, the QR sign-in, the tool and its lines, the versions a folder holds and the switch | +| `ClientVersionsWindow.cs`, `SteamSignInWindow.cs`, `src/Launcher.Core/SteamDownload.cs`, `ClientVersions.cs`, `CheckoutIgnores.cs` | a folder's game client from Steam: the window, the QR sign-in, the tool and its lines, the versions a folder holds and the switch | | `src/Launcher.Core/OwnClient.cs` | a release whose client is a link to the user's game folder: LocalExile's warning, and the copy on the user's word | | `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 | diff --git a/scripts/LeagueArt.py b/scripts/LeagueArt.py index b9f9905..f2bce24 100644 --- a/scripts/LeagueArt.py +++ b/scripts/LeagueArt.py @@ -66,13 +66,17 @@ def atlas_sprite(atlas, key): def extract(root, cache): import PIL from PIL import Image - archive = root / "Client/Content.ggpk" + # A client from Steam has no archive: its files are loose, LocalExile's extractor takes the client folder, and the + # index of its bundles stands for it. + archive = stamp = root / "Client/Content.ggpk" + if not archive.is_file(): + archive, stamp = root / "Client", root / "Client/Bundles2/_.index.bin" source_file = root / "src/GameServer.Core/Accounts/LeagueCatalog.cs" source = source_file.read_bytes() if len(source) > 1024 * 1024: raise ValueError("Banner contract is too large.") selector = wire_selector(source.decode("utf-8-sig")) - before = signature(archive) + before = signature(stamp) source_hash = hashlib.sha256(source).hexdigest() helper_hash = hashlib.sha256(Path(__file__).read_bytes()).hexdigest() key = hashlib.sha256(json.dumps([str(root), before, source_hash, helper_hash, PIL.__version__]).encode()).hexdigest() @@ -124,7 +128,7 @@ def read(path): image.convert("RGBA").crop(bounds).save(staging / (kind + ".png")) provenance["sprites"][kind] = {"key": chosen, "texture": texture, "bounds": bounds} provenance["hashes"][kind] = hashlib.sha256((staging / (kind + ".png")).read_bytes()).hexdigest() - if before != signature(archive) or source_file.read_bytes() != source: + if before != signature(stamp) or source_file.read_bytes() != source: raise ValueError("Client assets or banner contract changed while reading.") destination.mkdir(exist_ok=True) for kind in ("normal", "hardcore"): diff --git a/scripts/RuntimeBridge.ps1 b/scripts/RuntimeBridge.ps1 index e822642..3db2f7f 100644 --- a/scripts/RuntimeBridge.ps1 +++ b/scripts/RuntimeBridge.ps1 @@ -79,6 +79,8 @@ function Import-RuntimeProfile { [Environment]::SetEnvironmentVariable($key, $expression.Value, 'Process') } } + # Game_GGPK: LocalExile stopped reading it when its servers stopped opening the client's files; a profile from before + # may still name the old default. The client's files are found in Client, in either layout (Get-ClientLayout). foreach ($entry in @{ Game_BIND='127.0.0.1'; Game_LOGIN_PORT='20493'; Game_GATEWAY_PORT='6112'; Game_AUTH_CONTROL_PORT='20495'; Game_PATCH_TCP_PORT='12995'; Game_PATCH_URL='http://127.0.0.1:8080/'; Game_CLIENT_EXE='Client/Game.exe'; Game_GGPK='Client/Content.ggpk' @@ -276,7 +278,7 @@ function Get-Snapshot { @{ Name='Launch adapter'; Ready=((Test-Path -LiteralPath (At 'scripts/dev/live.ps1')) -and ((Get-Content -LiteralPath (At 'scripts/dev/live.ps1') -Raw) -match '\$ClientOnly')); Detail='scripts/dev/live.ps1 must support -ClientOnly and -Only' }, @{ Name='Original client'; Ready=(Test-Path -LiteralPath (At 'Client/Game.exe')); Detail=(Get-ClientDetail) }, @{ Name='Prepared client'; Ready=(Test-Path -LiteralPath $gamePath); Detail='Follow Agents/GettingStarted.md steps 4-5 to prepare Game.patched.exe' }, - @{ Name='Client archive'; Ready=(Test-Path -LiteralPath (At 'Client/Content.ggpk')); Detail='Standalone Content.ggpk is required; Steam layout is unsupported' }, + @{ Name='Client archive'; Ready=((Get-ClientLayout) -eq 'Standalone' -or ((Get-ClientLayout) -eq 'Steam' -and (Test-SteamLayoutAccepted))); Detail=(Get-ArchiveDetail) }, @{ Name='Login keys'; Ready=(Test-Path -LiteralPath (At 'data/login-keys.json')); Detail='data/login-keys.json must match the prepared client; never regenerate existing keys casually' }, @{ Name='Python'; Ready=(Test-Python); Detail='Python 3.9+ is required for data extraction' }, @{ Name='Node.js'; Ready=([bool](Get-Command node -ErrorAction SilentlyContinue)); Detail='Node.js is required for bundle decompression' }, @@ -801,9 +803,26 @@ function Start-FreshSaves($snapshot) { Assert-Physical $history if (Test-Path -LiteralPath $history) { Remove-Item -LiteralPath $history } } +# How Client holds the game's files, told apart as LocalExile does (its ClientFiles.Resolve): a Content.ggpk first, else the +# loose files of a Steam install, known by Bundles2/_.index.bin. '' when it holds neither. +function Get-ClientLayout { + if (Test-Path -LiteralPath (At 'Client/Content.ggpk') -PathType Leaf) { return 'Standalone' } + if (Test-Path -LiteralPath (At 'Client/Bundles2/_.index.bin') -PathType Leaf) { return 'Steam' } + return '' +} +# Whether this checkout's LocalExile runs a Steam install: its own live.ps1 says so, by accepting Bundles2\_.index.bin in +# place of Content.ggpk. An older checkout refuses such a client at every start. +function Test-SteamLayoutAccepted { + $live = At 'scripts/dev/live.ps1' + return (Test-Path -LiteralPath $live -PathType Leaf) -and ((Get-Content -LiteralPath $live -Raw) -match 'Bundles2\\_\.index\.bin') +} +function Get-ArchiveDetail { + if ((Get-ClientLayout) -eq 'Steam' -and -not (Test-SteamLayoutAccepted)) { return 'This LocalExile runs only a standalone client. A client from Steam needs a newer LocalExile.' } + return 'Client needs Content.ggpk (standalone) or Bundles2\_.index.bin (Steam)' +} function Get-ClientDetail { $client = Get-Item -LiteralPath (At 'Client') -Force -ErrorAction SilentlyContinue - if (-not $client -or -not ($client.Attributes -band [IO.FileAttributes]::ReparsePoint)) { return 'Standalone 3.29.3c executable at Client/Game.exe' } + if (-not $client -or -not ($client.Attributes -band [IO.FileAttributes]::ReparsePoint)) { return 'Client/Game.exe: a copy of PathOfExile.exe (Steam: PathOfExileSteam.exe)' } $target = @($client.Target)[0] if (Test-Path -LiteralPath (At 'Client/Game.exe')) { return "Linked to $target" } return "Client links to $target, which has no client. Run the setup guide to replace the link." @@ -820,8 +839,10 @@ function Prepare-Client($snapshot) { Write-Host "Client is a link to $target and is already prepared: nothing to do." return } - Require (Test-Path -LiteralPath (At 'Client/Content.ggpk')) 'Copy the complete standalone 3.29.3c client into Client first.' - foreach ($relative in @('Client/Content.ggpk','Client/Game.exe','Client/PathOfExile.exe','Client/Game.patched.exe','data','data/login-keys.json')) { + $layout = Get-ClientLayout + Require $layout 'Copy the complete game client into Client first.' + Require ($layout -ne 'Steam' -or (Test-SteamLayoutAccepted)) (Get-ArchiveDetail) + foreach ($relative in @('Client/Content.ggpk','Client/Bundles2','Client/Bundles2/_.index.bin','Client/gateway_list.txt','Client/Game.exe','Client/PathOfExile.exe','Client/PathOfExileSteam.exe','Client/Game.patched.exe','data','data/login-keys.json')) { $item = Get-Item -LiteralPath (At $relative) -ErrorAction SilentlyContinue Require (-not $item -or -not ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) "Preparation refuses redirected files or folders: $relative" } @@ -829,18 +850,25 @@ function Prepare-Client($snapshot) { $patched = Test-Path -LiteralPath (At 'Client/Game.patched.exe') Require ($keys -or -not $patched) 'A prepared executable exists without keys. Preserve it and recover its matching keys, or prepare a new client copy.' $game = At 'Client/Game.exe' - $original = At 'Client/PathOfExile.exe' $prepared = At 'Client/Game.patched.exe' $gameHash = if (Test-Path -LiteralPath $game) { (Get-FileHash -LiteralPath $game -Algorithm SHA256).Hash } else { '' } - $originalHash = if (Test-Path -LiteralPath $original) { (Get-FileHash -LiteralPath $original -Algorithm SHA256).Hash } else { '' } # Only a fingerprint from ClientLocator for this checkout's declared build authorizes a repair: one for each executable # GGG shipped under the build's name (a hotfix keeps the name), comma-separated. # Small launchers, future builds and a different checkout's build cannot replace an existing executable, and a # Game.exe that is one of the build's own executables is valid as it is: the build's other one does not replace it. $clientHashes = @($ClientExecutableHash -split ',' | Where-Object { $_ }) + # The game's own executable, in LocalExile's order (its ClientInstall): PathOfExile.exe, or a Steam install's + # PathOfExileSteam.exe, which is the same file. PathOfExile.exe can be the small launcher, so one that is the build's + # goes first; without one, the first that is there, as before. + $originals = @(@('PathOfExile.exe','PathOfExileSteam.exe') | Where-Object { Test-Path -LiteralPath (At "Client/$_") -PathType Leaf } | + ForEach-Object { @{ Name=$_; Hash=(Get-FileHash -LiteralPath (At "Client/$_") -Algorithm SHA256).Hash } }) + $chosen = @(@($originals | Where-Object { $clientHashes -contains $_.Hash }) + $originals) | Select-Object -First 1 + $originalName = if ($chosen) { $chosen.Name } elseif ($layout -eq 'Steam') { 'PathOfExileSteam.exe' } else { 'PathOfExile.exe' } + $original = At "Client/$originalName" + $originalHash = if ($chosen) { $chosen.Hash } else { '' } $refresh = $originalHash -and $clientHashes -contains $originalHash -and $gameHash -and $clientHashes -notcontains $gameHash Write-Host "Client/Game.exe SHA-256: $gameHash" - Write-Host "Client/PathOfExile.exe SHA-256: $originalHash" + Write-Host "Client/$originalName SHA-256: $originalHash" Set-Stage 'Building preparation tools' 'Auth and Patch' foreach ($name in @('Auth','Patch')) { & dotnet build (At "src/GameServer.$name") --nologo -v minimal @@ -851,7 +879,7 @@ function Prepare-Client($snapshot) { $stagedGame = $null; $stagedPatch = $null try { if (-not $gameHash) { - Require (Test-Path -LiteralPath $original) 'Client/PathOfExile.exe or Client/Game.exe is required.' + Require (Test-Path -LiteralPath $original) 'Client/PathOfExile.exe (Steam: PathOfExileSteam.exe) or Client/Game.exe is required.' Copy-Item -LiteralPath $original -Destination $game $gameHash = (Get-FileHash -LiteralPath $game -Algorithm SHA256).Hash } @@ -864,7 +892,7 @@ function Prepare-Client($snapshot) { } if (-not $keys) { & dotnet $auth keygen $inputGame - Require ($LASTEXITCODE -eq 0) 'Key generation failed. Check that the original executable is standalone 3.29.3c.' + Require ($LASTEXITCODE -eq 0) 'Key generation failed. Check that the original executable is a version this LocalExile runs.' } $knownGame = $refresh -or ($gameHash -and $clientHashes -contains $gameHash) $stalePatch = $patched -and $knownGame -and ( @@ -898,8 +926,11 @@ function Prepare-Client($snapshot) { if ($temp -and (Test-Path -LiteralPath $temp)) { Remove-Item -LiteralPath $temp -Force } } } - Set-Stage 'Selecting local gateway' 'Only the copied client archive is updated.' - & dotnet (At 'src/GameServer.Patch/bin/Debug/net10.0/GameServer.Patch.dll') gateway (At 'Client/Content.ggpk') --login '127.0.0.1:20493' + # The login list is in the GGPK, or a Steam install's loose Client/gateway_list.txt: LocalExile's own tool finds it in + # the client folder (its live.ps1 gives it the folder). A standalone client still gets its archive named, which every + # LocalExile takes. + Set-Stage 'Selecting local gateway' $(if ($layout -eq 'Steam') { 'Only the copied client''s gateway list is updated.' } else { 'Only the copied client archive is updated.' }) + & dotnet (At 'src/GameServer.Patch/bin/Debug/net10.0/GameServer.Patch.dll') gateway $(if ($layout -eq 'Steam') { At 'Client' } else { At 'Client/Content.ggpk' }) --login '127.0.0.1:20493' Require ($LASTEXITCODE -eq 0) 'Local gateway setup failed. Close all clients and inspect the operation log.' } function Register-Account($snapshot) { diff --git a/src/Launcher.Core/CheckoutIgnores.cs b/src/Launcher.Core/CheckoutIgnores.cs new file mode 100644 index 0000000..24fbdd8 --- /dev/null +++ b/src/Launcher.Core/CheckoutIgnores.cs @@ -0,0 +1,51 @@ +namespace Launcher.Core; + +/// +/// What Waypoint keeps in a LocalExile folder beside Client is its own: the clients set aside in Clients\ +/// () and the folders a download, a copy or a removal works in (.waypoint-…). A release +/// has no git. A source copy does, and there git would list those folders as new files, and a switch of the checkout, which +/// stashes what is not committed, would take a client apart. So before Waypoint makes one of them in a source copy, it +/// names them in the copy's own info/exclude: git's place for what one clone ignores, which no commit holds and +/// which therefore stays whichever revision the copy is on. Nothing tracked is changed. +/// +public static class CheckoutIgnores +{ + public static IReadOnlyList Patterns { get; } = ["/" + ClientVersions.KeptFolder + "/", "/.waypoint-*"]; + + const string Heading = "# Waypoint: game clients it keeps beside Client, and the folders it works in"; + + /// Names Waypoint's folders in the checkout's info/exclude; nothing for a folder without git, and + /// nothing when they are named already. True when the file holds them afterwards. + public static bool Ensure(string folder) + { + try + { + if (Exclude(folder) is not { } file) return false; + string[] lines = File.Exists(file) ? File.ReadAllLines(file) : []; + var missing = Patterns.Where(pattern => !lines.Any(line => line.Trim() == pattern)).ToList(); + if (missing.Count == 0) return true; + Directory.CreateDirectory(Path.GetDirectoryName(file)!); + var text = new List(lines); + if (!lines.Any(line => line.Trim() == Heading)) text.Add(Heading); + text.AddRange(missing); + File.WriteAllLines(file, text); + return true; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException) { return false; } + } + + /// The checkout's info/exclude: in .git, or for a worktree (whose .git is a file that + /// names its own folder) in the repository that folder's commondir names. Null for a folder without git. + static string? Exclude(string folder) + { + string git = Path.Combine(folder, ".git"); + if (Directory.Exists(git)) return Path.Combine(git, "info", "exclude"); + if (!File.Exists(git)) return null; + string? own = File.ReadLines(git).Select(line => line.Trim()).FirstOrDefault(line => line.StartsWith("gitdir:", StringComparison.Ordinal))?["gitdir:".Length..].Trim(); + if (own is not { Length: > 0 }) return null; + own = Path.GetFullPath(own, folder); + string shared = Path.Combine(own, "commondir"); + string common = File.Exists(shared) ? Path.GetFullPath(File.ReadAllText(shared).Trim(), own) : own; + return Directory.Exists(common) ? Path.Combine(common, "info", "exclude") : null; + } +} diff --git a/src/Launcher.Core/ClientCopy.cs b/src/Launcher.Core/ClientCopy.cs index 6062ed9..407358a 100644 --- a/src/Launcher.Core/ClientCopy.cs +++ b/src/Launcher.Core/ClientCopy.cs @@ -13,7 +13,8 @@ public sealed record ClientCopyProgress(string File, long Done, long Total); /// Copies a client into a checkout's Client folder, never touching the source. It can stop at any moment and go on /// later: a file is written as name.partial and takes its real name only when complete, so a file with its real name is /// always whole. (That is also why it is never compared with the source: Content.ggpk changes once the client is prepared.) -/// Content.ggpk goes last, so a checkout that has it has all of the client. A client already prepared can instead be shared +/// The file a layout is known by goes last (Content.ggpk, or a Steam install's Bundles2\_.index.bin), so a checkout that +/// has it has all of the client. A client already prepared can instead be shared /// through a link, which saves the copy: only that kind, because preparing a client changes it, and only with the keys it /// was patched for. /// @@ -21,7 +22,7 @@ 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. - internal const long Margin = 2_000_000_000; + public 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. is another folder than @@ -44,7 +45,10 @@ public static ClientCopyPlan Plan(string source, string checkout, string? target 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(); + string index = Path.Combine("Bundles2", "_.index.bin"); + bool Last(ClientCopyFile file) => Path.GetRelativePath(target, file.Target) is var relative + && (relative.Equals("Content.ggpk", StringComparison.OrdinalIgnoreCase) || relative.Equals(index, StringComparison.OrdinalIgnoreCase)); + files = files.OrderBy(Last).ToList(); long total = files.Sum(f => f.Length), remaining = 0; foreach (var file in files) { @@ -82,7 +86,7 @@ public static void RequireSpace(ClientCopyPlan plan) static void RemoveDeadLink(string target) { if (new DirectoryInfo(target).LinkTarget is null) return; - if (ClientLocator.Classify(target) is ClientKind.Ready or ClientKind.Standalone) + if (ClientLocator.IsClient(target)) throw new IOException(L.Text("Client must be a separate physical copy in this checkout, not a link to another folder.")); if (OperatingSystem.IsWindows()) Directory.Delete(target); else File.Delete(target); // a Unix link is a file } @@ -117,8 +121,8 @@ public static bool KeysFit(string client, string keysFile) } /// Links the checkout's Client to a prepared client, with the keys from - /// (). A folder with anything in it stays: that may be a copy stopped halfway. - public static async Task ShareAsync(string client, string checkout, string keys, Action output, CancellationToken stop) + /// (; null brings none). A folder with anything in it stays: that may be a copy stopped halfway. + public static async Task ShareAsync(string client, string checkout, string? keys, Action output, CancellationToken stop) { string target = Path.Combine(checkout, "Client"); RemoveDeadLink(target); @@ -134,7 +138,7 @@ public static async Task ShareAsync(string client, string checkout, string keys, if (code != 0) throw new IOException(L.Text("Windows could not make the link at {0}. Copy the client instead.", target)); } else Directory.CreateSymbolicLink(target, ClientLocator.RealPath(client)); - BringKeys(keys, checkout); + if (keys is not null) BringKeys(keys, checkout); } /// What belongs with a prepared client, for a checkout that lacks it. 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/ClientLocator.cs b/src/Launcher.Core/ClientLocator.cs index 636c8e4..6478055 100644 --- a/src/Launcher.Core/ClientLocator.cs +++ b/src/Launcher.Core/ClientLocator.cs @@ -5,22 +5,28 @@ namespace Launcher.Core; -/// Ready: already patched by a LocalExile checkout. Standalone: a client to copy. Unsupported: a Steam or Epic -/// layout, which has no Content.ggpk and cannot be used, found only to say so. -public enum ClientKind { Ready, Standalone, Unsupported } +/// Ready: already patched by a LocalExile, in either layout. Standalone: a client to copy, with its game files in +/// Content.ggpk. Steam: a client to copy that came from Steam, with its game files loose in Bundles2. Unsupported: a folder +/// of the game LocalExile runs nothing from (an Epic install, a Steam one without its index), found only to say so. +public enum ClientKind { Ready, Standalone, Steam, Unsupported } /// Whether its executable is the build LocalExile needs (); null /// when it has none to check. /// The build's name when it is one Waypoint knows (). -public sealed record FoundClient(string Folder, ClientKind Kind, long Bytes, bool? KnownBuild, string? Build = null) +/// For a client whose game files are Steam's loose ones, prepared or not: the SHA-256 of +/// its Bundles2/_.index.bin, by which LocalExile knows whose build they are. Null for a standalone client. +public sealed record FoundClient(string Folder, ClientKind Kind, long Bytes, bool? KnownBuild, string? Build = null, string? SteamIndexSha256 = null) { public string Summary => L.Text(Kind switch { ClientKind.Ready => "Already prepared for LocalExile", ClientKind.Standalone => "Standalone client", - _ => "Steam or Epic layout: it cannot be used", + ClientKind.Steam => "Client from Steam", + _ => "LocalExile cannot use this install", }) + (Bytes > 0 ? $" · {Bytes / 1e9:0.#} GB" : "") + (Build is not null ? " · " + Build : KnownBuild == false ? " · " + L.Text("not a version LocalExile runs") : ""); public bool Usable => Kind != ClientKind.Unsupported; + /// Its game files are Steam's loose ones, whether a LocalExile prepared it or not. + public bool FromSteam => SteamIndexSha256 is not null; } /// Where it looked, for the report when nothing is found. @@ -97,19 +103,53 @@ public static string[] ExecutableHashesFor(string? build) ".git", ".vs", ".venv", "node_modules", "bin", "obj", "Bundles2", "logs" }; - /// What a folder is; null when it holds no client. + /// What a folder is; null when it holds no client. The two layouts are told apart as LocalExile does + /// (ClientFiles.Resolve): a Content.ggpk first, else Steam's loose files, known by Bundles2/_.index.bin, + /// with the executable under one of the names LocalExile looks for (ClientInstall.FindExecutable). public static ClientKind? Classify(string folder) { bool File(string name) => System.IO.File.Exists(Path.Combine(folder, name)); - if (File("Content.ggpk") && (File("PathOfExile.exe") || File("Game.exe"))) + bool game = File("PathOfExile.exe") || File("Game.exe"); + if (File("Content.ggpk") && game) return File("Game.patched.exe") ? ClientKind.Ready : ClientKind.Standalone; + if (File(Path.Combine("Bundles2", "_.index.bin")) && (game || File("PathOfExileSteam.exe"))) + return File("Game.patched.exe") ? ClientKind.Ready : ClientKind.Steam; return Directory.Exists(Path.Combine(folder, "Bundles2")) && (File("PathOfExileSteam.exe") || File("PathOfExile.exe") || File("PathOfExile_x64Steam.exe") || File("PathOfExileEGS.exe")) ? ClientKind.Unsupported : null; } - /// The original executable of a client folder. + /// Whether a folder holds a client LocalExile can run from, in either layout, prepared or not. + public static bool IsClient(string folder) => Classify(folder) is ClientKind.Ready or ClientKind.Standalone or ClientKind.Steam; + + /// The original executable of a client folder (a Steam install's is PathOfExileSteam.exe). public static string? Executable(string folder) => - new[] { "PathOfExile.exe", "Game.exe" }.Select(n => Path.Combine(folder, n)).FirstOrDefault(File.Exists); + new[] { "PathOfExile.exe", "PathOfExileSteam.exe", "Game.exe" }.Select(n => Path.Combine(folder, n)).FirstOrDefault(File.Exists); + + /// The SHA-256 of a client folder's Bundles2/_.index.bin: LocalExile knows a Steam install's game files + /// by it (ClientFiles.Problem). Null for a standalone client, a folder without the file, or one that cannot be + /// read. It reads some 20 MB: never on the UI thread. + public static string? SteamIndexOf(string folder) + { + try + { + if (File.Exists(Path.Combine(folder, "Content.ggpk"))) return null; + string index = Path.Combine(folder, "Bundles2", "_.index.bin"); + if (!File.Exists(index)) return null; + using var stream = new FileStream(index, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); + return Convert.ToHexStringLower(SHA256.HashData(stream)); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return null; } + } + + /// Whether a LocalExile that lists these builds runs this client's Steam files: by LocalExile's own rule + /// (ClientInstall.FindExecutable) the index must be the one listed for the client's version. A LocalExile with no + /// list, or none that names an index, runs no Steam install. + public static bool SteamFilesFit(IEnumerable? builds, string? version, string? steamIndexSha256) => + steamIndexSha256 is not null && builds is not null + && builds.Any(b => b.SteamIndexSha256 == steamIndexSha256 && (version is null || b.Version == version)); + + /// Whether a LocalExile folder runs a Steam install at all: its list names the index of at least one. + public static bool RunsSteamFiles(string folder) => LocalExileBuilds.Of(folder) is { } builds && builds.Any(b => b.SteamIndexSha256 is not null); /// Whether a client's executable is the build; null when there is none, or it cannot be read. public static bool? IsKnownBuild(string folder) => Identify(folder) is { } build ? IsCurrent(build) : null; @@ -280,6 +320,7 @@ public static void RemoveClient(string folder) string client = Path.Combine(folder, "Client"), old = Path.Combine(folder, RemovedClientFolder); FinishRemoval(folder); if (!Directory.Exists(client)) return; + CheckoutIgnores.Ensure(folder); string settings = Path.Combine(client, "config.json"), saved = SavedSettings(folder); if (File.Exists(settings) && !File.Exists(saved)) { @@ -333,12 +374,14 @@ internal static void DeleteTree(string folder) public static FoundClient? Describe(string folder) { if (Classify(folder) is not { } kind) return null; + bool archive = File.Exists(Path.Combine(folder, "Content.ggpk")); long bytes = 0; - try { bytes = new FileInfo(Path.Combine(folder, "Content.ggpk")).Length; } + try { if (archive) bytes = new FileInfo(Path.Combine(folder, "Content.ggpk")).Length; } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } - if (!File.Exists(Path.Combine(folder, "Content.ggpk"))) bytes = 0; + // A Steam install's game files are loose: the folder's own size, which is what a copy of it takes. + if (!archive && kind != ClientKind.Unsupported) bytes = ClientVersions.SizeOf(folder); return new(Path.TrimEndingDirectorySeparator(Path.GetFullPath(folder)), kind, bytes, kind == ClientKind.Unsupported ? null : IsKnownBuild(folder), - kind == ClientKind.Unsupported ? null : BuildOf(folder)); + kind == ClientKind.Unsupported ? null : BuildOf(folder), kind == ClientKind.Unsupported ? null : SteamIndexOf(folder)); } /// The usual places first (other checkouts' clients, what the installers recorded, the default folders), then a diff --git a/src/Launcher.Core/ClientSettings.cs b/src/Launcher.Core/ClientSettings.cs index a48ca9a..10ca6b9 100644 --- a/src/Launcher.Core/ClientSettings.cs +++ b/src/Launcher.Core/ClientSettings.cs @@ -78,7 +78,7 @@ public static string Explain(string client) /// A setup with a whole client that has no settings of its own, and has not been offered them. public static bool ShouldOffer(string client, bool offered, string? documents = null) => - !offered && File.Exists(Path.Combine(client, "Content.ggpk")) && Read(client, documents).Kind != ClientSettingsKind.Separate; + !offered && ClientVersions.FilesOf(client) != ClientLayout.None && Read(client, documents).Kind != ClientSettingsKind.Separate; /// The network mode in a settings file; null when it names none or cannot be read. public static string? NetworkMode(string configFile) diff --git a/src/Launcher.Core/ClientUpdate.cs b/src/Launcher.Core/ClientUpdate.cs index be5c75d..0342254 100644 --- a/src/Launcher.Core/ClientUpdate.cs +++ b/src/Launcher.Core/ClientUpdate.cs @@ -40,11 +40,12 @@ public sealed record Plan(Kind Kind, string Folder, string Have, string Need, bo public static Func> KnownFolders { get; set; } = () => []; /// A quick look for a client of a build (a few seconds at most): the player's LocalExile folders and the usual places - /// first. A plain client goes before one another LocalExile prepared, whose patched executable trusts that folder's keys. - /// Its folder, or null. + /// first. A plain client goes before one another LocalExile prepared, whose patched executable trusts that folder's keys, + /// and a standalone one before one from Steam, which only a LocalExile from v0.5.0-beta on runs ( + /// passes over one its folder cannot run). Its folder, or null. public static Func FindClient { get; set; } = (build, stop) => ClientLocator.Find(KnownFolders().OfType().Where(f => f.Length > 0).Distinct(StringComparer.OrdinalIgnoreCase), stop, TimeSpan.FromSeconds(2)) - .Clients.Where(c => c.Usable && c.Build == build).OrderBy(c => c.Kind == ClientKind.Ready ? 1 : 0).FirstOrDefault()?.Folder; + .Clients.Where(c => c.Usable && c.Build == build).OrderBy(c => c.Kind == ClientKind.Ready ? 1 : 0).ThenBy(c => c.FromSteam ? 1 : 0).FirstOrDefault()?.Folder; /// What the folder needs before the game starts; null when its client fits (or is not one Waypoint knows). With /// , a folder whose LocalExile is older than current LocalExile but fits its client is also @@ -52,7 +53,10 @@ public sealed record Plan(Kind Kind, string Folder, string Have, string Need, bo /// stands for . public static Plan? Check(string folder, bool lookForNewer = false, CancellationToken stop = default, Func? find = null) { - find ??= FindClient; + var look = find ?? FindClient; + // A client from Steam is one to move to only for a LocalExile that runs its files. + find = (version, cancel) => look(version, cancel) is { } at + && (ClientLocator.SteamIndexOf(at) is not { } index || ClientLocator.SteamFilesFit(LocalExileBuilds.Of(folder), version, index)) ? at : null; // Every version this folder's LocalExile runs, newest first: a client of any of them fits. var supported = ClientLocator.Supported(folder); if (supported.Count == 0) return null; @@ -107,7 +111,11 @@ static Plan For(Kind kind, string folder, string have, string need, string? foun bool exists = Directory.Exists(client); bool link = exists && new DirectoryInfo(client).Attributes.HasFlag(FileAttributes.ReparsePoint); double gigabytes = 0; - try { if (exists) gigabytes = new FileInfo(Path.Combine(client, "Content.ggpk")).Length / 1e9; } + try + { + string archive = Path.Combine(client, "Content.ggpk"); + if (exists) gigabytes = (File.Exists(archive) ? new FileInfo(archive).Length : ClientVersions.SizeOf(Path.Combine(client, "Bundles2"))) / 1e9; + } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } return new(kind, folder, have, need, link, link ? ClientLocator.RealPath(client) : client, gigabytes, found, older); } diff --git a/src/Launcher.Core/ClientVersions.cs b/src/Launcher.Core/ClientVersions.cs index 88dda8b..f1c9e01 100644 --- a/src/Launcher.Core/ClientVersions.cs +++ b/src/Launcher.Core/ClientVersions.cs @@ -47,6 +47,10 @@ public static class ClientVersions public const string Marker = ".waypoint-switching"; /// In once the copy it starts from is whole. const string Seeded = ".waypoint-seeded"; + /// Beside Client while a client that is on this PC is copied in (). + public const string CopiedFolder = ".waypoint-copied-client"; + /// In : the folder the copy is of, so that a copy of another one starts over. + const string CopyOf = ".waypoint-copy-of"; /// Room left over on the drive, beyond what a switch is known to need. public const long Margin = 4_000_000_000; @@ -177,17 +181,23 @@ static string FreeName(string folder, string? version) } /// Puts a client that was set aside back in use, and the one in use in its place in Clients\: two renames, - /// the first undone when the second fails. Nothing is downloaded or copied. - public static void Use(string folder, string name) + /// the first undone when the second fails. Nothing is downloaded or copied. With (the Game + /// client window in Advanced mode) a Client that is a link gives way too: only the link goes, once the kept + /// client is in its place, and the folder it led to is never touched. + public static void Use(string folder, string name, bool overLink = false) { string client = Client(folder), kept = Path.Combine(folder, KeptFolder, name); if (!Directory.Exists(kept)) throw new IOException(L.Text("{0} is no longer there.", kept)); + CheckoutIgnores.Ensure(folder); var layout = Layout(folder); - if (layout == ClientLayout.Link) throw new IOException(L.Text("This folder's game client is a link to another folder. Make a copy of it first.")); - if (Unfinished(folder) is not null) throw new IOException(L.Text("The game client in use is half-way to another version. Finish that switch first.")); + bool link = layout == ClientLayout.Link; + if (link && !overLink) throw new IOException(L.Text("This folder's game client is a link to another folder. Make a copy of it first.")); + // The mark of a client that is half-way is in the folder a link leads to: that folder's to finish, not this one's. + if (!link && Unfinished(folder) is not null) throw new IOException(L.Text("The game client in use is half-way to another version. Finish that switch first.")); if (MarkIn(kept) is not null) throw new IOException(L.Text("That copy was set aside half-way to another version, so it is not whole and cannot be used.")); string? aside = null; - if (Directory.Exists(client)) + if (link) aside = SetLinkAside(folder); + else if (Directory.Exists(client)) { aside = FreeName(folder, ClientLocator.BuildOf(client)); Directory.Move(client, aside); @@ -198,6 +208,118 @@ public static void Use(string folder, string name) if (aside is not null) Directory.Move(aside, client); throw; } + if (link && aside is not null) RemoveLink(aside); + } + + /// A Client that is a link, renamed out of the way () so that it can be put + /// back as it was: a rename moves the link, never what it leads to. + static string SetLinkAside(string folder) + { + string aside = Path.Combine(folder, OwnClient.OldLink); + if (ClientSettings.IsLink(aside)) RemoveLink(aside); + Directory.Move(Client(folder), aside); + return aside; + } + + /// Removes a link and nothing it leads to. + static void RemoveLink(string link) + { + if (!ClientSettings.IsLink(link)) return; + if (OperatingSystem.IsWindows()) Directory.Delete(link); else File.Delete(link); // a Unix link is a file + } + + /// + /// Puts a link to another client folder in the place of the client in use. A client that is a copy is set aside in + /// Clients\ first, and a link is only renamed out of the way; either comes back if the new link cannot be + /// made. Nothing is deleted but a link that was replaced, and undoes the rest. Only from the Game + /// client window in Advanced mode, on its user's word. makes the link once Client is + /// out of the way (Waypoint's own for a shared client, or LocalExile's own link mode) and throws when it cannot. + /// + public static async Task LinkAsync(string folder, Func link) + { + string client = Client(folder); + bool linked = Layout(folder) == ClientLayout.Link; + if (!linked && Unfinished(folder) is not null) throw new IOException(L.Text("The game client in use is half-way to another version. Finish that switch first.")); + CheckoutIgnores.Ensure(folder); + string? aside = SetAside(folder, linked); + try + { + await link(); + if (!ClientSettings.IsLink(client)) throw new IOException(L.Text("The link could not be made. The client in use was not changed.")); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or InvalidOperationException or System.ComponentModel.Win32Exception or OperationCanceledException) + { + // Whatever a failed try left in Client's place is no client: what was set aside goes back. + if (aside is not null) + { + if (ClientSettings.IsLink(client)) RemoveLink(client); + if (!Directory.Exists(client)) Directory.Move(aside, client); + } + throw; + } + if (linked && aside is not null) RemoveLink(aside); + } + + /// Takes what is in Client's place out of the way, so that it can be put back: a link is renamed + /// (), a client goes to Clients\ under its version, an empty folder is removed. Where + /// it went, or null when there was nothing to keep. + static string? SetAside(string folder, bool linked) + { + string client = Client(folder); + if (linked) return SetLinkAside(folder); + if (!Directory.Exists(client)) return null; + if (!Directory.EnumerateFileSystemEntries(client).Any()) + { + Directory.Delete(client); + return null; + } + string aside = FreeName(folder, ClientLocator.BuildOf(client)); + Directory.Move(client, aside); + return aside; + } + + /// What a copy of into the folder takes (): its plan, with + /// what an earlier try of the same copy already made counted as done. + public static ClientCopyPlan CopyInPlan(string folder, string source) => ClientCopy.Plan(source, folder, Path.Combine(folder, CopiedFolder)); + + /// + /// Brings a copy of a client that is on this PC (another LocalExile folder's, in use or kept) into the folder's + /// Client. The copy is made beside it (), with the copy the setup guide uses, so the + /// client in use goes on working meanwhile, a stop leaves what was copied, and the same copy goes on from it. Only a + /// whole copy is swapped in: a client that was in use is then kept in Clients\, and a link loses only the link. + /// The folder copied from is only read. Its patched executable comes along only with the keys it was patched for + /// (); the folder's own setup must run afterwards, which prepares the new client. + /// + public static async Task CopyInAsync(string folder, string source, Action? progress, CancellationToken stop) + { + string client = Client(folder), side = Path.Combine(folder, CopiedFolder), of = Path.Combine(side, CopyOf); + bool linked = Layout(folder) == ClientLayout.Link; + if (!linked && Unfinished(folder) is not null) throw new IOException(L.Text("The game client in use is half-way to another version. Finish that switch first.")); + CheckoutIgnores.Ensure(folder); + source = Path.TrimEndingDirectorySeparator(Path.GetFullPath(source)); + // What an earlier copy of another client left is of no use to this one. + if (Directory.Exists(side) && (!File.Exists(of) || !string.Equals(File.ReadAllText(of).Trim(), source, StringComparison.OrdinalIgnoreCase))) + ClientLocator.DeleteTree(side); + Directory.CreateDirectory(side); + await File.WriteAllTextAsync(of, source, stop); + await ClientCopy.RunAsync(CopyInPlan(folder, source), progress, stop); + stop.ThrowIfCancellationRequested(); + // Waypoint's own marks are not part of a client. + foreach (string name in new[] { CopyOf, Seeded, Marker, OwnClient.Complete }) + if (File.Exists(Path.Combine(side, name))) File.Delete(Path.Combine(side, name)); + // LocalExile's own game settings are named by the client's config.json: they go with the folder. A linked + // client's are the folder's it leads to. + string settings = Path.Combine(client, "config.json"); + if (!linked && File.Exists(settings) && !File.Exists(Path.Combine(side, "config.json"))) File.Copy(settings, Path.Combine(side, "config.json")); + + string? aside = SetAside(folder, linked); + try { Directory.Move(side, client); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + if (aside is not null) Directory.Move(aside, client); + throw; + } + if (linked && aside is not null) RemoveLink(aside); } /// Deletes a client that was set aside: renamed first, which fails as a whole while anything holds one of its @@ -279,6 +401,7 @@ public static async Task FinishKeptAsync(string folder, string name try { if (!Directory.Exists(kept)) return new(SteamOutcome.Failed, L.Text("{0} is no longer there.", kept)); + CheckoutIgnores.Ensure(folder); if (new DirectoryInfo(kept).LinkTarget is not null || FilesOf(kept) != ClientLayout.Steam) return new(SteamOutcome.Failed, L.Text("That copy is not a client from Steam, so Steam cannot finish it.")); var fetched = await SteamDownload.FetchAsync(tool, build, account, kept, @@ -320,6 +443,8 @@ void Downloading(SteamProgress p) => progress?.Invoke(new("download", (p.Depot - 1 + p.Percent / 100) / p.Depots, L.Text("Part {0} of {1}: {2:0.0}% · {3}", p.Depot, p.Depots, p.Percent, p.File))); try { + // A source copy: git leaves alone what is made beside Client from here on. + CheckoutIgnores.Ensure(folder); if (layout == ClientLayout.Steam && way == SwitchWay.UpdateInPlace) { if (Directory.Exists(next)) ClientLocator.DeleteTree(next); diff --git a/src/Launcher.Core/LeagueArtwork.cs b/src/Launcher.Core/LeagueArtwork.cs index 693a9e2..b6e62cd 100644 --- a/src/Launcher.Core/LeagueArtwork.cs +++ b/src/Launcher.Core/LeagueArtwork.cs @@ -8,7 +8,7 @@ public sealed record LeagueArtwork(string Normal, string Hardcore) { public static async Task LoadAsync(string root, CancellationToken cancellation = default) { - if (!File.Exists(Path.Combine(root, "Client/Content.ggpk"))) return null; + if (ClientVersions.FilesOf(Path.Combine(root, "Client")) == ClientLayout.None) return null; var start = new ProcessStartInfo(Platform.Python) { WorkingDirectory = root, CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true }; foreach (var argument in new[] { Path.Combine(Path.GetDirectoryName(BridgeScripts.Extract())!, "LeagueArt.py"), root, diff --git a/src/Launcher.Core/LocalExileBuilds.cs b/src/Launcher.Core/LocalExileBuilds.cs index 48cf66a..b05763b 100644 --- a/src/Launcher.Core/LocalExileBuilds.cs +++ b/src/Launcher.Core/LocalExileBuilds.cs @@ -39,11 +39,15 @@ public static class LocalExileBuilds const string SourceList = "src/GameServer.Core/Protocol/ClientBuilds.cs"; - /// Whether the folder is a release from before LocalExile could list its builds. Such a folder has no list - /// for good; any other that answers none may only have failed to answer. + /// Whether the folder is a release from before LocalExile could list its builds, or a source copy from before + /// it had the list. Such a folder has no list for good; any other that answers none may only have failed to answer. public static bool TooOld(string folder) { - try { return LocalExileReleases.IsInstall(folder) && (LocalExileReleases.Installed(folder) is not { } version || version.CompareTo(FirstWithList) < 0); } + try + { + return LocalExileReleases.IsInstall(folder) ? LocalExileReleases.Installed(folder) is not { } version || version.CompareTo(FirstWithList) < 0 + : !File.Exists(Path.Combine(folder, SourceList)); + } catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException) { return false; } } diff --git a/src/Launcher.Core/OwnClient.cs b/src/Launcher.Core/OwnClient.cs index 87a67f6..075733b 100644 --- a/src/Launcher.Core/OwnClient.cs +++ b/src/Launcher.Core/OwnClient.cs @@ -14,7 +14,8 @@ namespace Launcher.Core; /// 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's client (the Client of a checkout or a release) is shared with it and is left alone, -/// by the rule LocalExile's own warning uses. +/// by the rule LocalExile's own warning uses. Its user can still ask for a copy in its place, from the Game client window +/// in Advanced mode (shared), for a release and for a source copy alike: the same copy, made the same way. /// public static class OwnClient { @@ -27,7 +28,8 @@ public static class OwnClient /// 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) + /// The link leads to another LocalExile folder's Client, not to a game folder of the user's. + public sealed record Plan(string Folder, string Source, ClientCopyPlan Copy, long? Free, bool Shared = false) { public bool HasSpace => Free is not { } free || free >= Copy.Remaining + ClientCopy.Margin; /// What an earlier try already copied. @@ -49,19 +51,21 @@ public enum Outcome 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) + /// or a link that leads to no client Waypoint can copy (the setup guide's to replace). With , + /// a link to another LocalExile's client has a copy too: nothing needs it, but its user may want it. + public static Plan? Check(string folder, bool shared = false) { 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; + bool theirs = InLocalExile(source); + if (!ClientLocator.IsClient(source) || theirs && !shared) 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)); + return new(Path.TrimEndingDirectorySeparator(Path.GetFullPath(folder)), source, copy, ClientCopy.FreeSpace(copy.Target), theirs); } catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException or System.Security.SecurityException) { return null; } } @@ -106,7 +110,7 @@ public static (string Message, string Details) Text(Plan plan) + (plan.Copied >= 100_000_000 ? " " + L.Text("The copy goes on from the {0:0.#} GB made earlier.", plan.Copied / 1e9) : "") : L.Text("The drive is too full for the copy: it needs {0:0.#} GB, and {1:0.#} GB is free. Free some space and try again; until then nothing changes.", (plan.Copy.Remaining + ClientCopy.Margin) / 1e9, (plan.Free ?? 0) / 1e9); - string details = L.Text("Your Path of Exile folder (only read):") + "\n " + plan.Source + "\n" + string details = (plan.Shared ? L.Text("The linked game client (only read):") : 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 (message, details); } @@ -144,7 +148,8 @@ public static string[] Leftovers(string source) 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); + // Another LocalExile's client keeps what that LocalExile made in it. + string[] left = plan.Shared ? [] : 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)); } @@ -158,7 +163,7 @@ public static string FailedText(Plan plan, string reason) => /// (), then the question, then the move while holds the folder (false: /// something else holds it). Whatever comes of it, the release still has a client that works. public static async Task MakeCopyAsync(string folder, Func ask, Action? progress, - Func, Task> exclusive, CancellationToken stop) + Func, Task> exclusive, CancellationToken stop, bool shared = false) { var plan = await Task.Run(() => { @@ -168,14 +173,14 @@ public static async Task MakeCopyAsync(string folder, Func a Discard(folder); } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } - return Check(folder); + return Check(folder, shared); }); if (plan is null || !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); } + try { await Task.Run(() => MoveAsync(folder, progress, stop, shared), CancellationToken.None); } catch (OperationCanceledException) { stopped = true; } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { failure = e; } }); @@ -186,9 +191,10 @@ public static async Task MakeCopyAsync(string folder, Func a /// 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) + public static async Task MoveAsync(string folder, Action? progress, CancellationToken stop, bool shared = false) { - 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.")); + var plan = Check(folder, shared) ?? throw new IOException(L.Text("This folder's game client is no longer a link, so there is nothing to copy.")); + CheckoutIgnores.Ensure(folder); // 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; @@ -198,7 +204,7 @@ public static async Task MoveAsync(string folder, Action? pr 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.")); + if (stale) plan = Check(folder, shared) ?? 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); diff --git a/src/Launcher.Core/Platform.cs b/src/Launcher.Core/Platform.cs index c15875f..cfe5539 100644 --- a/src/Launcher.Core/Platform.cs +++ b/src/Launcher.Core/Platform.cs @@ -31,6 +31,47 @@ public static class Platform public static string VenvPython(string root) => OperatingSystem.IsWindows() ? Path.Combine(root, ".venv", "Scripts", "python.exe") : Path.Combine(root, ".venv", "bin", "python"); + /// + /// Gives everything Waypoint starts the module path Windows PowerShell expects. Started from a PowerShell 7 shell + /// (a terminal, an editor's), Waypoint inherits that shell's PSModulePath, which names PowerShell 7's own module + /// folders first; Windows PowerShell, which the adapter and live.ps1 run under, then finds PowerShell 7's version of + /// its built-in modules, cannot load it, and a command as plain as Get-FileHash "is not recognized". PowerShell 7 + /// takes its own folders out when it starts Windows PowerShell itself; it cannot for a program in between, so + /// Waypoint does the same for its own process, once, at its start. Nothing else is changed, and a PowerShell 7 that + /// Waypoint starts adds its folders again by itself. + /// + public static void UseWindowsPowerShellModules() + { + if (!OperatingSystem.IsWindows()) return; + string? inherited = Environment.GetEnvironmentVariable("PSModulePath"); + string? cleaned = WithoutPowerShell7(inherited, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PowerShell", "Modules"), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "PowerShell", "Modules")); + if (cleaned != inherited) Environment.SetEnvironmentVariable("PSModulePath", cleaned); + } + + /// A module path without the three folders PowerShell 7 adds for itself: its user folder, its shared folder, + /// and the Modules folder of a PowerShell 7 install, known by the pwsh beside it wherever that install is. + /// Every other entry stays, in its order (a product's own module folder may be named PowerShell too). Null when + /// nothing is left: Windows PowerShell then builds its own. + public static string? WithoutPowerShell7(string? modulePath, string userModules, string sharedModules) + { + if (string.IsNullOrEmpty(modulePath)) return modulePath; + static string Clean(string folder) => Path.TrimEndingDirectorySeparator(folder.Trim().Trim('"')); + bool Same(string a, string b) => string.Equals(Clean(a), Clean(b), StringComparison.OrdinalIgnoreCase); + bool Home(string entry) + { + try + { + return Path.GetFileName(Clean(entry)).Equals("Modules", StringComparison.OrdinalIgnoreCase) && Path.GetDirectoryName(Clean(entry)) is { Length: > 0 } above + && (File.Exists(Path.Combine(above, "pwsh.exe")) || File.Exists(Path.Combine(above, "pwsh.dll"))); + } + catch (ArgumentException) { return false; } + } + string[] entries = modulePath.Split(';', StringSplitOptions.RemoveEmptyEntries); + var kept = entries.Where(entry => !Same(entry, userModules) && !Same(entry, sharedModules) && !Home(entry)).ToArray(); + return kept.Length == entries.Length ? modulePath : kept.Length == 0 ? null : string.Join(';', kept); + } + /// A file on PATH; null when there is none. public static string? OnPath(string file) { diff --git a/src/Launcher.Core/Resources/Strings.resx b/src/Launcher.Core/Resources/Strings.resx index 53d1a15..0384c9d 100644 --- a/src/Launcher.Core/Resources/Strings.resx +++ b/src/Launcher.Core/Resources/Strings.resx @@ -126,6 +126,9 @@ What backups include + + Client/Game.exe: a copy of PathOfExile.exe (Steam: PathOfExileSteam.exe) + {0}: no variant is defined for this league family; this option is unavailable. @@ -300,6 +303,9 @@ Hovered controls + + Choose your Path of Exile {0} folder: a standalone install (PathOfExile.exe and Content.ggpk) or a Steam install (PathOfExileSteam.exe and Bundles2). + Records each area's walk map with Frida @@ -705,6 +711,9 @@ Switch puzzle + + The link is in use now. + Repository @@ -1132,6 +1141,9 @@ Close the game and anything else using that folder, then try again. Possible: {0} + + LocalExile cannot use this folder. Choose a standalone or a Steam install. + Accounts refreshed. @@ -1204,6 +1216,9 @@ Close the game and anything else using that folder, then try again. What is happening + + Link: the folder in use runs the game from this client's folder. Nothing is copied. LocalExile changes files there, and a Path of Exile update there can break this LocalExile. + Automatic lookup runs on first use. You can also search again here. @@ -1261,6 +1276,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. @@ -1381,6 +1399,9 @@ Close the game and anything else using that folder, then try again. Area level + + Client needs Content.ggpk (standalone) or Bundles2\_.index.bin (Steam) + Only the published Waypoint.exe updates itself @@ -1505,6 +1526,9 @@ Change location above to choose somewhere else. Rare + + Waypoint makes a copy of this client for the folder in use: {0:0.#} GB. + BUILT COMPONENTS · DEBUG @@ -1634,6 +1658,9 @@ Change location above to choose somewhere else. the download holds an unsafe path, {0}; nothing was installed + + If you have no such folder, tick the box below. Then choose Game client in the folder list to download the game from Steam. + Close the game and stop services to create this league. Your draft is kept. @@ -1685,6 +1712,9 @@ Change location above to choose somewhere else. Get {0} + + This client: + Runtime status has not been confirmed. @@ -1733,6 +1763,9 @@ Change location above to choose somewhere else. Full copy + + The game files in this folder do not match its version, so preparing it will probably fail. Let Steam finish updating the game, or choose another folder. + Install Waypoint Tools? @@ -1784,9 +1817,6 @@ Change location above to choose somewhere else. Switch for every copy? - - Standalone 3.29.3c executable at Client/Game.exe - Mod @@ -2031,6 +2061,9 @@ This checkout has modified tracked files. League flag + + The folder in use: + Waypoint mint @@ -2109,9 +2142,6 @@ This checkout has modified tracked files. Switch - - Prepare the existing client copy using LocalExile's Auth and Patch tools. Existing login keys are retained. A verified supported PathOfExile.exe can refresh a stale Game.exe and its patched copy; previous executables are backed up first. Linked clients are never changed. - The Steam download did not finish. @@ -2215,6 +2245,9 @@ This checkout has modified tracked files. {0} mods · {1} {2} + + Choose a folder with a Path of Exile client + Password (at least 4 characters; not saved by the launcher) @@ -2491,6 +2524,9 @@ This checkout has modified tracked files. Details + + The linked game client (only read): + Global mods @@ -2539,6 +2575,9 @@ This checkout has modified tracked files. Power symbols + + This folder's game client is not a version this LocalExile runs. + Gold door @@ -2773,6 +2812,9 @@ This checkout has modified tracked files. threads + + Copy: the folder in use gets its own copy, {0:0.#} GB. + Building selected revision @@ -2806,6 +2848,9 @@ This checkout has modified tracked files. Stashed changes restored. + + The link you use now is removed. The folder it leads to is not changed. + Set up @@ -3073,9 +3118,6 @@ This checkout has modified tracked files. Update LocalExile to {0}? - - {0} has no Content.ggpk and PathOfExile.exe, so it is not a standalone client. - The backups folder {0} can't be used ({1}), so backups go to {2} for now. @@ -3234,9 +3276,6 @@ Current saves are unchanged. This backup will no longer be available to restore. The older version could not be chosen (git exit {0}). - - Steam and Epic installs have no Content.ggpk and do not work. Choose a standalone install. - No leagues @@ -3249,6 +3288,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… @@ -3831,9 +3873,6 @@ Switching to it builds and runs that code on this computer with your rights, liv Some of your folders or tools can't be used - - standalone client layout (Content.ggpk) - Stop offering these characters? @@ -3984,6 +4023,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Your old characters stay in {0} until you delete that folder. + + game files in Client\ (Content.ggpk, or Steam's Bundles2) + Uninstall {0} @@ -4173,6 +4215,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. @@ -4221,6 +4266,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Using your selected checkout. Change location or search again at any time. + + Only the copied client's gateway list is updated. + Python could not make its environment in {0}. @@ -4341,6 +4389,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Base + + {0} is copied. + Waiting for the Steam sign-in … @@ -4356,9 +4407,6 @@ Switching to it builds and runs that code on this computer with your rights, liv Open the setup guide - - To change this client, choose its folder in the sidebar. - {0}: choose from {1} to {2} @@ -4563,6 +4611,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). @@ -4617,6 +4668,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Unsaved settings + + You need a Path of Exile client that LocalExile runs: your own standalone or Steam install, or one downloaded from Steam after this guide. + Power @@ -4734,6 +4788,9 @@ Switching to it builds and runs that code on this computer with your rights, liv LocalExile server checkout (the folder with GameServer.slnx) + + This LocalExile runs only a standalone client. A client from Steam needs a newer LocalExile. + The game data could not be extracted (exit {0}). @@ -4767,6 +4824,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Save or discard the current draft before changing league visibility. + + Prepare the existing client copy using LocalExile's Auth and Patch tools. Existing login keys are retained. A verified supported PathOfExile.exe (Steam: PathOfExileSteam.exe) can refresh a stale Game.exe and its patched copy; previous executables are backed up first. Linked clients are never changed. + Running {0} … @@ -4797,9 +4857,6 @@ Switching to it builds and runs that code on this computer with your rights, liv Frida is optional; Python is needed for its game tools. - - Standalone Content.ggpk is required; Steam layout is unsupported - Adds a Simple | Advanced switch to the sidebar. On a release install, Advanced adds the status strip, performance and server timings; the other sections need a source checkout. @@ -4941,9 +4998,6 @@ Switching to it builds and runs that code on this computer with your rights, liv gen 2 - - Choose a folder with PathOfExile.exe and Content.ggpk: a standalone Path of Exile {0} install. Steam and Epic installs do not work here. - client not running @@ -5493,6 +5547,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys The update failed: {0} + + LocalExile cannot use this install + Patch server: the client's update check stays local @@ -5613,6 +5670,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Waypoint is closing. Wait for it to finish, then open it again. + + The client you use now is kept, not deleted. + Fit @@ -5895,6 +5955,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Keep this version? + + Link + Change… @@ -5970,6 +6033,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Lines containing this text (case ignored) + + Use this client + Check the account name and password requirements above. @@ -6258,6 +6324,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. @@ -6330,6 +6399,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Color-vision profiles override accent and status colors, including custom choices. Windows High Contrast takes priority over all palettes. + + {0} is in use now. The link was removed. The folder it led to was not changed. + Copy the complete client into its Client folder first. Preparation creates missing local keys and a prepared executable, then selects the local gateway in that copy. Close the game and stop services before making setup changes. @@ -6378,9 +6450,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Saved - - robocopy your 3.29.3c client to Client, then copy PathOfExile.exe to Game.exe - Keep at least one playable league card available for new characters. @@ -6648,6 +6717,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Redirected settings paths are not supported. + + Link: the folder in use runs the game from this client's folder. Nothing is copied, and what changes there changes here. + Your saves could not be read. Nothing was changed. @@ -6765,6 +6837,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys LocalExile has no release to download yet. + + Choose your Path of Exile folder + This client is incomplete and cannot be used. @@ -6958,23 +7033,12 @@ Last reported Gateway event. Open Gateway output for details. Could not load source choices: - - Copy the complete standalone PoE 3.29.3c installation to: -{0} - -1. In File Explorer, open the supported client folder containing Content.ggpk and PathOfExile.exe (or Game.exe). -2. Press Ctrl+A, then Ctrl+C to copy; do not move your normal installation. -3. Open the selected checkout in another File Explorer window. Create its Client folder if missing, open it, then press Ctrl+V. -4. Wait for the copy to finish. Return to Setup and click Prepare local client. - -Steam layout and a newer official client are unsupported. The launcher does not download the game. - - - Choose your Path of Exile folder (the one with Content.ggpk) - Use separate game settings… + + This client is from Steam, and this LocalExile is too old to run it. Update LocalExile first, or choose a standalone client. + Create local account @@ -7136,6 +7200,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. @@ -7436,6 +7503,9 @@ Client: {2} RARE NAME + + The link could not be made. The client in use was not changed. + Use color @@ -7616,6 +7686,9 @@ Dependencies: {2} Install mod + + Use this client? + Path of Exile, patched for the local servers @@ -7778,6 +7851,9 @@ Dependencies: {2} Enter a description of 1–2000 characters. + + Client from Steam + Warlord @@ -7799,6 +7875,9 @@ Dependencies: {2} RestoreBackup completed. + + Client\ has neither Content.ggpk (standalone) nor Bundles2\_.index.bin (Steam) + Rose @@ -7929,9 +8008,6 @@ Dependencies: {2} {0} holds the rules of a game mode. Turned on here, they apply to every character in this league from the next server start, without that mode's own skills, vendors and quest rewards, and the game still shows the league as it is. Untick it to go back. - - Use this version - The versions of the game this LocalExile holds: get one from Steam, keep several, switch between them @@ -8013,9 +8089,6 @@ Dependencies: {2} BuildMods completed. - - Steam installs have no Content.ggpk - Shown as a mode of: {0} @@ -8055,12 +8128,18 @@ Dependencies: {2} Password + + The link is in use now. The client it replaced is kept. + One checkout matches upstream HEAD. You can use it below or Browse elsewhere. Testing + + Choose a client outside this LocalExile folder. + shares another LocalExile folder's client @@ -8127,9 +8206,6 @@ Dependencies: {2} Guardian portals - - This client belongs to a source copy of LocalExile, which looks after its own client. - Select a backup to restore or delete it. @@ -8160,6 +8236,9 @@ Dependencies: {2} Your characters came with you, so log in as usual. Mods you added yourself did not: they are still in your old folder. + + Use this client… + Building services @@ -8196,6 +8275,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. @@ -8265,6 +8347,9 @@ Dependencies: {2} Settings must be a JSON object. + + Browse for a client… + now @@ -8433,6 +8518,17 @@ Dependencies: {2} Opens the setup guide, which gets LocalExile ready in a folder you choose + + Copy your complete Path of Exile folder to: +{0} + +1. In File Explorer, open the game folder. A standalone install has Content.ggpk and PathOfExile.exe; a Steam install has Bundles2 and PathOfExileSteam.exe. +2. Press Ctrl+A, then Ctrl+C to copy; do not move your normal installation. +3. Open the selected checkout in another File Explorer window. Create its Client folder if missing, open it, then press Ctrl+V. +4. Wait for the copy to finish. Return to Setup and click Prepare local client. + +The client must be a version this LocalExile runs. Or choose Game client in the folder list to download one from Steam. + Welcome to Waypoint @@ -8490,6 +8586,9 @@ Dependencies: {2} Python with frida (walk maps, console) + + {0} has no Path of Exile client that LocalExile can use. + Random name @@ -8683,6 +8782,9 @@ Mods at backup: Setup guide + + robocopy your game client to Client, then copy PathOfExile.exe (Steam: PathOfExileSteam.exe) to Game.exe + Clean up @@ -8710,9 +8812,6 @@ Mods at backup: Starting, rebuilding or restarting; inspect Gateway output for errors - - You need a Path of Exile client that LocalExile runs: your own standalone copy, or for a release one downloaded from Steam after this guide. - not the 3.29.3c build @@ -8758,6 +8857,9 @@ Mods at backup: {0} has no game settings. + + A link is not possible here: this client is not prepared for the folder in use. + Open Waypoint's data folder @@ -8896,9 +8998,6 @@ Mods at backup: Fortress - - Steam or Epic layout: it cannot be used - Game settings diff --git a/src/Launcher.Core/Resources/Strings.ru.resx b/src/Launcher.Core/Resources/Strings.ru.resx index 377de09..6861720 100644 --- a/src/Launcher.Core/Resources/Strings.ru.resx +++ b/src/Launcher.Core/Resources/Strings.ru.resx @@ -126,6 +126,9 @@ Что входит в копии + + Client/Game.exe: копия PathOfExile.exe (в Steam: PathOfExileSteam.exe) + {0}: для этого семейства лиг вариант не определён; параметр недоступен. @@ -300,6 +303,9 @@ Элементы под указателем + + Выберите папку Path of Exile {0}: автономную установку (PathOfExile.exe и Content.ggpk) или установку Steam (PathOfExileSteam.exe и Bundles2). + Записывает планировку каждой области через Frida @@ -705,6 +711,9 @@ Головоломка с рычагами + + Теперь используется ссылка. + Репозиторий @@ -1132,6 +1141,9 @@ Возможный босс: {0} + + LocalExile не может работать с этой папкой. Выберите автономную установку или установку Steam. + Список аккаунтов обновлён. @@ -1204,6 +1216,9 @@ Что происходит + + Ссылка: используемая папка запускает игру из папки этого клиента. Ничего не копируется. LocalExile изменяет в ней файлы, а обновление Path of Exile в ней может сломать этот LocalExile. + При первом запуске выполняется автоматический поиск. Здесь можно запустить его повторно. @@ -1261,6 +1276,9 @@ Не удалось проверить службы перед выходом. + + {0}: не подходит + {0}, {1:0.#} ГБ, будет удалена безвозвратно. Используемая версия не затрагивается. @@ -1381,6 +1399,9 @@ Уровень области + + В Client нужен Content.ggpk (автономный клиент) или Bundles2\_.index.bin (Steam) + Обновляется только опубликованный Waypoint.exe @@ -1505,6 +1526,9 @@ Редкий + + Waypoint сделает копию этого клиента для используемой папки: {0:0.#} ГБ. + СОБРАННЫЕ КОМПОНЕНТЫ · DEBUG @@ -1634,6 +1658,9 @@ в загрузке небезопасный путь, {0}; ничего не установлено + + Если такой папки нет, отметьте флажок ниже. Затем выберите «Клиент игры» в списке папок, чтобы загрузить игру из Steam. + Закройте игру и остановите службы, чтобы создать лигу. Черновик сохранён в форме. @@ -1685,6 +1712,9 @@ Скачать {0} + + Этот клиент: + Состояние в игре не подтверждено. @@ -1733,6 +1763,9 @@ Полная копия + + Файлы игры в этой папке не соответствуют её версии, поэтому подготовка, скорее всего, не удастся. Дайте Steam закончить обновление игры или выберите другую папку. + Установить Waypoint Tools? @@ -1784,9 +1817,6 @@ Переключить для всех копий? - - Исполняемый файл отдельного клиента 3.29.3c: Client/Game.exe - Мод @@ -2031,6 +2061,9 @@ Флаг лиги + + Используемая папка: + Мятная Waypoint @@ -2109,9 +2142,6 @@ Перейти - - Подготовить существующую копию клиента средствами Auth и Patch из LocalExile. Текущие ключи входа сохраняются. Проверенный поддерживаемый PathOfExile.exe может обновить устаревшие Game.exe и его исправленную копию; сначала создаются резервные копии прежних исполняемых файлов. Клиенты, подключённые ссылкой, не изменяются. - Загрузка из Steam не завершена. @@ -2215,6 +2245,9 @@ Модов: {0} · {1} {2} + + Выберите папку с клиентом Path of Exile + Пароль (не менее 4 символов; Waypoint его не сохраняет) @@ -2491,6 +2524,9 @@ Сведения + + Клиент игры по ссылке (только чтение): + Общие моды @@ -2539,6 +2575,9 @@ Символы силы + + Клиент игры в этой папке — не та версия, с которой работает этот LocalExile. + Золотая дверь @@ -2773,6 +2812,9 @@ потоки + + Копировать: используемая папка получит собственную копию, {0:0.#} ГБ. + Сборка выбранной ревизии @@ -2806,6 +2848,9 @@ Отложенные изменения возвращены. + + Ссылка, которую вы используете сейчас, будет удалена. Папка, на которую она ведёт, не изменится. + Настройка @@ -3073,9 +3118,6 @@ Обновить LocalExile до {0}? - - В {0} нет Content.ggpk и PathOfExile.exe, поэтому это не автономный клиент. - Папку резервных копий {0} нельзя использовать ({1}), поэтому пока копии сохраняются в {2}. @@ -3234,9 +3276,6 @@ Не удалось выбрать старую версию (git завершился с кодом {0}). - - В установках Steam и Epic нет Content.ggpk, они не подходят. Выберите автономную установку. - Ни одна лига @@ -3249,6 +3288,9 @@ Связи карточек лиг образуют цикл. + + Чтобы сменить его, выберите «Клиент игры» в списке папок. + Настроить заново… @@ -3831,9 +3873,6 @@ Некоторые ваши папки или программы недоступны - - структура отдельного клиента (Content.ggpk) - Больше не предлагать этих персонажей? @@ -3984,6 +4023,9 @@ Старые персонажи останутся в {0}, пока вы не удалите эту папку. + + файлы игры в Client\ (Content.ggpk или Bundles2 из Steam) + Удалить {0} @@ -4173,6 +4215,9 @@ Единственный клиент становится другой версией. Загружаются только отличия, дополнительное место не нужно, но прежняя версия не сохраняется. + + Этот LocalExile работает с Path of Exile {0}. + Команды проходят через игровой клиент (scripts/dev/client_control.py): сначала запустите игру и войдите в область. @@ -4221,6 +4266,9 @@ Используется выбранный репозиторий. Вы можете изменить путь или повторить поиск в любое время. + + Обновляется только список шлюзов скопированного клиента. + Python не смог создать окружение в {0}. @@ -4341,6 +4389,9 @@ База + + {0} скопирована. + Ожидание входа в Steam… @@ -4356,9 +4407,6 @@ Открыть мастер настройки - - Чтобы изменить этот клиент, выберите его папку на боковой панели. - {0}: выберите от {1} до {2} @@ -4563,6 +4611,9 @@ LocalExile v0.4.2-beta, с которым точно работает этот Waypoint. Перейти на последние изменения можно позже в разделе «Версии». + + Использовать другой клиент… + Готово: {0} ({1:0} с). @@ -4617,6 +4668,9 @@ Несохранённые настройки + + Нужен клиент Path of Exile, с которым работает LocalExile: ваша автономная установка или установка Steam, либо клиент, загруженный из Steam после этого мастера. + Мощь @@ -4734,6 +4788,9 @@ Репозиторий сервера LocalExile (папка с GameServer.slnx) + + Этот LocalExile работает только с автономным клиентом. Для клиента из Steam нужен более новый LocalExile. + Не удалось извлечь игровые данные (код {0}). @@ -4767,6 +4824,9 @@ Сохраните или отмените текущий черновик перед изменением видимости лиги. + + Подготовить существующую копию клиента средствами Auth и Patch из LocalExile. Текущие ключи входа сохраняются. Проверенный поддерживаемый PathOfExile.exe (в Steam: PathOfExileSteam.exe) может обновить устаревшие Game.exe и его исправленную копию; сначала создаются резервные копии прежних исполняемых файлов. Клиенты, подключённые ссылкой, не изменяются. + Выполняется {0} … @@ -4797,9 +4857,6 @@ Frida не обязательна; для её игровых инструментов нужен Python. - - Нужен Content.ggpk отдельного клиента; установка Steam не поддерживается - Добавляет на боковую панель переключатель «Простой | Расширенный». В установленном выпуске расширенный режим добавляет строку состояния, производительность и время работы сервера; остальным разделам нужен исходный код. @@ -4941,9 +4998,6 @@ пок. 2 - - Выберите папку с PathOfExile.exe и Content.ggpk: автономную установку Path of Exile {0}. Установки из Steam и Epic здесь не подходят. - клиент не запущен @@ -5493,6 +5547,9 @@ Не удалось обновить: {0} + + LocalExile не может работать с этой установкой + Сервер обновлений: проверка обновлений клиента остаётся локальной @@ -5613,6 +5670,9 @@ Waypoint закрывается. Дождитесь завершения, затем откройте его снова. + + Клиент, который вы используете сейчас, сохранится, а не будет удалён. + Вписать @@ -5895,6 +5955,9 @@ Оставить эту версию? + + Ссылка + Изменить… @@ -5970,6 +6033,9 @@ Строки с этим текстом (без учёта регистра) + + Использовать этот клиент + Проверьте указанные выше требования к имени и паролю. @@ -6258,6 +6324,9 @@ Исходные значки модулей + + Клиенты игры этой папки LocalExile: какая версия используется и как перейти на другую + Репозиториев с HEAD LocalExile: {0}. Выберите один ниже или укажите другую папку. @@ -6330,6 +6399,9 @@ Профили восприятия заменяют акцентные цвета и цвета состояний, включая свои настройки. Высокая контрастность Windows имеет приоритет над всеми палитрами. + + Теперь используется {0}. Ссылка удалена. Папка, на которую она вела, не изменена. + Сначала скопируйте полный клиент в папку Client этого репозитория. Подготовка создаст недостающие локальные ключи и исполняемый файл, затем выберет локальный шлюз в этой копии. Перед изменениями закройте игру и остановите службы. @@ -6378,9 +6450,6 @@ Сохранённые - - скопируйте клиент 3.29.3c в Client через robocopy, затем скопируйте PathOfExile.exe в Game.exe - Оставьте хотя бы одну доступную для игры карточку лиги при создании персонажей. @@ -6648,6 +6717,9 @@ Перенаправленные пути настроек не поддерживаются. + + Ссылка: используемая папка запускает игру из папки этого клиента. Ничего не копируется, и что меняется там, меняется и здесь. + Не удалось прочитать сохранения. Ничего не изменено. @@ -6765,6 +6837,9 @@ У LocalExile пока нет выпуска для загрузки. + + Выберите папку Path of Exile + Этот клиент неполный, использовать его нельзя. @@ -6958,23 +7033,12 @@ Не удалось загрузить варианты исходников: - - Скопируйте полную установку отдельного клиента PoE 3.29.3c в: -{0} - -1. В Проводнике откройте папку поддерживаемого клиента с Content.ggpk и PathOfExile.exe (или Game.exe). -2. Нажмите Ctrl+A, затем Ctrl+C, чтобы скопировать файлы; не перемещайте основную установку. -3. Откройте выбранный репозиторий в другом окне Проводника. При необходимости создайте папку Client, откройте её и нажмите Ctrl+V. -4. Дождитесь завершения копирования. Вернитесь на страницу подготовки и нажмите «Подготовить клиент». - -Установка Steam и более новый официальный клиент не поддерживаются. Waypoint не скачивает игру. - - - Выберите папку Path of Exile (с файлом Content.ggpk) - Использовать отдельные настройки игры… + + Это клиент из Steam, а этот LocalExile слишком старый, чтобы с ним работать. Сначала обновите LocalExile или выберите автономный клиент. + Создать учётную запись @@ -7136,6 +7200,9 @@ Сохраните настройки лиги перед применением выбора модулей. + + На этом ПК есть клиент {0}: {1} + Сначала закройте игру и остановите текущий LocalExile. @@ -7436,6 +7503,9 @@ ИМЯ РЕДКОГО ПРЕДМЕТА + + Ссылку создать не удалось. Используемый клиент не изменён. + Выбрать цвет @@ -7616,6 +7686,9 @@ Установить мод + + Использовать этот клиент? + Path of Exile, подготовленный для локальных серверов @@ -7778,6 +7851,9 @@ Введите описание длиной от 1 до 2000 символов. + + Клиент из Steam + Вождь @@ -7799,6 +7875,9 @@ Сохранения восстановлены. + + В Client\ нет ни Content.ggpk (автономный клиент), ни Bundles2\_.index.bin (Steam) + Роза @@ -7929,9 +8008,6 @@ {0} содержит правила режима игры. Если включить его здесь, они будут действовать для всех персонажей этой лиги со следующего запуска сервера, без собственных умений, торговцев и наград за задания этого режима, а игра по-прежнему будет показывать лигу как есть. Снимите флажок, чтобы вернуть всё назад. - - Использовать эту версию - Версии игры в этом LocalExile: получить из Steam, хранить несколько, переключаться между ними @@ -8013,9 +8089,6 @@ Моды собраны. - - В установках Steam нет Content.ggpk - Отображается как режим лиги: {0} @@ -8055,12 +8128,18 @@ Пароль + + Теперь используется ссылка. Клиент, который она заменила, сохранён. + Один репозиторий совпадает с HEAD LocalExile. Выберите его ниже или укажите другую папку. Тестирование + + Выберите клиент вне этой папки LocalExile. + общий клиент с другой папкой LocalExile @@ -8127,9 +8206,6 @@ Порталы защитников - - Этот клиент принадлежит копии исходного кода LocalExile, которая сама управляет своим клиентом. - Выберите копию для восстановления или удаления. @@ -8160,6 +8236,9 @@ Ваши персонажи перенесены, так что входите как обычно. Моды, которые вы добавляли сами, не перенесены: они остались в старой папке. + + Использовать этот клиент… + Сборка служб @@ -8196,6 +8275,9 @@ Выберите репозиторий LocalExile в настройках. + + не подходит к этому LocalExile + Ветки и PR не найдены. Очистите или измените поиск либо введите номер PR ниже. @@ -8265,6 +8347,9 @@ Настройки должны быть объектом JSON. + + Выбрать клиент в папке… + сейчас @@ -8433,6 +8518,17 @@ Открывает мастер настройки, который подготовит LocalExile в выбранной вами папке + + Скопируйте всю папку Path of Exile в: +{0} + +1. В Проводнике откройте папку игры. В автономной установке есть Content.ggpk и PathOfExile.exe, в установке Steam — Bundles2 и PathOfExileSteam.exe. +2. Нажмите Ctrl+A, затем Ctrl+C, чтобы скопировать файлы; не перемещайте основную установку. +3. Откройте выбранный репозиторий в другом окне Проводника. При необходимости создайте папку Client, откройте её и нажмите Ctrl+V. +4. Дождитесь завершения копирования. Вернитесь на страницу подготовки и нажмите «Подготовить клиент». + +Клиент должен быть версии, с которой работает этот LocalExile. Или выберите «Клиент игры» в списке папок, чтобы загрузить его из Steam. + Добро пожаловать в Waypoint @@ -8490,6 +8586,9 @@ Python с frida (запись планировок, консоль) + + В {0} нет клиента Path of Exile, с которым может работать LocalExile. + Случайное имя @@ -8683,6 +8782,9 @@ Мастер настройки + + скопируйте клиент игры в Client через robocopy, затем скопируйте PathOfExile.exe (в Steam: PathOfExileSteam.exe) в Game.exe + Очистить @@ -8710,9 +8812,6 @@ Запуск, сборка или перезапуск; проверьте вывод Gateway на ошибки - - Нужен клиент Path of Exile, с которым работает LocalExile: ваша автономная копия или, для релиза, клиент, загруженный из Steam после этого мастера. - не сборка 3.29.3c @@ -8758,6 +8857,9 @@ В {0} нет настроек игры. + + Ссылка здесь невозможна: этот клиент не подготовлен для используемой папки. + Открыть папку данных Waypoint @@ -8896,9 +8998,6 @@ Крепость - - Версия Steam или Epic: использовать нельзя - Настройки игры diff --git a/src/Launcher.Core/Resources/Strings.zh-CN.resx b/src/Launcher.Core/Resources/Strings.zh-CN.resx index 8a429bf..b70154c 100644 --- a/src/Launcher.Core/Resources/Strings.zh-CN.resx +++ b/src/Launcher.Core/Resources/Strings.zh-CN.resx @@ -126,6 +126,9 @@ 备份包含的内容 + + Client/Game.exe:PathOfExile.exe(Steam 版为 PathOfExileSteam.exe)的副本 + {0}:此联赛系列未定义相应变体,该选项不可用。 @@ -300,6 +303,9 @@ 悬停的控件 + + 选择你的流放之路 {0} 文件夹:独立安装(PathOfExile.exe 和 Content.ggpk)或 Steam 安装(PathOfExileSteam.exe 和 Bundles2)。 + 用 Frida 记录每个区域的行走地图 @@ -705,6 +711,9 @@ 开关谜题 + + 现在使用的是链接。 + 仓库 @@ -1132,6 +1141,9 @@ 可能的首领:{0} + + LocalExile 无法使用此文件夹。请选择独立安装或 Steam 安装。 + 账号已刷新。 @@ -1204,6 +1216,9 @@ 当前操作 + + 链接:正在使用的文件夹会从此客户端所在的文件夹运行游戏。不复制任何内容。LocalExile 会更改其中的文件,而那里的 Path of Exile 更新可能会破坏这个 LocalExile。 + 首次使用时会自动查找。你也可以在这里重新搜索。 @@ -1261,6 +1276,9 @@ 退出前无法验证服务状态。 + + {0}:不匹配 + {0}({1:0.#} GB)将被永久删除。正在使用的版本不受影响。 @@ -1381,6 +1399,9 @@ 区域等级 + + Client 需要 Content.ggpk(独立版)或 Bundles2\_.index.bin(Steam) + 只有已发布的 Waypoint.exe 才能自我更新 @@ -1505,6 +1526,9 @@ 稀有 + + Waypoint 会为正在使用的文件夹复制此客户端:{0:0.#} GB。 + 已构建组件 · Debug @@ -1634,6 +1658,9 @@ 下载内容包含不安全的路径 {0};未安装任何内容 + + 如果没有这样的文件夹,请勾选下方的选项。然后在文件夹列表中选择“游戏客户端”,从 Steam 下载游戏。 + 请关闭游戏并停止服务以创建此赛季。表单中的草稿会保留。 @@ -1685,6 +1712,9 @@ 获取 {0} + + 此客户端: + 尚未确认运行状态。 @@ -1733,6 +1763,9 @@ 完整复制 + + 此文件夹中的游戏文件与其版本不符,因此准备过程很可能失败。请让 Steam 完成游戏更新,或选择其他文件夹。 + 安装 Waypoint Tools? @@ -1784,9 +1817,6 @@ 要为所有副本切换吗? - - 独立客户端 3.29.3c 的可执行文件,位于 Client/Game.exe - 模组 @@ -2031,6 +2061,9 @@ 赛季旗帜 + + 正在使用的文件夹: + Waypoint 薄荷绿 @@ -2109,9 +2142,6 @@ 切换 - - 使用 LocalExile 的 Auth 和 Patch 工具准备现有客户端副本。保留现有登录密钥。经过验证且受支持的 PathOfExile.exe 可用于更新过时的 Game.exe 及其修补副本;替换前会备份原有可执行文件。通过链接使用的客户端不会被修改。 - 从 Steam 下载未完成。 @@ -2215,6 +2245,9 @@ {0} 个模组 · {1} {2} + + 选择包含 Path of Exile 客户端的文件夹 + 密码(至少 4 个字符;启动器不会保存) @@ -2491,6 +2524,9 @@ 详细信息 + + 链接指向的游戏客户端(只读取): + 全局模组 @@ -2539,6 +2575,9 @@ 力量符文 + + 此文件夹中的游戏客户端不是这个 LocalExile 支持的版本。 + 金色之门 @@ -2773,6 +2812,9 @@ 线程 + + 复制:正在使用的文件夹会得到自己的副本,{0:0.#} GB。 + 正在构建所选修订版本 @@ -2806,6 +2848,9 @@ 已恢复贮藏的更改。 + + 你现在使用的链接会被移除。它指向的文件夹不会改动。 + 安装 @@ -3073,9 +3118,6 @@ 要将 LocalExile 更新到 {0} 吗? - - {0} 中没有 Content.ggpk 和 PathOfExile.exe,因此不是独立版客户端。 - 无法使用备份文件夹 {0}({1}),暂时将备份保存到 {2}。 @@ -3234,9 +3276,6 @@ 无法选择旧版本(git 退出代码 {0})。 - - Steam 和 Epic 版本没有 Content.ggpk,无法使用。请选择独立版安装。 - 无联盟 @@ -3249,6 +3288,9 @@ 联赛卡片的关联存在循环。 + + 要更换它,请在文件夹列表中选择“游戏客户端”。 + 重新设置… @@ -3831,9 +3873,6 @@ 部分文件夹或工具无法使用 - - 独立版客户端布局(Content.ggpk) - 不再提示迁移这些角色? @@ -3984,6 +4023,9 @@ 你的旧角色会保留在 {0} 中,直到你删除该文件夹。 + + Client\ 中的游戏文件(Content.ggpk,或 Steam 的 Bundles2) + 卸载 {0} @@ -4173,6 +4215,9 @@ 现有的这一个客户端变为另一个版本。只下载有差异的部分,不需要额外空间,但原来的版本不再保留。 + + 这个 LocalExile 支持 Path of Exile {0}。 + 命令通过游戏客户端发送(scripts/dev/client_control.py):请先启动游戏并进入一个区域。 @@ -4221,6 +4266,9 @@ 正在使用你选择的源码副本。你可以随时更改位置或重新搜索。 + + 仅更新复制的客户端的网关列表。 + Python 无法在 {0} 中创建其环境。 @@ -4341,6 +4389,9 @@ 基础类型 + + {0} 已复制。 + 正在等待 Steam 登录… @@ -4356,9 +4407,6 @@ 打开安装向导 - - 要更改此客户端,请在侧边栏中选择它所在的文件夹。 - {0}:请选择 {1} 到 {2} 项 @@ -4563,6 +4611,9 @@ LocalExile v0.4.2-beta,已知可与此 Waypoint 正常配合。之后可以在“版本”部分改用最新更改。 + + 使用其他客户端… + 完成:{0}({1:0} 秒)。 @@ -4617,6 +4668,9 @@ 未保存的设置 + + 你需要一个 LocalExile 支持的流放之路客户端:你自己的独立安装或 Steam 安装,或者在本向导之后从 Steam 下载的客户端。 + 力量 @@ -4734,6 +4788,9 @@ LocalExile 服务器源码副本(包含 GameServer.slnx 的文件夹) + + 此 LocalExile 只能使用独立客户端。来自 Steam 的客户端需要更新的 LocalExile。 + 无法提取游戏数据(退出代码 {0})。 @@ -4767,6 +4824,9 @@ 请先保存或放弃当前草稿,再更改联赛可见性。 + + 使用 LocalExile 的 Auth 和 Patch 工具准备现有客户端副本。保留现有登录密钥。经过验证且受支持的 PathOfExile.exe(Steam 版为 PathOfExileSteam.exe)可用于更新过时的 Game.exe 及其修补副本;替换前会备份原有可执行文件。通过链接使用的客户端不会被修改。 + 正在运行 {0} … @@ -4797,9 +4857,6 @@ Frida 是可选组件;其游戏工具需要 Python。 - - 需要独立客户端的 Content.ggpk;不支持 Steam 版目录结构 - 在侧边栏添加“简易 | 高级”切换开关。在发行版安装中,高级模式会增加状态条、性能和服务器耗时;其他版块需要源码副本。 @@ -4941,9 +4998,6 @@ 第 2 代 - - 选择一个包含 PathOfExile.exe 和 Content.ggpk 的文件夹:流放之路 {0} 的独立安装。Steam 和 Epic 的安装在这里不可用。 - 客户端未运行 @@ -5493,6 +5547,9 @@ 更新失败:{0} + + LocalExile 无法使用此安装 + Patch 服务器:客户端的更新检查保持在本地 @@ -5613,6 +5670,9 @@ Waypoint 正在关闭。请等待其完成,然后重新打开。 + + 你现在使用的客户端会保留,不会被删除。 + 适应 @@ -5895,6 +5955,9 @@ 保留此版本? + + 链接 + 更改… @@ -5970,6 +6033,9 @@ 包含此文本的行(不区分大小写) + + 使用此客户端 + 请检查上方的账号名和密码要求。 @@ -6258,6 +6324,9 @@ 原始模块图标 + + 此 LocalExile 文件夹的游戏客户端:正在使用哪个版本,以及如何换成另一个 + {0} 个源码副本与上游 HEAD 一致。请在下方选择一个,或“浏览”其他位置。 @@ -6330,6 +6399,9 @@ 色觉配置会覆盖强调色和状态颜色,包括自定义的选择。Windows 高对比度优先于所有调色板。 + + 现在使用的是 {0}。链接已移除。它指向的文件夹没有改动。 + 请先将完整的客户端复制到源码副本的 Client 文件夹中。准备过程会创建缺失的本地密钥和已准备的可执行文件,然后在该副本中选择本地网关。更改安装设置前,请先关闭游戏并停止服务。 @@ -6378,9 +6450,6 @@ 已保存 - - 用 robocopy 将你的 3.29.3c 客户端复制到 Client,然后将 PathOfExile.exe 复制为 Game.exe - 请至少保留一个可供新角色选择的可玩联赛卡片。 @@ -6648,6 +6717,9 @@ 不支持重定向的设置路径。 + + 链接:正在使用的文件夹会从此客户端所在的文件夹运行游戏。不复制任何内容,那边的更改也会影响这里。 + 无法读取你的存档。未做任何更改。 @@ -6765,6 +6837,9 @@ LocalExile 暂无可下载的发行版。 + + 选择你的流放之路文件夹 + 此客户端不完整,无法使用。 @@ -6958,23 +7033,12 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 无法加载源码选项: - - 将完整的独立版流放之路 3.29.3c 安装复制到: -{0} - -1. 在文件资源管理器中,打开包含 Content.ggpk 和 PathOfExile.exe(或 Game.exe)的受支持客户端文件夹。 -2. 按 Ctrl+A,再按 Ctrl+C 复制;不要移动你平时使用的安装。 -3. 在另一个文件资源管理器窗口中打开所选的源码副本。如果没有 Client 文件夹,请创建它,打开该文件夹,然后按 Ctrl+V。 -4. 等待复制完成。返回“安装”,点击“准备客户端”。 - -不支持 Steam 版目录结构和更新的官方客户端。启动器不会下载游戏。 - - - 选择你的流放之路文件夹(包含 Content.ggpk 的那个) - 使用独立的游戏设置… + + 这是来自 Steam 的客户端,而此 LocalExile 版本太旧,无法使用它。请先更新 LocalExile,或选择独立客户端。 + 创建本地账号 @@ -7136,6 +7200,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 请先保存赛季设置,再应用模块选择。 + + 此电脑上有 {0} 客户端:{1} + 请先关闭游戏并停止当前的 LocalExile。 @@ -7436,6 +7503,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 稀有物品名称 + + 无法创建链接。正在使用的客户端没有改动。 + 使用此颜色 @@ -7616,6 +7686,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 安装模组 + + 使用此客户端? + 流放之路,已为本地服务器修补 @@ -7778,6 +7851,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 请输入 1–2000 个字符的描述。 + + 来自 Steam 的客户端 + 总督军 @@ -7799,6 +7875,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 存档已恢复。 + + Client\ 中既没有 Content.ggpk(独立版),也没有 Bundles2\_.index.bin(Steam) + 玫瑰 @@ -7929,9 +8008,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 包含一种游戏模式的规则。在此启用后,这些规则将从下次服务器启动起对此联赛的所有角色生效,但不包含该模式自身的技能、商人和任务奖励,游戏仍按原样显示此联赛。取消勾选即可恢复。 - - 使用此版本 - 这个 LocalExile 中的游戏版本:从 Steam 获取、保留多个、在它们之间切换 @@ -8013,9 +8089,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 模组构建完成。 - - Steam 安装版没有 Content.ggpk - 显示为以下联盟的模式:{0} @@ -8055,12 +8128,18 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 密码 + + 现在使用的是链接。被替换的客户端已保留。 + 有一个源码副本与上游 HEAD 一致。你可以在下方使用它,或“浏览”其他位置。 测试 + + 请选择此 LocalExile 文件夹之外的客户端。 + 与另一个 LocalExile 文件夹共用客户端 @@ -8127,9 +8206,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 卫兵传送门 - - 此客户端属于 LocalExile 的一个源代码副本,由该副本自行管理其客户端。 - 选择一个备份以恢复或删除。 @@ -8160,6 +8236,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 你的角色已一并迁移,照常登录即可。你自己添加的模组没有迁移:它们仍在旧文件夹中。 + + 使用此客户端… + 正在构建服务 @@ -8196,6 +8275,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 请在“设置”中选择 LocalExile 源码副本。 + + 与此 LocalExile 不匹配 + 没有匹配的分支或 PR。请清除或更改搜索,或使用下方的 PR 编号。 @@ -8265,6 +8347,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 设置必须为 JSON 对象。 + + 浏览客户端… + 现在 @@ -8433,6 +8518,17 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 打开安装向导,在你选择的文件夹中准备好 LocalExile + + 将完整的流放之路文件夹复制到: +{0} + +1. 在文件资源管理器中打开游戏文件夹。独立安装包含 Content.ggpk 和 PathOfExile.exe;Steam 安装包含 Bundles2 和 PathOfExileSteam.exe。 +2. 按 Ctrl+A,再按 Ctrl+C 复制;不要移动你平时使用的安装。 +3. 在另一个文件资源管理器窗口中打开所选的源码副本。如果没有 Client 文件夹,请创建它,打开该文件夹,然后按 Ctrl+V。 +4. 等待复制完成。返回“安装”,点击“准备客户端”。 + +客户端必须是这个 LocalExile 支持的版本。也可以在文件夹列表中选择“游戏客户端”,从 Steam 下载。 + 欢迎使用 Waypoint @@ -8490,6 +8586,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 Python 及 frida(行走地图、控制台) + + {0} 中没有 LocalExile 可以使用的流放之路客户端。 + 随机名称 @@ -8683,6 +8782,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 安装向导 + + 用 robocopy 将你的游戏客户端复制到 Client,然后将 PathOfExile.exe(Steam 版为 PathOfExileSteam.exe)复制为 Game.exe + 清理 @@ -8710,9 +8812,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 正在启动、重新构建或重启;请检查 Gateway 输出中的错误 - - 你需要一个 LocalExile 支持的流放之路客户端:你自己的独立版,或者(对于发行版)在本向导之后从 Steam 下载的客户端。 - 不是 3.29.3c 版本 @@ -8758,6 +8857,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 中没有游戏设置。 + + 此处无法使用链接:此客户端不是为正在使用的文件夹准备的。 + 打开 Waypoint 的数据文件夹 @@ -8896,9 +8998,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 堡垒 - - Steam 或 Epic 版目录结构:无法使用 - 游戏设置 diff --git a/src/Launcher.Core/SetupGuidance.cs b/src/Launcher.Core/SetupGuidance.cs index d6722a9..c69fdde 100644 --- a/src/Launcher.Core/SetupGuidance.cs +++ b/src/Launcher.Core/SetupGuidance.cs @@ -19,8 +19,8 @@ public static SetupStep Describe(Requirement requirement, string root) "Python" => ("Python", L.Text("Get Python"), L.Text("Install Python 3.9 or newer from python.org, best with 'Add python.exe to PATH' ticked, then Check again: Waypoint reads the PATH again, and finds a Python installed without that option through its installer's registry entry. Frida is optional and is not required for ordinary play.")), "Node.js" => ("Node", L.Text("Get Node.js"), L.Text("Install Node.js (the LocalExile setup guide uses Node 24), then Check again: Waypoint reads the PATH again, so it need not restart.")), "Bundle decompressor" => ("Dependencies", L.Text("Install dependency"), L.Text("This installs the checkout's locked Node dependency in Tools/ooz using npm ci. It does not install software globally. Node.js must be installed first.")), - "Original client" or "Client archive" => ("ClientFolder", L.Text("Client instructions"), L.Text("Copy the complete standalone PoE 3.29.3c installation to:\n{0}\n\n1. In File Explorer, open the supported client folder containing Content.ggpk and PathOfExile.exe (or Game.exe).\n2. Press Ctrl+A, then Ctrl+C to copy; do not move your normal installation.\n3. Open the selected checkout in another File Explorer window. Create its Client folder if missing, open it, then press Ctrl+V.\n4. Wait for the copy to finish. Return to Setup and click Prepare local client.\n\nSteam layout and a newer official client are unsupported. The launcher does not download the game.", client)), - "Prepared client" or "Login keys" => ("PrepareClient", L.Text("Prepare client"), L.Text("Prepare the existing client copy using LocalExile's Auth and Patch tools. Existing login keys are retained. A verified supported PathOfExile.exe can refresh a stale Game.exe and its patched copy; previous executables are backed up first. Linked clients are never changed.")), + "Original client" or "Client archive" => ("ClientFolder", L.Text("Client instructions"), L.Text("Copy your complete Path of Exile folder to:\n{0}\n\n1. In File Explorer, open the game folder. A standalone install has Content.ggpk and PathOfExile.exe; a Steam install has Bundles2 and PathOfExileSteam.exe.\n2. Press Ctrl+A, then Ctrl+C to copy; do not move your normal installation.\n3. Open the selected checkout in another File Explorer window. Create its Client folder if missing, open it, then press Ctrl+V.\n4. Wait for the copy to finish. Return to Setup and click Prepare local client.\n\nThe client must be a version this LocalExile runs. Or choose Game client in the folder list to download one from Steam.", client)), + "Prepared client" or "Login keys" => ("PrepareClient", L.Text("Prepare client"), L.Text("Prepare the existing client copy using LocalExile's Auth and Patch tools. Existing login keys are retained. A verified supported PathOfExile.exe (Steam: PathOfExileSteam.exe) can refresh a stale Game.exe and its patched copy; previous executables are backed up first. Linked clients are never changed.")), "Existing save database" => ("Guide", L.Text("View instructions"), L.Text("The selected local runtime profile names a database which does not exist. Restore the intended database or correct config/runtime.local.ps1. Do not create an empty replacement for an existing installation. Open Settings to select a different checkout/profile if needed.")), _ => ("Guide", L.Text("View setup guide"), L.Text("Open Agents/GettingStarted.md in the selected checkout. Use the supported upstream launch script and standard client/build paths. Then Recheck setup.")) }; 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.Linux/Views/SetupWizard.axaml.cs b/src/Waypoint.Linux/Views/SetupWizard.axaml.cs index f42302d..adf8995 100644 --- a/src/Waypoint.Linux/Views/SetupWizard.axaml.cs +++ b/src/Waypoint.Linux/Views/SetupWizard.axaml.cs @@ -587,7 +587,7 @@ void BrowseCheckout(object? sender, RoutedEventArgs e) /// The client build to set up for: the folder's own; for a new one the current build when a client of it was /// found, and only when none was, an older build a found client has (its last LocalExile is set up, ). string NeededClient => FolderNeeds ?? ClientLocator.Current.FirstOrDefault(version => _clients.Any(c => c.Usable && c.Build == version)) - ?? _clients.Where(c => c.Usable && c.Build is { } b && ClientLocator.LastVersionFor(b) is not null).Select(c => c.Build!).FirstOrDefault() ?? ClientLocator.Build; + ?? _clients.Where(c => c.Usable && !c.FromSteam && c.Build is { } b && ClientLocator.LastVersionFor(b) is not null).Select(c => c.Build!).FirstOrDefault() ?? ClientLocator.Build; /// Whether the LocalExile being set up runs a client of this version. A folder that has a LocalExile says so /// itself (); one that has none yet gets the newest, which runs every current version. @@ -596,7 +596,7 @@ bool Runs(string build) => FolderNeeds is not null && ChosenCheckout() is { } fo /// With a client of an older build chosen: that build, whose last LocalExile is set up instead of the newest. For a /// new folder, and for a source copy that needs a newer client than any found (). - string? OlderToSetUp => NoClient.IsChecked != true && ClientList.SelectedItem is FoundClient { Build: { } build } + string? OlderToSetUp => NoClient.IsChecked != true && ClientList.SelectedItem is FoundClient { Build: { } build, FromSteam: false } && ClientLocator.LastVersionFor(build) is not null && (FolderNeeds is null || CanGoBackFor(build)) ? build : null; /// A source copy whose LocalExile needs a newer client than any found can move to the last LocalExile made for the @@ -605,13 +605,20 @@ bool CanGoBackFor(string build) => FolderNeeds is { } needs && ChosenCheckout() && RepositoryDiscovery.IsLocalExile(folder) && ClientLocator.IsOlder(build, needs) && ClientLocator.LastVersionFor(build) is not null && !_clients.Any(c => c.Usable && c.Build is { } found && Runs(found)); - /// A client of a known build other than the one needed cannot be used: it would fail at the login. One of a build - /// Waypoint does not know is the player's call (). - bool Fits(FoundClient client) => client.Build is not { } build || Runs(build) || CanGoBackFor(build); + /// Whether the LocalExile being set up runs a client that came from Steam (its game files loose in Bundles2). + /// A folder that has a LocalExile says so itself (); one that has none yet + /// gets the newest, which runs Steam's files of every current version. The last LocalExile made for an older client + /// runs none. + bool RunsSteam(string? build) => FolderNeeds is not null && ChosenCheckout() is { } folder ? ClientLocator.RunsSteamFiles(folder) + : build is null || ClientLocator.IsCurrent(build); - static bool HasClient(string? checkout) => - checkout is not null && (ClientLocator.Classify(Path.Combine(checkout, "Client")) is ClientKind.Ready or ClientKind.Standalone - || ClientVersions.Layout(checkout) == ClientLayout.Steam); + /// A client of a known build other than the one needed cannot be used: it would fail at the login. Nor can a + /// client from Steam with a LocalExile that runs only a standalone one. One of a build Waypoint does not know is the + /// player's call (). + bool Fits(FoundClient client) => client.FromSteam ? RunsSteam(client.Build) && (client.Build is not { } steam || Runs(steam)) + : client.Build is not { } build || Runs(build) || CanGoBackFor(build); + + static bool HasClient(string? checkout) => checkout is not null && ClientLocator.IsClient(Path.Combine(checkout, "Client")); async void SearchClientsClicked(object? sender, RoutedEventArgs e) => await FindClientsAsync(); @@ -651,7 +658,7 @@ async Task FindClientsAsync() : L.Text("No usable client was found. Searched {0}.", string.Join(", ", result.Searched)); string warning = ClientList.SelectedItem is FoundClient chosen ? ClientWarning(chosen) : ""; ClientNote.Text = usable == 0 - ? L.Text("Choose a folder with PathOfExile.exe and Content.ggpk: a standalone Path of Exile {0} install. Steam and Epic installs do not work here.", NeededClient) + ? L.Text("Choose your Path of Exile {0} folder: a standalone install (PathOfExile.exe and Content.ggpk) or a Steam install (PathOfExileSteam.exe and Bundles2).", NeededClient) + " " + L.Text("Waypoint cannot download the game for this LocalExile.") : warning.Length > 0 ? warning : result.Limited ? L.Text("The search stopped at its time limit; Browse if your client is not listed.") : ""; @@ -675,17 +682,17 @@ bool IsOldClient(FoundClient client) => SwitchFrom is { } old && client.Usable void BrowseClient(object? sender, RoutedEventArgs e) { - if (Ui.PickFolder(this, L.Text("Choose your Path of Exile folder (the one with Content.ggpk)")) is not { } folder) return; + if (Ui.PickFolder(this, L.Text("Choose your Path of Exile folder")) is not { } folder) return; var client = ClientLocator.Describe(folder); if (client is null) { - ClientStatus.Text = L.Text("{0} has no Content.ggpk and PathOfExile.exe, so it is not a standalone client.", folder); + ClientStatus.Text = L.Text("{0} has no Path of Exile client that LocalExile can use.", folder); return; } var existing = _clients.FirstOrDefault(c => c.Folder.Equals(client.Folder, StringComparison.Ordinal)); if (existing is null) _clients.Insert(0, existing = client); if (client.Usable) ClientList.SelectedItem = existing; - else ClientNote.Text = L.Text("Steam and Epic installs have no Content.ggpk and do not work. Choose a standalone install."); + else ClientNote.Text = L.Text("LocalExile cannot use this folder. Choose a standalone or a Steam install."); } async void ClientSelected(object? sender, SelectionChangedEventArgs e) @@ -723,6 +730,8 @@ void ShareChanged(object? sender, RoutedEventArgs e) /// because a build Waypoint does not know may be one a newer server supports. string ClientWarning(FoundClient client) { + if (client.FromSteam && !RunsSteam(client.Build)) + return L.Text("This client is from Steam, and this LocalExile is too old to run it. Update LocalExile first, or choose a standalone client."); if (client.Build is { } build && !Fits(client)) return ClientLocator.IsOlder(build, NeededClient) ? L.Text("This is the {0} client, and this LocalExile needs {1}. Choose a {1} client instead: let the official Path of Exile launcher update a copy of this one, or download it.", build, NeededClient) @@ -734,6 +743,10 @@ string ClientWarning(FoundClient client) ? L.Text("Only a {0} client was found, so Waypoint sets up {1}, the last LocalExile made for it.", chosen, last.Release) : L.Text("Only a {0} client was found, so this copy moves to the last LocalExile made for it.", chosen)) + " " + ClientUpdate.OlderNoteFor(chosen); if (client.KnownBuild == false && client.Build is null) return L.Text("Waypoint does not know this as a version LocalExile runs, so preparing it will probably fail. You can still try, but check the version first: the copy is large."); + // LocalExile knows a Steam install's game files by their index, and refuses files that are another build's than the + // executable's (a game update that did not finish). The player's call, as above: LocalExile has the last word. + if (client.FromSteam && FolderNeeds is not null && ChosenCheckout() is { } listed && !ClientLocator.SteamFilesFit(LocalExileBuilds.Of(listed), client.Build, client.SteamIndexSha256)) + return L.Text("The game files in this folder do not match its version, so preparing it will probably fail. Let Steam finish updating the game, or choose another folder."); if (Sharing || Linking) return ""; var plan = ChosenCheckout() is { } checkout ? ClientCopy.Plan(client.Folder, checkout) : null; return plan is not null && ClientCopy.FreeSpace(plan.Target) is { } free && free < plan.Remaining diff --git a/src/Waypoint/App.xaml.cs b/src/Waypoint/App.xaml.cs index 45f4b57..dbea221 100644 --- a/src/Waypoint/App.xaml.cs +++ b/src/Waypoint/App.xaml.cs @@ -26,6 +26,8 @@ protected override async void OnStartup(StartupEventArgs e) base.OnStartup(e); // The first start's questions are windows too; closing one must not end the application. ShutdownMode = ShutdownMode.OnExplicitShutdown; + // Before anything is started: a PowerShell 7 shell's module path would break the scripts Windows PowerShell runs. + Platform.UseWindowsPowerShellModules(); Settings = Settings.Load(); // The folder the settings name before anything else writes one: the guide saves its own. string? saved = Settings.ServerPath; diff --git a/src/Waypoint/ClientVersionsWindow.cs b/src/Waypoint/ClientVersionsWindow.cs index a2c42ea..bf50e8e 100644 --- a/src/Waypoint/ClientVersionsWindow.cs +++ b/src/Waypoint/ClientVersionsWindow.cs @@ -18,7 +18,19 @@ namespace Waypoint; /// something is blocked or not safe, or when a thing happens. A download signs in to Steam when it needs to, by the tool's /// 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. +/// runs while the game or a server runs, and a client that just came in is prepared the folder's own way: LocalExile's +/// setup for a release, the adapter's client preparation for a source copy. +/// 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 (). +/// The window is a chooser: any line that is not the client in use has one button, "Use this client", and it +/// always means that the folder in use will run that client. A client the folder set aside is swapped in at once. A +/// client of another folder, or of a folder chosen with "Browse for a client…" beside the download, is asked +/// about first ("Use this client…"): the question names both folders, says what becomes of the client in use (a copy is +/// kept, a link loses only the link), and gives the ways there are. Simple mode has one, a copy. Advanced mode adds a +/// link, where one can be made, and lets a kept client take a link's place. "Make a copy…" on a linked client in use +/// changes how the same client is held (a release's link to the user's own game folder has it in every mode: +/// ). Nothing is deleted by any of them. /// sealed class ClientVersionsWindow : FormWindow { @@ -34,8 +46,10 @@ sealed class ClientVersionsWindow : FormWindow /// For a client in use that carries the mark of an update in place that did not finish: the /// version it was on its way to. A kept one says so itself (). /// Its version is more than one build in its folder's list, so the line names the build. + /// For a client of another folder: the LocalExile of the folder in use runs it, so it can be + /// copied or linked here. sealed record Row(KnownFolder Folder, string Client, ClientLayout Files, bool InUse, string? Version, ListedBuild? Build, - KeptClient? Kept = null, string? LinkTarget = null, bool Shared = false, string? HalfWayTo = null, bool Several = false) + KeptClient? Kept = null, string? LinkTarget = null, bool Shared = false, string? HalfWayTo = null, bool Several = false, bool FitsHere = false) { /// A client of the folder in use: the only ones this window changes. public bool Here => Folder.Current; @@ -58,8 +72,17 @@ 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; - /// The copy the folder in use can have in place of a link to a game folder outside LocalExile (). + readonly Button _use, _move, _copy, _delete, _open, _download, _browse, _forget, _stopButton, _close; + /// The folder in use is a source copy: the adapter prepares its client, and LocalExile's launcher is not there to ask. + readonly bool _source = !Repo.IsInstall; + /// Advanced mode: a link can be changed for a copy and a copy for a link. + readonly bool _advanced; + /// 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 its link: to a game folder outside LocalExile and, in + /// Advanced mode, to another LocalExile's client (). OwnClient.Plan? _linked; IReadOnlyList? _builds; /// The builds Steam can deliver that the folder in use does not hold: what the download offers. @@ -84,6 +107,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"); @@ -94,6 +121,7 @@ static ClientVersionsWindow() public ClientVersionsWindow(Window? owner, Shared shared, bool downloadNewest = false) { _shared = shared; + _advanced = Editions.Advanced(shared.Settings); _downloadNewest = downloadNewest; DialogLayout.Configure(this, owner, L.Text("Game client"), 760); var root = new DockPanel { Margin = new Thickness(24) }; @@ -130,6 +158,12 @@ public ClientVersionsWindow(Window? owner, Shared shared, bool downloadNewest = ToolTipService.SetShowOnDisabled(_download, true); DockPanel.SetDock(_download, Dock.Left); get.Children.Add(_download); + // Beside the download: the other way to a client that is not in the list. + // No margin of its own: the button style's margin spaces the two and keeps them on one line. + _browse = new Button { Content = L.Text("Browse for a client…") }; + _browse.Click += (_, _) => _ = BrowseAsync(); + DockPanel.SetDock(_browse, Dock.Left); + get.Children.Add(_browse); get.Children.Add(_note); below.Children.Add(get); DockPanel.SetDock(below, Dock.Bottom); @@ -139,12 +173,13 @@ public ClientVersionsWindow(Window? owner, Shared shared, bool downloadNewest = root.Children.Add(_blocked); // Beside the list: only the buttons the chosen line has a use for. - _use = Action(L.Text("Use this version"), () => _ = UseAsync()); - _copy = Action(L.Text("Make a copy…"), () => { CopyRequested = true; Close(); }); + _use = Action(L.Text("Use this client"), () => _ = UseAsync()); + _move = Action(L.Text("Use another client…"), () => { MoveRequested = true; Close(); }); + _copy = Action(L.Text("Make a copy…"), CopyClicked); _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); @@ -175,6 +210,14 @@ public ClientVersionsWindow(Window? owner, Shared shared, bool downloadNewest = }; Loaded += async (_, _) => { + // A copy in a link's place that was cut short at the swap is finished, or its link put back, before the + // folder is read (a release's Play page does the same for its own). + if (_source && !Running) + await Task.Run(() => + { + try { OwnClient.Finish(_folder); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + }); await RefreshAsync(); // A kept client whose deletion was cut short is still on the drive under a name the list does not show. if (!Running && await Task.Run(() => ClientVersions.HasUnfinishedDeletes(_folder))) @@ -221,10 +264,12 @@ 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); + IReadOnlyList versions = [.. ClientLocator.Supported(_folder).Reverse()]; + bool Here(string client, ClientLayout files, string? version) => RunsHere(client, files, version, listed, versions); var found = new List(); // The folder in use first, then the others in the order the sidebar's list has them. foreach (var known in FolderList.Read(paths, _folder).Where(f => f.Kind != FolderKind.Missing).OrderByDescending(f => f.Current)) @@ -242,13 +287,17 @@ async Task RefreshAsync() // client, or a game folder outside LocalExile (the retail game's own). string? target = Launcher.Core.ClientSettings.IsLink(client) ? Path.TrimEndingDirectorySeparator(Path.GetFullPath(ClientLocator.RealPath(client))) : null; var build = Named(client); - found.Add(new(known, client, files, InUse: true, FolderList.ClientOf(known.Path), build, LinkTarget: target, - Shared: target is not null && OwnClient.InLocalExile(target), HalfWayTo: ClientVersions.Unfinished(known.Path), Several: Several(build))); + string? version = FolderList.ClientOf(known.Path); + found.Add(new(known, client, files, InUse: true, version, build, LinkTarget: target, + Shared: target is not null && OwnClient.InLocalExile(target), HalfWayTo: ClientVersions.Unfinished(known.Path), Several: Several(build), + FitsHere: !known.Current && Here(client, files, version))); } foreach (var kept in ClientVersions.Kept(known.Path)) { var build = Named(kept.Folder); - found.Add(new(known, kept.Folder, ClientVersions.FilesOf(kept.Folder), InUse: false, kept.Version, build, kept, Several: Several(build))); + var layout = ClientVersions.FilesOf(kept.Folder); + found.Add(new(known, kept.Folder, layout, InUse: false, kept.Version, build, kept, Several: Several(build), + FitsHere: !known.Current && Here(kept.Folder, layout, kept.Version))); } } // One folder that cannot be read (a drive gone, a launcher that will not start) leaves the others their lines. @@ -256,11 +305,15 @@ 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); + 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 && !_advanced ? null : OwnClient.Check(_folder, shared: _advanced), 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. @@ -278,20 +331,47 @@ async Task RefreshAsync() foreach (var row in others) Add(row, here); } var lines = _list.Items.OfType().Where(item => item.Tag is Row).ToList(); - _list.SelectedItem = lines.FirstOrDefault(item => ((Row)item.Tag).Client == chosen) ?? lines.FirstOrDefault(item => ((Row)item.Tag).Here); + // A folder with no client of its own starts on the first one it could take from another folder. + _list.SelectedItem = lines.FirstOrDefault(item => ((Row)item.Tag).Client == chosen) ?? lines.FirstOrDefault(item => ((Row)item.Tag).Here) + ?? lines.FirstOrDefault(item => CanBring((Row)item.Tag)); // 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.") // 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.")) - : _offered.Count == 0 && builds.Any(b => b.FromSteam) ? L.Text("This folder already has every version Steam has for this LocalExile.") : ""; + // A list that names no build Steam can deliver is a LocalExile from before it could say. + : !builds.Any(b => b.FromSteam) ? L.Text("This LocalExile lists no versions to download. LocalExile v0.5.0-beta and later do.") + : _offered.Count == 0 ? L.Text("This folder already has every version Steam has for this LocalExile.") : ""; if (started > 100_000_000) note = (note.Length > 0 ? note + " " : "") + L.Text("{0:0.#} GB of an unfinished download is kept in this folder.", started / 1e9); _note.Text = note; _note.Visibility = note.Length > 0 ? Visibility.Visible : Visibility.Collapsed; 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); + + /// A client of another folder that the folder in use can take: whole, and one its LocalExile runs. + static bool CanBring(Row? row) => row is { Here: false, Unfinished: null, FitsHere: true }; + + /// Whether the LocalExile of the folder in use runs a client that is elsewhere: one of the builds it lists (a + /// client from Steam with the index listed for it), or, for a LocalExile with no list, a standalone client of a + /// version it names or of none that can be told. It reads the executable: never on the UI thread. + static bool RunsHere(string client, ClientLayout files, string? version, IReadOnlyList? listed, IReadOnlyList versions) => + listed is not null + ? ClientLocator.ListedBuildOf(client, listed) is { } mine && (files != ClientLayout.Steam || ClientLocator.SteamFilesFit(listed, mine.Version, ClientLocator.SteamIndexOf(client))) + : files != ClientLayout.Steam && (version is null || versions.Count == 0 || versions.Contains(version)); + + /// 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 +388,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 @@ -391,20 +472,27 @@ string LinkReason() string Detail(Row? row) { if (row is null) return ""; + // A client of another folder: only why it cannot be brought here. Its buttons say the rest. if (!row.Here) - return row.Folder.Kind == FolderKind.Source ? L.Text("This client belongs to a source copy of LocalExile, which looks after its own client.") - : L.Text("To change this client, choose its folder in the sidebar."); + return row.Unfinished is not null ? L.Text("This client is incomplete and cannot be used.") + : !row.FitsHere ? (_runs.Count > 0 ? L.Text("This LocalExile runs Path of Exile {0}.", Runs) : ClientExtractionFailure.Refused) : ""; if (row.Kept is { HalfWayTo: not null } half) return L.Text("This client is incomplete and cannot be used.") // Not knowing the list is not the same as the list lacking the build: nothing then says "delete it". + (_builds is null ? " " + L.Text("Waypoint could not read the versions this LocalExile runs. Open this window again.") : HalfWay(half) is null ? " " + L.Text("Steam does not have that version for this LocalExile. This copy can only be deleted.") : ""); 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() : ""; + // In Advanced mode a kept client can take a link's place: only the link goes. + return _layout == ClientLayout.Link ? (_advanced ? "" : LinkReason()) + : _unfinished is not null ? L.Text("The game client in use is half-way to another version. Finish that switch first.") : ""; + // 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.") : ""; } @@ -423,12 +511,20 @@ void Enable() bool half = row is { Here: true, Kept.HalfWayTo: not null }; bool finish = half && HalfWay(row!.Kept!) is not null && DepotTool.Supported; bool kept = row is { Here: true, Kept.HalfWayTo: null }; - bool canUse = kept && !link && _unfinished is null || resume || finish; - _use.Visibility = kept || resume || finish ? Visibility.Visible : Visibility.Collapsed; + // A client of another folder: the same button, with the dots of one that asks first. + bool bring = CanBring(row); + bool canUse = kept && (link ? _advanced : _unfinished is null) || resume || finish || bring; + _use.Visibility = kept || resume || finish || bring ? 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; + _use.Content = resume ? L.Text("Finish the switch") : half ? L.Text("Finish this copy") : bring ? L.Text("Use this client…") : L.Text("Use this client"); + // 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; + _browse.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; @@ -443,14 +539,17 @@ void Enable() _blocked.Visibility = !_busy && Running ? Visibility.Visible : Visibility.Collapsed; Lead(_ready && !_busy ? _close : _use.Visibility == Visibility.Visible && canUse ? _use - : _copy.Visibility == Visibility.Visible ? _copy + : canMove ? _move + // The copy is the next step only where LocalExile's warning names it: a release linked to the user's own game. + // A source copy's link, and one to another LocalExile's client, are there on purpose. + : _copy.Visibility == Visibility.Visible && !_source && _linked is { Shared: false } ? _copy : canDownload ? _download : null); } /// 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); @@ -572,6 +671,12 @@ void OpenFolder() async Task UseAsync() { + // A client of another folder is asked about first. + if (Selected is { Here: false } other) + { + if (!_busy && CanBring(other)) await TakeAsync(other.Client, other.Version, linkable: other.InUse); + return; + } if (Selected is not { Here: true } row) return; if (row.Kept is { HalfWayTo: not null } half) { @@ -580,17 +685,228 @@ async Task UseAsync() } if (row.Kept is { } kept) { + bool overLink = _advanced && _layout == ClientLayout.Link; await WorkAsync(L.Text("Game client"), async _ => { - await Task.Run(() => ClientVersions.Use(_folder, kept.Name)); + await Task.Run(() => ClientVersions.Use(_folder, kept.Name, overLink)); Changed = true; - Say(L.Text("{0} is in use now. The version it replaced is kept.", Version(kept.Version))); + Say(overLink ? L.Text("{0} is in use now. The link was removed. The folder it led to was not changed.", Version(kept.Version)) + : L.Text("{0} is in use now. The version it replaced is kept.", Version(kept.Version))); }, stoppable: false); return; } if (row.InUse && Unfinished is { } build) await GetAsync(build); } + void Open(string path) => Process.Start(new ProcessStartInfo("explorer.exe") { ArgumentList = { path }, UseShellExecute = false })?.Dispose(); + + /// "Make a copy…" on a linked client. A release's link to the user's own game folder is its Play page's to + /// copy, with its own question and progress, once this window is closed; every other link (Advanced mode: a source + /// copy's, and one to another LocalExile's client) is copied from here, the same way. + void CopyClicked() + { + if (!_source && _linked is { Shared: false }) + { + CopyRequested = true; + Close(); + return; + } + _ = CopyAsync(); + } + + /// A copy in the place of the folder's link (): the link works until the copy + /// is whole, the folder it leads to is only read, and a stop leaves what was copied for the next try. + async Task CopyAsync() + { + if (_busy || _linked is not { } plan) return; + if (!OwnClient.Ask(plan, (title, message, details, buttons) => Dialog.Show(this, DialogKind.Question, title, message, details, buttons, buttons.Length - 1), Open)) return; + await WorkAsync(L.Text("Copying the game client"), async stop => + { + Say(L.Text("Copying the game client"), working: true); + try + { + await Task.Run(() => OwnClient.MoveAsync(_folder, copied => Dispatcher.BeginInvoke(() => + { + if (_busy) Say(L.Text("Copying the game client") + ": " + L.Text("{0:0.0} of {1:0.0} GB", copied.Done / 1e9, copied.Total / 1e9), copied.Total == 0 ? null : (double)copied.Done / copied.Total, working: true); + }), stop, shared: true), CancellationToken.None); + } + catch (OperationCanceledException) + { + Say(L.Text("The copy was stopped, and nothing was changed. It goes on from there next time.")); + return; + } + Changed = true; + _shared.Logs.Write($"the game client was copied from {plan.Source}; this folder has its own now", Severity.Info); + Say(L.Text("LocalExile now runs from {0}, and no longer uses {1}.", Path.Combine(plan.Folder, "Client"), plan.Source)); + }); + } + + /// "Browse for a client…", beside the download: for a client that is in no folder the list + /// knows. The folder is chosen, checked as a line of the list is (a client, and one this LocalExile runs), and then + /// taken the same way (). + async Task BrowseAsync() + { + if (_busy) return; + var dialog = new Microsoft.Win32.OpenFolderDialog { Title = L.Text("Choose a folder with a Path of Exile client") }; + if (dialog.ShowDialog(this) != true) return; + string chosen = dialog.FolderName; + var (builds, runs) = (_builds, _runs); + var (usable, version, fits) = await Task.Run(() => + { + string real = ClientLocator.RealPath(chosen); + string? build = ClientLocator.BuildOf(real); + return (ClientLocator.IsClient(real), build, RunsHere(real, ClientVersions.FilesOf(real), build, builds, runs)); + }); + if (!usable) Say(L.Text("{0} has no Path of Exile client that LocalExile can use.", chosen)); + else if (!fits) Say(_runs.Count > 0 ? L.Text("This LocalExile runs Path of Exile {0}.", Runs) : ClientExtractionFailure.Refused); + else await TakeAsync(chosen, version, linkable: true); + } + + /// + /// Makes a client that is elsewhere on this PC the client of the folder in use, on one question. The question names + /// both folders, so that there is no doubt which way it goes, says what becomes of the client in use, and gives the + /// ways there are: a copy () in every mode, and in Advanced mode a link + /// () where one can be made. LocalExile's own link mode, which prepares the + /// folder it links to, is for a release and a game folder of the user's own; a client another LocalExile uses, and any + /// client for a source copy (whose linked client Waypoint never changes), must be prepared for this folder's keys + /// already, as when the setup guide shares one. Simple mode never links. + /// + /// A link can lead to it: the client a folder uses, or a folder of the user's choice. A + /// client another folder only keeps can be moved or deleted there, so it is only copied. + async Task TakeAsync(string chosen, string? version, bool linkable) + { + string source = Path.TrimEndingDirectorySeparator(Path.GetFullPath(ClientLocator.RealPath(chosen))); + string here = Path.TrimEndingDirectorySeparator(Path.GetFullPath(_folder)); + if ((source + Path.DirectorySeparatorChar).StartsWith(here + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)) + { + Say(L.Text("Choose a client outside this LocalExile folder.")); + return; + } + bool offerLink = _advanced && linkable; + string[] others = [.. FolderList.Paths(_shared.Settings, _folder).Where(path => !FolderList.Same(path, _folder))]; + var (plan, free, theirs, keys, linked) = await Task.Run(() => (ClientVersions.CopyInPlan(_folder, source), ClientCopy.FreeSpace(_folder), + OwnClient.InLocalExile(source), offerLink ? ClientCopy.SharedKeys(source, _folder, others) : null, + // The link in use leads there already: only a copy would change anything. + Launcher.Core.ClientSettings.IsLink(Path.Combine(_folder, "Client")) && FolderList.Same(ClientLocator.RealPath(Path.Combine(_folder, "Client")), source))); + bool byLocalExile = !_source && !theirs; + bool canLink = offerLink && !linked && (byLocalExile || keys is not null); + long needed = plan.Remaining + ClientCopy.Margin; + bool canCopy = free is not { } has || has >= needed; + string title = L.Text("Use this client?"); + string ends = L.Text("This client:") + "\n " + source + "\n" + L.Text("The folder in use:") + "\n " + here; + string room = free is { } f ? L.Text("{0:0.#} GB is free on this drive.", f / 1e9) : ""; + string full = L.Text("The drive is too full: {0} needs {1:0.#} GB.", Version(version), needed / 1e9) + " " + room; + if (!canCopy && !canLink) + { + Ask(DialogKind.Warning, title, full, ends, L.Text("OK")); + return; + } + string earlier = plan.Total - plan.Remaining >= 100_000_000 ? " " + L.Text("The copy goes on from the {0:0.#} GB made earlier.", (plan.Total - plan.Remaining) / 1e9) : ""; + var texts = new List(); + var ways = new List<(string Button, bool Link)>(); + if (!_advanced) + { + // One way, so one sentence and no choice to make. + texts.Add(L.Text("Waypoint makes a copy of this client for the folder in use: {0:0.#} GB.", plan.Total / 1e9) + " " + room + earlier); + ways.Add((L.Text("Copy now"), false)); + } + else + { + texts.Add(canCopy ? L.Text("Copy: the folder in use gets its own copy, {0:0.#} GB.", plan.Total / 1e9) + " " + room + earlier : full); + if (canCopy) ways.Add((L.Text("Copy"), false)); + if (canLink) + { + texts.Add(theirs ? L.Text("Link: the folder in use runs the game from this client's folder. Nothing is copied, and what changes there changes here.") + : L.Text("Link: the folder in use runs the game from this client's folder. Nothing is copied. LocalExile changes files there, and a Path of Exile update there can break this LocalExile.")); + ways.Add((L.Text("Link"), true)); + } + // Why the second way is missing, where an Advanced user would look for it. + else if (offerLink && !linked) texts.Add(L.Text("A link is not possible here: this client is not prepared for the folder in use.")); + } + if (GivesWay.Length > 0) texts.Add(GivesWay); + int way = Ask(DialogKind.Question, title, string.Join("\n\n", texts), ends, [.. ways.Select(w => w.Button), L.Text("Cancel")]); + if (way < 0 || way >= ways.Count) return; + if (ways[way].Link) await LinkWorkAsync(source, byLocalExile, keys); + else await CopyWorkAsync(source, version); + } + + /// The folder in use has a client that is a copy of its own: one that gives way is kept in Clients\. + bool Keeps => _layout is ClientLayout.Standalone or ClientLayout.Steam; + + /// For the question that puts another client in the place of the one in use: what becomes of that one. A copy + /// is kept, a link loses only the link, and a folder with no client has nothing to say. + string GivesWay => Keeps ? L.Text("The client you use now is kept, not deleted.") + : _layout == ClientLayout.Link ? L.Text("The link you use now is removed. The folder it leads to is not changed.") : ""; + + /// The link (): the client in use is set aside first and comes back if + /// the link cannot be made, and "Use this client" on it undoes the whole. + async Task LinkWorkAsync(string target, bool byLocalExile, string? keys) + { + bool kept = Keeps; + await WorkAsync(L.Text("Game client"), async stop => + { + Say(L.Text("Linking the game client"), working: true); + string? refusal = null; + try + { + await Task.Run(() => ClientVersions.LinkAsync(_folder, byLocalExile + ? async () => refusal = await LinkByLocalExileAsync(target, stop) + : () => ClientCopy.ShareAsync(target, _folder, keys, line => Dispatcher.BeginInvoke(() => LogSetup(line)), stop)), CancellationToken.None); + } + // The client in use is back where it was. LocalExile's own words for a folder it will not link to come + // before Waypoint's. + catch (Exception e) when (e is IOException or UnauthorizedAccessException or InvalidOperationException or System.ComponentModel.Win32Exception) + { + Say(refusal is { Length: > 0 } ? refusal : e.Message); + Log(e.Message); + return; + } + Changed = true; + _shared.Logs.Write($"the game client is now a link to {target}", Severity.Info); + Say(kept ? L.Text("The link is in use now. The client it replaced is kept.") : L.Text("The link is in use now.")); + }, stoppable: false); + } + + /// The copy (): made beside the client in use, swapped in when it + /// is whole, then prepared by the folder's own setup. A stop leaves what was copied for the next try. + async Task CopyWorkAsync(string source, string? version) + { + await WorkAsync(L.Text("Copying the game client"), async stop => + { + Say(L.Text("Copying the game client"), working: true); + try + { + await Task.Run(() => ClientVersions.CopyInAsync(_folder, source, copied => Dispatcher.BeginInvoke(() => + { + if (_busy && copied.Total > 0 && copied.Done < copied.Total) + Say(L.Text("Copying the game client") + ": " + L.Text("{0:0.0} of {1:0.0} GB", copied.Done / 1e9, copied.Total / 1e9), (double)copied.Done / copied.Total, working: true); + }), stop), CancellationToken.None); + } + catch (OperationCanceledException) + { + Say(L.Text("The copy was stopped, and nothing was changed. It goes on from there next time.")); + return; + } + Changed = true; + _shared.Logs.Write($"the game client was copied from {source}", Severity.Info); + await PrepareAsync(version, L.Text("{0} is copied.", Version(version)), stop); + }); + } + + /// LocalExile's own link (--client-mode link, its developers' option): it checks the folder, links to + /// it and prepares it. What it said when it refused, or null. A setup that linked and then stopped for something else + /// (an account still to make) is the Play page's to finish. + async Task LinkByLocalExileAsync(string target, CancellationToken stop) + { + string? last = null; + var result = await LocalExileTool.RunAsync(_folder, ["setup", "--no-update-check", "--client", target, "--client-mode", "link"], item => Dispatcher.BeginInvoke(() => + { + if (item.Message is { } message) LogSetup(message); + }), line => Dispatcher.BeginInvoke(() => LogSetup(line)), stop: stop); + if (result.Code != 0) last = result.Error; + return last; + } + /// The build a copy that was set aside half-way was on its way to, when Steam can deliver it. ListedBuild? HalfWay(KeptClient kept) => (_builds ?? []).LastOrDefault(b => b.FromSteam && b.Version == kept.HalfWayTo && (kept.HalfWayToBuild is null || kept.HalfWayToBuild == b.ExecutableSha256)); @@ -723,7 +1039,7 @@ await WorkAsync(L.Text("Game client"), async stop => return; } Changed = true; - await PrepareAsync(build, stop); + await PrepareAsync(build.Version, L.Text("{0} is downloaded.", Version(build.Version)), stop); }); } @@ -789,10 +1105,30 @@ await WorkAsync(L.Text("Game client"), async stop => /// LocalExile's own setup, which makes Game.exe and the copy patched for this folder's keys from the client /// that just came in. A folder that still needs something from its user (an account) is finished from the Play page, - /// which says so itself. - async Task PrepareAsync(ListedBuild build, CancellationToken stop) + /// which says so itself. A source copy has no launcher: the adapter prepares its client, by the steps of LocalExile's + /// own guide (the keys kept, Game.exe, the patched copy, the login list). + /// What to say when the client is there but its preparation did not finish. + async Task PrepareAsync(string? version, string came, CancellationToken stop) { - Say(L.Text("Preparing {0} for LocalExile …", Version(build.Version)), working: true); + Say(L.Text("Preparing {0} for LocalExile …", Version(version)), working: true); + if (_source) + { + try + { + var bridge = new RuntimeClient(BridgeScripts.Extract()); + var prepared = await bridge.RunAsync(_shared.Settings.ForBridge, "PrepareClient", log: line => Dispatcher.BeginInvoke(() => LogSetup(line)), + progress: update => Dispatcher.BeginInvoke(() => { if (_busy && update.Stage.Length > 0) Say(L.Text(update.Stage), working: true); }), stop: stop); + _ready = prepared.Ok; + // What stopped the preparation is said with it: Setup's "Prepare client" tries again. + Say(_ready ? L.Text("{0} is ready to play.", Version(version)) : came + " " + L.Describe(prepared.Message)); + } + catch (Exception e) when (e is System.ComponentModel.Win32Exception or InvalidOperationException or IOException or System.Text.Json.JsonException) + { + Say(came); + Log(e.Message); + } + return; + } try { var result = await LocalExileTool.RunAsync(_folder, ["setup", "--no-update-check"], item => Dispatcher.BeginInvoke(() => @@ -801,11 +1137,11 @@ async Task PrepareAsync(ListedBuild build, CancellationToken stop) if (item.Name is "step" or "progress") Say(LocalExileReleases.Stage(item.Id, item.Message ?? ""), working: true); }), line => Dispatcher.BeginInvoke(() => LogSetup(line)), stop: stop); _ready = result.Code == 0; - Say(_ready ? L.Text("{0} is ready to play.", Version(build.Version)) : L.Text("{0} is downloaded.", Version(build.Version))); + Say(_ready ? L.Text("{0} is ready to play.", Version(version)) : came); } catch (Exception e) when (e is System.ComponentModel.Win32Exception or InvalidOperationException or IOException) { - Say(L.Text("{0} is downloaded.", Version(build.Version))); + Say(came); Log(e.Message); } } 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 @@