diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51ca695..562f469 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,11 @@ jobs: "number=$($Matches[1])" >> $env:GITHUB_OUTPUT - name: Test run: dotnet test Waypoint.slnx -c Release + # Waypoint.exe carries DepotDownloader's release (the game client from Steam). The script holds it to its SHA-256, + # and fetches the source of that same release, which goes beside Waypoint.exe: it is GPL-2.0 (THIRD-PARTY-NOTICES.md). + - name: DepotDownloader + shell: pwsh + run: ./tools/Get-DepotDownloader.ps1 -Source - name: Publish shell: pwsh run: | @@ -49,6 +54,6 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: > - gh release create '${{ github.ref_name }}' out/Waypoint.exe out/Waypoint.exe.sha256 + gh release create '${{ github.ref_name }}' out/Waypoint.exe out/Waypoint.exe.sha256 tools/bundled/DepotDownloader-3.4.0-source.zip --title 'Waypoint ${{ steps.version.outputs.number }}' --generate-notes --verify-tag - --notes 'Download **Waypoint.exe** below and run it; a Waypoint you already have offers this version itself. The Source code archives are added by GitHub to every release and are not needed to run it.' + --notes 'Download **Waypoint.exe** below and run it; a Waypoint you already have offers this version itself. The Source code archives are added by GitHub to every release and are not needed to run it. Waypoint.exe carries DepotDownloader (GPL-2.0, THIRD-PARTY-NOTICES.md): its source is DepotDownloader-3.4.0-source.zip below.' diff --git a/.gitignore b/.gitignore index 118b40a..3a3c392 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # The published launcher (dotnet publish src/Waypoint -o .) /Waypoint.exe +# What tools/Get-DepotDownloader.ps1 fetches for a build (Waypoint.exe carries it; it is never committed) +/tools/bundled/ + # --- .NET --- bin/ obj/ diff --git a/README.md b/README.md index bcd0246..c080a4b 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,12 @@ Launcher, and the setup, mod, backup, account, appearance and language tools of It is a separate tool: it references no server project and drives a checkout only through what the server offers outside tools (`scripts/dev/live.ps1`, the Gateway's `commands`/`values` modes, the dev host's protocol, the client control bridge, the logs) and through its own adapter in `scripts/`. Every start goes through `live.ps1`, so the server's rules apply -unchanged. It does not download Path of Exile, bundle LocalExile or offer a public server. +unchanged. It does not bundle Path of Exile or LocalExile, and does not offer a public server. ## Install -Requirements: Windows 10/11 x64, the .NET 10 Desktop Runtime, and your own standalone PoE **3.29.3c** client (a player who has only 3.29.3b gets +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 +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: @@ -33,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** client | A separate copy in the checkout's `Client` folder; Steam layout and other builds are unsupported | +| 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 | 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. @@ -54,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** client. A source checkout also needs PowerShell 7 (`dotnet tool install --global PowerShell`), Git, +standalone PoE **3.29.3c** or **3.29.3d** client. A source checkout also needs PowerShell 7 (`dotnet tool install --global PowerShell`), Git, Python 3.9+ and Node.js. ```bash @@ -134,6 +135,6 @@ dotnet publish src/Waypoint -o . A build from source has no version and never offers updates. Everything else, from the sections to the code layout and how a release is made, is in [docs/launcher.md](docs/launcher.md); what comes next is in [docs/roadmap.md](docs/roadmap.md). -Waypoint is under the [MIT license](LICENSE). OpenDyslexic is under the [SIL Open Font License](src/Waypoint/Fonts/OFL.txt). +Waypoint is under the [MIT license](LICENSE). What a released `Waypoint.exe` carries of others' work (DepotDownloader, GPL-2.0; OpenDyslexic, the [SIL Open Font License](src/Waypoint/Fonts/OFL.txt)) is in [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md). This project is not affiliated with or endorsed by Grinding Gear Games. diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..5d743b6 --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,23 @@ +# Third-party notices + +Waypoint is under the [MIT license](LICENSE). A released `Waypoint.exe` also carries the works below, each under its own +license. They are separate works: none of them changes Waypoint's license, and Waypoint's does not change theirs. + +## DepotDownloader + +- **What:** [DepotDownloader](https://github.com/SteamRE/DepotDownloader) 3.4.0, the program Waypoint runs to fetch a game + client from Steam ([docs/launcher.md](docs/launcher.md), "The game client from Steam"). +- **How it is carried:** the project's own release for Windows x64 (`DepotDownloader-windows-x64.zip`, SHA-256 + `41c9e9f0df54b3ad02e67a11726756e5c73283bd7c2e1b04acfa5ae4c2ed3767`), unchanged, inside `Waypoint.exe`. Waypoint unpacks it + into its own data folder (`tools\DepotDownloader`), with the `LICENSE` file that comes in that zip, and runs it as a + program of its own. Waypoint contains none of its code. +- **License:** GNU General Public License, version 2. Its full text is the `LICENSE` file beside the unpacked program, and + . +- **Source:** the corresponding source is the tag + [`DepotDownloader_3.4.0`](https://github.com/SteamRE/DepotDownloader/tree/DepotDownloader_3.4.0). Every Waypoint release + that carries the program has that source attached beside `Waypoint.exe`, as `DepotDownloader-3.4.0-source.zip`. +- DepotDownloader is built on SteamKit2 (LGPL-2.1), protobuf-net and QRCoder, whose notices are in its own repository. + +## OpenDyslexic + +The reading font Waypoint offers, under the [SIL Open Font License](src/Waypoint/Fonts/OFL.txt). diff --git a/docs/launcher.md b/docs/launcher.md index fc5ab23..93a4f73 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -62,7 +62,9 @@ The random seed button uses the server's normal instance seed range; manually en A release is a git tag `v..` pushed to GitHub. The release workflow (`.github/workflows/release.yml`) runs the tests, publishes `Waypoint.exe` with the tag's version (`-p:Version`), writes its SHA-256 to `Waypoint.exe.sha256`, and attaches both to a GitHub release of the tag -with generated notes. A tag that is not `v1.2.3` fails the workflow. The CI workflow (`ci.yml`) builds and tests every +with generated notes. Before publishing it runs `tools/Get-DepotDownloader.ps1 -Source`, so the exe carries the Steam +download tool and the release also gets that tool's source zip ([The game client from Steam](#the-game-client-from-steam)); +a release fails when the tool cannot be fetched or its hash differs. A tag that is not `v1.2.3` fails the workflow. The CI workflow (`ci.yml`) builds and tests every push to `main` and every pull request, and runs the adapter's checks and the translation check. ```powershell @@ -157,8 +159,12 @@ It needs the .NET 10 Desktop Runtime, which the .NET 10 SDK installs on Windows. ### The server folder The folder Waypoint works on is at the top of the sidebar, under its name: what it is (**Release 0.3.0-beta**, or -**Source, main** for a source copy and its branch) over its path. A click opens the list of the LocalExile folders Waypoint -knows, and a click on one starts Waypoint again on it ([Copies and changing folder](#copies-and-changing-folder)). +**Source, main** for a source copy and its branch) over its path, and under that the version of its game client +(**Path of Exile 3.29.3d**) once it is read. A click opens the list of the LocalExile folders Waypoint knows, each with its +client's version beside its name, and a click on one starts Waypoint again on it. The version is the one the folder's own +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)). **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 @@ -369,8 +375,8 @@ both modes, for everyone: someone with one release sees that release and nothing removes the row, **Cancel** leaves it. - The small **×** on a row, shown while the mouse or the keyboard is on it, takes that folder off the list (`FolderList.Forget`). Nothing in the folder is touched, and adding it again brings it back. The folder in use has none. -- The sidebar has room for about 27 characters of a path, so a longer one keeps its end, which says which folder it is - (`FolderList.Short`); the tooltip has all of it. +- The sidebar is too narrow for most paths, so a path keeps its end, which says which folder it is, and loses its + start behind dots: never dots at both ends (`PathLine`, fitted to the width the line has). The tooltip has all of it. Every way of changing folder goes through one step (`App.SwitchServerAsync`): the folder list, **Change folder…** on a release's Versions, **Change…** and **Find automatically…** in Advanced mode, and the setup guide when it made another copy. @@ -611,7 +617,7 @@ to a user. ### The setup guide With no checkout or release install, the first start opens the guide (`SetupWizard.xaml`); **Run setup guide…** on the Setup -section, or **Finish setup** on a release install's Play, opens it any time. A saved folder that is not there any more is not +section, or **Finish setup** on a release install's Play, opens it any time (for a folder with no game client, Finish setup first asks where the client should come from). A saved folder that is not there any more is not a first start: Waypoint says which folder it can't find (`MissingFolderDialog`) and offers **Open** for each other folder of the list that is there, **Find it…**, **Set up again…** (the guide) and **Close**. Nothing is changed until one is chosen, and the missing folder stays in the list, marked **Not found**. **Skip setup** leaves it: with nothing to open on, @@ -619,8 +625,9 @@ Waypoint still needs a checkout, so the plain chooser follows. Its second page chooses the route. **The ready-to-play release**, the default, asks for a new or empty folder (or an existing install), the client, and an account when the install has no saves. Its run is two steps: the zip, as an update does it, then -`LocalExile.exe setup --json`, shown by its events' stage and progress. The client is copied unless the player chooses to use the -folder itself. A stop waits out a step that writes the client or the keys. A `needs-input` answer returns to the page that gives +`LocalExile.exe setup --json`, shown by its events' stage and progress. The client is copied (`--client-mode copy`), as LocalExile's own launcher +does it; only with Developer Mode on does the page offer to link the chosen folder instead +([A client linked to the user's game](#a-client-linked-to-the-users-game)). A stop waits out a step that writes the client or the keys. A `needs-input` answer returns to the page that gives that option, and the run starts again from where it was. **The source code** is everything below. Until **Start setup** it only looks. It checks .NET 10, Git, Python and Node (a missing one has a button for its download page, @@ -640,19 +647,31 @@ LocalExile cannot use is refused with the reason ([Game client builds](#game-cli 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 game is never downloaded. +**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`). ### Game client builds -LocalExile works with one Path of Exile build at a time. v0.2.0-beta moved from 3.29.3b to **3.29.3c**: a 3.29.3b client no -longer logs in to it, and v0.1.0-beta (the server's `3.29.3b` branch) is the last LocalExile for 3.29.3b. `ClientLocator.Builds` -holds each build Waypoint knows (the SHA-256 and size of its `PathOfExile.exe`, and for an older build its last release and -commit), with a row for each executable GGG shipped under the build's name: the 3.29.3.5 hotfix is still 3.29.3c, with -another `PathOfExile.exe`, and LocalExile runs both with the same code. A hotfix Waypoint has no row for shows as "not -the 3.29.3c build" in the setup guide, which warns before the copy and lets the player go on. `ClientLocator.Needed` reads which build a folder's LocalExile needs (a release's `release.json`, a checkout's -`scripts/release/build-release.ps1`), so a folder pinned to an older version keeps its own. - -The rule: a player who has a 3.29.3c client plays on 3.29.3c; one who has only 3.29.3b keeps the last LocalExile for it. Waypoint +**Which client versions a LocalExile runs is that LocalExile's to say**, so that the two never disagree. A release answers +`LocalExile.exe builds --json` (from v0.5.0-beta: one `build` event per allowed build, with its version, its name, the +SHA-256 of its unpatched executable, and its Steam index and manifests), and a source copy's list is its +`src/GameServer.Core/Protocol/ClientBuilds.cs` (`LocalExileBuilds`, asked once per file and remembered until the file changes). +`ClientLocator.Supported` gives a folder's versions, newest first; the builds a list names are recognized from then on by +their executable's hash (`ClientLocator.Learn`), so a build LocalExile comes to allow shows by its version without a new +Waypoint. A LocalExile that cannot say (a release before v0.5.0-beta, an older checkout) runs the one version its +`release.json` or `scripts/release/build-release.ps1` names, and a release before the command is never asked. + +LocalExile moves to a new client now and then. v0.2.0-beta moved from 3.29.3b to **3.29.3c**: a 3.29.3b client no longer logs +in to it, and v0.1.0-beta (the server's `3.29.3b` branch) is the last LocalExile for 3.29.3b. v0.5.0-beta runs **3.29.3c and +3.29.3d** side by side: a client of either fits. `ClientLocator.Builds` holds the builds Waypoint knows without asking (the +SHA-256 and size of each `PathOfExile.exe`, and for an older build its last release and commit), with a row for each +executable GGG shipped under a version's name: the 3.29.3.5 hotfix is still 3.29.3c. They serve the folders that cannot say, +and `ClientLocator.Current` names the versions the newest LocalExile runs, for a folder that has no LocalExile yet. A client +of no build that a list or a row names shows as "not a version LocalExile runs" in the setup guide, which warns before the +copy and lets the player go on. `ClientLocator.Needed` is the version a folder's client is held against: its own when its +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). 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 @@ -768,6 +787,147 @@ under Proton, and Next waits until it is found. The source route's tools include The client's folder goes to `LocalExile.exe` as a `Z:\` path: Proton gives the install a drive letter of its own, so an unqualified Unix path would land on that drive, while `Z:` is the root in every prefix. +### 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. + +- **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 + 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 + clients of the folder in use come first: the one it uses (`Client\`, marked **In use**) and those it set aside + (`Clients\`). Those of the other LocalExile folders Waypoint knows (`FolderList`) follow under **Other folders**, + quieter, each with its folder's title. A line is the version (with LocalExile's own name for the build only where the + version is several builds: 3.29.3c has a release and the 3.29.3.5 hotfix), then **Steam version** or **Standalone + 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 + 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 + 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 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 + (`ClientVersions.FinishKeptAsync`: Steam sends what is missing, the copy is checked as a client in use is, the mark + goes and the folder takes that version's name). When Steam cannot deliver that build for this LocalExile it can only + be deleted, and when the list could not be read the window says that instead. Current Waypoint never sets a half-way + client aside; this is for one that got there another way. +- **Download a version…** is apart from the list, as setting up a new copy is apart from the sidebar's folders. It opens + the builds the folder's LocalExile lists that Steam can deliver and the folder does not hold (`ClientVersions.Offered`; + which versions, and Steam's app, depots and manifests for each, are LocalExile's to say: `LocalExile.exe builds`, + [Game client builds](#game-client-builds)), newest first, each with LocalExile's name for it, and the one chosen is + downloaded into the folder in use. Enter in that list is Cancel. Beside the button a note shows only when there is a + reason it is off (a LocalExile that lists nothing, a folder that already has every version, a PC the tool does not + run on) or something a download will go on from (what an unfinished one left). A LocalExile that failed to answer is + asked once more when the window opens (`LocalExileBuilds.Of(folder, again: true)`, at most every half minute, never + from the UI thread). +- **From Finish setup.** A release folder with no game client, in use or kept, has nothing to finish setup with. Its + Play page says "No game client in this folder yet.", and **Finish setup** asks where the client should come from: + **Download from Steam** (the question names the version: the newest its LocalExile lists that Steam can deliver, + `ClientVersions.Newest`), **Use a client on this PC** (the setup guide, as before) or Cancel. The download opens this window + and starts at once (`downloadNewest`): the sign-in when there is none, then the question with the size, which Enter + cancels. When the client is there and the folder still needs an account, the guide opens next. A LocalExile that + lists nothing (before v0.5.0-beta), and a Waypoint that cannot run the tool, go to the guide as before. + +- **The tool.** Waypoint does not speak to Steam itself: it runs [DepotDownloader](https://github.com/SteamRE/DepotDownloader) + (GPL-2.0), a program of its own (`DepotTool`, `SteamDownload` in `src/Launcher.Core/SteamDownload.cs`). A released + `Waypoint.exe` carries the tool's official release for Windows x64, unchanged, so that a user's Waypoint downloads no + tool: `tools/Get-DepotDownloader.ps1` fetches it when Waypoint is built and holds it to its SHA-256, the project embeds + the zip when it is there, and the release workflow runs the script and attaches the tool's source beside `Waypoint.exe` + ([THIRD-PARTY-NOTICES.md](../THIRD-PARTY-NOTICES.md)). The first time it is needed it is unpacked into + `%LOCALAPPDATA%\Waypoint\tools\DepotDownloader`, checked against the same SHA-256. A Waypoint built without the zip + fetches that release then. Neither Steam nor SteamCMD has to be on the PC. +- **The sign-in.** Steam's anonymous account cannot fetch the game, so the user signs in once, with an account that has + Path of Exile in its library. There is no sign-in button in the window: a download signs in when it needs to. That is + the tool's own QR sign-in: Waypoint draws the code the tool prints (`SteamSignInWindow`), the user scans it with the + Steam mobile app and approves, and the picture follows when Steam changes the code. The tool gives up after about two + minutes without an approval: the window then says so and offers **New code**. **Sign in with a password…** in that + window is for someone without the app: Waypoint asks only the account's name, and the tool asks for the password and + the Steam Guard code in a console window of its own, which stays open after a failure. Either way Waypoint sees no + password and no token: the tool keeps the sign-in (in the Windows user's isolated storage, by where the tool runs from, + which is why its folder has no version in its name), and Waypoint keeps the account's name (`Settings.SteamAccount`), + which names that sign-in on later runs and is shown at the foot of the window once there is one, with **Forget the + sign-in**, which drops the name. + When Steam no longer takes the remembered sign-in, the next download asks again. A log never gets the code or the name. +- **Getting a version.** Waypoint first asks Steam how large the build is (its manifests, a few seconds). A folder with no + client downloads it whole. A folder that has one is asked how to move, each time (`SwitchWay`), with only the ways the + drive has room for. The question's title names the build; its text gives the size (when the whole build is + downloaded) and the free room, then one line a way, which says what that way costs: + - **Update in place**: the one client is brought to the other version where it is. Only what differs is downloaded and + it needs no more room, but the version it was is gone. The client carries `.waypoint-switching` (the version and + the build's executable hash) until it is whole: Play starts nothing on it meanwhile, and **Finish the switch** on its + line, or the same download again, finishes it. A client half-way is only ever made whole where it is, whichever + build is asked for: it is never set aside or copied. + - **Keep both**: the client in use is set aside in the folder's `Clients\` and the other version takes its + place. With a client from Steam in use, the new one starts as a copy of it, so only what differs is downloaded; it + needs the room of both. + - A standalone client (`Content.ggpk`) shares nothing with Steam's files: the version is downloaded whole either way, + and **Replace** deletes the standalone one once the new client is in place. Steam cannot bring a standalone client + back, so **Keep both** is the first button there. Enter and Esc are always Cancel. + - **Settings → Game client versions** makes one way the way every time (`Settings.ClientSwitch`); a way the drive has + no room for is asked about instead, and so is a standalone client under "always update in place", because it would + be deleted for good. + Everything but an update in place is made ready in `.waypoint-next-client`, beside a client that goes on working, and + only a whole build is swapped in (its executable is the build's, and its `Bundles2\_.index.bin` has the hash LocalExile + lists); a rename that fails puts the old client back. **Stop** keeps what was fetched, and the next try goes on from it: + the window says how much is there, and it counts as room the next try does not need again (the question still gives + the drive's own free space). Updating a client from Steam in place needs no second folder and removes what one was + begun in, which the question says on that way's line. +- **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 + 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. + +### A client linked to the user's game + +LocalExile's launcher always copies the client. Its `--client-mode link` makes `Client` a link to the folder it was given +instead; that is for developers, and neither `LocalExile.exe` nor Waypoint offers it to anyone else. A release linked to the +user's own Path of Exile folder runs from it: LocalExile writes `Game.exe`, `Game.patched.exe` and the login list there, and +the game data is shared, so a game update in that folder can break the install. Waypoint follows LocalExile in each part: + +- **The setup guide** offers "For developers: use this folder itself instead of a copy" on a release's client page only with + Developer Mode on, with what it risks, and passes `--client-mode link` for it. +- **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. +- **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 + start the copy by accident. Without the room for the copy (what is left to copy and 2 GB more) the box only says so, with + the two numbers. + - **The copy** goes into `.waypoint-new-client` beside the link, with the resumable copy the guide uses, the patched + executable included (it was patched for this folder's keys, and `IsSetUp` needs it). The link keeps working meanwhile. + The page shows the progress and **Stop the copy**; a stop or a failure leaves the release as it was, and the next try + goes on from what was copied. A file an earlier try copied counts only while it still has the size and time of the one + in the user's folder. + - **The swap** happens only for a copy that is whole and matches the user's folder as it is then (every file's size and + time, and the build): `.waypoint-complete` is written into it, the link is set aside as `.waypoint-old-link` (a rename, + so it can be put back; on Linux the link is removed and made again if needed), the copy is renamed to `Client`, and the + link is removed, which removes nothing it leads to. A rename that fails puts the link back. A move cut short between + those steps is finished when Waypoint next opens the folder (`OwnClient.Finish`, before the page decides whether the + release is set up), forward when the copy is whole and back to the link otherwise. A `Client` that is a folder of its + own is never replaced. + - **Afterwards** a box names the files LocalExile left in the user's folder, for the user to delete (`Game.exe`, + `Game.patched.exe`, and `config.json` only when it is the one naming LocalExile's own settings). Waypoint deletes + nothing there and does not put that folder's login list back. + - A copy begun for a link that is gone since is removed (`OwnClient.Discard`): only Waypoint's own folder, and never + while `Client` is a link. + ### Setup The requirements come from the adapter's inspection, each with what to do about it. **Prepare client** creates what is @@ -1302,6 +1462,9 @@ adapter does not know can be browsed but not changed. | `DevHost.cs`, `AccountList.cs` | the dev host and its account list | | `SetupChecks.cs`, `Settings.cs` | the setup checks, the per-user settings | | `SetupWizard.xaml`, `PortCheck.cs` | the setup guide; what holds a server's port, and the question about it | +| `src/Launcher.Core/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 | +| `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 | | `Tray.cs` | the tray icon (Windows Forms' NotifyIcon) | diff --git a/src/Launcher.Core/ClientCopy.cs b/src/Launcher.Core/ClientCopy.cs index 75376ec..6062ed9 100644 --- a/src/Launcher.Core/ClientCopy.cs +++ b/src/Launcher.Core/ClientCopy.cs @@ -21,13 +21,15 @@ public static class ClientCopy { const int BufferSize = 4 * 1024 * 1024; /// Room left over on the drive, so a copy does not end with a full disk. - const long Margin = 2_000_000_000; + internal const long Margin = 2_000_000_000; /// A patched client only works with the keys it was patched for: they come with it when the checkout has none - /// yet, and otherwise it stays behind and the client is patched again. - public static ClientCopyPlan Plan(string source, string checkout) + /// yet, and otherwise it stays behind and the client is patched again. is another folder than + /// the checkout's Client to copy into; brings the patched executable whatever the keys + /// (: the client the folder already runs from, patched for its own keys). + public static ClientCopyPlan Plan(string source, string checkout, string? target = null, bool keepPatched = false) { - string target = Path.Combine(checkout, "Client"); + target ??= Path.Combine(checkout, "Client"); string keys = Path.Combine(checkout, "data", "login-keys.json"); string? sourceData = Path.GetDirectoryName(Path.TrimEndingDirectorySeparator(source)) is { } parent ? Path.Combine(parent, "data") : null; bool withKeys = ClientLocator.Classify(source) == ClientKind.Ready && !File.Exists(keys) @@ -39,7 +41,7 @@ public static ClientCopyPlan Plan(string source, string checkout) string relative = Path.GetRelativePath(root, file.FullName); // The client's own logs are not part of the game; a leftover .partial is another copy's. if (relative.StartsWith("logs" + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) || relative.EndsWith(".partial", StringComparison.OrdinalIgnoreCase)) continue; - if (!withKeys && relative.Equals("Game.patched.exe", StringComparison.OrdinalIgnoreCase)) continue; + if (!withKeys && !keepPatched && relative.Equals("Game.patched.exe", StringComparison.OrdinalIgnoreCase)) continue; files.Add(new(file.FullName, Path.Combine(target, relative), file.Length)); } files = files.OrderBy(f => Path.GetFileName(f.Target).Equals("Content.ggpk", StringComparison.OrdinalIgnoreCase)).ToList(); diff --git a/src/Launcher.Core/ClientLocator.cs b/src/Launcher.Core/ClientLocator.cs index d45e404..636c8e4 100644 --- a/src/Launcher.Core/ClientLocator.cs +++ b/src/Launcher.Core/ClientLocator.cs @@ -19,21 +19,28 @@ public sealed record FoundClient(string Folder, ClientKind Kind, long Bytes, boo ClientKind.Ready => "Already prepared for LocalExile", ClientKind.Standalone => "Standalone client", _ => "Steam or Epic layout: it cannot be used", - }) + (Bytes > 0 ? $" · {Bytes / 1e9:0.#} GB" : "") + (Build is not null ? " · " + Build : KnownBuild == false ? " · " + L.Text("not the 3.29.3c build") : ""); + }) + (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; } /// Where it looked, for the report when nothing is found. public sealed record ClientSearchResult(FoundClient[] Clients, string[] Searched, bool Limited); -/// Finds the player's game clients. Bounded and read-only: it never opens the game or changes a file. The server -/// works only with one client build at a time (), whose executable has no version resource, so a build is -/// recognized by its hash; the point is to warn before a copy of 70 GB, not to replace the server's own check when it makes the -/// keys. +/// Finds the player's game clients. Bounded and read-only: it never opens the game or changes a file. A LocalExile +/// runs only the client builds in its own list (), whose executables have no version resource, +/// so a build is recognized by its hash; the point is to say which version a client is and to warn before a copy of 70 GB, +/// not to replace the server's own check when it makes the keys. public static class ClientLocator { - /// The client build current LocalExile needs. LocalExile v0.2.0-beta moved to it and dropped 3.29.3b. - public const string Build = "3.29.3c"; + /// The client versions the newest LocalExile runs, newest first: for a folder that has no LocalExile yet, and to + /// tell a folder on an older LocalExile. A folder that has a LocalExile is asked instead (). + /// v0.2.0-beta moved to 3.29.3c and dropped 3.29.3b; v0.5.0-beta added 3.29.3d beside it. + public static IReadOnlyList Current { get; } = ["3.29.3d", "3.29.3c"]; + + /// The newest of . + public static string Build => Current[0]; + + public static bool IsCurrent(string? build) => build is not null && Current.Contains(build); /// The last LocalExile made for an older client build: its release tag and the source commit (the head of the /// server's branch named after the build). @@ -44,6 +51,8 @@ public sealed record OlderVersion(string Release, string Commit); /// for each executable GGG shipped under its name: a hotfix keeps the name and changes the file. static readonly (string Name, string Hash, long Length, OlderVersion? Older)[] Builds = [ + // 3.29.3d (build 328228, GGG's patch of 2026-11-10): 3.29.3.5's code, which LocalExile runs from v0.5.0-beta. + ("3.29.3d", "e9ba3d31c4d922e1826ef01d02fd22178a001b29e17264b68fc2446efd41f53d", 79_394_136, null), // The 3.29.3c release (build 327984), then its 3.29.3.5 hotfix (build 328126), which LocalExile runs with the same code. ("3.29.3c", "cc8aa38345be2a837575215d2ce142ebecf7b007345843265b335ebb8ac5964c", 79_394_136, null), ("3.29.3c", "01a22facf36886b39bca74793c0d8c7295b1495f1625b4ebc7b23c2de32a70cf", 79_394_136, null), @@ -54,9 +63,27 @@ static readonly (string Name, string Hash, long Length, OlderVersion? Older)[] B /// SHA-256 of the PathOfExile.exe as first released. public static string KnownExecutable => Builds.First(b => b.Name == Build).Hash; + /// Builds a LocalExile folder's own list named (): the executable's hash and the + /// version it is. They are recognized like the rows above, so a build LocalExile comes to allow shows by its version + /// without a new Waypoint. + static readonly Dictionary Learned = new(StringComparer.OrdinalIgnoreCase); + + /// Takes in a LocalExile's list. A hash Waypoint has a row for keeps that row's name. + public static void Learn(IEnumerable builds) + { + lock (Learned) + foreach (var build in builds) + if (!Builds.Any(b => b.Hash.Equals(build.ExecutableSha256, StringComparison.OrdinalIgnoreCase)) && Learned.TryAdd(build.ExecutableSha256, build.Version)) + lock (Identified) Identified.Clear(); + } + /// The original executables' fingerprints for a supported build, its hotfixes included; none for a build /// Waypoint does not know: unknown future builds are never repaired automatically. - public static string[] ExecutableHashesFor(string? build) => [.. Builds.Where(b => b.Name == build).Select(b => b.Hash)]; + public static string[] ExecutableHashesFor(string? build) + { + lock (Learned) + return [.. Builds.Where(b => b.Name == build).Select(b => b.Hash), .. Learned.Where(l => l.Value == build).Select(l => l.Key.ToLowerInvariant())]; + } /// The last LocalExile made for an older build; null for the current build or one Waypoint does not know. public static OlderVersion? LastVersionFor(string build) => Builds.FirstOrDefault(b => b.Name == build).Older; @@ -85,7 +112,7 @@ static readonly (string Name, string Hash, long Length, OlderVersion? Older)[] B new[] { "PathOfExile.exe", "Game.exe" }.Select(n => Path.Combine(folder, n)).FirstOrDefault(File.Exists); /// 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 ? build == Build : null; + public static bool? IsKnownBuild(string folder) => Identify(folder) is { } build ? IsCurrent(build) : null; /// The named build of a client folder ("3.29.3b"); null when its executable is another one, missing or unreadable. public static string? BuildOf(string folder) => BuildOverride is { } read ? read(folder) : Identify(folder) is { Length: > 0 } build ? build : null; @@ -94,21 +121,28 @@ static readonly (string Name, string Hash, long Length, OlderVersion? Older)[] B /// real build's hash). public static Func? BuildOverride { get; set; } - /// Whether build is older than ; false when either is not one Waypoint knows. - public static bool IsOlder(string a, string b) - { - int ia = Array.FindIndex(Builds, x => x.Name == a), ib = Array.FindIndex(Builds, x => x.Name == b); - return ia >= 0 && ib >= 0 && ia > ib; - } + /// Whether version is older than ("3.29.3b" before "3.29.3c" before + /// "3.30.0"); false when either does not read as a version of the game. + public static bool IsOlder(string a, string b) => Parts(a) is { } x && Parts(b) is { } y && x.CompareTo(y) < 0; + + static (int, int, int, int)? Parts(string version) => + Regex.Match(version, @"\A(\d{1,4})\.(\d{1,4})\.(\d{1,4})([a-z]?)\z") is { Success: true } m + ? (int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), int.Parse(m.Groups[3].Value), m.Groups[4].Length == 0 ? 0 : m.Groups[4].Value[0] - 'a' + 1) + : null; static readonly Dictionary<(string, long, DateTime), string> Identified = []; + /// Anything this large is a game executable; the official launcher that can sit under the same name is well + /// under a megabyte. (LocalExile's own check draws the same line.) + const long GameExecutableSize = 16 << 20; + /// The build's name, "" for an executable of no known build, null when there is none or it cannot be read. A - /// checkout's PathOfExile.exe can be the small launcher, so Game.exe is read too. Remembered by path, size and time. + /// checkout's PathOfExile.exe can be the small launcher, so Game.exe is read too, and a Steam install's game is + /// PathOfExileSteam.exe. Remembered by path, size and time. static string? Identify(string folder) { bool any = false; - foreach (string name in new[] { "PathOfExile.exe", "Game.exe" }) + foreach (string name in new[] { "PathOfExile.exe", "PathOfExileSteam.exe", "Game.exe" }) { string executable = Path.Combine(folder, name); try @@ -122,11 +156,15 @@ public static bool IsOlder(string a, string b) if (build is null) { build = ""; - if (Builds.Any(b => b.Length == file.Length)) + bool learned; + lock (Learned) learned = Learned.Count > 0; + if (Builds.Any(b => b.Length == file.Length) || learned && file.Length >= GameExecutableSize) { using var stream = new FileStream(executable, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); string hash = Convert.ToHexStringLower(SHA256.HashData(stream)); - build = Builds.FirstOrDefault(b => b.Hash == hash).Name ?? ""; + build = Builds.FirstOrDefault(b => b.Hash == hash).Name; + if (build is null) lock (Learned) build = Learned.GetValueOrDefault(hash); + build ??= ""; } lock (Identified) Identified[key] = build; } @@ -137,9 +175,55 @@ public static bool IsOlder(string a, string b) return any ? "" : null; } - /// The client build a LocalExile folder needs: a release's release.json says; a checkout's release script names the - /// one its release would be made for (a checkout pinned to an older version names its own). Null when neither says. + /// LocalExile's own name for the build a client folder holds ("3.29.3.5 hotfix of 2026-11-09, build 328126"), + /// among the builds its list names: one version can be several builds. Null when the executable is none of them. It + /// reads the whole executable: never on the UI thread. + public static ListedBuild? ListedBuildOf(string folder, IEnumerable builds) + { + foreach (string name in new[] { "PathOfExile.exe", "PathOfExileSteam.exe", "Game.exe" }) + { + try + { + var file = new FileInfo(Path.Combine(folder, name)); + if (!file.Exists || file.Length < GameExecutableSize) continue; + using var stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); + string hash = Convert.ToHexStringLower(SHA256.HashData(stream)); + if (builds.FirstOrDefault(b => b.ExecutableSha256 == hash) is { } build) return build; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + } + return null; + } + + /// The client versions a LocalExile folder runs, newest first: its own list when it has one + /// (, whose builds are then recognized here too), and otherwise the one version its + /// release.json or release script names. Empty when nothing says. + public static IReadOnlyList Supported(string folder) + { + if (LocalExileBuilds.Of(folder) is { Count: > 0 } listed) + { + Learn(listed); + return [.. listed.Select(b => b.Version).Distinct().OrderByDescending(v => Parts(v) ?? default)]; + } + return Named(folder) is { } one ? [one] : []; + } + + /// Whether the folder's LocalExile runs a client of this version. + public static bool Supports(string folder, string build) => Supported(folder).Contains(build); + + /// The client version to hold a LocalExile folder's client against: the version of the client it has when its + /// LocalExile runs that one, and otherwise the newest it runs. Null when nothing says what it runs. public static string? Needed(string folder) + { + var supported = Supported(folder); + if (supported.Count == 0) return null; + string client = Path.Combine(folder, "Client"); + return Directory.Exists(client) && BuildOf(client) is { } have && supported.Contains(have) ? have : supported[0]; + } + + /// The one client build a LocalExile folder names: a release's release.json; a checkout's release script names the + /// one its release would be made for (a checkout pinned to an older version names its own). Null when neither says. + static string? Named(string folder) { try { @@ -231,7 +315,7 @@ public static bool RestoreSettings(string folder) } /// Deletes a folder without following a link inside it: a link is removed, never what it points to. - static void DeleteTree(string folder) + internal static void DeleteTree(string folder) { foreach (var entry in new DirectoryInfo(folder).EnumerateFileSystemInfos()) { diff --git a/src/Launcher.Core/ClientUpdate.cs b/src/Launcher.Core/ClientUpdate.cs index dbdcf76..be5c75d 100644 --- a/src/Launcher.Core/ClientUpdate.cs +++ b/src/Launcher.Core/ClientUpdate.cs @@ -3,10 +3,11 @@ namespace Launcher.Core; /// -/// LocalExile moves to a new game client now and then (v0.2.0-beta: 3.29.3b to 3.29.3c), and a folder whose client and -/// LocalExile are of different builds cannot log in. The rule: a player who has a client of the build current LocalExile needs -/// plays on it; one who has only an older client keeps the last LocalExile made for it, with a quiet note that it will not -/// last. Waypoint looks when a folder is about to start the game (Play), at that folder's +/// LocalExile moves to a new game client now and then (v0.2.0-beta: 3.29.3b to 3.29.3c), and a folder whose client is no +/// version its LocalExile runs cannot log in. A LocalExile can run several versions at once (v0.5.0-beta: 3.29.3c and +/// 3.29.3d), and which ones is its own to say (): a client of any of them fits. The +/// rule: a player who has a client of a version current LocalExile runs plays on it; one who has only an older client keeps +/// the last LocalExile made for it, with a quiet note that it will not last. Waypoint looks when a folder is about to start the game (Play), at that folder's /// client and, for a client of another build, at the usual places (), never at every client on the PC, /// and settles what fits before anything starts (). A move is asked once () and the /// answer kept for the folder while Waypoint runs. A client of a build Waypoint does not know is left to LocalExile's own check. @@ -52,29 +53,53 @@ public sealed record Plan(Kind Kind, string Folder, string Have, string Need, bo public static Plan? Check(string folder, bool lookForNewer = false, CancellationToken stop = default, Func? find = null) { find ??= FindClient; - if (ClientLocator.Needed(folder) is not { } need) return 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; + string need = supported[0], oldest = supported[^1]; + (string Version, string Folder)? FindAmong(IEnumerable versions) + { + foreach (string version in versions) + if (find(version, stop) is { } at) return (version, at); + return null; + } string client = Path.Combine(folder, "Client"); string? have = Directory.Exists(client) ? ClientLocator.BuildOf(client) : null; if (have is null) { // No client yet (or none Waypoint knows): only a player with nothing but an older client needs a word here. - if (Directory.Exists(client) || find(need, stop) is not null) return null; - foreach (string older in ClientLocator.OlderBuilds.Where(b => ClientLocator.IsOlder(b, need))) + if (Directory.Exists(client) || FindAmong(supported) is not null) return null; + foreach (string older in ClientLocator.OlderBuilds.Where(b => ClientLocator.IsOlder(b, oldest))) if (find(older, stop) is { } olderClient) return For(Kind.UseOlder, folder, older, need, olderClient, ClientLocator.LastVersionFor(older)); return null; } - if (ClientLocator.IsOlder(have, need)) - return find(need, stop) is { } found - ? For(Kind.Replace, folder, have, need, found) + if (supported.Contains(have)) + { + // It fits. A folder still on a LocalExile made for an older client is told when a current client is on the PC. + if (lookForNewer && !supported.Any(ClientLocator.IsCurrent) && FindAmong(ClientLocator.Current) is { } newer) + return For(Kind.UpdateLocalExile, folder, newer.Version, have, newer.Folder); + return null; + } + if (ClientLocator.IsOlder(have, oldest)) + return FindAmong(supported) is { } found + ? For(Kind.Replace, folder, have, found.Version, found.Folder) : ClientLocator.LastVersionFor(have) is { } last ? For(Kind.UseOlder, folder, have, need, null, last) : null; if (ClientLocator.IsOlder(need, have)) return For(Kind.UpdateLocalExile, folder, have, need); - if (lookForNewer && ClientLocator.IsOlder(need, ClientLocator.Build) && find(ClientLocator.Build, stop) is { } newer) - return For(Kind.UpdateLocalExile, folder, ClientLocator.Build, need, newer); + // A version between two this LocalExile runs: LocalExile's own check has the last word. return null; } + /// The version of the older client a folder's LocalExile was made for, when it runs none of the current ones + /// (); null for a folder on a current LocalExile, or one that does not say. + public static string? OlderVersionOf(string folder) => + ClientLocator.Supported(folder) is { Count: > 0 } supported && !supported.Any(ClientLocator.IsCurrent) ? supported[0] : null; + + /// A quick look for a client of any version current LocalExile runs, the newest first; its folder, or null. + public static string? FindCurrent(CancellationToken stop = default) => + ClientLocator.Current.Select(version => FindClient(version, stop)).FirstOrDefault(folder => folder is not null); + /// A plan with what the folder's own client is: a link or a copy, where, and how big. static Plan For(Kind kind, string folder, string have, string need, string? found = null, ClientLocator.OlderVersion? older = null) { @@ -153,8 +178,7 @@ public static string OlderText(Plan plan, bool release) => /// The quiet note for a folder on a LocalExile made for an older client than current LocalExile's: null when it is /// on the current one. Not a warning: the older version still works, it is only not kept up. - public static string? OlderNote(string folder) => - ClientLocator.Needed(folder) is { } need && ClientLocator.IsOlder(need, ClientLocator.Build) ? OlderNoteFor(need) : null; + public static string? OlderNote(string folder) => OlderVersionOf(folder) is { } older ? OlderNoteFor(older) : null; public static string OlderNoteFor(string build) => L.Text("LocalExile now uses Path of Exile {0}. When you can, move to it: versions for {1} won't be offered after 3.30 comes out.", ClientLocator.Build, build); diff --git a/src/Launcher.Core/ClientVersions.cs b/src/Launcher.Core/ClientVersions.cs new file mode 100644 index 0000000..88dda8b --- /dev/null +++ b/src/Launcher.Core/ClientVersions.cs @@ -0,0 +1,371 @@ +using System.Security.Cryptography; + +namespace Launcher.Core; + +/// What a LocalExile folder's Client is, as LocalExile tells the two layouts apart (ClientFiles.Resolve: +/// a Content.ggpk first, else Bundles2/_.index.bin). +public enum ClientLayout { None, Standalone, Steam, Link } + +/// How a folder moves to another version of the game from Steam when it already has a client. +public enum SwitchWay +{ + /// The one client is brought to the other version where it is: only what differs is downloaded, and no more + /// room is needed, but the version it was is gone. + UpdateInPlace, + /// The client in use is set aside in and the other version made beside + /// it: both stay, at the room of both, and going back is a rename. + KeepBoth, +} + +/// A client set aside in the folder's Clients\. +/// Its folder's name there. +/// The version it is, when its executable is one a list or Waypoint names. +/// For a client that was set aside while half-way to another version (it carries the mark): that +/// version. Such a copy is not whole and cannot be used until it is finished (). +/// The executable hash of the build it was on its way to, when the mark names it. +public sealed record KeptClient(string Name, string? Version, string Folder, long Bytes, string? HalfWayTo = null, string? HalfWayToBuild = null); + +/// "copy" while the client in use is copied as a start, "download" while Steam's files come. +/// 0 to 1 of the stage, when it can be told. +public sealed record SwitchProgress(string Stage, double? Fraction, string Detail); + +/// +/// The versions of the game a LocalExile folder holds: the one in Client, which is all LocalExile ever looks at, and +/// those set aside in Clients\, which are Waypoint's own. A version comes from Steam () in +/// one of two ways, the user's to choose (). Throughout, a client that works is never taken away +/// before another is whole, except by , whose point is to need no second copy: a +/// client being updated where it is carries a mark () until it is whole again, nothing starts on it +/// meanwhile, and the same switch run again finishes it. +/// +public static class ClientVersions +{ + public const string KeptFolder = "Clients"; + /// Beside Client while another version is made ready to take its place. + public const string NextFolder = ".waypoint-next-client"; + /// In a client that is being updated where it is: the version it is on its way to and, on a second line, that + /// build's executable hash (one version can be several builds). + public const string Marker = ".waypoint-switching"; + /// In once the copy it starts from is whole. + const string Seeded = ".waypoint-seeded"; + /// Room left over on the drive, beyond what a switch is known to need. + public const long Margin = 4_000_000_000; + + static string Client(string folder) => Path.Combine(folder, "Client"); + + public static ClientLayout Layout(string folder) => LayoutOf(Client(folder)); + + public static ClientLayout LayoutOf(string client) + { + try + { + if (ClientSettings.IsLink(client)) return ClientLayout.Link; + if (File.Exists(Path.Combine(client, "Content.ggpk"))) return ClientLayout.Standalone; + return File.Exists(Path.Combine(client, "Bundles2", "_.index.bin")) ? ClientLayout.Steam : ClientLayout.None; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException) { return ClientLayout.None; } + } + + /// Which of the two a client folder's files are, whether the folder is a link or not: a client that came as the + /// standalone game (Content.ggpk) or one that came from Steam. + public static ClientLayout FilesOf(string client) + { + try + { + if (File.Exists(Path.Combine(client, "Content.ggpk"))) return ClientLayout.Standalone; + return File.Exists(Path.Combine(client, "Bundles2", "_.index.bin")) ? ClientLayout.Steam : ClientLayout.None; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException) { return ClientLayout.None; } + } + + /// The version a client being updated where it is was on its way to, when that was cut short; null for a + /// client that is whole. + public static string? Unfinished(string folder) => UnfinishedBuild(folder)?.Version; + + /// The same, with the executable hash of the build it was on its way to when the mark names it. + public static (string Version, string? ExecutableSha256)? UnfinishedBuild(string folder) => MarkIn(Client(folder)); + + /// The mark in a client folder, the one in use or one set aside. + static (string Version, string? ExecutableSha256)? MarkIn(string client) + { + try + { + string marker = Path.Combine(client, Marker); + if (!File.Exists(marker)) return null; + string[] lines = [.. File.ReadAllLines(marker).Select(l => l.Trim()).Where(l => l.Length > 0)]; + return (lines.Length > 0 ? lines[0] : "", lines.Length > 1 ? lines[1] : null); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return null; } + } + + /// The newest of the builds on offer: the highest version, and of a version's builds the first offered, which + /// is the latest LocalExile lists (a hotfix before its release). Null when nothing is on offer. + public static ListedBuild? Newest(IEnumerable offered) + { + ListedBuild? newest = null; + foreach (var build in offered) + if (newest is null || ClientLocator.IsOlder(newest.Version, build.Version)) newest = build; + return newest; + } + + /// For a LocalExile folder with no game client at all, in use or kept: the newest build its LocalExile lists + /// that Steam can deliver. Null when the folder has a client, its LocalExile lists none (before v0.5.0-beta), or this + /// Waypoint cannot run the download tool. It is what Finish setup offers, and the one test for whether the setup guide + /// may say so. It can ask the folder's launcher, which takes a moment: never on the UI thread. + public static ListedBuild? FirstDownload(string folder) => + DepotTool.Supported && Layout(folder) == ClientLayout.None && Kept(folder).Count == 0 + ? Newest(Offered(LocalExileBuilds.Of(folder) ?? [], null, whole: true, [])) : null; + + /// Whether a version is more than one build in the list (a release and its hotfix), whether Steam can deliver + /// each or not: its builds are then told apart by LocalExile's own name for each. + public static bool Several(IEnumerable builds, string? version) => builds.Count(b => b.Version == version) > 1; + + /// The builds to offer from Steam, newest first: every build Steam can deliver, less those the folder holds + /// already (the one in use when it is whole, and those set aside). + /// The build of the client in use, when its executable is a listed one. + /// False for a client half-way to another build: every build is then offered, the one it was too. + /// The builds of the clients set aside. + public static IReadOnlyList Offered(IEnumerable builds, ListedBuild? inUse, bool whole, IEnumerable kept) + { + var here = kept.Append(whole ? inUse : null).Where(b => b is not null).Select(b => b!.ExecutableSha256).ToHashSet(StringComparer.OrdinalIgnoreCase); + return [.. builds.Where(b => b.FromSteam && !here.Contains(b.ExecutableSha256)).Reverse()]; + } + + /// The bytes of every file under a folder, links not followed; 0 when it cannot be read. + public static long SizeOf(string folder) + { + try + { + return new DirectoryInfo(folder).EnumerateFiles("*", new EnumerationOptions { RecurseSubdirectories = true, AttributesToSkip = FileAttributes.ReparsePoint }) + .Sum(file => file.Length); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return 0; } + } + + /// The clients set aside in the folder, by name. + public static IReadOnlyList Kept(string folder) + { + var kept = new List(); + try + { + string store = Path.Combine(folder, KeptFolder); + if (!Directory.Exists(store)) return kept; + foreach (var entry in new DirectoryInfo(store).EnumerateDirectories().OrderBy(d => d.Name, StringComparer.OrdinalIgnoreCase)) + // A copy whose deletion was cut short (".deleting-") is not a client to list. + if (entry.LinkTarget is null && !entry.Name.StartsWith(Deleting, StringComparison.Ordinal) && LayoutOf(entry.FullName) is ClientLayout.Standalone or ClientLayout.Steam) + { + var mark = MarkIn(entry.FullName); + kept.Add(new(entry.Name, ClientLocator.BuildOf(entry.FullName), entry.FullName, SizeOf(entry.FullName), mark?.Version, mark?.ExecutableSha256)); + } + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + return kept; + } + + /// The start of a kept client's name while it is being deleted. + const string Deleting = ".deleting-"; + + /// A name in Clients\ that is free: the version, or the version with a number. + static string FreeName(string folder, string? version) + { + string store = Path.Combine(folder, KeptFolder), name = version ?? "other"; + Directory.CreateDirectory(store); + for (int i = 1; ; i++) + { + string candidate = Path.Combine(store, i == 1 ? name : $"{name} ({i})"); + if (!Directory.Exists(candidate) && !File.Exists(candidate)) return candidate; + } + } + + /// 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) + { + 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)); + 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.")); + 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)) + { + aside = FreeName(folder, ClientLocator.BuildOf(client)); + Directory.Move(client, aside); + } + try { Directory.Move(kept, client); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + if (aside is not null) Directory.Move(aside, client); + throw; + } + } + + /// Deletes a client that was set aside: renamed first, which fails as a whole while anything holds one of its + /// files, then deleted without following a link inside it. + public static void Delete(string folder, string name) + { + string kept = Path.Combine(folder, KeptFolder, name), going = Path.Combine(folder, KeptFolder, Deleting + name); + FinishDeletes(folder); + if (!Directory.Exists(kept)) return; + if (Directory.Exists(going)) ClientLocator.DeleteTree(going); + Directory.Move(kept, going); + ClientLocator.DeleteTree(going); + } + + /// Whether a deletion of a kept client was cut short (Waypoint closed, the PC went off): its remains are + /// still on the drive, under a name the list does not show. + public static bool HasUnfinishedDeletes(string folder) + { + try + { + string store = Path.Combine(folder, KeptFolder); + return Directory.Exists(store) && new DirectoryInfo(store).EnumerateDirectories(Deleting + "*").Any(); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return false; } + } + + /// Finishes the deletions of kept clients that were cut short. Their user already said to delete them. + public static void FinishDeletes(string folder) + { + string store = Path.Combine(folder, KeptFolder); + if (!Directory.Exists(store)) return; + foreach (var entry in new DirectoryInfo(store).EnumerateDirectories(Deleting + "*").ToList()) + if (entry.LinkTarget is null) ClientLocator.DeleteTree(entry.FullName); + } + + /// The room a switch needs on the folder's drive, as far as it can be told before it starts. + /// The build's size on disk (). + /// The size of the client in use. + public static long Needed(ClientLayout layout, SwitchWay way, long buildBytes, long currentBytes) => + layout == ClientLayout.Steam && way == SwitchWay.UpdateInPlace ? Margin + : layout == ClientLayout.Steam ? currentBytes + Margin + : buildBytes + Margin; + + /// Whether a folder holds this build whole: its executable is the build's, and its game files' index is the + /// one LocalExile lists for it. + public static bool Holds(string client, ListedBuild build) + { + try + { + string index = Path.Combine(client, "Bundles2", "_.index.bin"); + if (!File.Exists(index) || ClientLocator.BuildOf(client) != build.Version) return false; + // Two builds of one version differ by their executable (a test has no real executable to hash). + if (ClientLocator.BuildOverride is null && ClientLocator.ListedBuildOf(client, [build]) is null) return false; + if (build.SteamIndexSha256 is not { } expected) return true; + using var stream = new FileStream(index, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); + return Convert.ToHexStringLower(SHA256.HashData(stream)) == expected; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return false; } + } + + /// What LocalExile made beside the game's files for the build that was there (Game.exe and the copy patched for + /// this folder's keys): gone, so that its next setup makes them again from the build that is there now. + static void ForgetPrepared(string client) + { + // The mark too: a copy of a client that was half-way carries it, and what was just verified is whole. + foreach (string name in new[] { "Game.exe", "Game.patched.exe", Seeded, Marker }) + if (File.Exists(Path.Combine(client, name))) File.Delete(Path.Combine(client, name)); + } + + /// + /// Makes a client that was set aside half-way to another version whole where it is, as the build it was on its way to: + /// Steam sends what is missing, the same check as for a client in use says it is whole, and only then does the mark go. + /// It is then a kept copy of that build, under that version's name. The client in use is not touched. + /// + public static async Task FinishKeptAsync(string folder, string name, ListedBuild build, string tool, string account, + Action? progress, Action log, CancellationToken stop) + { + string kept = Path.Combine(folder, KeptFolder, name); + try + { + if (!Directory.Exists(kept)) return new(SteamOutcome.Failed, L.Text("{0} is no longer there.", kept)); + 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, + 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))), log, stop); + if (fetched.Outcome != SteamOutcome.Done) return fetched; + if (!Holds(kept, build)) return new(SteamOutcome.Failed, L.Text("The download ended, but the client is not whole. Run it again.")); + ForgetPrepared(kept); + // Its folder is named after the version it was: it is the build's now. + if (!string.Equals(name, build.Version, StringComparison.OrdinalIgnoreCase)) Directory.Move(kept, FreeName(folder, build.Version)); + return new(SteamOutcome.Done); + } + catch (OperationCanceledException) { return new(SteamOutcome.Stopped); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return new(SteamOutcome.Failed, e.Message); } + } + + /// + /// Brings the folder to a build from Steam. A client from Steam that is updated where it is carries + /// until it is whole. Every other case makes the build ready in , beside a client that goes on + /// working, and swaps only a whole one in: the client in use then goes to Clients\ + /// () or is deleted once the new one is in place. With a client from Steam in use, the + /// new folder starts as a copy of it, so that only what differs is downloaded. A stop or a failure leaves what was + /// fetched, and the same call goes on from it. LocalExile's setup must run afterwards: it prepares the new client. + /// + public static async Task SwitchAsync(string folder, ListedBuild build, SwitchWay way, string tool, string account, + Action? progress, Action log, CancellationToken stop) + { + var layout = Layout(folder); + if (layout == ClientLayout.Link) return new(SteamOutcome.Failed, L.Text("This folder's game client is a link to another folder. Make a copy of it first.")); + string client = Client(folder), next = Path.Combine(folder, NextFolder); + // A client half-way to another version is made whole where it is, whichever build is asked for: set aside or + // copied, it would be a client that is not whole under a whole one's name. + bool marked = Unfinished(folder) is not null; + if (marked && layout == ClientLayout.Steam && way != SwitchWay.UpdateInPlace) + return new(SteamOutcome.Failed, L.Text("The game client in use is half-way to another version. Finish that switch first.")); + // A marked client that is not from Steam cannot be finished where it is (a broken or hand-altered folder): it is + // replaced by the build, and never set aside as if it were whole. + if (marked && layout != ClientLayout.Steam) way = SwitchWay.UpdateInPlace; + 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 + { + if (layout == ClientLayout.Steam && way == SwitchWay.UpdateInPlace) + { + if (Directory.Exists(next)) ClientLocator.DeleteTree(next); + await File.WriteAllTextAsync(Path.Combine(client, Marker), build.Version + "\n" + build.ExecutableSha256, stop); + var updated = await SteamDownload.FetchAsync(tool, build, account, client, Downloading, log, stop); + if (updated.Outcome != SteamOutcome.Done) return updated; + if (!Holds(client, build)) return new(SteamOutcome.Failed, L.Text("The download ended, but the client is not whole. Run it again.")); + ForgetPrepared(client); + File.Delete(Path.Combine(client, Marker)); + return new(SteamOutcome.Done); + } + + if (layout == ClientLayout.Steam && !File.Exists(Path.Combine(next, Seeded))) + { + // A copy of the client in use, as the start: Steam then sends only what differs. + var copy = ClientCopy.Plan(client, folder, next); + ClientCopy.RequireSpace(copy); + await ClientCopy.RunAsync(copy, copied => progress?.Invoke(new("copy", copied.Total == 0 ? 0 : (double)copied.Done / copied.Total, + L.Text("{0:0.0} of {1:0.0} GB", copied.Done / 1e9, copied.Total / 1e9))), stop); + await File.WriteAllTextAsync(Path.Combine(next, Seeded), "", stop); + } + var fetched = await SteamDownload.FetchAsync(tool, build, account, next, Downloading, log, stop); + if (fetched.Outcome != SteamOutcome.Done) return fetched; + if (!Holds(next, build)) return new(SteamOutcome.Failed, L.Text("The download ended, but the client is not whole. Run it again.")); + ForgetPrepared(next); + // LocalExile's own game settings are named by the client's config.json: they go with the folder. + string settings = Path.Combine(client, "config.json"); + if (File.Exists(settings) && !File.Exists(Path.Combine(next, "config.json"))) File.Copy(settings, Path.Combine(next, "config.json")); + + string? aside = null; + if (Directory.Exists(client)) + { + aside = way == SwitchWay.KeepBoth ? FreeName(folder, ClientLocator.BuildOf(client)) : Path.Combine(folder, ClientLocator.RemovedClientFolder); + if (way != SwitchWay.KeepBoth) ClientLocator.FinishRemoval(folder); + Directory.Move(client, aside); + } + try { Directory.Move(next, client); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + if (aside is not null) Directory.Move(aside, client); + throw; + } + if (aside is not null && way != SwitchWay.KeepBoth) ClientLocator.FinishRemoval(folder); + return new(SteamOutcome.Done); + } + catch (OperationCanceledException) { return new(SteamOutcome.Stopped); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return new(SteamOutcome.Failed, e.Message); } + } +} diff --git a/src/Launcher.Core/LocalExileBuilds.cs b/src/Launcher.Core/LocalExileBuilds.cs new file mode 100644 index 0000000..48cf66a --- /dev/null +++ b/src/Launcher.Core/LocalExileBuilds.cs @@ -0,0 +1,167 @@ +using System.Diagnostics; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; + +namespace Launcher.Core; + +/// One depot of the game on Steam at one build. Steam's ids are text: a manifest id is larger than a JSON reader's +/// exact numbers. +public sealed record SteamDepot(string Depot, string Manifest); + +/// One client build a LocalExile runs, as that LocalExile says it (LocalExile.exe builds). +/// The version players know it by ("3.29.3d"). +/// Which build of that version ("release of 2026-11-10, build 328228"). +/// SHA-256 of its unpatched executable. +/// SHA-256 of Bundles2/_.index.bin in its Steam install; null when that LocalExile does +/// not accept the build's Steam files. +/// The game's app id on Steam; null when the build cannot be fetched from Steam. +/// Steam's manifest of each depot that holds this build; empty when they are not known. +public sealed record ListedBuild(string Version, string Name, string ExecutableSha256, string? SteamIndexSha256 = null, string? SteamApp = null, + IReadOnlyList? SteamManifests = null) +{ + public IReadOnlyList Depots => SteamManifests ?? []; + /// Whether Steam can deliver this build: the app and at least one depot's manifest are known. + public bool FromSteam => SteamApp is { Length: > 0 } && Depots.Count > 0; +} + +/// +/// The client builds a LocalExile folder runs, asked of that LocalExile and never kept in a list of Waypoint's own: a release +/// answers LocalExile.exe builds --json (from v0.5.0-beta), and a source copy's list is its +/// src/GameServer.Core/Protocol/ClientBuilds.cs. So a client build LocalExile comes to allow, or stops allowing, is +/// known here without a new Waypoint. A LocalExile that cannot say (an older release, an older checkout) answers null, and +/// what it needs is read as before (). +/// +public static class LocalExileBuilds +{ + /// The first release whose launcher has the builds command. An older one is never asked: it has nothing to say. + static readonly ReleaseVersion FirstWithList = new(0, 5, 0, "beta"); + + 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. + public static bool TooOld(string folder) + { + try { return LocalExileReleases.IsInstall(folder) && (LocalExileReleases.Installed(folder) is not { } version || version.CompareTo(FirstWithList) < 0); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException) { return false; } + } + + /// For tests only: what answers instead of asking a LocalExile. + public static Func?>? Override { get; set; } + + static readonly Dictionary<(string, long, DateTime), IReadOnlyList?> Asked = []; + /// When a launcher last failed to answer (it did not start, ran out of time, or ended with an error). + static readonly Dictionary<(string, long, DateTime), long> Failed = []; + /// How long a launcher that failed to answer is left alone before it may be asked again, in milliseconds. + const long AskAgainAfter = 30_000; + + /// The builds this folder's LocalExile runs; null when it cannot say. An answer is remembered until the file + /// that gave it changes (an update, a pull). A launcher that failed to answer (it did not start, ran out of time, ended + /// with an error) is not asked again by itself, because that can take ten seconds and many callers are on the UI + /// thread; asks it once more, at most every half minute, for a caller that is in the + /// background and whose user is looking at the list. + public static IReadOnlyList? Of(string folder, bool again = false) + { + if (Override is { } told) return told(folder); + try + { + bool release = LocalExileReleases.IsInstall(folder); + if (release && (LocalExileReleases.Installed(folder) is not { } version || version.CompareTo(FirstWithList) < 0)) return null; + var file = new FileInfo(Path.Combine(folder, release ? LocalExileReleases.Launcher : SourceList)); + if (!file.Exists) return null; + var key = (file.FullName, file.Length, file.LastWriteTimeUtc); + lock (Asked) + { + if (Asked.TryGetValue(key, out var known)) return known; + if (Failed.TryGetValue(key, out long at) && (!again || Environment.TickCount64 - at < AskAgainAfter)) return null; + } + var builds = release ? Ask(folder, file.FullName) : ParseSource(File.ReadAllText(file.FullName)); + lock (Asked) + { + if (builds is null) Failed[key] = Environment.TickCount64; + else Asked[key] = builds.Count == 0 ? null : builds; + } + return builds is { Count: > 0 } ? builds : null; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or System.ComponentModel.Win32Exception or InvalidOperationException) { return null; } + } + + /// LocalExile.exe builds --json: it reads nothing but its own list, changes nothing and starts nothing. + static IReadOnlyList? Ask(string folder, string launcher) + { + var start = new ProcessStartInfo(launcher) + { + WorkingDirectory = folder, UseShellExecute = false, CreateNoWindow = true, + RedirectStandardOutput = true, RedirectStandardError = true, StandardOutputEncoding = Encoding.UTF8, + }; + start.ArgumentList.Add("builds"); + start.ArgumentList.Add("--json"); + using var process = Process.Start(start); + if (process is null) return null; + var output = process.StandardOutput.ReadToEndAsync(); + _ = process.StandardError.ReadToEndAsync(); + if (!process.WaitForExit(10_000)) + { + try { process.Kill(entireProcessTree: true); } + // A child that cannot be ended makes Kill throw an AggregateException: still a launcher that did not answer. + catch (Exception e) when (e is InvalidOperationException or System.ComponentModel.Win32Exception or AggregateException) { } + return null; + } + return process.ExitCode == 0 ? Parse(output.Result.Split('\n')) : null; + } + + /// The build events among a launcher's lines (the server's Agents/docs/dev/releases.md); anything else, + /// and a line that is no event, is passed over. + public static IReadOnlyList Parse(IEnumerable lines) + { + var builds = new List(); + foreach (string line in lines) + { + if (line.TrimStart() is not ['{', ..]) continue; + try + { + using var document = JsonDocument.Parse(line); + var item = document.RootElement; + if (Text(item, "event") != "build" || Text(item, "version") is not { Length: > 0 } version + || Text(item, "executableSha256") is not { } hash || !Regex.IsMatch(hash, @"\A[0-9a-fA-F]{64}\z")) continue; + var depots = new List(); + if (item.TryGetProperty("steamManifests", out var manifests) && manifests.ValueKind == JsonValueKind.Array) + foreach (var manifest in manifests.EnumerateArray()) + if (Text(manifest, "depot") is { Length: > 0 } depot && Text(manifest, "manifest") is { Length: > 0 } id && Digits(depot) && Digits(id)) + depots.Add(new(depot, id)); + string? app = Text(item, "steamApp"); + builds.Add(new(version, Text(item, "name") ?? "", hash.ToLowerInvariant(), Text(item, "steamIndexSha256")?.ToLowerInvariant(), + app is not null && Digits(app) ? app : null, depots)); + } + catch (JsonException) { } + } + return builds; + } + + static string? Text(JsonElement item, string name) => + item.ValueKind == JsonValueKind.Object && item.TryGetProperty(name, out var value) && value.ValueKind == JsonValueKind.String ? value.GetString() : null; + + static bool Digits(string text) => text.Length is > 0 and <= 20 && text.All(char.IsAsciiDigit); + + /// A source copy's list, read from its ClientBuilds.cs: the rows of Allowed, each a version, a name + /// and the executable's hash, with its Steam index and manifests when it has them. + public static IReadOnlyList ParseSource(string source) + { + string? app = Regex.Match(source, @"\bSteamApp\s*=\s*(\d{1,10})\s*;") is { Success: true } steam ? steam.Groups[1].Value : null; + var rows = Regex.Matches(source, @"new\(\s*""(?[^""\r\n]+)""\s*,\s*""(?[^""\r\n]*)""\s*,\s*""(?[0-9a-fA-F]{64})"""); + var builds = new List(); + for (int i = 0; i < rows.Count; i++) + { + int from = rows[i].Index + rows[i].Length, to = i + 1 < rows.Count ? rows[i + 1].Index : source.Length; + string rest = source[from..to]; + string? index = Regex.Match(rest, @"SteamIndexSha256\s*:\s*""([0-9a-fA-F]{64})""") is { Success: true } found ? found.Groups[1].Value.ToLowerInvariant() : null; + var depots = Regex.Match(rest, @"SteamManifests\s*:\s*\[(?[^\]]*)\]") is { Success: true } list + ? Regex.Matches(list.Groups["list"].Value, @"new\(\s*(\d{1,10})\s*,\s*(\d{1,20})\s*\)").Select(m => new SteamDepot(m.Groups[1].Value, m.Groups[2].Value)).ToList() + : []; + builds.Add(new(rows[i].Groups["version"].Value, rows[i].Groups["name"].Value, rows[i].Groups["hash"].Value.ToLowerInvariant(), index, + depots.Count > 0 ? app : null, depots)); + } + return builds; + } +} diff --git a/src/Launcher.Core/OwnClient.cs b/src/Launcher.Core/OwnClient.cs new file mode 100644 index 0000000..87a67f6 --- /dev/null +++ b/src/Launcher.Core/OwnClient.cs @@ -0,0 +1,269 @@ +namespace Launcher.Core; + +/// +/// A LocalExile whose Client is a link to the user's own Path of Exile folder (LocalExile's --client-mode link, +/// which is for developers and which neither LocalExile nor Waypoint offers to anyone else) runs from that folder: +/// LocalExile writes Game.exe, Game.patched.exe and the login list there, and a game update in it can break the install. +/// LocalExile says so at every start, and Waypoint says the same on the Play page (). Nothing is +/// refused, and nothing is done unasked: what Waypoint adds is the way out LocalExile's warning names, a copy of its own, +/// made on the user's word and without a moment in which the release has no client: +/// +/// the copy is made beside the link (), which keeps working meanwhile; +/// only a copy that is whole, and still matches the folder it came from, takes the link's place; +/// the folder the link led to is only ever read, and removing the link removes nothing in it; +/// a stop or a failure leaves the release as it was, and the next try goes on from what was copied. +/// +/// A link to another LocalExile'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. +/// +public static class OwnClient +{ + /// Beside Client while the copy is made. + public const string NewFolder = ".waypoint-new-client"; + /// The link, set aside on Windows while the copy takes its place, so that it can be put back as it was. + public const string OldLink = ".waypoint-old-link"; + /// Written into once the copy is whole: from then on only goes forward. + public const string Complete = ".waypoint-complete"; + + /// The folder the link leads to: only read. + /// Free bytes on the release's drive; null when it cannot be told. + public sealed record Plan(string Folder, string Source, ClientCopyPlan Copy, long? Free) + { + public bool HasSpace => Free is not { } free || free >= Copy.Remaining + ClientCopy.Margin; + /// What an earlier try already copied. + public long Copied => Copy.Total - Copy.Remaining; + } + + public enum Outcome + { + /// Nothing to do, or the user did not want the copy: nothing was changed. + None, + /// The release has its own client now. + Moved, + /// The copy failed; the release is as it was. + Failed, + /// The user stopped the copy; the release is as it was. + Stopped, + } + + public sealed record Result(Outcome Outcome, Plan? Plan = null, string? Reason = null); + + /// The copy this folder needs; null when its client is a folder of its own, a link to another LocalExile's client, + /// or a link that leads to no client Waypoint can copy (the setup guide's to replace). + public static Plan? Check(string folder) + { + try + { + string client = Path.Combine(folder, "Client"); + if (!ClientSettings.IsLink(client)) return null; + string source = Path.TrimEndingDirectorySeparator(Path.GetFullPath(ClientLocator.RealPath(client))); + if (ClientLocator.Classify(source) is not (ClientKind.Ready or ClientKind.Standalone) || InLocalExile(source)) return null; + // A release set up inside the game's own folder would be copied into itself. + if (Path.GetFullPath(folder).StartsWith(source + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)) return null; + var copy = ClientCopy.Plan(source, folder, Path.Combine(folder, NewFolder), keepPatched: true); + return new(Path.TrimEndingDirectorySeparator(Path.GetFullPath(folder)), source, copy, ClientCopy.FreeSpace(copy.Target)); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException or System.Security.SecurityException) { return null; } + } + + /// The Client folder of a LocalExile checkout or release: shared with it, and that folder's to look after. + /// The same test as LocalExile's own warning (ClientInstall.LinkedInstall): the folder above it holds a + /// GameServer.slnx or a release.json. + public static bool InLocalExile(string source) => + Path.GetDirectoryName(source) is { Length: > 0 } parent && (File.Exists(Path.Combine(parent, "GameServer.slnx")) || File.Exists(Path.Combine(parent, "release.json"))); + + /// The standing line on a release's Play page while its client is such a link: LocalExile's own warning, in + /// its words. + public static string Notice(Plan plan) => Notice(plan.Source); + + /// The same warning for any game folder outside LocalExile that a client is a link to, whether or not Waypoint + /// can make the copy (). + public static string Notice(string source) => + L.Text("Client is a link to {0}, not a copy. LocalExile changes files in that folder, and a Path of Exile update there can break this LocalExile. A separate copy is safe from both.", source); + + /// The game folder outside LocalExile that the folder's Client is a link to, standalone or from Steam; + /// null for a client of its own and for a link to another LocalExile's client. LocalExile warns about every such + /// link, so the Play page does too, also where has no copy to offer. + public static string? LinkedOutside(string folder) + { + try + { + string client = Path.Combine(folder, "Client"); + if (!ClientSettings.IsLink(client)) return null; + string source = Path.TrimEndingDirectorySeparator(Path.GetFullPath(ClientLocator.RealPath(client))); + return InLocalExile(source) || ClientVersions.FilesOf(source) == ClientLayout.None ? null : source; + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or ArgumentException or System.Security.SecurityException) { return null; } + } + + public static string Title => L.Text("Make a copy of the game for LocalExile?"); + + /// The question, kept short, and the two folders set apart so that a long path does not push the words away. + public static (string Message, string Details) Text(Plan plan) + { + string message = plan.HasSpace + ? L.Text("Waypoint copies the game into this LocalExile folder and then removes the link. The link works until the copy is whole, and your saves, accounts and login keys are kept.") + + (plan.Copied >= 100_000_000 ? " " + L.Text("The copy goes on from the {0:0.#} GB made earlier.", plan.Copied / 1e9) : "") + : L.Text("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" + + L.Text("The copy ({0:0.#} GB):", plan.Copy.Total / 1e9) + "\n " + Path.Combine(plan.Folder, "Client"); + return (message, details); + } + + /// The question: Copy now (true) or Cancel; Open folder shows the user's folder and asks again; a box closed + /// without an answer is a Cancel. Without the room for the copy there is nothing to agree to, only to know. + /// shows a question (title, message, details, buttons) and answers the button chosen. + public static bool Ask(Plan plan, Func show, Action open) + { + var (message, details) = Text(plan); + // The last button is the one Enter and Esc press: Cancel, or OK where there is nothing to agree to. + string[] buttons = plan.HasSpace ? [L.Text("Copy now"), L.Text("Open folder"), L.Text("Cancel")] : [L.Text("Open folder"), L.Text("OK")]; + int look = plan.HasSpace ? 1 : 0; + while (true) + { + int chosen = show(Title, message, details, buttons); + if (chosen != look) return plan.HasSpace && chosen == 0; + open(plan.Source); + } + } + + /// What LocalExile added to the user's folder while it ran from it, and their normal game does not need: for the + /// user to delete, never Waypoint. config.json only when it is the one that names LocalExile's own settings. + public static string[] Leftovers(string source) + { + var names = new List(); + foreach (string name in new[] { "Game.exe", "Game.patched.exe" }) + if (File.Exists(Path.Combine(source, name))) names.Add(name); + if (File.Exists(Path.Combine(source, "config.json")) && ClientSettings.Read(source, linked: false).Kind == ClientSettingsKind.Separate) names.Add("config.json"); + return [.. names]; + } + + public static string DoneTitle => L.Text("LocalExile has its own copy of the game"); + + public static string DoneText(Plan plan) + { + string text = L.Text("LocalExile now runs from {0}, and no longer uses {1}.", Path.Combine(plan.Folder, "Client"), plan.Source); + var left = Leftovers(plan.Source); + return left.Length == 0 ? text + : text + "\n\n" + L.Text("LocalExile left these files in your Path of Exile folder. Your normal game does not need them, and you can delete them: {0}", string.Join(", ", left)); + } + + public static string FailedTitle => L.Text("The copy did not finish"); + + public static string FailedText(Plan plan, string reason) => + reason + "\n\n" + L.Text("Nothing was changed: LocalExile still runs from {0}. The next try goes on from where the copy stopped.", plan.Source); + + /// The copy, on the user's word (, true to go on): first what an earlier move left + /// (), 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) + { + var plan = await Task.Run(() => + { + try + { + Finish(folder); + Discard(folder); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + return Check(folder); + }); + if (plan is null || !ask(plan)) return new(Outcome.None, plan); + Exception? failure = null; + bool stopped = false; + bool ran = await exclusive(async () => + { + try { await Task.Run(() => MoveAsync(folder, progress, stop), CancellationToken.None); } + catch (OperationCanceledException) { stopped = true; } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { failure = e; } + }); + if (stopped) return new(Outcome.Stopped, plan); + if (!ran) return new(Outcome.Failed, plan, L.Text("Something else is using LocalExile. Try again when it is done.")); + return failure is null ? new(Outcome.Moved, plan) : new(Outcome.Failed, plan, failure.Message); + } + + /// Copies the client the folder's link leads to into , checks the copy against that folder as + /// it is now, and only then lets it take the link's place. Throws with the release as it was. + public static async Task MoveAsync(string folder, Action? progress, CancellationToken stop) + { + var plan = Check(folder) ?? throw new IOException(L.Text("This folder's game client is no longer a link, so there is nothing to copy.")); + // What an earlier try copied counts only while it is still what the folder holds: the official launcher may have + // updated the game in between. + bool stale = false; + foreach (var file in plan.Copy.Files) + if (File.Exists(file.Target) && !Same(file)) + { + File.Delete(file.Target); + stale = true; + } + if (stale) plan = Check(folder) ?? throw new IOException(L.Text("This folder's game client is no longer a link, so there is nothing to copy.")); + await ClientCopy.RunAsync(plan.Copy, progress, stop); + stop.ThrowIfCancellationRequested(); + var now = ClientCopy.Plan(plan.Source, folder, plan.Copy.Target, keepPatched: true); + if (now.Files.Length != plan.Copy.Files.Length || now.Files.Any(f => !Same(f)) + || ClientLocator.BuildOf(plan.Copy.Target) != ClientLocator.BuildOf(plan.Source)) + throw new IOException(L.Text("The game folder changed while it was copied, so the copy was not used.")); + File.WriteAllText(Path.Combine(plan.Copy.Target, Complete), ""); + if (!Finish(folder)) throw new IOException(L.Text("The copy is ready, but it could not take the link's place.")); + } + + /// A copy begun for a link that is gone since (the client was replaced another way) is of no use: Waypoint's own + /// folder, removed. Never while Client is a link, or the copy is whole. + public static void Discard(string folder) + { + string client = Path.Combine(folder, "Client"), copy = Path.Combine(folder, NewFolder); + if (!Directory.Exists(copy) || ClientSettings.IsLink(copy) || File.Exists(Path.Combine(copy, Complete))) return; + if (ClientSettings.IsLink(client) || ClientSettings.IsLink(Path.Combine(folder, OldLink))) return; + Directory.Delete(copy, recursive: true); + } + + /// A copied file is the source's while it has its length and time (the copy keeps the time; some drives round it). + static bool Same(ClientCopyFile file) + { + FileInfo source = new(file.Source), target = new(file.Target); + return source.Exists && target.Exists && source.Length == target.Length + && Math.Abs((source.LastWriteTimeUtc - target.LastWriteTimeUtc).TotalSeconds) <= 2; + } + + /// Lets a whole copy () take the link's place, also after a move that was cut short there; + /// true when the folder's client is the copy now. A link set aside without a whole copy goes back. Nothing is done to a + /// Client that is a folder of its own, and a copy that cannot be renamed leaves the link where it was. + public static bool Finish(string folder) + { + string client = Path.Combine(folder, "Client"), copy = Path.Combine(folder, NewFolder), aside = Path.Combine(folder, OldLink); + bool present = Directory.Exists(client) || ClientSettings.IsLink(client); + if (!File.Exists(Path.Combine(copy, Complete))) + { + if (!present && ClientSettings.IsLink(aside)) Directory.Move(aside, client); + return false; + } + string? target = null; + if (present) + { + if (!ClientSettings.IsLink(client)) return false; + target = new DirectoryInfo(client).LinkTarget; + if (OperatingSystem.IsWindows()) + { + // Renamed, not removed: a junction cannot be made again without a tool, and a rename can be undone. + if (ClientSettings.IsLink(aside)) Directory.Delete(aside); + Directory.Move(client, aside); + } + else File.Delete(client); // a Unix link is a file + } + try { Directory.Move(copy, client); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + if (present) + { + if (OperatingSystem.IsWindows()) Directory.Move(aside, client); + else if (target is not null) Directory.CreateSymbolicLink(client, target); + } + throw; + } + File.Delete(Path.Combine(client, Complete)); + if (ClientSettings.IsLink(aside)) Directory.Delete(aside); + return true; + } +} diff --git a/src/Launcher.Core/Resources/Strings.resx b/src/Launcher.Core/Resources/Strings.resx index 94a61c5..53d1a15 100644 --- a/src/Launcher.Core/Resources/Strings.resx +++ b/src/Launcher.Core/Resources/Strings.resx @@ -213,6 +213,9 @@ Found and using: + + Game client versions + a build from source @@ -237,6 +240,9 @@ Your characters can't come yet + + {0:0.#} GB is free on this drive. + Without {0}, this league runs without the rules or content it is named for. Its characters stay as they are, and you can turn it back on. @@ -255,6 +261,9 @@ {0} has no settings object + + Part {0} of {1}: {2:0.0}% · {3} + Compile failed @@ -264,6 +273,9 @@ Show for new characters + + Finish the switch + pid {0} @@ -333,6 +345,9 @@ Filter the commands by name or description + + Steam version + Save and check @@ -348,6 +363,9 @@ Frida could not be installed. Check your connection and try again. + + Copying the client in use as a start: {0} + A new version of Waypoint is ready @@ -378,6 +396,9 @@ Layers + + The copy ({0:0.#} GB): + Python {0} is installed in {1} but not on PATH. Waypoint uses it anyway, for itself and the scripts it runs. @@ -600,6 +621,9 @@ Package status + + LocalExile has its own copy of the game + Voyage @@ -699,6 +723,9 @@ none + + Waypoint does not download the game here. You need your own standalone copy of a Path of Exile version that LocalExile runs. + Client is a link to {0}, and other copies of LocalExile may share that folder, so Waypoint will not change it. Prepare it there, or run the setup guide to put a client here. @@ -738,6 +765,9 @@ Door to the Aspirants' Plaza + + The client in use is half-way to {0} and cannot be kept. It is updated in place. + Tools LocalExile needs @@ -804,6 +834,9 @@ Level + + {0:0.0} of {1:0.0} GB + Network @@ -837,6 +870,9 @@ Frida installed (optional game tools) + + A way the drive has no room for is asked about instead. + Selected log output @@ -912,15 +948,15 @@ The folder wasn't made + + Replace: the client in use is deleted permanently. A standalone client cannot be downloaded again. + Restore saves… Create account… - - Waypoint does not download the game. You need your own standalone copy of Path of Exile 3.29.3c. - Item tags @@ -973,6 +1009,9 @@ Close the game and anything else using that folder, then try again. Checkbox marks + + LocalExile now runs from {0}, and no longer uses {1}. + Hidden from new characters @@ -1135,6 +1174,9 @@ Close the game and anything else using that folder, then try again. ManageAccount completed. + + This folder's client was being changed to Path of Exile {0} and that did not finish, so it cannot start. Open Game client and finish the switch. + Cannot continue: {0} @@ -1201,6 +1243,9 @@ Close the game and anything else using that folder, then try again. Updates + + When a LocalExile folder that has a game client gets another version from Steam: + Could not open download page: @@ -1216,6 +1261,9 @@ Close the game and anything else using that folder, then try again. Could not verify services before exiting. + + {0}, {1:0.#} GB, is deleted for good. The version in use is not touched. + Invalid or duplicate league. @@ -1231,6 +1279,9 @@ Close the game and anything else using that folder, then try again. The password can only use English letters, digits and common symbols. + + Get the game client + League card preview @@ -1315,6 +1366,9 @@ Close the game and anything else using that folder, then try again. live.ps1 -NoClient: rebuilds and restarts Patch, Auth and Gateway (after a pull, or edits outside the Gateway); the Gateway's own code edits apply by themselves with hot reload. A running client stays. + + This LocalExile lists no versions to download. LocalExile v0.5.0-beta and later do. + Creating a consistent SQLite snapshot and checking its integrity. @@ -1478,6 +1532,9 @@ Change location above to choose somewhere else. Installing: {0:0} of {1:0} MB + + Deleted. + Reduce motion @@ -1583,6 +1640,9 @@ Change location above to choose somewhere else. the dev host did not start (logs\launcher-host.err): {0} + + Keep both: it needs {0:0.#} GB more, and you can switch back at any time. + Update to {0}? @@ -1595,6 +1655,9 @@ Change location above to choose somewhere else. Waypoint works with the defaults until then. Change or clear them in Settings → Folders and tools. + + Delete this copy of the game? + Enter a positive LocalExile PR number, including closed PRs @@ -1808,6 +1871,9 @@ Change location above to choose somewhere else. Switch and build + + That does not look like a Steam account name. It is the name you sign in with, not your profile's display name. + Shared settings @@ -1872,6 +1938,9 @@ This checkout has modified tracked files. {0:0.0} of {1:0.0} GB · {2:0} MB/s · {3} + + Forgotten. The download tool keeps its own sign-in on this PC until Steam ends it. + Waypoint (built from source) @@ -1932,6 +2001,9 @@ This checkout has modified tracked files. This checkout does not expose supported league creation. Existing leagues remain available for inspection. + + Waypoint forgets which Steam account to use. The next download asks to sign in again. + Calls per second over the window @@ -1950,6 +2022,9 @@ This checkout has modified tracked files. Fonts + + Download a game version + Find a module @@ -2037,6 +2112,9 @@ This checkout has modified tracked files. 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. + Use it as it is @@ -2130,6 +2208,9 @@ This checkout has modified tracked files. Live process measurements + + Ask each time + {0} mods · {1} {2} @@ -2218,6 +2299,9 @@ This checkout has modified tracked files. the mod is larger than {0} files or 64 MB; nothing was installed + + The game folder changed while it was copied, so the copy was not used. + Nothing was changed. Press Play to try again. @@ -2227,6 +2311,9 @@ This checkout has modified tracked files. Primary button text + + New code + Stop and switch @@ -2269,6 +2356,9 @@ This checkout has modified tracked files. Move down + + Path of Exile {0} + Prepare this checkout @@ -2371,6 +2461,9 @@ This checkout has modified tracked files. Performance + + Always keep both versions + No game client yet: the setup guide adds one. @@ -2386,6 +2479,12 @@ This checkout has modified tracked files. Healing + + not a version LocalExile runs + + + Close the game and stop the servers to change the game client. + The download failed (git exit {0}). Check your connection and try again. @@ -2431,6 +2530,9 @@ This checkout has modified tracked files. Port {0} is occupied by another process (PID {1}); {2} is not owned by this checkout. + + LocalExile names no Steam download for this version. + Go back to the version you had @@ -2455,6 +2557,9 @@ This checkout has modified tracked files. The crafter makes no enchantments + + linked to a game folder + Availability changes apply at the next server start. @@ -2527,6 +2632,9 @@ This checkout has modified tracked files. Shows this copy in Advanced mode: every section, with branches and pull requests under Versions. A release keeps the mode you chose there. + + Stop the copy + League created. It becomes available after the next server start. @@ -2626,6 +2734,9 @@ This checkout has modified tracked files. Client instructions + + Getting the download tool ready … + Hide… @@ -2704,6 +2815,9 @@ This checkout has modified tracked files. Game mode and visibility + + This folder already has every version Steam has for this LocalExile. + Every map entry needs a unique, non-empty key. @@ -2755,6 +2869,9 @@ This checkout has modified tracked files. This guide gets LocalExile ready to play. It looks for what you already have, and asks before it downloads or copies anything. + + The game client is half-way to another version + Saved {0} @@ -2791,6 +2908,9 @@ This checkout has modified tracked files. Fetching pull request + + Download a version… + Implicit @@ -2803,6 +2923,9 @@ This checkout has modified tracked files. No verified process for this checkout + + 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. + {0} · Checked {1} @@ -2812,6 +2935,9 @@ This checkout has modified tracked files. {0:0} MB + + The code was not approved in time, so Steam let it go. Ask for a new one when you have the Steam app ready. + Move to Path of Exile {0}? @@ -2974,9 +3100,15 @@ This checkout has modified tracked files. Waypoint Tools did not answer. Is the game running, with a character in an area? + + Game client… + Give LocalExile its own game settings, so your normal game keeps its own. + + Your Steam account name (what you sign in to Steam with): + Automatic backups run before branch/PR activation, builds, Gateway startup/restart, game-data reload, mod changes and save restore. A failed backup blocks the change. Mod history records choices, manifest versions, DLL fingerprints and the last confirmed runtime report. Restoring saves does not switch source, client files, login keys or game-data overrides. Restoring mod choices never installs DLLs or replaces saves. Last launched Gateway is recorded by Waypoint; outside launches and every hot edit are not tracked. @@ -2989,6 +3121,9 @@ This checkout has modified tracked files. OK + + Make a copy… + DisableMod completed. @@ -3138,6 +3273,9 @@ Current saves are unchanged. This backup will no longer be available to restore. {0} has {1} commit(s) of its own that the pull request has not; push or move them first + + Download from Steam + Everything is in place. Press Play in Waypoint to start the servers and the game. LocalExile has its own game settings, so your normal Path of Exile keeps its own. @@ -3183,6 +3321,9 @@ Current saves are unchanged. This backup will no longer be available to restore. live.ps1 output + + Not signed in to Steam. + Mod choices apply across all leagues. Saved choices do not confirm live load status. @@ -3247,6 +3388,9 @@ Search limits reached; other checkouts may exist. Browse to any location. Branches ({0}) + + If you have no such folder, tick the box below. Finish setup on the Play page can then download the game from Steam. + Only modes defined for this league are offered. @@ -3256,6 +3400,9 @@ Search limits reached; other checkouts may exist. Browse to any location. LocalExile.exe: starts the servers, then the game + + This DepotDownloader is not the release Waypoint expects, so it was not used. + The profile wasn't made @@ -3289,6 +3436,9 @@ Search limits reached; other checkouts may exist. Browse to any location. Search accounts or characters + + The drive is too full: {0} needs {1:0.#} GB. + Stash and switch @@ -3298,6 +3448,9 @@ Search limits reached; other checkouts may exist. Browse to any location. No update + + Copy now + Waiting… @@ -3349,6 +3502,9 @@ Search limits reached; other checkouts may exist. Browse to any location. Object + + {0} is downloaded. + Setup checks · {0} need attention @@ -3397,6 +3553,9 @@ Search limits reached; other checkouts may exist. Browse to any location. · not made here + + It also deletes the {0:0.#} GB already downloaded. + Your LocalExile folder @@ -3421,6 +3580,9 @@ Setup can identify PathOfExile.exe while extraction reads Game.exe in this Local {2} + + in use + Action @@ -3444,6 +3606,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Walk maps · Frida. Saves area layout data as the game loads new areas. Optional; attaches only to this checkout's patched client. Existing captures are kept. + + Standalone version + Branches and pull requests @@ -3510,6 +3675,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Start with a new database + + Sign in with a password + Always ask when I close the window @@ -3654,6 +3822,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Supplies + + Deleting … + Save database @@ -3870,6 +4041,9 @@ Switching to it builds and runs that code on this computer with your rights, liv This changes Waypoint's interface. Repository names, paths, commit hashes, in-game commands and raw logs keep their original text. + + {0} is no longer there. + Copy ID @@ -3996,6 +4170,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Path of Exile {0} was found on this PC. Waypoint updates LocalExile, then copies it over your current client. + + 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. + Commands go through the game client (scripts/dev/client_control.py): start the game and enter an area first. @@ -4137,6 +4314,9 @@ Switching to it builds and runs that code on this computer with your rights, liv live.ps1 selects the local gateway itself; step 6 keeps a backup + + The copy is ready, but it could not take the link's place. + extract-data.ps1 -List: which extracted files are missing or stale @@ -4161,6 +4341,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Base + + Waiting for the Steam sign-in … + Only a {0} client was found, so this copy moves to the last LocalExile made for it. @@ -4173,6 +4356,9 @@ 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} @@ -4230,9 +4416,15 @@ Switching to it builds and runs that code on this computer with your rights, liv just now + + Scan this code with the Steam mobile app (Steam Guard, then the scan button) and approve the sign-in. The game comes from your own Steam account, which needs Path of Exile in its library. + Play gets the newest LocalExile at most once a day, after backing up your saves. A copy with your own changes is left alone. + + The drive has room for only one way. + The requested checkout path is empty or too long. @@ -4263,6 +4455,9 @@ Switching to it builds and runs that code on this computer with your rights, liv EnableMod completed. + + Get {0}? + Play, logs and settings. @@ -4341,6 +4536,12 @@ Switching to it builds and runs that code on this computer with your rights, liv ! no {0} suggestions: {1} + + Stopped. What was downloaded is kept, and the next try goes on from it. + + + Update in place: it needs no extra space, but {0} is removed from this PC. + This league has a missing or cyclic parent chain. Restore its definition before editing. @@ -4392,6 +4593,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Waypoint blue + + Path of Exile, version not known + this commit @@ -4518,6 +4722,9 @@ Switching to it builds and runs that code on this computer with your rights, liv live.ps1 is already running. + + Steam asks for the sign-in again. + Register an account @@ -4563,6 +4770,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Running {0} … + + Steam: signed in as {0} + Install a mod folder from your disk: a project is built, a built mod or scripts are copied. @@ -4578,6 +4788,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Saves the reviewed report as one text file and shows it, ready to attach or drag into a chat + + Waypoint copies the game into this LocalExile folder and then removes the link. The link works until the copy is whole, and your saves, accounts and login keys are kept. + ReloadMod completed. @@ -4593,6 +4806,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Double-click a command to put it in the line. + + That copy is not a client from Steam, so Steam cannot finish it. + Another game client is running. Close it before launching or restarting services. @@ -4692,12 +4908,18 @@ Switching to it builds and runs that code on this computer with your rights, liv Remove {0} from Browse? Mods installed from it stay installed. + + Preparing {0} for LocalExile … + Copied 15 min + + Downloading from Steam. {0} + Changes require the game and all LocalExile services to stay stopped until the operation finishes. @@ -4719,6 +4941,9 @@ 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 @@ -4764,6 +4989,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Pet + + {0:0.#} GB of an unfinished download is kept in this folder. + Set up area capture @@ -4800,6 +5028,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Game client + + LocalExile left these files in your Path of Exile folder. Your normal game does not need them, and you can delete them: {0} + Mods are add-ons installed for this checkout. Enable, update and configure them in Mods. @@ -4824,6 +5055,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Latest has LocalExile's newest changes. Every change is reviewed, but Latest may be less stable than the release. + + Without the Steam mobile app: the download tool asks for the password and the Steam Guard code in a window of its own. Waypoint sees neither. + Delete the selected items (Delete key); Ctrl or Shift selects several @@ -4833,6 +5067,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Downloading {0} … {1:N0} KB + + Client is a link to {0}, not a copy. + Starts with Play or Start servers while Walk maps is on @@ -4882,6 +5119,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Grayscale + + Keep both + New league name @@ -4969,6 +5209,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Save game configuration + + Replace + Update all @@ -5253,6 +5496,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Patch server: the client's update check stays local + + Sign in to Steam + The folder was not changed @@ -5277,6 +5523,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Multiple-instance test mode + + half-way to {0} + Open logs folder @@ -5304,9 +5553,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Port held by another - - Use this folder itself instead of a copy. It saves the space, but LocalExile then changes that client. - No modifier is worded like this @@ -5343,6 +5589,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Milestone + + Always update the one client in place + No module dependencies declared. @@ -5385,6 +5634,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Base pack size: {0}–{1} + + Waiting for you to scan and approve … + Copy a command, then paste it into the game's chat with Ctrl+V. @@ -5439,6 +5691,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys LocalExile {0} needs the Path of Exile {1} client, and this PC has only {2}. After this update you could not play until you have a {1} client. + + Delete this copy… + Stop services before exiting @@ -5448,15 +5703,24 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Reload this enabled mod and its dependents. + + a link to another folder + Delete account + + Client is a link to {0}, not a copy. LocalExile changes files in that folder, and a Path of Exile update there can break this LocalExile. A separate copy is safe from both. + Checking your account Build or install this mod first; its binary manifest is missing. + + That Steam account has no Path of Exile. Add the game to its library in Steam (it is free), then try again. + Start anyway @@ -5472,6 +5736,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Uncommitted changes + + {0} is whole now, and kept in this folder. + PowerShell 7 runs LocalExile's build and setup scripts @@ -5523,6 +5790,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys the downloaded {0} does not match its SHA-256; nothing was changed + + The Steam download works on 64-bit Windows only for now. + Another server or watcher is running (PID {0}). Stop it from its own installation before launching here. @@ -5685,6 +5955,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Needs Gateway running, an enabled built mod, and a client in a playable area (Python + Frida). + + This folder shares the game client of another LocalExile folder: what changes there changes here. + Item level {0} @@ -5745,6 +6018,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys The servers are not running + + The copy goes on from the {0:0.#} GB made earlier. + Snake @@ -5778,6 +6054,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Waypoint couldn't delete your old LocalExile: {0} + + Enter your password and Steam Guard code in the window that opened. Waypoint does not see them. + Minimize to tray @@ -5946,6 +6225,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Nothing else to install. Waypoint tells you when a newer release is out and installs it for you. + + Forget the sign-in + Keyboard: Ctrl+1–9 chooses a page · Ctrl+Tab / Ctrl+Shift+Tab moves between pages · Ctrl+F searches the current page · F5 refreshes local status. Change appearance and accessibility preferences in Settings. @@ -5970,6 +6252,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Search mods + + {0} is in use now. The version it replaced is kept. + Original module icons @@ -6177,6 +6462,12 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Nothing was switched. + + The game client in use is half-way to another version. Finish that switch first. + + + This folder's game client is no longer a link, so there is nothing to copy. + the release holds an unsafe path, {0}; nothing was changed @@ -6207,6 +6498,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys on + + Make a copy of the game for LocalExile? + Give item needs Frida, a tool that talks to the running game. Waypoint can install it into this LocalExile folder. It takes about 180 MB, and some antivirus programs flag it. @@ -6303,6 +6597,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Settings could not be loaded + + The Steam download did not finish: {0} + Starting the game @@ -6333,6 +6630,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys This feature needs Frida. Frida is optional for normal play. + + The copy did not finish + Window behavior saved. @@ -6378,6 +6678,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys % of the machine + + Open Game client + Gateway is running without a watcher. Stop servers to change launch mode. @@ -6462,6 +6765,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys LocalExile has no release to download yet. + + This client is incomplete and cannot be used. + Back to My Mods @@ -6537,6 +6843,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Cosmetics + + from Steam + Mod information unavailable @@ -6588,6 +6897,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Best tier only + + The client in use is set aside and the other version is made beside it. It needs the room of both, and going back is instant. + Maximize Waypoint @@ -6616,6 +6928,9 @@ Last reported Gateway event. Open Gateway output for details. Crafted (bench) + + Update in place + Spear @@ -6836,6 +7151,9 @@ Client: {2} Only {0} is defined for this league. Other modes cannot be selected. + + Waypoint cannot download the game for this LocalExile. + Shared by every league where this mod runs. @@ -6905,6 +7223,9 @@ Client: {2} {0} lines + + The copy was stopped, and nothing was changed. It goes on from there next time. + game data not extracted yet (step 7) @@ -6926,6 +7247,9 @@ Client: {2} Enable mod + + kept, {0:0.#} GB + LocalExile folder: {0}, {1} @@ -6956,9 +7280,6 @@ Client: {2} SELECTED SOURCE - - Browse to a folder with PathOfExile.exe and Content.ggpk. It must be a standalone 3.29.3c install: Steam and Epic installs do not work, and Waypoint cannot download the game. - Failed: {0} exited with {1}; see the output and the Logs section. @@ -6995,6 +7316,9 @@ Client: {2} Python {0} is on PATH; 3.9 or newer is needed. Install it from python.org and tick 'Add python.exe to PATH'. + + Nothing was changed: LocalExile still runs from {0}. The next try goes on from where the copy stopped. + Not built @@ -7133,6 +7457,9 @@ Client: {2} {0} is up to date. Restart servers (or Play) builds it. + + Download + This LocalExile folder's game client is {0}, and its LocalExile needs {1}. Play offers what to do about it. @@ -7208,6 +7535,9 @@ Client: {2} Try again + + Steam does not have that version for this LocalExile. This copy can only be deleted. + {0} comes from {1}, not from the official mods. A mod runs with the Gateway's rights on your PC: install it only from a repository you trust. @@ -7241,6 +7571,9 @@ Client: {2} Filtering + + The download ended, but the client is not whole. Run it again. + {0} · {1} Dependencies: {2} @@ -7331,6 +7664,9 @@ Dependencies: {2} {0} min ago + + The download is {0:0.#} GB. + The clipboard is not available. @@ -7355,6 +7691,9 @@ Dependencies: {2} Prepare the existing client copy using LocalExile's Auth and Patch tools. Existing keys are retained. Missing keys and Game.patched.exe are created, and the copy's gateway list is set to localhost. Existing prepared executables are never overwritten. + + Steam has {0}. + No backups yet. Use Back up now to save a copy of your current progress. @@ -7388,6 +7727,9 @@ Dependencies: {2} Waypoint can set up LocalExile {0}, the last version for {1}, in a new folder. This folder stays as it is. + + Asking Steam how large {0} is … + server checkout supports the launcher @@ -7460,6 +7802,9 @@ Dependencies: {2} Rose + + Sign in with a password… + build failed: GameServer.Host {0} @@ -7551,6 +7896,9 @@ Dependencies: {2} Room-authored anchor; actual monsters and positions may differ. + + This folder's game client is a link to another folder. Make a copy of it first. + Choose a full folder path. @@ -7560,6 +7908,9 @@ Dependencies: {2} Under dotnet watch: a saved edit to the Gateway's code applies within seconds, the game staying in; an edit hot reload cannot apply restarts the Gateway by itself. Edits to Auth, Patch or shared projects need Restart servers. + + No game client in this folder yet. + {0} is not empty. Choose an empty folder for the download. @@ -7578,6 +7929,12 @@ 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 + Not found @@ -7704,6 +8061,9 @@ Dependencies: {2} Testing + + shares another LocalExile folder's client + Unresolved pack anchor @@ -7767,6 +8127,9 @@ 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. @@ -7923,6 +8286,9 @@ Dependencies: {2} Game mode + + Asking Steam for a code … + Updating {0} … @@ -7935,6 +8301,9 @@ Dependencies: {2} No save database exists yet. Create your first account to initialize LocalExile. + + {0} is ready to play. + Watcher is alive but Gateway has no running child. Open Gateway output to inspect the build errors. @@ -7944,6 +8313,9 @@ Dependencies: {2} Setup and compatibility + + That copy was set aside half-way to another version, so it is not whole and cannot be used. + Close the game and stop LocalExile services before changing player accounts. @@ -8034,6 +8406,9 @@ Dependencies: {2} Choose color: {0} + + Your Path of Exile folder (only read): + Looking for updates @@ -8140,6 +8515,9 @@ Dependencies: {2} Mods at backup: + + Finish this copy + Put every setting back to its default? @@ -8332,6 +8710,9 @@ 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 @@ -8344,6 +8725,9 @@ Mods at backup: lock contentions/s + + Use a client on this PC + Scion @@ -8443,6 +8827,12 @@ Mods at backup: {0} account(s). + + Waypoint could not read the versions this LocalExile runs. Open this window again. + + + For developers: use this folder itself instead of a copy. LocalExile changes files there, and a Path of Exile update in that folder can break this LocalExile. + Choose your checkout to get started. @@ -8476,6 +8866,9 @@ Mods at backup: the dev host closed the connection + + 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. + {0} ahead of LocalExile, {1} behind diff --git a/src/Launcher.Core/Resources/Strings.ru.resx b/src/Launcher.Core/Resources/Strings.ru.resx index bc1331a..377de09 100644 --- a/src/Launcher.Core/Resources/Strings.ru.resx +++ b/src/Launcher.Core/Resources/Strings.ru.resx @@ -213,6 +213,9 @@ Найден и выбран: + + Версии клиента игры + сборка из исходников @@ -237,6 +240,9 @@ Персонажей пока нельзя перенести + + На этом диске свободно {0:0.#} ГБ. + Без {0} эта лига будет работать без правил или содержимого, в честь которых она названа. Её персонажи останутся как есть, и модуль можно включить снова. @@ -255,6 +261,9 @@ В {0} нет объекта settings + + Часть {0} из {1}: {2:0.0}% · {3} + Ошибка компиляции @@ -264,6 +273,9 @@ Показать при создании персонажей + + Завершить переключение + PID {0} @@ -333,6 +345,9 @@ Фильтр команд по имени или описанию + + Версия Steam + Сохранить и проверить @@ -348,6 +363,9 @@ Не удалось установить Frida. Проверьте подключение и повторите попытку. + + Копирование используемого клиента в качестве основы: {0} + Готова новая версия Waypoint @@ -378,6 +396,9 @@ Слои + + Копия ({0:0.#} ГБ): + Python {0} установлен в {1}, но не добавлен в PATH. Waypoint всё равно использует его — для себя и для запускаемых им скриптов. @@ -600,6 +621,9 @@ Состояние пакета + + У LocalExile теперь собственная копия игры + Путешествие @@ -699,6 +723,9 @@ нет + + Здесь Waypoint не загружает игру. Нужна ваша автономная копия версии Path of Exile, с которой работает LocalExile. + Client — это ссылка на {0}. Эту папку могут использовать другие копии LocalExile, поэтому Waypoint не будет её менять. Подготовьте клиент там или запустите мастер настройки, чтобы разместить клиент здесь. @@ -738,6 +765,9 @@ Дверь на Площадь претендентов + + Используемый клиент наполовину переведён на {0}, сохранить его нельзя. Он будет обновлён на месте. + Инструменты для LocalExile @@ -804,6 +834,9 @@ Уровень + + {0:0.0} из {1:0.0} ГБ + Сеть @@ -837,6 +870,9 @@ Frida установлена (необязательные игровые инструменты) + + Если для выбранного способа на диске нет места, будет задан вопрос. + Вывод выбранного журнала @@ -912,15 +948,15 @@ Папка не создана + + Заменить: используемый клиент будет удалён безвозвратно. Автономный клиент нельзя загрузить заново. + Восстановить сохранения… Создать аккаунт… - - Waypoint не скачивает игру. Нужна ваша собственная автономная копия Path of Exile 3.29.3c. - Метки предметов @@ -973,6 +1009,9 @@ Отметки флажков + + Теперь LocalExile запускается из {0} и больше не использует {1}. + Скрыта для новых персонажей @@ -1135,6 +1174,9 @@ Аккаунт изменён. + + Клиент в этой папке переводился на Path of Exile {0}, и это не завершилось, поэтому запустить его нельзя. Откройте «Клиент игры» и завершите переключение. + Не удалось продолжить: {0} @@ -1201,6 +1243,9 @@ Обновления + + Когда папка LocalExile, в которой уже есть клиент игры, получает другую версию из Steam: + Не удалось открыть страницу загрузки: @@ -1216,6 +1261,9 @@ Не удалось проверить службы перед выходом. + + {0}, {1:0.#} ГБ, будет удалена безвозвратно. Используемая версия не затрагивается. + Недопустимая или повторяющаяся лига. @@ -1231,6 +1279,9 @@ В пароле можно использовать только латинские буквы, цифры и обычные символы. + + Получить игровой клиент + Предпросмотр карточки лиги @@ -1315,6 +1366,9 @@ live.ps1 -NoClient: пересобирает и перезапускает Patch, Auth и Gateway (после pull или изменений вне Gateway); правки кода самого Gateway применяются сами через горячую перезагрузку. Запущенный клиент остаётся. + + Этот LocalExile не сообщает версий для загрузки. Это умеет LocalExile v0.5.0-beta и новее. + Создание согласованного снимка SQLite и проверка его целостности. @@ -1478,6 +1532,9 @@ Установка: {0:0} из {1:0} МБ + + Удалено. + Уменьшить анимацию @@ -1583,6 +1640,9 @@ dev host не запустился (logs\launcher-host.err): {0} + + Сохранить обе: нужно ещё {0:0.#} ГБ, и вернуться можно в любой момент. + Обновить до {0}? @@ -1595,6 +1655,9 @@ До тех пор Waypoint работает со значениями по умолчанию. Измените или очистите их в разделе «Настройки» → «Папки и программы». + + Удалить эту копию игры? + Введите положительный номер PR LocalExile, включая закрытые PR @@ -1808,6 +1871,9 @@ Переключить и собрать + + Это не похоже на имя аккаунта Steam. Нужно имя, с которым вы входите, а не отображаемое имя профиля. + Общие настройки @@ -1872,6 +1938,9 @@ {0:0.0} из {1:0.0} ГБ · {2:0} МБ/с · {3} + + Забыто. Инструмент загрузки хранит собственный вход на этом ПК, пока Steam его не завершит. + Waypoint (сборка из исходников) @@ -1932,6 +2001,9 @@ Эта копия исходников не предоставляет поддерживаемый способ создания лиг. Существующие лиги доступны для просмотра. + + Waypoint забудет, какой аккаунт Steam использовать. При следующей загрузке вход потребуется снова. + Вызовов в секунду за период @@ -1950,6 +2022,9 @@ Купели + + Загрузка версии игры + Найти модуль @@ -2037,6 +2112,9 @@ Подготовить существующую копию клиента средствами Auth и Patch из LocalExile. Текущие ключи входа сохраняются. Проверенный поддерживаемый PathOfExile.exe может обновить устаревшие Game.exe и его исправленную копию; сначала создаются резервные копии прежних исполняемых файлов. Клиенты, подключённые ссылкой, не изменяются. + + Загрузка из Steam не завершена. + Использовать как есть @@ -2130,6 +2208,9 @@ Текущие показатели процессов + + Спрашивать каждый раз + Модов: {0} · {1} {2} @@ -2218,6 +2299,9 @@ в моде больше {0} файлов или больше 64 МБ; ничего не установлено + + Папка игры изменилась во время копирования, поэтому копия не использована. + Ничего не изменилось. Нажмите «Играть», чтобы попробовать снова. @@ -2227,6 +2311,9 @@ Текст основных кнопок + + Новый код + Остановить и переключить @@ -2269,6 +2356,9 @@ Ниже + + Path of Exile {0} + Подготовка репозитория @@ -2371,6 +2461,9 @@ Мониторинг + + Всегда сохранять обе версии + Игрового клиента ещё нет: его добавит мастер настройки. @@ -2386,6 +2479,12 @@ Исцеление + + не версия, с которой работает LocalExile + + + Закройте игру и остановите серверы, чтобы изменить клиент игры. + Загрузка не удалась (код git {0}). Проверьте подключение и повторите попытку. @@ -2431,6 +2530,9 @@ Порт {0} занят другим процессом (PID {1}); {2} не принадлежит этой установке. + + LocalExile не указывает загрузку из Steam для этой версии. + Вернуться к прежней версии @@ -2455,6 +2557,9 @@ Конструктор не делает зачарования + + ссылка на папку игры + Изменения доступности вступят в силу при следующем запуске сервера. @@ -2527,6 +2632,9 @@ Показывает эту копию в расширенном режиме: все разделы, ветки и запросы на слияние в разделе «Версии». Релиз сохраняет режим, выбранный для него. + + Остановить копирование + Лига создана. Она станет доступна после следующего запуска сервера. @@ -2626,6 +2734,9 @@ Инструкция для клиента + + Подготовка программы загрузки… + Скрыть… @@ -2704,6 +2815,9 @@ Режим игры и видимость + + В этой папке уже есть все версии, которые есть в Steam для этого LocalExile. + У каждой записи должен быть уникальный непустой ключ. @@ -2755,6 +2869,9 @@ Этот мастер подготовит LocalExile к игре. Он найдёт то, что у вас уже есть, и спросит, прежде чем что-либо скачивать или копировать. + + Клиент игры наполовину переведён на другую версию + Сохранено: {0} @@ -2791,6 +2908,9 @@ Получение PR + + Загрузить версию… + Собственное @@ -2803,6 +2923,9 @@ Нет подтверждённого процесса этой установки + + Waypoint не знает эту версию как поддерживаемую LocalExile, поэтому подготовка, скорее всего, не удастся. Можно попробовать, но сначала проверьте версию: копия большая. + {0} · проверено в {1} @@ -2812,6 +2935,9 @@ {0:0} МБ + + Код не был подтверждён вовремя, и Steam его отменил. Запросите новый, когда приложение Steam будет под рукой. + Перейти на Path of Exile {0}? @@ -2974,9 +3100,15 @@ Waypoint Tools не ответил. Игра запущена, а персонаж находится в локации? + + Клиент игры… + Дать LocalExile собственные настройки игры, а у вашей обычной игры останутся свои. + + Имя вашего аккаунта Steam (с которым вы входите в Steam): + Автоматические копии создаются перед переключением ветки/PR, сборкой, запуском/перезапуском Gateway, перезагрузкой игровых данных, изменением модов и восстановлением сохранений. Ошибка копирования блокирует изменение. В историю модов входят выбор модов, версии манифестов, отпечатки DLL и последний подтверждённый отчёт. Восстановление сохранений не меняет исходники, клиент, ключи входа и переопределения игровых данных. Восстановление выбора модов не устанавливает DLL и не заменяет сохранения. Waypoint записывает ревизию последнего запущенного Gateway; внешние запуски и каждое горячее изменение не отслеживаются. @@ -2989,6 +3121,9 @@ ОК + + Сделать копию… + Мод отключён. @@ -3138,6 +3273,9 @@ В {0} есть собственные коммиты, которых нет в запросе на слияние ({1}); сначала отправьте или перенесите их + + Загрузить из Steam + Всё на месте. Нажмите «Играть» в Waypoint, чтобы запустить серверы и игру. У LocalExile собственные настройки игры, поэтому у вашей обычной Path of Exile остаются свои. @@ -3183,6 +3321,9 @@ Вывод live.ps1 + + Вход в Steam не выполнен. + Выбор модов действует во всех лигах. Сохранённый выбор не подтверждает их загрузку на сервере. @@ -3247,6 +3388,9 @@ Ветки ({0}) + + Если такой папки нет, отметьте флажок ниже. Тогда «Завершить настройку» на странице «Играть» сможет загрузить игру из Steam. + Доступны только режимы, определённые для этой лиги. @@ -3256,6 +3400,9 @@ LocalExile.exe: запускает серверы, затем игру + + Этот DepotDownloader не совпадает с выпуском, который ожидает Waypoint, поэтому он не использован. + Профиль не создан @@ -3289,6 +3436,9 @@ Поиск аккаунтов или персонажей + + На диске недостаточно места: для {0} нужно {1:0.#} ГБ. + Отложить и переключить @@ -3298,6 +3448,9 @@ Обновлений нет + + Скопировать сейчас + Ожидание… @@ -3349,6 +3502,9 @@ Объект + + {0} загружена. + Проверки подготовки · требуют внимания: {0} @@ -3397,6 +3553,9 @@ · создан не здесь + + Также будут удалены уже загруженные {0:0.#} ГБ. + Ваша папка LocalExile @@ -3421,6 +3580,9 @@ {2} + + используется + Действие @@ -3444,6 +3606,9 @@ Запись планировок · Frida. Сохраняет планировки при загрузке новых областей. Необязательный инструмент; подключается только к подготовленному клиенту этой копии. Существующие записи сохраняются. + + Автономная версия + Ветки и запросы на слияние @@ -3510,6 +3675,9 @@ Начать с новой базы данных + + Вход с паролем + Всегда спрашивать при закрытии окна @@ -3654,6 +3822,9 @@ Припасы + + Удаление… + База сохранений @@ -3870,6 +4041,9 @@ Меняется интерфейс Waypoint. Названия репозиториев, пути, хеши коммитов, игровые команды и необработанные журналы остаются без перевода. + + {0} больше не существует. + Копировать ID @@ -3996,6 +4170,9 @@ На этом ПК найден Path of Exile {0}. Waypoint обновит LocalExile, а затем скопирует его поверх вашего текущего клиента. + + Единственный клиент становится другой версией. Загружаются только отличия, дополнительное место не нужно, но прежняя версия не сохраняется. + Команды проходят через игровой клиент (scripts/dev/client_control.py): сначала запустите игру и войдите в область. @@ -4137,6 +4314,9 @@ live.ps1 сам выбирает локальный шлюз; шаг 6 сохраняет резервную копию + + Копия готова, но поставить её на место ссылки не удалось. + extract-data.ps1 -List: какие извлечённые файлы отсутствуют или устарели @@ -4161,6 +4341,9 @@ База + + Ожидание входа в Steam… + Найден только клиент {0}, поэтому эта копия перейдёт на последний LocalExile для него. @@ -4173,6 +4356,9 @@ Открыть мастер настройки + + Чтобы изменить этот клиент, выберите его папку на боковой панели. + {0}: выберите от {1} до {2} @@ -4230,9 +4416,15 @@ только что + + Отсканируйте этот код мобильным приложением Steam (Steam Guard, затем кнопка сканирования) и подтвердите вход. Игра загружается с вашего аккаунта Steam, в библиотеке которого должна быть Path of Exile. + Кнопка «Играть» получает новейший LocalExile не чаще раза в день, сначала создав резервную копию сохранений. Копия с вашими изменениями остаётся нетронутой. + + На диске хватает места только для одного способа. + Путь к запрошенному репозиторию пуст или слишком длинный. @@ -4263,6 +4455,9 @@ Мод включён. + + Получить {0}? + Игра, журналы и настройки. @@ -4341,6 +4536,12 @@ ! нет подсказок {0}: {1} + + Остановлено. Загруженное сохранено, и следующая попытка продолжит с этого места. + + + Обновить на месте: дополнительное место не нужно, но {0} будет удалена с этого ПК. + В цепочке родителей этой лиги есть пропуск или цикл. Восстановите её определение перед редактированием. @@ -4392,6 +4593,9 @@ Синяя Waypoint + + Path of Exile, версия неизвестна + этот коммит @@ -4518,6 +4722,9 @@ live.ps1 уже выполняется. + + Steam снова запрашивает вход. + Регистрация аккаунта @@ -4563,6 +4770,9 @@ Выполняется {0} … + + Steam: вход выполнен как {0} + Установить папку мода с диска: проект собирается, собранный мод или скрипты копируются. @@ -4578,6 +4788,9 @@ Сохраняет проверенный отчёт в один текстовый файл и показывает его: файл можно прикрепить или перетащить в чат + + Waypoint скопирует игру в папку LocalExile, а затем удалит ссылку. Ссылка работает, пока копия не готова целиком; сохранения, аккаунты и ключи входа сохранятся. + Мод перезагружен. @@ -4593,6 +4806,9 @@ Дважды щёлкните команду, чтобы подставить её в строку. + + Эта копия — не клиент из Steam, поэтому Steam не может её завершить. + Запущен другой игровой клиент. Закройте его перед запуском или перезапуском служб. @@ -4692,12 +4908,18 @@ Убрать {0} из каталога? Установленные из него моды останутся. + + Подготовка {0} для LocalExile… + Скопировано 15 мин + + Загрузка из Steam. {0} + До завершения изменений игра и все службы LocalExile должны оставаться остановленными. @@ -4719,6 +4941,9 @@ пок. 2 + + Выберите папку с PathOfExile.exe и Content.ggpk: автономную установку Path of Exile {0}. Установки из Steam и Epic здесь не подходят. + клиент не запущен @@ -4764,6 +4989,9 @@ Питомец + + В этой папке сохранено {0:0.#} ГБ незавершённой загрузки. + Настройка записи областей @@ -4800,6 +5028,9 @@ Игровой клиент + + LocalExile оставил эти файлы в вашей папке Path of Exile. Вашей обычной игре они не нужны, их можно удалить: {0} + Моды — дополнения, установленные для этой копии. Включайте, обновляйте и настраивайте их в разделе «Моды». @@ -4824,6 +5055,9 @@ «Новейшая» содержит последние изменения LocalExile. Каждое изменение проверяется, но «Новейшая» может быть менее стабильной, чем релиз. + + Без мобильного приложения Steam: программа загрузки запросит пароль и код Steam Guard в собственном окне. Waypoint не видит ни то, ни другое. + Удалить выбранные предметы (клавиша Delete); Ctrl или Shift выбирает несколько @@ -4833,6 +5067,9 @@ Загрузка {0} … {1:N0} КБ + + Client — это ссылка на {0}, а не копия. + Запускается кнопками «Играть» или «Запустить серверы», когда включена «Запись планировок» @@ -4882,6 +5119,9 @@ Оттенки серого + + Сохранить обе + Имя новой лиги @@ -4969,6 +5209,9 @@ Сохранить конфигурацию игры + + Заменить + Обновить все @@ -5253,6 +5496,9 @@ Сервер обновлений: проверка обновлений клиента остаётся локальной + + Вход в Steam + Папка не изменена @@ -5277,6 +5523,9 @@ Тестовый режим нескольких экземпляров + + наполовину переведён на {0} + Папка журналов @@ -5304,9 +5553,6 @@ Порт занят - - Использовать саму эту папку вместо копии. Это экономит место, но LocalExile будет изменять этот клиент. - Нет свойства с таким текстом @@ -5343,6 +5589,9 @@ Этап + + Всегда обновлять единственный клиент на месте + Зависимости от других модулей не указаны. @@ -5385,6 +5634,9 @@ Базовый размер группы: {0}–{1} + + Ожидание сканирования и подтверждения… + Скопируйте команду и вставьте её в чат игры сочетанием Ctrl+V. @@ -5439,6 +5691,9 @@ LocalExile {0} нужен клиент Path of Exile {1}, а на этом ПК есть только {2}. После этого обновления играть не получится, пока у вас не будет клиента {1}. + + Удалить эту копию… + Остановить службы перед выходом @@ -5448,15 +5703,24 @@ Перезагрузить включённый мод и зависимые от него моды. + + ссылка на другую папку + Удалить аккаунт + + Client — это ссылка на {0}, а не копия. LocalExile изменяет файлы в этой папке, и обновление Path of Exile в ней может сломать этот LocalExile. Отдельная копия защищает и от того, и от другого. + Проверка учётной записи Сначала соберите или установите этот мод: его mod.json отсутствует. + + В этом аккаунте Steam нет Path of Exile. Добавьте игру в библиотеку Steam (она бесплатная) и повторите попытку. + Всё равно запустить @@ -5472,6 +5736,9 @@ Незакоммиченные изменения + + {0} теперь полная и сохранена в этой папке. + PowerShell 7 выполняет скрипты сборки и настройки LocalExile @@ -5523,6 +5790,9 @@ загруженный {0} не совпадает со своим SHA-256; ничего не изменено + + Загрузка из Steam пока работает только в 64-разрядной Windows. + Работает другой сервер или процесс отслеживания (PID {0}). Остановите его из его установки перед запуском здесь. @@ -5685,6 +5955,9 @@ Нужны запущенный Gateway, включённый собранный мод и клиент в игровой области (Python + Frida). + + Эта папка использует игровой клиент другой папки LocalExile: что меняется там, меняется и здесь. + Уровень предмета {0} @@ -5745,6 +6018,9 @@ Серверы не запущены + + Копирование продолжится с уже скопированных {0:0.#} ГБ. + Змея @@ -5778,6 +6054,9 @@ Waypoint не удалось удалить старый LocalExile: {0} + + Введите пароль и код Steam Guard в открывшемся окне. Waypoint их не видит. + Свернуть в трей @@ -5946,6 +6225,9 @@ Больше ничего устанавливать не нужно. Waypoint сообщит о новом выпуске и установит его за вас. + + Забыть вход + Клавиатура: Ctrl+1–9 выбирает страницу · Ctrl+Tab / Ctrl+Shift+Tab переключает страницы · Ctrl+F открывает поиск на текущей странице · F5 обновляет локальное состояние. Параметры оформления и доступности можно изменить в настройках. @@ -5970,6 +6252,9 @@ Поиск модов + + Теперь используется {0}. Версия, которую она заменила, сохранена. + Исходные значки модулей @@ -6177,6 +6462,12 @@ Переключение не выполнено. + + Используемый клиент игры наполовину переведён на другую версию. Сначала завершите это переключение. + + + Клиент игры в этой папке больше не ссылка, поэтому копировать нечего. + в выпуске есть небезопасный путь {0}; ничего не изменено @@ -6207,6 +6498,9 @@ включено + + Сделать копию игры для LocalExile? + Для выдачи предметов нужна Frida — инструмент, который взаимодействует с запущенной игрой. Waypoint может установить её в эту папку LocalExile. Она занимает около 180 МБ, а некоторые антивирусы на неё реагируют. @@ -6303,6 +6597,9 @@ Не удалось загрузить настройки + + Загрузка из Steam не завершена: {0} + Запуск игры @@ -6333,6 +6630,9 @@ Для этой функции нужна Frida. Для обычной игры она не требуется. + + Копирование не завершено + Настройки поведения окна сохранены. @@ -6378,6 +6678,9 @@ % всей машины + + Открыть «Клиент игры» + Gateway работает без отслеживания изменений. Остановите серверы, чтобы изменить режим запуска. @@ -6462,6 +6765,9 @@ У LocalExile пока нет выпуска для загрузки. + + Этот клиент неполный, использовать его нельзя. + Назад к моим модам @@ -6537,6 +6843,9 @@ Внешний вид + + из Steam + Информация о модах недоступна @@ -6588,6 +6897,9 @@ Только лучший тир + + Используемый клиент откладывается, а другая версия создаётся рядом. Нужно место для обеих, зато вернуться можно мгновенно. + Развернуть Waypoint @@ -6616,6 +6928,9 @@ Ремесленные (верстак) + + Обновить на месте + Копьё @@ -6836,6 +7151,9 @@ Для этой лиги определён только режим «{0}». Другие режимы выбрать нельзя. + + Для этого LocalExile Waypoint не может загрузить игру. + Общие для всех лиг, в которых работает этот мод. @@ -6905,6 +7223,9 @@ Строк: {0} + + Копирование остановлено, ничего не изменилось. В следующий раз оно продолжится с этого места. + игровые данные ещё не извлечены (шаг 7) @@ -6926,6 +7247,9 @@ Включить мод + + сохранена, {0:0.#} ГБ + Папка LocalExile: {0}, {1} @@ -6956,9 +7280,6 @@ ВЫБРАННЫЕ ИСХОДНИКИ - - Укажите папку с PathOfExile.exe и Content.ggpk. Это должна быть автономная установка 3.29.3c: версии Steam и Epic не подходят, а скачать игру Waypoint не может. - Ошибка: {0} завершился с кодом {1}; см. вывод и раздел «Журналы». @@ -6995,6 +7316,9 @@ В PATH есть Python {0}; нужен 3.9 или новее. Установите его с python.org, отметив «Add python.exe to PATH». + + Ничего не изменилось: LocalExile по-прежнему запускается из {0}. При следующей попытке копирование продолжится с того места, где остановилось. + Не собран @@ -7133,6 +7457,9 @@ {0}: обновлено. «Перезапустить серверы» (или «Играть») соберёт новую версию. + + Загрузить + Игровой клиент в этой папке LocalExile — {0}, а её LocalExile нужен {1}. «Играть» предложит, что с этим сделать. @@ -7208,6 +7535,9 @@ Повторить + + В Steam нет этой версии для этого LocalExile. Эту копию можно только удалить. + {0} взят из {1}, а не из официальных модов. Мод работает с правами Gateway на вашем ПК: устанавливайте его только из репозитория, которому доверяете. @@ -7241,6 +7571,9 @@ Фильтрация + + Загрузка завершилась, но клиент получен не полностью. Запустите её ещё раз. + {0} · {1} Зависимости: {2} @@ -7331,6 +7664,9 @@ {0} мин назад + + Размер загрузки: {0:0.#} ГБ. + Буфер обмена недоступен. @@ -7355,6 +7691,9 @@ Подготовьте существующую копию клиента инструментами Auth и Patch LocalExile. Имеющиеся ключи сохраняются. Будут созданы недостающие ключи и Game.patched.exe, а список шлюзов копии будет настроен на localhost. Готовые исполняемые файлы не перезаписываются. + + В Steam есть {0}. + Копий пока нет. Нажмите «Создать копию», чтобы сохранить текущий прогресс. @@ -7388,6 +7727,9 @@ Waypoint может установить LocalExile {0}, последнюю версию для {1}, в новую папку. Эта папка останется как есть. + + Запрос размера {0} у Steam… + репозиторий сервера поддерживает Waypoint @@ -7460,6 +7802,9 @@ Роза + + Войти с паролем… + ошибка сборки: GameServer.Host {0} @@ -7551,6 +7896,9 @@ Точка из данных комнаты; реальные монстры и их позиции могут отличаться. + + Клиент игры в этой папке — ссылка на другую папку. Сначала сделайте его копию. + Укажите полный путь к папке. @@ -7560,6 +7908,9 @@ Под dotnet watch: сохранённое изменение кода Gateway применяется за несколько секунд, игра не прерывается; изменение, которое горячая перезагрузка применить не может, само перезапускает Gateway. Для изменений Auth, Patch или общих проектов нужно «Перезапустить серверы». + + В этой папке пока нет игрового клиента. + Папка {0} не пуста. Выберите для загрузки пустую папку. @@ -7578,6 +7929,12 @@ {0} содержит правила режима игры. Если включить его здесь, они будут действовать для всех персонажей этой лиги со следующего запуска сервера, без собственных умений, торговцев и наград за задания этого режима, а игра по-прежнему будет показывать лигу как есть. Снимите флажок, чтобы вернуть всё назад. + + Использовать эту версию + + + Версии игры в этом LocalExile: получить из Steam, хранить несколько, переключаться между ними + Не найдено @@ -7704,6 +8061,9 @@ Тестирование + + общий клиент с другой папкой LocalExile + Точка неопределённой группы @@ -7767,6 +8127,9 @@ Порталы защитников + + Этот клиент принадлежит копии исходного кода LocalExile, которая сама управляет своим клиентом. + Выберите копию для восстановления или удаления. @@ -7923,6 +8286,9 @@ Режим игры + + Запрос кода у Steam… + Обновление {0} … @@ -7935,6 +8301,9 @@ Базы сохранений пока нет. Создайте первый аккаунт для инициализации LocalExile. + + {0} готова к игре. + Отслеживание работает, но дочерний процесс Gateway не запущен. Проверьте ошибки сборки в выводе Gateway. @@ -7944,6 +8313,9 @@ Подготовка и совместимость + + Эта копия была отложена на полпути к другой версии, поэтому она неполная и использовать её нельзя. + Перед изменением аккаунтов закройте игру и остановите службы LocalExile. @@ -8034,6 +8406,9 @@ Выбор цвета: {0} + + Ваша папка Path of Exile (только чтение): + Поиск обновлений @@ -8140,6 +8515,9 @@ Моды при копировании: + + Завершить эту копию + Вернуть все настройки к значениям по умолчанию? @@ -8332,6 +8710,9 @@ Запуск, сборка или перезапуск; проверьте вывод Gateway на ошибки + + Нужен клиент Path of Exile, с которым работает LocalExile: ваша автономная копия или, для релиза, клиент, загруженный из Steam после этого мастера. + не сборка 3.29.3c @@ -8344,6 +8725,9 @@ конфликты блокировок/с + + Взять клиент с этого ПК + Дворянка @@ -8443,6 +8827,12 @@ Аккаунтов: {0}. + + Waypoint не смог прочитать версии, с которыми работает этот LocalExile. Откройте это окно снова. + + + Для разработчиков: использовать саму эту папку вместо копии. LocalExile изменяет в ней файлы, и обновление Path of Exile в этой папке может сломать этот LocalExile. + Для начала выберите репозиторий. @@ -8476,6 +8866,9 @@ dev host закрыл соединение + + На диске недостаточно места для копии: нужно {0:0.#} ГБ, а свободно {1:0.#} ГБ. Освободите место и попробуйте снова; до тех пор ничего не меняется. + опережает LocalExile на {0}, отстаёт на {1} diff --git a/src/Launcher.Core/Resources/Strings.zh-CN.resx b/src/Launcher.Core/Resources/Strings.zh-CN.resx index 28007dc..8a429bf 100644 --- a/src/Launcher.Core/Resources/Strings.zh-CN.resx +++ b/src/Launcher.Core/Resources/Strings.zh-CN.resx @@ -213,6 +213,9 @@ 已找到并使用: + + 游戏客户端版本 + 源码构建版本 @@ -237,6 +240,9 @@ 你的角色暂时还不能转移 + + 此驱动器的可用空间为 {0:0.#} GB。 + 没有 {0},此联赛将不再具备其名称所代表的规则或内容。其中的角色保持不变,之后可以重新启用。 @@ -255,6 +261,9 @@ {0} 中没有 settings 对象 + + 第 {0} 部分,共 {1} 部分:{2:0.0}% · {3} + 编译失败 @@ -264,6 +273,9 @@ 在新角色创建界面显示 + + 完成切换 + PID {0} @@ -333,6 +345,9 @@ 按名称或描述筛选命令 + + Steam 版 + 保存并检查 @@ -348,6 +363,9 @@ 无法安装 Frida。请检查网络连接后重试。 + + 正在复制当前使用的客户端作为基础:{0} + Waypoint 新版本已就绪 @@ -378,6 +396,9 @@ 图层 + + 副本({0:0.#} GB): + Python {0} 已安装在 {1},但不在 PATH 中。Waypoint 仍会使用它,供自身和它运行的脚本使用。 @@ -600,6 +621,9 @@ 安装包状态 + + LocalExile 已拥有自己的游戏副本 + 航行 @@ -699,6 +723,9 @@ 无 + + Waypoint 在这里不会下载游戏。你需要自己拥有 LocalExile 支持的流放之路版本的独立版。 + Client 是指向 {0} 的链接,其他 LocalExile 副本可能也在使用该文件夹,因此 Waypoint 不会更改它。请在那里准备客户端,或运行安装向导在此处放置客户端。 @@ -738,6 +765,9 @@ 通往试炼者广场的门 + + 正在使用的客户端正在切换到 {0},尚未完成,无法保留。它会被原地更新。 + LocalExile 所需的工具 @@ -804,6 +834,9 @@ 等级 + + {0:0.0} / {1:0.0} GB + 网络 @@ -837,6 +870,9 @@ Frida 已安装(可选游戏工具) + + 如果驱动器空间不够使用所选方式,则会改为询问。 + 所选日志输出 @@ -912,15 +948,15 @@ 文件夹没有创建 + + 替换:正在使用的客户端会被永久删除。独立客户端无法重新下载。 + 恢复存档… 创建账号… - - Waypoint 不会下载游戏。你需要自备一份独立版的流放之路 3.29.3c。 - 物品标签 @@ -973,6 +1009,9 @@ 复选框勾选标记 + + LocalExile 现在从 {0} 运行,不再使用 {1}。 + 对新角色隐藏 @@ -1135,6 +1174,9 @@ 账号已更新。 + + 此文件夹的客户端正在切换到流放之路 {0},但尚未完成,因此无法启动。请打开“游戏客户端”并完成切换。 + 无法继续:{0} @@ -1201,6 +1243,9 @@ 更新 + + 当已有游戏客户端的 LocalExile 文件夹从 Steam 获取另一个版本时: + 无法打开下载页面: @@ -1216,6 +1261,9 @@ 退出前无法验证服务状态。 + + {0}({1:0.#} GB)将被永久删除。正在使用的版本不受影响。 + 联赛无效或重复。 @@ -1231,6 +1279,9 @@ 密码只能使用英文字母、数字和常用符号。 + + 获取游戏客户端 + 联盟卡片预览 @@ -1315,6 +1366,9 @@ live.ps1 -NoClient:重新构建并重启 Patch、Auth 和 Gateway(用于拉取之后,或修改了 Gateway 以外的内容时);Gateway 自身的代码修改会通过热重载自动生效。正在运行的客户端会保留。 + + 这个 LocalExile 没有列出可下载的版本。LocalExile v0.5.0-beta 及更高版本才会列出。 + 正在创建一致的 SQLite 快照并检查其完整性。 @@ -1478,6 +1532,9 @@ 正在安装:{0:0} / {1:0} MB + + 已删除。 + 减少动画 @@ -1583,6 +1640,9 @@ dev host 未能启动(logs\launcher-host.err):{0} + + 两者都保留:还需要 {0:0.#} GB,并且随时可以切换回去。 + 要更新到 {0} 吗? @@ -1595,6 +1655,9 @@ 在此之前 Waypoint 使用默认值。可以在“设置”→“文件夹和工具”中更改或清除它们。 + + 删除此游戏副本? + 输入 LocalExile PR 编号(正整数),包括已关闭的 PR @@ -1808,6 +1871,9 @@ 切换并构建 + + 这看起来不像 Steam 账号名。应填写登录时使用的名称,而不是个人资料的显示名称。 + 共享设置 @@ -1872,6 +1938,9 @@ {0:0.0} / {1:0.0} GB · {2:0} MB/s · {3} + + 已忘记。下载工具会在这台电脑上保留它自己的登录状态,直到 Steam 将其终止。 + Waypoint(从源码构建) @@ -1932,6 +2001,9 @@ 此源码副本未提供受支持的联赛创建方式。仍可查看现有联赛。 + + Waypoint 将不再记住使用哪个 Steam 账号。下次下载时需要重新登录。 + 时间窗口内的每秒调用次数 @@ -1950,6 +2022,9 @@ 水晶塔 + + 下载游戏版本 + 查找模块 @@ -2037,6 +2112,9 @@ 使用 LocalExile 的 Auth 和 Patch 工具准备现有客户端副本。保留现有登录密钥。经过验证且受支持的 PathOfExile.exe 可用于更新过时的 Game.exe 及其修补副本;替换前会备份原有可执行文件。通过链接使用的客户端不会被修改。 + + 从 Steam 下载未完成。 + 按原样使用 @@ -2130,6 +2208,9 @@ 实时进程指标 + + 每次询问 + {0} 个模组 · {1} {2} @@ -2218,6 +2299,9 @@ 模组超过 {0} 个文件或 64 MB;未安装任何内容 + + 游戏文件夹在复制过程中发生了变化,因此未使用该副本。 + 没有做任何更改。点击“开始游戏”重试。 @@ -2227,6 +2311,9 @@ 主要按钮文本 + + 获取新二维码 + 停止并切换 @@ -2269,6 +2356,9 @@ 下移 + + 流放之路 {0} + 准备此源码副本 @@ -2371,6 +2461,9 @@ 性能 + + 始终保留两个版本 + 还没有游戏客户端:安装向导会添加。 @@ -2386,6 +2479,12 @@ 治疗 + + 不是 LocalExile 支持的版本 + + + 请关闭游戏并停止服务器后再更改游戏客户端。 + 下载失败(git 退出代码 {0})。请检查网络连接后重试。 @@ -2431,6 +2530,9 @@ 端口 {0} 已被另一个进程(PID {1})占用;{2} 不属于此源码副本。 + + LocalExile 没有为此版本提供 Steam 下载信息。 + 回到之前的版本 @@ -2455,6 +2557,9 @@ 物品制作器不制作附魔 + + 链接到游戏文件夹 + 可用性更改将在下次服务器启动时生效。 @@ -2527,6 +2632,9 @@ 以高级模式显示此副本:显示所有部分,分支和拉取请求在“版本”部分。发布版保留你在那里选择的模式。 + + 停止复制 + 联赛已创建,将在下次启动服务器后可用。 @@ -2626,6 +2734,9 @@ 客户端说明 + + 正在准备下载工具… + 隐藏… @@ -2704,6 +2815,9 @@ 游戏模式与可见性 + + 此文件夹已有 Steam 上适用于这个 LocalExile 的所有版本。 + 每个映射条目都需要一个非空且唯一的键。 @@ -2755,6 +2869,9 @@ 本向导会帮你做好游玩 LocalExile 的准备。它会查找你已有的内容,并在下载或复制任何东西之前先询问你。 + + 游戏客户端切换到另一个版本的过程尚未完成 + 已保存 {0} @@ -2791,6 +2908,9 @@ 正在获取拉取请求 + + 下载版本… + 固定词缀 @@ -2803,6 +2923,9 @@ 此源码副本没有已验证的进程 + + Waypoint 不确定这是 LocalExile 支持的版本,因此准备过程很可能失败。你仍可尝试,但请先确认版本:复制的数据量很大。 + {0} · 检查于 {1} @@ -2812,6 +2935,9 @@ {0:0} MB + + 二维码未在有效时间内确认,Steam 已将其作废。请准备好 Steam 应用后再获取新的二维码。 + 迁移到 Path of Exile {0}? @@ -2974,9 +3100,15 @@ Waypoint Tools 没有回应。游戏是否在运行,且有角色在区域中? + + 游戏客户端… + 为 LocalExile 提供独立的游戏设置,你平时的游戏保留自己的设置。 + + 你的 Steam 账户名(登录 Steam 时使用的名称): + 在激活分支/PR、构建、启动/重启 Gateway、重新加载游戏数据、更改模组和恢复存档之前,会自动备份。备份失败时会阻止该更改。模组历史会记录模组选择、清单版本、DLL 指纹和最近一次确认的运行时报告。恢复存档不会切换源码、客户端文件、登录密钥或游戏数据覆盖。恢复模组选择绝不会安装 DLL 或替换存档。Waypoint 会记录最近启动的 Gateway;外部启动和每次热编辑都不会被跟踪。 @@ -2989,6 +3121,9 @@ 确定 + + 创建副本… + 模组已禁用。 @@ -3138,6 +3273,9 @@ {0} 上有 {1} 个拉取请求中没有的自有提交;请先推送或转移这些提交 + + 从 Steam 下载 + 一切就绪。在 Waypoint 中点击“开始游戏”即可启动服务器和游戏。LocalExile 使用自己的游戏设置,因此你平时的流放之路会保留原有设置。 @@ -3183,6 +3321,9 @@ live.ps1 输出 + + 未登录 Steam。 + 模组选择适用于所有赛季。已保存的选项不代表实际加载状态。 @@ -3247,6 +3388,9 @@ 分支({0}) + + 如果没有这样的文件夹,请勾选下方的选项。之后“开始游戏”页面上的“完成安装”可以从 Steam 下载游戏。 + 仅提供此赛季已定义的模式。 @@ -3256,6 +3400,9 @@ LocalExile.exe:启动服务器,然后启动游戏 + + 此 DepotDownloader 与 Waypoint 预期的版本不符,因此未使用。 + 配置文件没有创建 @@ -3289,6 +3436,9 @@ 搜索账号或角色 + + 驱动器空间不足:{0} 需要 {1:0.#} GB。 + 贮藏并切换 @@ -3298,6 +3448,9 @@ 没有更新 + + 立即复制 + 等待中… @@ -3349,6 +3502,9 @@ 物体 + + {0} 已下载。 + 安装检查 · {0} 项需要注意 @@ -3397,6 +3553,9 @@ · 非在此创建 + + 同时会删除已下载的 {0:0.#} GB。 + 你的 LocalExile 文件夹 @@ -3421,6 +3580,9 @@ {2} + + 使用中 + 操作 @@ -3444,6 +3606,9 @@ 行走地图 · Frida。在游戏加载新区域时保存区域布局数据。可选;仅附加到此源码副本已准备的客户端。现有采集数据会保留。 + + 独立版 + 分支和拉取请求 @@ -3510,6 +3675,9 @@ 使用新数据库开始 + + 使用密码登录 + 关闭窗口时总是询问 @@ -3654,6 +3822,9 @@ 补给 + + 正在删除… + 存档数据库 @@ -3870,6 +4041,9 @@ 这会更改 Waypoint 的界面。仓库名称、路径、提交哈希、游戏内命令和原始日志会保留原文。 + + {0} 已不存在。 + 复制 ID @@ -3996,6 +4170,9 @@ 在这台电脑上找到了 Path of Exile {0}。Waypoint 会先更新 LocalExile,然后把它复制过来替换你当前的客户端。 + + 现有的这一个客户端变为另一个版本。只下载有差异的部分,不需要额外空间,但原来的版本不再保留。 + 命令通过游戏客户端发送(scripts/dev/client_control.py):请先启动游戏并进入一个区域。 @@ -4137,6 +4314,9 @@ live.ps1 会自行选择本地网关;第 6 步会保留备份 + + 副本已就绪,但未能替换链接。 + extract-data.ps1 -List:列出缺失或过期的已提取文件 @@ -4161,6 +4341,9 @@ 基础类型 + + 正在等待 Steam 登录… + 只找到了 {0} 客户端,因此此副本会切换到为它制作的最后一个 LocalExile。 @@ -4173,6 +4356,9 @@ 打开安装向导 + + 要更改此客户端,请在侧边栏中选择它所在的文件夹。 + {0}:请选择 {1} 到 {2} 项 @@ -4230,9 +4416,15 @@ 刚刚 + + 请用 Steam 手机应用扫描此二维码(Steam 令牌,然后点击扫描按钮)并确认登录。游戏来自你自己的 Steam 账号,该账号的库中需要有流放之路。 + “开始游戏”每天最多获取一次最新的 LocalExile,获取前会先备份你的存档。包含你自己更改的副本不会被改动。 + + 驱动器空间只够使用其中一种方式。 + 请求的源码副本路径为空或过长。 @@ -4263,6 +4455,9 @@ 模组已启用。 + + 获取 {0}? + 开始游戏、日志和设置。 @@ -4341,6 +4536,12 @@ ! 没有 {0} 建议:{1} + + 已停止。已下载的内容会保留,下次将从这里继续。 + + + 原地更新:不需要额外空间,但 {0} 会从这台电脑上移除。 + 此联赛的父联赛链缺失或存在循环。请先恢复其定义再编辑。 @@ -4392,6 +4593,9 @@ Waypoint 蓝 + + 流放之路,版本未知 + 此提交 @@ -4518,6 +4722,9 @@ live.ps1 已在运行。 + + Steam 要求重新登录。 + 注册账号 @@ -4563,6 +4770,9 @@ 正在运行 {0} … + + Steam:已登录为 {0} + 从磁盘安装模组文件夹:项目会被构建,已构建的模组或脚本会被复制。 @@ -4578,6 +4788,9 @@ 将已检查的报告保存为一个文本文件并显示它,可直接作为附件或拖入聊天 + + Waypoint 会把游戏复制到这个 LocalExile 文件夹中,然后移除链接。在副本完整之前链接仍然有效,你的存档、账号和登录密钥都会保留。 + 模组已重新加载。 @@ -4593,6 +4806,9 @@ 双击命令可将其填入输入行。 + + 这个副本不是来自 Steam 的客户端,因此 Steam 无法完成它。 + 另一个游戏客户端正在运行。请先关闭它,再启动或重启服务。 @@ -4692,12 +4908,18 @@ 从浏览中移除 {0} 吗?从中安装的模组会保留。 + + 正在为 LocalExile 准备 {0}… + 已复制 15 分钟 + + 正在从 Steam 下载。{0} + 进行更改时,游戏和所有 LocalExile 服务必须保持停止,直到操作完成。 @@ -4719,6 +4941,9 @@ 第 2 代 + + 选择一个包含 PathOfExile.exe 和 Content.ggpk 的文件夹:流放之路 {0} 的独立安装。Steam 和 Epic 的安装在这里不可用。 + 客户端未运行 @@ -4764,6 +4989,9 @@ 宠物 + + 此文件夹中保留了 {0:0.#} GB 未完成的下载。 + 设置区域采集 @@ -4800,6 +5028,9 @@ 游戏客户端 + + LocalExile 在你的流放之路文件夹中留下了这些文件。你平时的游戏不需要它们,可以删除:{0} + 模组是为此副本安装的扩展。可在“模组”中启用、更新和配置。 @@ -4824,6 +5055,9 @@ 最新版包含 LocalExile 的最新更改。每项更改都经过审查,但最新版可能不如发布版稳定。 + + 没有 Steam 手机应用时:下载工具会在自己的窗口中询问密码和 Steam 令牌验证码。Waypoint 两者都不会接触。 + 删除所选物品(Delete 键);按住 Ctrl 或 Shift 可多选 @@ -4833,6 +5067,9 @@ 正在下载 {0} … {1:N0} KB + + Client 是指向 {0} 的链接,而不是副本。 + 开启“行走地图”时,随“开始游戏”或“启动服务器”一起启动 @@ -4882,6 +5119,9 @@ 灰度 + + 两者都保留 + 新联赛名称 @@ -4969,6 +5209,9 @@ 保存游戏配置 + + 替换 + 全部更新 @@ -5253,6 +5496,9 @@ Patch 服务器:客户端的更新检查保持在本地 + + 登录 Steam + 文件夹未更改 @@ -5277,6 +5523,9 @@ 多实例测试模式 + + 正在切换到 {0},尚未完成 + 打开日志文件夹 @@ -5304,9 +5553,6 @@ 端口被其他程序占用 - - 直接使用此文件夹,而不是副本。这样可以节省空间,但 LocalExile 随后会修改该客户端。 - 没有词缀的文本与此相符 @@ -5343,6 +5589,9 @@ 里程碑 + + 始终原地更新这一个客户端 + 未声明模块依赖项。 @@ -5385,6 +5634,9 @@ 基础怪物群数量:{0}–{1} + + 正在等待你扫描并确认… + 复制命令,然后用 Ctrl+V 粘贴到游戏聊天中。 @@ -5439,6 +5691,9 @@ LocalExile {0} 需要 Path of Exile {1} 客户端,而这台电脑上只有 {2}。更新后,在你拥有 {1} 客户端之前将无法游戏。 + + 删除此副本… + 退出前停止服务 @@ -5448,15 +5703,24 @@ 重新加载此已启用的模组及依赖它的模组。 + + 指向另一个文件夹的链接 + 删除账号 + + Client 是指向 {0} 的链接,而不是副本。LocalExile 会修改该文件夹中的文件,而且那里的流放之路一旦更新,就可能导致这个 LocalExile 无法运行。使用独立副本可以避免这两个问题。 + 正在检查你的账号 请先构建或安装此模组:缺少其二进制清单。 + + 该 Steam 账号中没有流放之路。请在 Steam 中将游戏添加到库(免费),然后重试。 + 仍然启动 @@ -5472,6 +5736,9 @@ 未提交的更改 + + {0} 现已完整,并保留在此文件夹中。 + PowerShell 7 用于运行 LocalExile 的构建和安装脚本 @@ -5523,6 +5790,9 @@ 下载的 {0} 与其 SHA-256 不匹配;未做任何更改 + + 从 Steam 下载目前仅支持 64 位 Windows。 + 另一个服务器或监视进程正在运行(PID {0})。请先从它所属的安装中停止它,再在此处启动。 @@ -5685,6 +5955,9 @@ 需要 Gateway 正在运行、一个已启用且已构建的模组,以及位于可游玩区域的客户端(Python + Frida)。 + + 此文件夹与另一个 LocalExile 文件夹共用游戏客户端:那边的更改也会影响这里。 + 物品等级 {0} @@ -5745,6 +6018,9 @@ 服务器未运行 + + 复制会从之前已完成的 {0:0.#} GB 继续。 + 蛇 @@ -5778,6 +6054,9 @@ Waypoint 无法删除旧的 LocalExile:{0} + + 请在打开的窗口中输入密码和 Steam 令牌验证码。Waypoint 看不到它们。 + 最小化到托盘 @@ -5946,6 +6225,9 @@ 无需安装其他东西。有新的发行版时,Waypoint 会通知你并为你安装。 + + 忘记登录 + 键盘:Ctrl+1–9 选择页面 · Ctrl+Tab / Ctrl+Shift+Tab 在页面间切换 · Ctrl+F 搜索当前页面 · F5 刷新本地状态。可在“设置”中更改外观和辅助功能偏好。 @@ -5970,6 +6252,9 @@ 搜索模组 + + 现在使用的是 {0}。被替换的版本已保留。 + 原始模块图标 @@ -6177,6 +6462,12 @@ 没有进行切换。 + + 正在使用的游戏客户端切换到另一个版本的过程尚未完成。请先完成这次切换。 + + + 此文件夹的游戏客户端已不再是链接,因此无需复制。 + 发行版包含不安全的路径 {0};未做任何更改 @@ -6207,6 +6498,9 @@ 已开启 + + 为 LocalExile 创建游戏副本? + “发放物品”需要 Frida,这是一个与正在运行的游戏通信的工具。Waypoint 可以将它安装到此 LocalExile 文件夹中。它大约占用 180 MB,部分杀毒软件会将其标记为可疑。 @@ -6303,6 +6597,9 @@ 无法加载设置 + + 从 Steam 下载未完成:{0} + 正在启动游戏 @@ -6333,6 +6630,9 @@ 此功能需要 Frida。正常游戏不需要 Frida。 + + 复制未完成 + 窗口行为已保存。 @@ -6378,6 +6678,9 @@ 占整机的 % + + 打开“游戏客户端” + Gateway 正在运行,但没有监视进程。请停止服务器以更改启动模式。 @@ -6462,6 +6765,9 @@ LocalExile 暂无可下载的发行版。 + + 此客户端不完整,无法使用。 + 返回我的模组 @@ -6537,6 +6843,9 @@ 外观 + + 来自 Steam + 模组信息不可用 @@ -6588,6 +6897,9 @@ 仅最高阶 + + 当前使用的客户端被保留在一旁,另一个版本在旁边生成。需要两者的空间,但可以立即切换回去。 + 最大化 Waypoint @@ -6616,6 +6928,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 工艺(工艺台) + + 原地更新 + 长矛 @@ -6836,6 +7151,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 此赛季仅定义了“{0}”模式,无法选择其他模式。 + + Waypoint 无法为这个 LocalExile 下载游戏。 + 由运行此模组的所有联赛共用。 @@ -6905,6 +7223,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 行 + + 复制已停止,没有做任何更改。下次会从这里继续。 + 游戏数据尚未提取(第 7 步) @@ -6926,6 +7247,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 启用模组 + + 已保留,{0:0.#} GB + LocalExile 文件夹:{0},{1} @@ -6956,9 +7280,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 所选源码 - - 请浏览到包含 PathOfExile.exe 和 Content.ggpk 的文件夹。它必须是独立版 3.29.3c 安装:Steam 和 Epic 版本无法使用,并且 Waypoint 无法下载游戏。 - 失败:{0} 已退出,退出代码 {1};请查看输出和“日志”页面。 @@ -6995,6 +7316,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 PATH 中的 Python 是 {0};需要 3.9 或更高版本。请从 python.org 安装,并勾选“Add python.exe to PATH”。 + + 没有做任何更改:LocalExile 仍从 {0} 运行。下次重试时,复制会从中断处继续。 + 未构建 @@ -7133,6 +7457,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 已是最新。“重启服务器”(或“开始游戏”)会构建它。 + + 下载 + 这个 LocalExile 文件夹的游戏客户端是 {0},而它的 LocalExile 需要 {1}。“开始游戏”会给出处理办法。 @@ -7208,6 +7535,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 重试 + + Steam 上没有适用于这个 LocalExile 的该版本。此副本只能删除。 + {0} 来自 {1},不是官方模组。模组在你的电脑上以 Gateway 的权限运行:只从你信任的仓库安装。 @@ -7241,6 +7571,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 筛选 + + 下载已结束,但客户端不完整。请再运行一次。 + {0} · {1} 依赖项:{2} @@ -7331,6 +7664,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 分钟前 + + 下载大小为 {0:0.#} GB。 + 剪贴板不可用。 @@ -7355,6 +7691,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 使用 LocalExile 的 Auth 和 Patch 工具准备现有的客户端副本。现有密钥会保留。会创建缺失的密钥和 Game.patched.exe,并将该副本的网关列表设为 localhost。绝不会覆盖已有的已准备可执行文件。 + + Steam 上有 {0}。 + 还没有备份。使用“立即备份”保存当前进度的副本。 @@ -7388,6 +7727,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 Waypoint 可以把 LocalExile {0}(适用于 {1} 的最后版本)安装到新文件夹。此文件夹保持不变。 + + 正在向 Steam 查询 {0} 的大小… + 服务器源码副本支持启动器 @@ -7460,6 +7802,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 玫瑰 + + 使用密码登录… + 构建失败:GameServer.Host {0} @@ -7551,6 +7896,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 房间预设锚点;实际怪物及其位置可能不同。 + + 此文件夹的游戏客户端是指向另一个文件夹的链接。请先为它创建副本。 + 请选择完整的文件夹路径。 @@ -7560,6 +7908,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 在 dotnet watch 下运行:保存的 Gateway 代码修改会在几秒内生效,游戏无需退出;热重载无法应用的修改会使 Gateway 自动重启。Auth、Patch 或共享项目的修改需要“重启服务器”。 + + 此文件夹还没有游戏客户端。 + {0} 不是空文件夹。请选择一个空文件夹用于下载。 @@ -7578,6 +7929,12 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 包含一种游戏模式的规则。在此启用后,这些规则将从下次服务器启动起对此联赛的所有角色生效,但不包含该模式自身的技能、商人和任务奖励,游戏仍按原样显示此联赛。取消勾选即可恢复。 + + 使用此版本 + + + 这个 LocalExile 中的游戏版本:从 Steam 获取、保留多个、在它们之间切换 + 未找到 @@ -7704,6 +8061,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 测试 + + 与另一个 LocalExile 文件夹共用客户端 + 未解析的怪物群锚点 @@ -7767,6 +8127,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 卫兵传送门 + + 此客户端属于 LocalExile 的一个源代码副本,由该副本自行管理其客户端。 + 选择一个备份以恢复或删除。 @@ -7923,6 +8286,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 游戏模式 + + 正在向 Steam 请求二维码… + 正在更新 {0}… @@ -7935,6 +8301,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 尚无存档数据库。创建第一个账号即可初始化 LocalExile。 + + {0} 已可以开始游戏。 + 监视进程正在运行,但 Gateway 没有运行中的子进程。请打开 Gateway 输出查看构建错误。 @@ -7944,6 +8313,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 安装与兼容性 + + 这个副本是在切换到另一个版本的中途被保留的,因此并不完整,无法使用。 + 更改玩家账号前,请关闭游戏并停止 LocalExile 服务。 @@ -8034,6 +8406,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 选择颜色:{0} + + 你的流放之路文件夹(只读取): + 正在检查更新 @@ -8140,6 +8515,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 备份时的模组: + + 完成此副本 + 要将所有设置恢复为默认值吗? @@ -8332,6 +8710,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 正在启动、重新构建或重启;请检查 Gateway 输出中的错误 + + 你需要一个 LocalExile 支持的流放之路客户端:你自己的独立版,或者(对于发行版)在本向导之后从 Steam 下载的客户端。 + 不是 3.29.3c 版本 @@ -8344,6 +8725,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 锁争用/秒 + + 使用这台电脑上的客户端 + 贵族 @@ -8443,6 +8827,12 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 {0} 个账号。 + + Waypoint 无法读取这个 LocalExile 支持的版本。请重新打开此窗口。 + + + 面向开发者:直接使用此文件夹,而不是副本。LocalExile 会修改那里的文件,而且该文件夹中的流放之路一旦更新,就可能导致这个 LocalExile 无法运行。 + 选择你的源码副本以开始。 @@ -8476,6 +8866,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 dev host 关闭了连接 + + 驱动器空间不足,无法创建副本:需要 {0:0.#} GB,而可用空间只有 {1:0.#} GB。请释放一些空间后重试;在此之前不会做任何更改。 + 领先 LocalExile {0} 个提交,落后 {1} 个 diff --git a/src/Launcher.Core/SteamDownload.cs b/src/Launcher.Core/SteamDownload.cs new file mode 100644 index 0000000..0c721d9 --- /dev/null +++ b/src/Launcher.Core/SteamDownload.cs @@ -0,0 +1,353 @@ +using System.Globalization; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text.RegularExpressions; + +namespace Launcher.Core; + +/// +/// DepotDownloader (github.com/SteamRE/DepotDownloader, GPL-2.0), the one outside program the Steam download needs. A +/// released Waypoint.exe carries its official release, unchanged (; tools/Get-DepotDownloader.ps1 +/// fetches it when Waypoint is built, and THIRD-PARTY-NOTICES.md has its licence and where its source is), so a user's +/// Waypoint downloads no tool. The first time it is needed it is unpacked under Waypoint's own folder, held to the SHA-256 +/// written here, and it runs as a program of its own. It is self-contained, so nothing else is installed, and neither +/// Steam nor SteamCMD has to be on the PC. Only a Waypoint built without the zip (from source) fetches that same release. +/// +public static class DepotTool +{ + public const string Version = "3.4.0"; + public const string Page = "https://github.com/SteamRE/DepotDownloader"; + const string WindowsUrl = "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_3.4.0/DepotDownloader-windows-x64.zip"; + const string WindowsSha256 = "41c9e9f0df54b3ad02e67a11726756e5c73283bd7c2e1b04acfa5ae4c2ed3767"; + /// The zip's size, for the progress before the server says. + public const long DownloadBytes = 33_474_005; + const string ExeName = "DepotDownloader.exe"; + + /// Only the build that was fetched, hashed and run: Windows on x64. + public static bool Supported => OperatingSystem.IsWindows() && RuntimeInformation.OSArchitecture == Architecture.X64; + + /// The release's zip as Waypoint.exe carries it; null from a build made without it. Set by the app. + public static Func? Bundled { get; set; } + + public static bool IsBundled + { + get + { + using var zip = Bundled?.Invoke(); + return zip is not null; + } + } + + /// One folder whatever the version: the tool keeps its remembered Steam sign-in by where it runs from, so a + /// newer version in the same place still has it. says which version is unpacked there. + public static string Folder(string home) => Path.Combine(home, "tools", "DepotDownloader"); + public static string Executable(string home) => Path.Combine(Folder(home), ExeName); + const string VersionFile = "waypoint-version.txt"; + + public static bool Installed(string home) + { + try { return File.Exists(Executable(home)) && File.ReadAllText(Path.Combine(Folder(home), VersionFile)).Trim() == Version; } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { return false; } + } + + /// Unpacks the release Waypoint.exe carries, or from a build without it fetches that release with + /// ; throws for a file that is not the one pinned. A folder is used + /// only once it is whole: it is unpacked beside its place and renamed into it. + public static async Task InstallAsync(string home, Func http, Action? progress, CancellationToken stop) + { + if (!Supported) throw new IOException(L.Text("The Steam download works on 64-bit Windows only for now.")); + if (Installed(home)) return; + string folder = Folder(home), staging = folder + ".download", zip = Path.Combine(staging, "DepotDownloader.zip"); + if (Directory.Exists(staging)) Directory.Delete(staging, recursive: true); + Directory.CreateDirectory(staging); + try + { + await using (var carried = Bundled?.Invoke()) + { + if (carried is not null) + { + await using var to = new FileStream(zip, FileMode.Create, FileAccess.Write, FileShare.None); + await carried.CopyToAsync(to, stop); + } + else + { + using var client = http(); + using var response = await GitHubDownload.GetAsync(client, WindowsUrl, stop); + response.EnsureSuccessStatusCode(); + long total = response.Content.Headers.ContentLength ?? DownloadBytes, done = 0; + await using var from = await response.Content.ReadAsStreamAsync(stop); + await using var to = new FileStream(zip, FileMode.Create, FileAccess.Write, FileShare.None); + byte[] buffer = new byte[1 << 16]; + int read; + while ((read = await from.ReadAsync(buffer, stop)) > 0) + { + await to.WriteAsync(buffer.AsMemory(0, read), stop); + progress?.Invoke(done += read, total); + } + } + } + string hash; + await using (var file = File.OpenRead(zip)) hash = Convert.ToHexStringLower(await SHA256.HashDataAsync(file, stop)); + if (hash != WindowsSha256) + throw new IOException(L.Text("This DepotDownloader is not the release Waypoint expects, so it was not used.")); + string unpacked = Path.Combine(staging, "tool"); + Directory.CreateDirectory(unpacked); + using (var archive = ZipFile.OpenRead(zip)) + foreach (var entry in archive.Entries) + { + // Its files are at the zip's root; nothing with a folder in its name is wanted. + if (entry.Name.Length == 0 || entry.FullName != entry.Name) continue; + entry.ExtractToFile(Path.Combine(unpacked, entry.Name), overwrite: true); + } + if (!File.Exists(Path.Combine(unpacked, ExeName))) throw new IOException(L.Text("This DepotDownloader is not the release Waypoint expects, so it was not used.")); + await File.WriteAllTextAsync(Path.Combine(unpacked, VersionFile), Version, stop); + Directory.CreateDirectory(Path.GetDirectoryName(folder)!); + if (Directory.Exists(folder)) Directory.Delete(folder, recursive: true); + Directory.Move(unpacked, folder); + } + finally + { + try { if (Directory.Exists(staging)) Directory.Delete(staging, recursive: true); } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + } + } +} + +public enum SteamLineKind +{ + /// Nothing Waypoint acts on. + Other, + /// A file of the depot is whole: how far the depot is, and the file. + Progress, + /// A new sign-in code follows, row by row. + CodeStart, + /// One row of the sign-in code. + CodeRow, + /// The sign-in was approved; the tool names the account it now remembers. + SignedIn, + /// The account has no Path of Exile, or no account was used. + NotAvailable, + /// The remembered sign-in is no longer taken, or there is none: sign in again. + SignInNeeded, +} + +/// A row of the sign-in code: true for a dark square. +public readonly record struct SteamLine(SteamLineKind Kind, double Percent = 0, string? File = null, string? Account = null, bool[]? Cells = null); + +public enum SteamOutcome +{ + Done, + /// Its user stopped it: what was fetched stays, and the next run goes on from it. + Stopped, + /// No sign-in the tool remembers is taken by Steam. + SignInNeeded, + /// The Steam account has no Path of Exile in its library. + NotAvailable, + Failed, +} + +public sealed record SteamResult(SteamOutcome Outcome, string? Message = null); + +/// Which of the build's depots is being fetched, from 1. +/// How far that depot is. +public sealed record SteamProgress(int Depot, int Depots, double Percent, string File); + +/// +/// A client build from Steam, through : which build, and the app, depots and manifests that hold it, +/// are LocalExile's to say (, from LocalExile.exe builds). +/// +/// Steam's anonymous account cannot fetch the game, so a sign-in is needed once. It is the tool's own QR sign-in: +/// Waypoint shows the code the tool prints and the user approves it in the Steam mobile app. Waypoint sees no password and +/// no token. The tool keeps the sign-in (in the Windows user's isolated storage) and reports the account's name, which is +/// all Waypoint keeps, to name that sign-in on later runs. +/// A fetch into a folder that already holds a build downloads only what differs, and removes files the new build no +/// longer has; one that was stopped goes on from what it has. +/// +/// +public static partial class SteamDownload +{ + [GeneratedRegex(@"\A\s*(\d{1,3}\.\d{2})% (.+)\z")] + private static partial Regex ProgressLine(); + + [GeneratedRegex(@"login with -username (\S+) -remember-password")] + private static partial Regex SignedInLine(); + + [GeneratedRegex(@"Total bytes on disk\s*:\s*(\d+)")] + private static partial Regex DiskBytes(); + + /// What one line of the tool's output says. + public static SteamLine Read(string line) + { + if (ProgressLine().Match(line) is { Success: true } progress + && double.TryParse(progress.Groups[1].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out double percent)) + return new(SteamLineKind.Progress, percent, progress.Groups[2].Value); + if (line.Contains("sign in with this QR code", StringComparison.Ordinal)) return new(SteamLineKind.CodeStart); + if (SignedInLine().Match(line) is { Success: true } signedIn) return new(SteamLineKind.SignedIn, Account: signedIn.Groups[1].Value); + if (line.Contains("is not available from this account", StringComparison.Ordinal)) return new(SteamLineKind.NotAvailable); + if (line.Contains("Access token was rejected", StringComparison.Ordinal) || line.Contains("Enter account password", StringComparison.Ordinal) + || line.Contains("Unable to login to Steam3", StringComparison.Ordinal) || line.Contains("has stored credentials", StringComparison.Ordinal)) + return new(SteamLineKind.SignInNeeded); + // A row of the code is two characters a square and nothing a word is made of. + if (line.Length >= 42 && line.Length % 2 == 0 && !line.Any(char.IsAsciiLetterOrDigit)) + { + bool[] cells = new bool[line.Length / 2]; + for (int i = 0; i < cells.Length; i++) cells[i] = line[i * 2] != ' ' || line[i * 2 + 1] != ' '; + return new(SteamLineKind.CodeRow, Cells: cells); + } + return new(SteamLineKind.Other); + } + + /// A line for a log: never a row of the sign-in code, and never the account's name. + public static string? ForLog(string line, string? account) + { + var read = Read(line); + if (read.Kind is SteamLineKind.CodeRow or SteamLineKind.Progress || line.Trim().Length == 0) return null; + if (read.Account is { } named) line = line.Replace(named, ""); + if (account is { Length: > 0 }) line = line.Replace(account, ""); + return Regex.Replace(line, @"Logging '[^']*' into", "Logging '' into"); + } + + static string[] Arguments(ListedBuild build, SteamDepot depot, string target) => + ["-app", build.SteamApp!, "-depot", depot.Depot, "-manifest", depot.Manifest, "-dir", target]; + + /// The tool's QR sign-in. Each code it prints goes to , whole, and again when Steam + /// changes it. The account's name once the user approved it in the Steam mobile app; null when it ended without one. + /// Only the manifest of the build's smallest depot is fetched, into . + public static async Task SignInAsync(string tool, ListedBuild build, string scratch, Action code, Action log, CancellationToken stop) + { + if (!build.FromSteam) return null; + Directory.CreateDirectory(scratch); + string? account = null; + var rows = new List(); + void Line(string line) + { + var read = Read(line); + if (ForLog(line, account) is { } text) log(text); + switch (read.Kind) + { + case SteamLineKind.CodeStart: rows.Clear(); break; + case SteamLineKind.CodeRow: + rows.Add(read.Cells!); + // A code is square: once it has as many rows as a row has squares it is whole. + if (rows.Count == read.Cells!.Length) code([.. rows]); + break; + case SteamLineKind.SignedIn: account = read.Account; break; + } + } + int exit = await ToolProcess.RunAsync(tool, [.. Arguments(build, build.Depots[^1], scratch), "-manifest-only", "-qr", "-remember-password"], scratch, Line, stop, input: "", utf8: true); + return exit == 0 ? account : null; + } + + [GeneratedRegex(@"\A[A-Za-z0-9_.@-]{2,64}\z")] + private static partial Regex AccountName(); + + /// Whether a text can be a Steam account's name: it goes on a command line, so nothing else is taken. + public static bool IsAccountName(string? name) => name is not null && AccountName().IsMatch(name); + + /// + /// The tool's own sign-in with a password, for someone without the Steam mobile app: in a console window of the tool's + /// own, where it asks for the password (not shown as it is typed) and then for the Steam Guard code. Waypoint is given + /// the account's name and nothing else: it reads nothing from that window. True when the tool signed in and now + /// remembers the account. The window stays open after a failure, so that its reason can be read. + /// + public static async Task PasswordSignInAsync(string tool, ListedBuild build, string account, CancellationToken stop) + { + if (!build.FromSteam || !IsAccountName(account) || !OperatingSystem.IsWindows()) return false; + var depot = build.Depots[^1]; + // Everything on this line is a number LocalExile listed, the checked account name, or a name written here: the + // tool is named from the working directory, so that no path has to be quoted for cmd. (With the dot: a PC can + // be set not to look for programs in the current folder.) + string line = $".\\{Path.GetFileName(tool)} -app {build.SteamApp} -depot {depot.Depot} -manifest {depot.Manifest} -manifest-only" + + $" -username {account} -remember-password -dir signin && exit /b 0 || (pause & exit /b 1)"; + var start = new System.Diagnostics.ProcessStartInfo("cmd.exe") + { + WorkingDirectory = Path.GetDirectoryName(tool)!, UseShellExecute = false, CreateNoWindow = false, + Arguments = $"/d /s /c \"title Steam sign-in & {line}\"", + }; + using var process = System.Diagnostics.Process.Start(start); + if (process is null) return false; + try + { + await process.WaitForExitAsync(stop); + return process.ExitCode == 0; + } + catch (OperationCanceledException) + { + try { if (!process.HasExited) process.Kill(entireProcessTree: true); } + catch (Exception e) when (e is InvalidOperationException or System.ComponentModel.Win32Exception) { } + return false; + } + } + + /// How much room the build takes on disk, from its manifests (a few seconds, nothing else is fetched); null + /// when it cannot be told, with why in . + public static async Task<(long? Bytes, SteamResult Result)> SizeAsync(string tool, ListedBuild build, string account, string scratch, Action log, CancellationToken stop) + { + Directory.CreateDirectory(scratch); + long bytes = 0; + foreach (var depot in build.Depots) + { + var result = await RunAsync(tool, [.. Arguments(build, depot, scratch), "-manifest-only", "-username", account, "-remember-password"], scratch, account, null, log, stop); + if (result.Outcome != SteamOutcome.Done) return (null, result); + string listing = Path.Combine(scratch, $"manifest_{depot.Depot}_{depot.Manifest}.txt"); + if (!File.Exists(listing) || DiskBytes().Match(await File.ReadAllTextAsync(listing, stop)) is not { Success: true } size) return (null, new(SteamOutcome.Failed)); + bytes += long.Parse(size.Groups[1].Value, CultureInfo.InvariantCulture); + } + return (bytes, new(SteamOutcome.Done)); + } + + /// Fetches the build into , depot after depot: a folder that holds another build of + /// the game from Steam is brought to this one, and a stopped fetch is gone on with. + public static async Task FetchAsync(string tool, ListedBuild build, string account, string target, Action? progress, Action log, CancellationToken stop) + { + if (!build.FromSteam) return new(SteamOutcome.Failed, L.Text("LocalExile names no Steam download for this version.")); + Directory.CreateDirectory(target); + for (int i = 0; i < build.Depots.Count; i++) + { + int depot = i + 1; + var result = await RunAsync(tool, [.. Arguments(build, build.Depots[i], target), "-username", account, "-remember-password"], target, account, + progress is null ? null : (percent, file) => progress(new(depot, build.Depots.Count, percent, file)), log, stop); + if (result.Outcome != SteamOutcome.Done) return result; + } + return new(SteamOutcome.Done); + } + + static async Task RunAsync(string tool, string[] arguments, string directory, string account, Action? progress, Action log, CancellationToken stop) + { + bool notAvailable = false, signIn = false; + string? last = null; + void Line(string line) + { + var read = Read(line); + if (ForLog(line, account) is { } text) + { + log(text); + last = text; + } + switch (read.Kind) + { + case SteamLineKind.Progress: progress?.Invoke(read.Percent, Path.GetFileName(read.File!)); break; + case SteamLineKind.NotAvailable: notAvailable = true; break; + case SteamLineKind.SignInNeeded: signIn = true; break; + } + } + try + { + int exit = await ToolProcess.RunAsync(tool, arguments, directory, Line, stop, input: "", utf8: true); + if (exit == 0) return new(SteamOutcome.Done); + } + catch (OperationCanceledException) { return new(SteamOutcome.Stopped); } + catch (Exception e) when (e is System.ComponentModel.Win32Exception or IOException) { return new(SteamOutcome.Failed, e.Message); } + return signIn ? new(SteamOutcome.SignInNeeded) : notAvailable ? new(SteamOutcome.NotAvailable) : new(SteamOutcome.Failed, last); + } + + /// What an outcome that is not Done means, for its user. + public static string Explain(SteamResult result) => result.Outcome switch + { + SteamOutcome.NotAvailable => L.Text("That Steam account has no Path of Exile. Add the game to its library in Steam (it is free), then try again."), + SteamOutcome.SignInNeeded => L.Text("Steam asks for the sign-in again."), + SteamOutcome.Stopped => L.Text("Stopped. What was downloaded is kept, and the next try goes on from it."), + _ => result.Message is { Length: > 0 } message ? L.Text("The Steam download did not finish: {0}", message) : L.Text("The Steam download did not finish."), + }; +} diff --git a/src/Waypoint.Linux/Views/FolderPicker.axaml b/src/Waypoint.Linux/Views/FolderPicker.axaml index 4e8516b..34aa945 100644 --- a/src/Waypoint.Linux/Views/FolderPicker.axaml +++ b/src/Waypoint.Linux/Views/FolderPicker.axaml @@ -92,6 +92,8 @@ + + @@ -122,7 +124,9 @@ - + + + diff --git a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs index 2b68472..5080c8a 100644 --- a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs +++ b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs @@ -14,6 +14,8 @@ sealed class FolderRow(KnownFolder folder) { public KnownFolder Folder { get; } = folder; public string Title => Folder.Title; + /// Which version of the game the folder's client is, beside its title; empty when that is not known. + public string Client => Folder.ClientText ?? ""; public string Path => Folder.Path; /// The row has room for about this much of a path; the tooltip has all of it. public string ShortPath => FolderList.Short(Folder.Path, 52); @@ -27,7 +29,7 @@ sealed class FolderRow(KnownFolder folder) public string Tip => Folder.Path; public string Spoken => Folder.Current ? L.Text("{0}, {1}, in use", Folder.Title, Folder.Path) : Folder.Kind == FolderKind.Missing ? L.Text("{0}, {1}, not found", Folder.Title, Folder.Path) - : $"{Folder.Title}, {Folder.Path}"; + : Folder.ClientText is { } client ? $"{Folder.Title}, {client}, {Folder.Path}" : $"{Folder.Title}, {Folder.Path}"; /// What a screen reader is given for the row as an item of the list. public override string ToString() => Spoken; } @@ -68,11 +70,33 @@ internal void ShowCurrent() CurrentIcon.Kind = IconOf(folder.Kind); CurrentTitle.Text = folder.Title; CurrentPath.Text = FolderList.Short(folder.Path); + ShowCurrentClient(_client.Path == folder.Path ? _client.Version : null); + _ = ReadCurrentClientAsync(folder); // The box may be too narrow for a long branch name or path: all of both is here. ToolTip.SetTip(Current, $"{folder.Title}\n{folder.Path}\n{L.Text("Click for your other LocalExile folders")}"); AutomationProperties.SetName(Current, L.Text("LocalExile folder: {0}, {1}", folder.Title, folder.Path)); } + /// The version of the client in the folder in use, as last read: shown at once while it is read again. + (string Path, string? Version) _client = ("", null); + + /// The client's version under the folder's name, once it is read (off the UI thread: the first reading hashes + /// the executable). + async Task ReadCurrentClientAsync(KnownFolder folder) + { + string? version = await Task.Run(() => FolderList.ClientOf(folder.Path)); + if (!FolderList.Same(folder.Path, Environment.CurrentDirectory)) return; + _client = (folder.Path, version); + ShowCurrentClient(version); + } + + void ShowCurrentClient(string? version) + { + string? client = FolderList.ClientText(version); + CurrentClient.Text = client ?? ""; + CurrentClient.IsVisible = client is not null; + } + async void OpenList(object? sender, RoutedEventArgs e) { // A click outside the list closes it and goes no further, so this is always a click to open. @@ -95,7 +119,7 @@ async Task FillAsync() { string current = Environment.CurrentDirectory; var paths = FolderList.Paths(_shared.Settings, current); - var folders = await Task.Run(() => FolderList.Read(paths, current)); + var folders = await Task.Run(() => FolderList.Read(paths, current, client: true)); Rows.ItemsSource = folders.Select(folder => new FolderRow(folder)).ToArray(); } diff --git a/src/Waypoint.Linux/Views/InstallTab.axaml b/src/Waypoint.Linux/Views/InstallTab.axaml index f0dc23f..559872f 100644 --- a/src/Waypoint.Linux/Views/InstallTab.axaml +++ b/src/Waypoint.Linux/Views/InstallTab.axaml @@ -17,6 +17,8 @@ HorizontalContentAlignment="Center" VerticalContentAlignment="Center" /> + + bool CanGoBackFor(string build) => FolderNeeds is { } needs && ChosenCheckout() is { } folder && !LocalExileReleases.IsInstall(folder) && RepositoryDiscovery.IsLocalExile(folder) && ClientLocator.IsOlder(build, needs) && ClientLocator.LastVersionFor(build) is not null - && !_clients.Any(c => c.Usable && c.Build == needs); + && !_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 || build == NeededClient || CanGoBackFor(build); + bool Fits(FoundClient client) => client.Build is not { } build || Runs(build) || CanGoBackFor(build); static bool HasClient(string? checkout) => - checkout is not null && ClientLocator.Classify(Path.Combine(checkout, "Client")) is ClientKind.Ready or ClientKind.Standalone; + checkout is not null && (ClientLocator.Classify(Path.Combine(checkout, "Client")) is ClientKind.Ready or ClientKind.Standalone + || ClientVersions.Layout(checkout) == ClientLayout.Steam); async void SearchClientsClicked(object sender, RoutedEventArgs e) => await FindClientsAsync(); @@ -553,7 +556,15 @@ async Task FindClientsAsync() ClientStatus.Text = usable > 0 ? L.Text("Found {0} on this PC. Choose the one to use.", usable) : 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("Browse to a folder with PathOfExile.exe and Content.ggpk. It must be a standalone 3.29.3c install: Steam and Epic installs do not work, and Waypoint cannot download the game.") + // Without a client, the Play page's Finish setup can download the game: said here, where the user is stuck, and + // only where it will hold. That is a release (a source copy's Play page has no download) whose LocalExile + // lists a build Steam can deliver; one not installed yet will be the newest, which does. + bool download = usable == 0 && DepotTool.Supported && UsingRelease + && (checkout is null || !LocalExileReleases.IsInstall(checkout) || await Task.Run(() => ClientVersions.FirstDownload(checkout) is not null)); + 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) + + " " + (download ? L.Text("If you have no such folder, tick the box below. Finish setup on the Play page can then download the game from Steam.") + : 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.") : ""; } @@ -595,7 +606,7 @@ async void ClientSelected(object sender, SelectionChangedEventArgs e) var client = ClientList.SelectedItem as FoundClient; _sharedKeys = null; ShareClient.Visibility = Visibility.Collapsed; - LinkClient.Visibility = UsingRelease && client is not null ? Visibility.Visible : Visibility.Collapsed; + LinkClient.Visibility = UsingRelease && client is not null && _settings.Developer ? Visibility.Visible : Visibility.Collapsed; if (client is not null) ClientNote.Text = ClientWarning(client); ShowRail(); UpdateButtons(); @@ -622,7 +633,7 @@ void ShowSettings() string? checkout = ChosenCheckout(); bool has = HasClient(checkout); string client = has ? Path.Combine(checkout!, "Client") : (ClientList.SelectedItem as FoundClient)?.Folder ?? ""; - bool linked = has ? ClientSettings.IsLink(client) : LinkedClient; + bool linked = has ? ClientSettings.IsLink(client) : Sharing || Linking; SettingsWhy.Text = ClientSettings.WhyUnknown(client, linked); OwnSettingsNote.Text = L.Text("LocalExile keeps its own graphics, keys and saved login in {0}, and starts with the network mode it needs. Your normal game's settings are only read, once, as a starting point.", ClientSettings.OwnFolderPath); } @@ -630,6 +641,10 @@ void ShowSettings() /// The chosen client is shared through a link, with the keys of this folder, instead of copied. bool Sharing => _sharedKeys is not null && ShareClient.IsChecked == true; + /// For developers only, as LocalExile's own --client-mode link is: the release's client is a link to the + /// chosen folder instead of a copy of it. Never offered without Developer Mode. + bool Linking => _settings.Developer && LinkClient.IsChecked == true; + /// A wrong client only fails later, at the keys, after a long copy: this says so now. It stays the player's call, /// because a build Waypoint does not know may be one a newer server supports. string ClientWarning(FoundClient client) @@ -644,8 +659,8 @@ string ClientWarning(FoundClient client) return (FolderNeeds is null ? 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("This is not the 3.29.3c build LocalExile needs, so preparing it will probably fail. You can still try, but check the version first: the copy is large."); - if (Sharing || LinkClient.IsChecked == true) return ""; + 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."); + 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 ? L.Text("Not enough free space: the client needs {0:0.#} GB more on this drive, and {1:0.#} GB is free.", plan.Remaining / 1e9, free / 1e9) : ""; @@ -798,7 +813,7 @@ void ShowProgress(long done, long total) async Task PrepareReleaseAsync(string folder, string? client, Action detail, CancellationToken stop) { List arguments = ["setup"]; - if (client is not null && !HasClient(folder)) arguments.AddRange(["--client", client, "--client-mode", LinkClient.IsChecked == true ? "link" : "copy"]); + if (client is not null && !HasClient(folder)) arguments.AddRange(["--client", client, "--client-mode", Linking ? "link" : "copy"]); string? password = null; if (AccountProblem() is null) { diff --git a/src/Waypoint/Shared.cs b/src/Waypoint/Shared.cs index 67187dc..d289e91 100644 --- a/src/Waypoint/Shared.cs +++ b/src/Waypoint/Shared.cs @@ -42,6 +42,9 @@ public Shared() Metrics = new Metrics(Monitor); // The player's other LocalExile folders: their clients are the first place a move to another client build looks. ClientUpdate.KnownFolders = () => [Settings.ServerPath, Settings.ReleaseFolder, Settings.LatestFolder, .. Settings.KnownFolders]; + // Which client versions this folder's LocalExile runs is asked of it once, ahead of the first page that needs it. + string folder = Environment.CurrentDirectory; + _ = Task.Run(() => ClientLocator.Supported(folder)); Workspace = new Workspace(this); // The log on disk leaves out the account and character names Waypoint comes to know. if (SessionLog.Current is { } disk) disk.PrivateNames = () => Workspace.PrivateNames; diff --git a/src/Waypoint/SteamSignInWindow.cs b/src/Waypoint/SteamSignInWindow.cs new file mode 100644 index 0000000..bcf62d6 --- /dev/null +++ b/src/Waypoint/SteamSignInWindow.cs @@ -0,0 +1,103 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace Waypoint; + +/// +/// The Steam sign-in for the game client's download: DepotDownloader's own QR sign-in, with the code it prints drawn here +/// (). The user scans it with the Steam mobile app and approves; Steam changes the +/// code now and then, and the picture follows. The tool gives up after about two minutes without an approval: the window +/// then says so and offers a new code. Waypoint sees no password and no token: the tool keeps the sign-in, and says only +/// the account's name (). +/// +sealed class SteamSignInWindow : FormWindow +{ + readonly Image _code = new() { Width = 340, Height = 340, Stretch = Stretch.Uniform }; + readonly TextBlock _status = new() { TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 12, 0, 0) }; + readonly Button _again = new() { Margin = new Thickness(0, 0, 8, 0), Visibility = Visibility.Collapsed }; + readonly CancellationTokenSource _stop = new(); + readonly string _tool, _scratch; + readonly ListedBuild _build; + readonly Action _log; + + /// The account the tool now remembers; null when the window closed without a sign-in. + public string? Account { get; private set; } + + /// The user has no Steam mobile app and asked for the tool's password prompt instead: the window that opened + /// this one runs it. + public bool UsePassword { get; private set; } + + public SteamSignInWindow(Window? owner, string tool, ListedBuild build, string scratch, Action log) + { + (_tool, _build, _scratch, _log) = (tool, build, scratch, log); + DialogLayout.Configure(this, owner, L.Text("Sign in to Steam"), 460); + RenderOptions.SetBitmapScalingMode(_code, BitmapScalingMode.NearestNeighbor); + var root = new StackPanel { Margin = new Thickness(24) }; + root.Children.Add(new TextBlock + { + TextAlignment = TextAlignment.Center, Margin = new Thickness(0, 0, 0, 14), + Text = L.Text("Scan this code with the Steam mobile app (Steam Guard, then the scan button) and approve the sign-in. The game comes from your own Steam account, which needs Path of Exile in its library."), + }); + // A code is read against white, whatever the theme. + root.Children.Add(new Border { Background = Brushes.White, Padding = new Thickness(10), HorizontalAlignment = HorizontalAlignment.Center, Child = _code }); + root.Children.Add(_status); + var buttons = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 16, 0, 0) }; + _again.Content = L.Text("New code"); + _again.Click += (_, _) => _ = RunAsync(); + var cancel = new Button { Content = L.Text("Cancel"), IsCancel = true }; + cancel.Click += (_, _) => Close(); + var password = new Button { Content = L.Text("Sign in with a password…"), Margin = new Thickness(0, 0, 8, 0), + ToolTip = L.Text("Without the Steam mobile app: the download tool asks for the password and the Steam Guard code in a window of its own. Waypoint sees neither.") }; + password.Click += (_, _) => { UsePassword = true; Close(); }; + buttons.Children.Add(password); + buttons.Children.Add(_again); + buttons.Children.Add(cancel); + root.Children.Add(buttons); + Content = root; + Closed += (_, _) => _stop.Cancel(); + Loaded += (_, _) => _ = RunAsync(); + } + + /// One run of the tool's sign-in: it ends with an account, or without one when nobody approved a code in time. + async Task RunAsync() + { + _again.Visibility = Visibility.Collapsed; + _status.Text = L.Text("Asking Steam for a code …"); + try + { + Account = await SteamDownload.SignInAsync(_tool, _build, _scratch, rows => Dispatcher.BeginInvoke(() => + { + _code.Source = Picture(rows); + _code.Opacity = 1; + _status.Text = L.Text("Waiting for you to scan and approve …"); + }), _log, _stop.Token); + } + catch (OperationCanceledException) { return; } + catch (Exception e) when (e is System.ComponentModel.Win32Exception or IOException) { _log(e.Message); } + if (_stop.IsCancellationRequested) return; + if (Account is not null) + { + Close(); + return; + } + // The code on screen is no longer good: it stays, greyed, so the window does not jump. + _code.Opacity = 0.15; + _status.Text = L.Text("The code was not approved in time, so Steam let it go. Ask for a new one when you have the Steam app ready."); + _again.Visibility = Visibility.Visible; + } + + /// The code as a picture, a pixel a square: the Image scales it without smoothing. + static BitmapSource Picture(bool[][] rows) + { + int width = rows.Max(row => row.Length), height = rows.Length; + byte[] pixels = new byte[width * height]; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + pixels[y * width + x] = x < rows[y].Length && rows[y][x] ? (byte)0 : (byte)255; + var picture = BitmapSource.Create(width, height, 96, 96, PixelFormats.Gray8, null, pixels, width); + picture.Freeze(); + return picture; + } +} diff --git a/src/Waypoint/Waypoint.csproj b/src/Waypoint/Waypoint.csproj index 67cbfef..0118109 100644 --- a/src/Waypoint/Waypoint.csproj +++ b/src/Waypoint/Waypoint.csproj @@ -35,6 +35,14 @@ + + + + + diff --git a/tests/Waypoint.Tests/ClientBuildListTests.cs b/tests/Waypoint.Tests/ClientBuildListTests.cs new file mode 100644 index 0000000..c85998c --- /dev/null +++ b/tests/Waypoint.Tests/ClientBuildListTests.cs @@ -0,0 +1,159 @@ +using System.Security.Cryptography; + +namespace Waypoint.Tests; + +/// Which client versions a LocalExile runs is that LocalExile's to say (), and a +/// client of any of them fits its folder (, ). +[Collection(nameof(ClientUpdateTests))] +public class ClientBuildListTests : IDisposable +{ + readonly string _top = Path.Combine(Path.GetTempPath(), "Waypoint-builds-" + Guid.NewGuid().ToString("N")); + readonly Dictionary _builds = new(StringComparer.OrdinalIgnoreCase); + readonly Dictionary _found = []; + readonly Dictionary> _lists = new(StringComparer.OrdinalIgnoreCase); + string Folder => Path.Combine(_top, "LocalExile"); + string Client => Path.Combine(Folder, "Client"); + + // LocalExile v0.5.0-beta's answer to "builds --json", as its launcher prints it. + static readonly string[] Answer = + [ + """{"schema":1,"event":"build","time":"2026-11-12T03:00:00.0000000Z","version":"3.29.3c","name":"release, build 327984","executableSha256":"cc8aa38345be2a837575215d2ce142ebecf7b007345843265b335ebb8ac5964c","steamIndexSha256":null,"steamApp":null,"steamManifests":null}""", + """{"schema":1,"event":"build","time":"2026-11-12T03:00:00.0000000Z","version":"3.29.3c","name":"3.29.3.5 hotfix of 2026-11-09, build 328126","executableSha256":"01a22facf36886b39bca74793c0d8c7295b1495f1625b4ebc7b23c2de32a70cf","steamIndexSha256":"d23c78997206716586041a3e47a89dde0eb516f1488df4a1ccf39b0d51be54d0","steamApp":"238960","steamManifests":[{"depot":"238961","manifest":"2467965126630699088"},{"depot":"238962","manifest":"1925736551784903498"}]}""", + """{"schema":1,"event":"build","time":"2026-11-12T03:00:00.0000000Z","version":"3.29.3d","name":"release of 2026-11-10, build 328228","executableSha256":"e9ba3d31c4d922e1826ef01d02fd22178a001b29e17264b68fc2446efd41f53d","steamIndexSha256":"53560cc6391d2b11276f480ce5ebe86eb75a26935064c846aa99499f376bac29","steamApp":"238960","steamManifests":[{"depot":"238961","manifest":"5379264335337066375"},{"depot":"238962","manifest":"8687196073893351989"}]}""", + ]; + + public ClientBuildListTests() + { + Directory.CreateDirectory(Path.Combine(Folder, "data")); + ClientLocator.BuildOverride = folder => _builds.TryGetValue(Path.GetFullPath(folder), out var build) ? build : null; + ClientUpdate.FindClient = (build, _) => _found.TryGetValue(build, out var folder) ? folder : null; + LocalExileBuilds.Override = folder => _lists.TryGetValue(Path.GetFullPath(folder), out var list) ? list : null; + } + + public void Dispose() + { + ClientLocator.BuildOverride = null; + LocalExileBuilds.Override = null; + ClientUpdate.FindClient = (build, stop) => + ClientLocator.Find([], stop, TimeSpan.FromSeconds(2)).Clients.FirstOrDefault(c => c.Usable && c.Build == build)?.Folder; + if (Directory.Exists(_top)) Directory.Delete(_top, recursive: true); + } + + /// A release whose release.json names 3.29.3c, as every release does, with a client of . + void Release(string? has, bool withList) + { + File.WriteAllText(Path.Combine(Folder, "release.json"), """{"version":"0.5.0-beta","commit":"b0929b2","client":"3.29.3c"}"""); + if (withList) _lists[Folder] = LocalExileBuilds.Parse(Answer); + if (has is null) return; + Directory.CreateDirectory(Client); + File.WriteAllText(Path.Combine(Client, "Content.ggpk"), new string('x', 1000)); + _builds[Client] = has; + } + + [Fact] + public void The_launchers_answer_names_each_build_with_its_Steam_manifests_as_text() + { + var builds = LocalExileBuilds.Parse([.. Answer, "not an event", """{"schema":1,"event":"info","message":"x"}""", """{"event":"build","version":"9.9.9","executableSha256":"short"}"""]); + Assert.Equal(["3.29.3c", "3.29.3c", "3.29.3d"], builds.Select(b => b.Version)); + Assert.False(builds[0].FromSteam); + Assert.Null(builds[0].SteamIndexSha256); + var d = builds[2]; + Assert.True(d.FromSteam); + Assert.Equal("238960", d.SteamApp); + Assert.Equal([new SteamDepot("238961", "5379264335337066375"), new SteamDepot("238962", "8687196073893351989")], d.Depots); + Assert.Equal("release of 2026-11-10, build 328228", d.Name); + } + + [Fact] + public void A_source_copys_list_is_read_from_its_ClientBuilds_file() + { + const string source = """ + public static class ClientBuilds + { + public const uint SteamApp = 238960; + + public static IReadOnlyList Allowed { get; } = + [ + // Its executables are depot 238962 manifest 6963407386864245615; its Steam game files were never checked. + new("3.29.3c", "release, build 327984", + "cc8aa38345be2a837575215d2ce142ebecf7b007345843265b335ebb8ac5964c", 0x142feaed0), + new("3.29.3d", "release of 2026-11-10, build 328228", + "e9ba3d31c4d922e1826ef01d02fd22178a001b29e17264b68fc2446efd41f53d", 0x142feaeb0, + SteamIndexSha256: "53560cc6391d2b11276f480ce5ebe86eb75a26935064c846aa99499f376bac29", + SteamManifests: [new(238961, 5379264335337066375), new(238962, 8687196073893351989)]), + ]; + } + """; + var builds = LocalExileBuilds.ParseSource(source); + Assert.Equal(["3.29.3c", "3.29.3d"], builds.Select(b => b.Version)); + Assert.False(builds[0].FromSteam); + Assert.Empty(builds[0].Depots); + Assert.Equal("53560cc6391d2b11276f480ce5ebe86eb75a26935064c846aa99499f376bac29", builds[1].SteamIndexSha256); + Assert.Equal("238960", builds[1].SteamApp); + Assert.Equal([new SteamDepot("238961", "5379264335337066375"), new SteamDepot("238962", "8687196073893351989")], builds[1].Depots); + Assert.Empty(LocalExileBuilds.ParseSource("nothing like a list")); + } + + [Fact] + public void A_LocalExile_that_lists_its_builds_runs_every_version_listed() + { + Release("3.29.3c", withList: true); + Assert.Equal(["3.29.3d", "3.29.3c"], ClientLocator.Supported(Folder)); + // Its 3.29.3c client fits, although a newer version is listed and a client of it is on the PC. + Assert.Equal("3.29.3c", ClientLocator.Needed(Folder)); + _found["3.29.3d"] = @"E:\Path of Exile"; + Assert.Null(ClientUpdate.Check(Folder, lookForNewer: true)); + Assert.Null(ClientLocator.Outdated(Folder)); + Assert.Null(ClientUpdate.OlderVersionOf(Folder)); + _builds[Client] = "3.29.3d"; + Assert.Equal("3.29.3d", ClientLocator.Needed(Folder)); + Assert.Null(ClientUpdate.Check(Folder, lookForNewer: true)); + Assert.Null(ClientLocator.Newer(Folder)); + } + + [Fact] + public void A_release_that_cannot_list_them_runs_the_one_version_it_names() + { + Release("3.29.3d", withList: false); + Assert.Equal(["3.29.3c"], ClientLocator.Supported(Folder)); + // v0.4.3-beta with a client the official launcher took to 3.29.3d: LocalExile needs the update, not the client. + var plan = ClientUpdate.Check(Folder)!; + Assert.Equal(ClientUpdate.Kind.UpdateLocalExile, plan.Kind); + Assert.Equal(("3.29.3d", "3.29.3c"), (plan.Have, plan.Need)); + // It is on a current LocalExile all the same: no note that its version is going away. + Assert.Null(ClientUpdate.OlderVersionOf(Folder)); + } + + [Fact] + public void An_older_client_moves_to_whichever_listed_version_is_on_the_PC() + { + Release("3.29.3b", withList: true); + _found["3.29.3c"] = @"D:\Path of Exile 3.29.3c"; + var plan = ClientUpdate.Check(Folder)!; + Assert.Equal(ClientUpdate.Kind.Replace, plan.Kind); + Assert.Equal(("3.29.3b", "3.29.3c", @"D:\Path of Exile 3.29.3c"), (plan.Have, plan.Need, plan.Found)); + // The newest listed version first, when both are there. + _found["3.29.3d"] = @"E:\Path of Exile"; + plan = ClientUpdate.Check(Folder)!; + Assert.Equal(("3.29.3d", @"E:\Path of Exile"), (plan.Need, plan.Found)); + Assert.Equal(@"E:\Path of Exile", ClientUpdate.FindCurrent()); + } + + [Fact] + public void A_build_a_LocalExile_lists_is_recognized_by_its_executable() + { + // A build Waypoint has no row for: the list names its executable's hash and its version. + ClientLocator.BuildOverride = null; + string client = Path.Combine(_top, "A newer client"); + Directory.CreateDirectory(client); + byte[] executable = new byte[17 << 20]; + executable[0] = 0x4d; + executable[^1] = 0x5a; + File.WriteAllBytes(Path.Combine(client, "PathOfExileSteam.exe"), executable); + Assert.Null(ClientLocator.BuildOf(client)); + ClientLocator.Learn([new("3.29.3z", "a later patch", Convert.ToHexStringLower(SHA256.HashData(executable)))]); + Assert.Equal("3.29.3z", ClientLocator.BuildOf(client)); + Assert.True(ClientLocator.IsOlder("3.29.3d", "3.29.3z")); + Assert.Single(ClientLocator.ExecutableHashesFor("3.29.3z")); + } +} diff --git a/tests/Waypoint.Tests/ClientExtractionFailureTests.cs b/tests/Waypoint.Tests/ClientExtractionFailureTests.cs index ffaefd7..fd25650 100644 --- a/tests/Waypoint.Tests/ClientExtractionFailureTests.cs +++ b/tests/Waypoint.Tests/ClientExtractionFailureTests.cs @@ -36,7 +36,7 @@ public async Task Other_extraction_failures_keep_their_own_error() Assert.Equal("Node is missing", error.Message); // The release and its 3.29.3.5 hotfix are both the 3.29.3c build. Assert.Equal(2, ClientLocator.ExecutableHashesFor("3.29.3c").Length); - Assert.Equal(ClientLocator.KnownExecutable, ClientLocator.ExecutableHashesFor("3.29.3c")[0]); + Assert.Equal(ClientLocator.KnownExecutable, ClientLocator.ExecutableHashesFor(ClientLocator.Build)[0]); Assert.Single(ClientLocator.ExecutableHashesFor("3.29.3b")); Assert.Empty(ClientLocator.ExecutableHashesFor("future build")); } diff --git a/tests/Waypoint.Tests/ClientUpdateTests.cs b/tests/Waypoint.Tests/ClientUpdateTests.cs index f297529..83476c8 100644 --- a/tests/Waypoint.Tests/ClientUpdateTests.cs +++ b/tests/Waypoint.Tests/ClientUpdateTests.cs @@ -56,10 +56,14 @@ public void A_folder_says_which_client_it_needs() [Fact] public void Builds_are_ordered_and_the_older_one_keeps_its_last_version() { - Assert.Equal("3.29.3c", ClientLocator.Build); + Assert.Equal(["3.29.3d", "3.29.3c"], ClientLocator.Current); + Assert.Equal("3.29.3d", ClientLocator.Build); Assert.True(ClientLocator.IsOlder("3.29.3b", "3.29.3c")); + Assert.True(ClientLocator.IsOlder("3.29.3c", "3.29.3d")); + Assert.True(ClientLocator.IsOlder("3.29.3d", "3.30.0")); Assert.False(ClientLocator.IsOlder("3.29.3c", "3.29.3b")); - Assert.False(ClientLocator.IsOlder("3.29.3a", "3.29.3c")); + Assert.False(ClientLocator.IsOlder("3.29.3c", "3.29.3c")); + Assert.False(ClientLocator.IsOlder("not a version", "3.29.3c")); Assert.Equal(new ClientLocator.OlderVersion("v0.1.0-beta", "7724004c8f13fce2c5e8a8c29ff40ef4b4ef10de"), ClientLocator.LastVersionFor("3.29.3b")); Assert.Null(ClientLocator.LastVersionFor("3.29.3c")); } diff --git a/tests/Waypoint.Tests/ClientVersionsTests.cs b/tests/Waypoint.Tests/ClientVersionsTests.cs new file mode 100644 index 0000000..3c2276d --- /dev/null +++ b/tests/Waypoint.Tests/ClientVersionsTests.cs @@ -0,0 +1,324 @@ +using System.Security.Cryptography; + +namespace Waypoint.Tests; + +/// The versions of the game a LocalExile folder holds (), and what DepotDownloader's +/// output says (). The lines are the tool's own, as version 3.4.0 printed them. +[Collection(nameof(ClientUpdateTests))] +public class ClientVersionsTests : IDisposable +{ + readonly string _top = Path.Combine(Path.GetTempPath(), "Waypoint-versions-" + Guid.NewGuid().ToString("N")); + readonly Dictionary _builds = new(StringComparer.OrdinalIgnoreCase); + string Folder => Path.Combine(_top, "LocalExile"); + string Client => Path.Combine(Folder, "Client"); + + public ClientVersionsTests() + { + Directory.CreateDirectory(Folder); + ClientLocator.BuildOverride = folder => _builds.TryGetValue(Path.GetFullPath(folder), out var build) ? build : null; + } + + public void Dispose() + { + ClientLocator.BuildOverride = null; + if (Directory.Exists(_top)) Directory.Delete(_top, recursive: true); + } + + /// A client as Steam lays it out, of , with what LocalExile adds beside it. + string Steam(string folder, string version, string mark = "") + { + Directory.CreateDirectory(Path.Combine(folder, "Bundles2")); + File.WriteAllText(Path.Combine(folder, "Bundles2", "_.index.bin"), "index of " + version); + File.WriteAllText(Path.Combine(folder, "PathOfExileSteam.exe"), "game " + version + mark); + File.WriteAllText(Path.Combine(folder, "Game.patched.exe"), "patched " + version); + _builds[folder] = version; + return folder; + } + + [Fact] + public void A_folders_client_is_told_as_LocalExile_tells_it() + { + Assert.Equal(ClientLayout.None, ClientVersions.Layout(Folder)); + Steam(Client, "3.29.3d"); + Assert.Equal(ClientLayout.Steam, ClientVersions.Layout(Folder)); + // A Content.ggpk wins, as in LocalExile's own check. + File.WriteAllText(Path.Combine(Client, "Content.ggpk"), "archive"); + Assert.Equal(ClientLayout.Standalone, ClientVersions.Layout(Folder)); + } + + [Fact] + public void A_kept_client_comes_back_by_two_renames_and_the_one_in_use_takes_its_place() + { + Steam(Client, "3.29.3d"); + string kept = Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c"), "3.29.3c"); + var listed = Assert.Single(ClientVersions.Kept(Folder)); + Assert.Equal(("3.29.3c", "3.29.3c", kept), (listed.Name, listed.Version, listed.Folder)); + Assert.True(listed.Bytes > 0); + + ClientVersions.Use(Folder, "3.29.3c"); + Assert.Equal("game 3.29.3c", File.ReadAllText(Path.Combine(Client, "PathOfExileSteam.exe"))); + // What LocalExile prepared for it is still there: nothing is downloaded or patched again. + Assert.Equal("patched 3.29.3c", File.ReadAllText(Path.Combine(Client, "Game.patched.exe"))); + string aside = Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3d"); + Assert.Equal("game 3.29.3d", File.ReadAllText(Path.Combine(aside, "PathOfExileSteam.exe"))); + + ClientVersions.Delete(Folder, "3.29.3d"); + Assert.False(Directory.Exists(aside)); + Assert.Empty(ClientVersions.Kept(Folder)); + Assert.True(File.Exists(Path.Combine(Client, "PathOfExileSteam.exe"))); + } + + [Fact] + public void Two_kept_clients_of_one_version_keep_apart_and_an_unfinished_client_is_not_set_aside() + { + Steam(Client, "3.29.3c", " in use"); + Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c"), "3.29.3c", " kept"); + ClientVersions.Use(Folder, "3.29.3c"); + Assert.Equal("game 3.29.3c kept", File.ReadAllText(Path.Combine(Client, "PathOfExileSteam.exe"))); + // The name was taken while the two changed places: the one set aside gets a number. + Assert.Equal("game 3.29.3c in use", File.ReadAllText(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c (2)", "PathOfExileSteam.exe"))); + + File.WriteAllText(Path.Combine(Client, ClientVersions.Marker), "3.29.3d"); + Assert.Equal("3.29.3d", ClientVersions.Unfinished(Folder)); + Assert.Throws(() => ClientVersions.Use(Folder, "3.29.3c (2)")); + Assert.True(Directory.Exists(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c (2)"))); + Assert.Equal("game 3.29.3c kept", File.ReadAllText(Path.Combine(Client, "PathOfExileSteam.exe"))); + } + + [Fact] + public void Every_build_Steam_can_deliver_is_offered_but_those_the_folder_holds() + { + static ListedBuild Build(string version, string name, string hash, bool steam = true) => + new(version, name, hash, null, steam ? "238960" : null, steam ? [new("238961", "1" + hash.Length)] : null); + ListedBuild release = Build("3.29.3c", "release", "aa"), plain = Build("3.29.3c", "not on Steam", "ab", steam: false), + hotfix = Build("3.29.3c", "hotfix", "bb"), d = Build("3.29.3d", "release", "cc"); + ListedBuild[] listed = [release, plain, hotfix, d]; + + // Newest first, a version's two builds each on a line of its own, and never one Steam cannot deliver. + Assert.Equal([d, hotfix, release], ClientVersions.Offered(listed, null, whole: true, [])); + Assert.True(ClientVersions.Several(listed, "3.29.3c")); + Assert.False(ClientVersions.Several(listed, "3.29.3d")); + // The hotfix in use still leaves the release of the same version to get, and a kept build is not offered again. + Assert.Equal([d, release], ClientVersions.Offered(listed, hotfix, whole: true, [])); + Assert.Equal([release], ClientVersions.Offered(listed, hotfix, whole: true, [d, null])); + // A client half-way to another build may also go back to the one it was. + Assert.Equal([d, hotfix, release], ClientVersions.Offered(listed, hotfix, whole: false, [])); + } + + [Fact] + public void The_newest_build_on_offer_is_the_highest_version_whatever_the_order_and_a_hotfix_before_its_release() + { + static ListedBuild Build(string version, string name) => new(version, name, name, null, "238960", [new("238961", "1")]); + ListedBuild release = Build("3.29.3c", "release"), hotfix = Build("3.29.3c", "hotfix"), d = Build("3.29.3d", "d"); + // As Offered gives them (newest first), and in an order no list has today: the version decides, not the place. + Assert.Same(d, ClientVersions.Newest([d, hotfix, release])); + Assert.Same(d, ClientVersions.Newest([hotfix, release, d])); + // Of one version's builds, the first offered: LocalExile's latest of them. + Assert.Same(hotfix, ClientVersions.Newest([hotfix, release])); + Assert.Null(ClientVersions.Newest([])); + } + + [Fact] + public void A_version_of_two_listed_builds_is_several_whether_Steam_delivers_both_or_not() + { + // LocalExile v0.5.0-beta's own list: the 3.29.3c release has no Steam data, its hotfix has. + ListedBuild[] listed = [new("3.29.3c", "release", "aa"), new("3.29.3c", "hotfix", "bb", null, "238960", [new("238961", "1")]), + new("3.29.3d", "release", "cc", null, "238960", [new("238961", "2")])]; + Assert.True(ClientVersions.Several(listed, "3.29.3c")); + Assert.False(ClientVersions.Several(listed, "3.29.3d")); + } + + [Fact] + public void A_clients_files_say_standalone_or_Steam_and_a_copy_being_deleted_is_not_listed() + { + Steam(Client, "3.29.3d"); + Assert.Equal(ClientLayout.Steam, ClientVersions.FilesOf(Client)); + File.WriteAllText(Path.Combine(Client, "Content.ggpk"), "archive"); + Assert.Equal(ClientLayout.Standalone, ClientVersions.FilesOf(Client)); + Assert.Equal(ClientLayout.None, ClientVersions.FilesOf(Path.Combine(Folder, "nothing"))); + + Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c"), "3.29.3c"); + Steam(Path.Combine(Folder, ClientVersions.KeptFolder, ".deleting-3.29.3b"), "3.29.3b"); + Assert.Equal("3.29.3c", Assert.Single(ClientVersions.Kept(Folder)).Name); + } + + [Fact] + public async Task A_client_half_way_to_another_version_is_never_set_aside_or_put_in_use() + { + var d = new ListedBuild("3.29.3d", "", "dd", null, "238960", [new("238962", "1")]); + Steam(Client, "3.29.3c"); + File.WriteAllText(Path.Combine(Client, ClientVersions.Marker), "3.29.3d\ndd"); + // Keeping both would put a client that is not whole in Clients\ under a whole one's name: refused before anything runs. + var result = await ClientVersions.SwitchAsync(Folder, d, SwitchWay.KeepBoth, "no tool is started", "nobody", null, _ => { }, CancellationToken.None); + Assert.Equal(SteamOutcome.Failed, result.Outcome); + Assert.False(Directory.Exists(Path.Combine(Folder, ClientVersions.KeptFolder))); + Assert.False(Directory.Exists(Path.Combine(Folder, ClientVersions.NextFolder))); + Assert.Equal("3.29.3d", ClientVersions.Unfinished(Folder)); + + // One that was set aside half-way by an earlier Waypoint says so, and does not come back into use. + File.Delete(Path.Combine(Client, ClientVersions.Marker)); + string kept = Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3b"), "3.29.3b"); + File.WriteAllText(Path.Combine(kept, ClientVersions.Marker), "3.29.3c"); + Assert.Equal("3.29.3c", Assert.Single(ClientVersions.Kept(Folder)).HalfWayTo); + Assert.Throws(() => ClientVersions.Use(Folder, "3.29.3b")); + Assert.Equal("game 3.29.3c", File.ReadAllText(Path.Combine(Client, "PathOfExileSteam.exe"))); + } + + [Fact] + public void A_deletion_of_a_kept_client_that_was_cut_short_is_finished_and_nothing_else_goes() + { + Steam(Client, "3.29.3d"); + string kept = Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c"), "3.29.3c"); + Assert.False(ClientVersions.HasUnfinishedDeletes(Folder)); + string remains = Steam(Path.Combine(Folder, ClientVersions.KeptFolder, ".deleting-3.29.3b"), "3.29.3b"); + Assert.True(ClientVersions.HasUnfinishedDeletes(Folder)); + + ClientVersions.FinishDeletes(Folder); + Assert.False(Directory.Exists(remains)); + Assert.False(ClientVersions.HasUnfinishedDeletes(Folder)); + Assert.True(File.Exists(Path.Combine(kept, "PathOfExileSteam.exe"))); + Assert.True(File.Exists(Path.Combine(Client, "PathOfExileSteam.exe"))); + } + + [Fact] + public async Task Only_a_kept_client_from_Steam_that_is_there_can_be_finished() + { + var d = new ListedBuild("3.29.3d", "", "dd", null, "238960", [new("238962", "1")]); + Steam(Client, "3.29.3d"); + // The mark names the build it was on its way to, for the window to find it in LocalExile's list. + string kept = Steam(Path.Combine(Folder, ClientVersions.KeptFolder, "3.29.3c"), "3.29.3c"); + File.WriteAllText(Path.Combine(kept, ClientVersions.Marker), "3.29.3d\ndd"); + var half = Assert.Single(ClientVersions.Kept(Folder)); + Assert.Equal(("3.29.3d", "dd"), (half.HalfWayTo, half.HalfWayToBuild)); + + // Nothing is started for a copy that is gone, or for one that is not a client from Steam: both are refused first. + var gone = await ClientVersions.FinishKeptAsync(Folder, "3.29.3b", d, "no tool is started", "nobody", null, _ => { }, CancellationToken.None); + Assert.Equal(SteamOutcome.Failed, gone.Outcome); + File.WriteAllText(Path.Combine(kept, "Content.ggpk"), "archive"); + var standalone = await ClientVersions.FinishKeptAsync(Folder, "3.29.3c", d, "no tool is started", "nobody", null, _ => { }, CancellationToken.None); + Assert.Equal(SteamOutcome.Failed, standalone.Outcome); + Assert.True(File.Exists(Path.Combine(kept, ClientVersions.Marker))); + Assert.Equal("game 3.29.3d", File.ReadAllText(Path.Combine(Client, "PathOfExileSteam.exe"))); + } + + [Fact] + public void An_unfinished_switch_names_its_build_when_the_mark_does() + { + Steam(Client, "3.29.3c"); + Assert.Null(ClientVersions.UnfinishedBuild(Folder)); + File.WriteAllText(Path.Combine(Client, ClientVersions.Marker), "3.29.3c\nbb\n"); + Assert.Equal(("3.29.3c", "bb"), ClientVersions.UnfinishedBuild(Folder)); + Assert.Equal("3.29.3c", ClientVersions.Unfinished(Folder)); + // A mark with the version alone, as it was first written. + File.WriteAllText(Path.Combine(Client, ClientVersions.Marker), "3.29.3d"); + Assert.Equal(("3.29.3d", null), ClientVersions.UnfinishedBuild(Folder)); + } + + [Fact] + public void A_switch_needs_room_by_how_it_is_done() + { + const long build = 71_000_000_000, current = 70_000_000_000; + // Where it is: only what differs. + Assert.Equal(ClientVersions.Margin, ClientVersions.Needed(ClientLayout.Steam, SwitchWay.UpdateInPlace, build, current)); + // Both kept: a copy of the client in use, then what differs. + Assert.Equal(current + ClientVersions.Margin, ClientVersions.Needed(ClientLayout.Steam, SwitchWay.KeepBoth, build, current)); + // A standalone client shares nothing with Steam's files, and no client at all needs the whole build. + Assert.Equal(build + ClientVersions.Margin, ClientVersions.Needed(ClientLayout.Standalone, SwitchWay.UpdateInPlace, build, current)); + Assert.Equal(build + ClientVersions.Margin, ClientVersions.Needed(ClientLayout.None, SwitchWay.KeepBoth, build, 0)); + } + + [Fact] + public void A_client_holds_a_build_when_its_executable_and_its_index_are_that_builds() + { + Steam(Client, "3.29.3d"); + string index = Convert.ToHexStringLower(SHA256.HashData(File.ReadAllBytes(Path.Combine(Client, "Bundles2", "_.index.bin")))); + Assert.True(ClientVersions.Holds(Client, new("3.29.3d", "", new string('a', 64), index))); + Assert.False(ClientVersions.Holds(Client, new("3.29.3d", "", new string('a', 64), new string('b', 64)))); + Assert.False(ClientVersions.Holds(Client, new("3.29.3c", "", new string('a', 64), index))); + } + + [Fact] + public void The_tools_lines_are_read_for_what_they_say() + { + var progress = SteamDownload.Read(@" 03.86% F:\LocalExile\Client\D3D12\d3d12SDKLayers.dll"); + Assert.Equal((SteamLineKind.Progress, 3.86, @"F:\LocalExile\Client\D3D12\d3d12SDKLayers.dll"), (progress.Kind, progress.Percent, progress.File)); + Assert.Equal(100, SteamDownload.Read(@"100.00% F:\LocalExile\Client\PathOfExileSteam.exe").Percent); + Assert.Equal(SteamLineKind.NotAvailable, SteamDownload.Read("App 238960 (Path of Exile) is not available from this account.").Kind); + Assert.Equal(SteamLineKind.SignInNeeded, SteamDownload.Read("Access token was rejected (InvalidPassword).").Kind); + Assert.Equal(SteamLineKind.CodeStart, SteamDownload.Read("Use the Steam Mobile App to sign in with this QR code:").Kind); + var signedIn = SteamDownload.Read("Success! Next time you can login with -username some_name -remember-password instead of -qr."); + Assert.Equal((SteamLineKind.SignedIn, "some_name"), (signedIn.Kind, signedIn.Account)); + Assert.Equal(SteamLineKind.Other, SteamDownload.Read("Got depot key for 238962 result: OK").Kind); + Assert.Equal(SteamLineKind.Other, SteamDownload.Read("").Kind); + + // A row of the sign-in code: two characters a square. + string row = " " + string.Concat(Enumerable.Repeat("\u2588\u2588 ", 10)) + " "; + var code = SteamDownload.Read(row); + Assert.Equal(SteamLineKind.CodeRow, code.Kind); + Assert.Equal(row.Length / 2, code.Cells!.Length); + Assert.Equal([false, false, false, false, true, false, true, false], code.Cells.Take(8)); + } + + [Fact] + public void A_log_never_gets_the_sign_in_code_or_the_accounts_name() + { + Assert.Null(SteamDownload.ForLog(" " + new string('\u2588', 40), null)); + Assert.Null(SteamDownload.ForLog(" 50.00% file.dll", null)); + Assert.Equal("Success! Next time you can login with -username -remember-password instead of -qr.", + SteamDownload.ForLog("Success! Next time you can login with -username some_name -remember-password instead of -qr.", null)); + Assert.Equal("Logging '' into Steam3...", SteamDownload.ForLog("Logging 'some_name' into Steam3...", "some_name")); + Assert.Equal("Got 12 licenses for !", SteamDownload.ForLog("Got 12 licenses for some_name!", "some_name")); + } + + /// The real tool against Steam, on the small depot of executables only: opt in by naming a folder that holds + /// DepotDownloader.exe and an account whose sign-in it remembers (WAYPOINT_STEAM_TOOL, WAYPOINT_STEAM_ACCOUNT). It + /// downloads about 130 MB. + [Fact] + public async Task With_the_real_tool_a_client_moves_between_versions_both_ways() + { + string? tool = Environment.GetEnvironmentVariable("WAYPOINT_STEAM_TOOL"), account = Environment.GetEnvironmentVariable("WAYPOINT_STEAM_ACCOUNT"); + if (string.IsNullOrEmpty(tool) || string.IsNullOrEmpty(account)) return; + ClientLocator.BuildOverride = null; + // LocalExile's two builds, with only the depot of executables: the index is a stand-in, so no hash is asked of it. + var d = new ListedBuild("3.29.3d", "", "e9ba3d31c4d922e1826ef01d02fd22178a001b29e17264b68fc2446efd41f53d", null, "238960", [new("238962", "8687196073893351989")]); + var c = new ListedBuild("3.29.3c", "", "01a22facf36886b39bca74793c0d8c7295b1495f1625b4ebc7b23c2de32a70cf", null, "238960", [new("238962", "1925736551784903498")]); + ClientLocator.Learn([d, c]); + var log = new List(); + void Index(string client) + { + Directory.CreateDirectory(Path.Combine(client, "Bundles2")); + File.WriteAllText(Path.Combine(client, "Bundles2", "_.index.bin"), "stand-in"); + } + + // No client yet: the build is made ready beside it and moved in. (The stand-in index is put where the fetch goes.) + Index(Path.Combine(Folder, ClientVersions.NextFolder)); + var first = await ClientVersions.SwitchAsync(Folder, d, SwitchWay.KeepBoth, tool, account, null, log.Add, default); + Assert.True(first.Outcome == SteamOutcome.Done, string.Join("\n", log.TakeLast(8))); + Assert.Equal("3.29.3d", ClientLocator.BuildOf(Client)); + Assert.DoesNotContain(log, line => line.Contains(account, StringComparison.OrdinalIgnoreCase)); + + // Both kept: the client in use goes to Clients\, the other version takes its place. + File.WriteAllText(Path.Combine(Client, "Game.patched.exe"), "patched for 3.29.3d"); + File.WriteAllText(Path.Combine(Client, "config.json"), "{}"); + var both = await ClientVersions.SwitchAsync(Folder, c, SwitchWay.KeepBoth, tool, account, null, log.Add, default); + Assert.True(both.Outcome == SteamOutcome.Done, string.Join("\n", log.TakeLast(8))); + Assert.Equal("3.29.3c", ClientLocator.BuildOf(Client)); + Assert.False(File.Exists(Path.Combine(Client, "Game.patched.exe"))); + Assert.True(File.Exists(Path.Combine(Client, "config.json"))); + var kept = Assert.Single(ClientVersions.Kept(Folder)); + Assert.Equal("3.29.3d", kept.Version); + Assert.True(File.Exists(Path.Combine(kept.Folder, "Game.patched.exe"))); + + // Where it is: the one client becomes the other version, and nothing more is kept. + var inPlace = await ClientVersions.SwitchAsync(Folder, d, SwitchWay.UpdateInPlace, tool, account, null, log.Add, default); + Assert.True(inPlace.Outcome == SteamOutcome.Done, string.Join("\n", log.TakeLast(8))); + Assert.Equal("3.29.3d", ClientLocator.BuildOf(Client)); + Assert.Null(ClientVersions.Unfinished(Folder)); + Assert.Single(ClientVersions.Kept(Folder)); + + // And back, without a download. + ClientVersions.Use(Folder, kept.Name); + Assert.Equal("3.29.3d", ClientLocator.BuildOf(Client)); + Assert.True(File.Exists(Path.Combine(Client, "Game.patched.exe"))); + } +} diff --git a/tests/Waypoint.Tests/OwnClientTests.cs b/tests/Waypoint.Tests/OwnClientTests.cs new file mode 100644 index 0000000..03c9751 --- /dev/null +++ b/tests/Waypoint.Tests/OwnClientTests.cs @@ -0,0 +1,326 @@ +using System.Diagnostics; + +namespace Waypoint.Tests; + +/// A release whose client is a link to the user's own Path of Exile folder is told so in LocalExile's words, and can +/// be given a copy of its own on the user's word (): the link works until a whole copy takes its +/// place, and the folder it led to is only read. +[Collection(nameof(ClientUpdateTests))] +public class OwnClientTests : IDisposable +{ + readonly string _top = Path.Combine(Path.GetTempPath(), "Waypoint-own-client-" + Guid.NewGuid().ToString("N")); + string Folder => Path.Combine(_top, "LocalExile"); + string Client => Path.Combine(Folder, "Client"); + string Retail => Path.Combine(_top, "Path of Exile"); + string Copy => Path.Combine(Folder, OwnClient.NewFolder); + string Aside => Path.Combine(Folder, OwnClient.OldLink); + + public OwnClientTests() + { + Directory.CreateDirectory(Path.Combine(Folder, "data")); + File.WriteAllText(Path.Combine(Folder, "data", "login-keys.json"), "{}"); + File.WriteAllText(Path.Combine(Folder, "data", "saves.db"), "saves"); + MakeClient(Retail); + } + + public void Dispose() + { + RemoveLinks(new DirectoryInfo(_top)); + if (Directory.Exists(_top)) Directory.Delete(_top, recursive: true); + } + + /// Without following a link: one of these tests links a folder to the folder above it. + static void RemoveLinks(DirectoryInfo folder) + { + foreach (var child in folder.EnumerateDirectories()) + if (child.LinkTarget is not null) child.Delete(); + else RemoveLinks(child); + } + + /// A client LocalExile ran from: the game's files, and what LocalExile added beside them. + static void MakeClient(string folder) + { + Directory.CreateDirectory(Path.Combine(folder, "Redist", "x64")); + Directory.CreateDirectory(Path.Combine(folder, "logs")); + File.WriteAllText(Path.Combine(folder, "PathOfExile.exe"), "the game"); + File.WriteAllText(Path.Combine(folder, "Game.exe"), "the game"); + File.WriteAllText(Path.Combine(folder, "Game.patched.exe"), "patched for this folder's keys"); + File.WriteAllText(Path.Combine(folder, "Content.ggpk"), new string('g', 5000)); + File.WriteAllText(Path.Combine(folder, "Redist", "x64", "runtime.dll"), "nested"); + File.WriteAllText(Path.Combine(folder, "logs", "Client.txt"), "the game's own log"); + } + + static Dictionary Snapshot(string folder) => new DirectoryInfo(folder).EnumerateFiles("*", SearchOption.AllDirectories) + .ToDictionary(f => Path.GetRelativePath(folder, f.FullName), f => File.ReadAllText(f.FullName) + "|" + f.LastWriteTimeUtc.Ticks, StringComparer.OrdinalIgnoreCase); + + static bool IsLink(string folder) => new DirectoryInfo(folder).LinkTarget is not null; + + [Fact] + public void A_client_of_its_own_needs_nothing() + { + MakeClient(Client); + Assert.Null(OwnClient.Check(Folder)); + Directory.Delete(Client, recursive: true); + Assert.Null(OwnClient.Check(Folder)); + } + + [Fact] + public void A_link_to_the_users_game_folder_is_offered_a_copy() + { + Junction(Client, Retail); + var plan = OwnClient.Check(Folder)!; + Assert.Equal(Retail, plan.Source, StringComparer.OrdinalIgnoreCase); + Assert.Equal(Copy, plan.Copy.Target, StringComparer.OrdinalIgnoreCase); + Assert.True(plan.HasSpace); + Assert.Contains(plan.Copy.Files, f => f.Target.EndsWith("Game.patched.exe", StringComparison.OrdinalIgnoreCase)); + Assert.DoesNotContain(plan.Copy.Files, f => f.Source.Contains(@"\logs\", StringComparison.OrdinalIgnoreCase)); + // The standing line is LocalExile's own warning, with the folder the link leads to. + Assert.StartsWith($"Client is a link to {plan.Source}, not a copy. LocalExile changes files in that folder, and a Path of Exile update there can break this LocalExile.", OwnClient.Notice(plan)); + var (message, details) = OwnClient.Text(plan); + Assert.Contains("The link works until the copy is whole", message); + Assert.Contains(Retail, details); + Assert.Contains(Client, details); + } + + [Fact] + public void A_link_to_another_LocalExiles_client_is_left_alone() + { + // LocalExile's own rule for its warning: the folder above the client holds a release.json or a GameServer.slnx. + foreach (string marker in new[] { "release.json", "GameServer.slnx" }) + { + string other = Path.Combine(_top, "Other " + marker); + MakeClient(Path.Combine(other, "Client")); + File.WriteAllText(Path.Combine(other, marker), "{}"); + Junction(Client, Path.Combine(other, "Client")); + Assert.Null(OwnClient.Check(Folder)); + Directory.Delete(Client); + } + } + + [Fact] + public void A_link_that_leads_to_no_client_is_the_setup_guides() + { + string empty = Path.Combine(_top, "empty"); + Directory.CreateDirectory(empty); + Junction(Client, empty); + Assert.Null(OwnClient.Check(Folder)); + } + + [Fact] + public void A_release_inside_the_game_folder_is_not_copied_into_itself() + { + string inside = Path.Combine(Retail, "LocalExile"); + Directory.CreateDirectory(inside); + Junction(Path.Combine(inside, "Client"), Retail); + Assert.Null(OwnClient.Check(inside)); + } + + [Fact] + public async Task The_move_copies_everything_and_only_reads_the_users_folder() + { + Junction(Client, Retail); + var before = Snapshot(Retail); + await OwnClient.MoveAsync(Folder, null, default); + Assert.False(IsLink(Client)); + Assert.Equal(before, Snapshot(Retail)); + var copied = Snapshot(Client); + foreach (var (name, content) in before.Where(f => !f.Key.StartsWith("logs", StringComparison.OrdinalIgnoreCase))) + Assert.Equal(content, copied[name]); + Assert.DoesNotContain(copied.Keys, k => k.StartsWith("logs", StringComparison.OrdinalIgnoreCase) || k == OwnClient.Complete); + Assert.False(Directory.Exists(Copy)); + Assert.False(Directory.Exists(Aside)); + Assert.True(LocalExileReleases.IsSetUp(Folder)); + Assert.Null(OwnClient.Check(Folder)); + } + + [Fact] + public async Task A_stopped_copy_leaves_the_link_and_goes_on_next_time() + { + Junction(Client, Retail); + using var stop = new CancellationTokenSource(); + stop.Cancel(); + await Assert.ThrowsAnyAsync(() => OwnClient.MoveAsync(Folder, null, stop.Token)); + Assert.True(IsLink(Client)); + Assert.True(File.Exists(Path.Combine(Client, "Content.ggpk"))); + // Half a copy from that try: one file whole, one begun. + Directory.CreateDirectory(Copy); + File.Copy(Path.Combine(Retail, "Game.exe"), Path.Combine(Copy, "Game.exe")); + File.WriteAllText(Path.Combine(Copy, "Content.ggpk.partial"), new string('g', 2000)); + Assert.True(OwnClient.Check(Folder)!.Copied > 0); + await OwnClient.MoveAsync(Folder, null, default); + Assert.False(IsLink(Client)); + Assert.Equal(new string('g', 5000), File.ReadAllText(Path.Combine(Client, "Content.ggpk"))); + } + + [Fact] + public async Task What_an_earlier_try_copied_is_dropped_when_the_game_was_updated_since() + { + Junction(Client, Retail); + Directory.CreateDirectory(Copy); + File.WriteAllText(Path.Combine(Copy, "PathOfExile.exe"), "an older build of the game"); + File.SetLastWriteTimeUtc(Path.Combine(Copy, "PathOfExile.exe"), new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc)); + await OwnClient.MoveAsync(Folder, null, default); + Assert.Equal("the game", File.ReadAllText(Path.Combine(Client, "PathOfExile.exe"))); + } + + [Fact] + public void A_move_cut_short_at_the_swap_is_finished_from_either_side() + { + // The copy is whole and the link was already set aside. + Junction(Aside, Retail); + MakeClient(Copy); + File.WriteAllText(Path.Combine(Copy, OwnClient.Complete), ""); + Assert.True(OwnClient.Finish(Folder)); + Assert.False(IsLink(Client)); + Assert.True(File.Exists(Path.Combine(Client, "Content.ggpk"))); + Assert.False(File.Exists(Path.Combine(Client, OwnClient.Complete))); + Assert.False(Directory.Exists(Aside)); + Assert.True(File.Exists(Path.Combine(Retail, "Content.ggpk"))); + } + + [Fact] + public void A_link_set_aside_without_a_whole_copy_goes_back() + { + Junction(Aside, Retail); + Directory.CreateDirectory(Copy); + File.WriteAllText(Path.Combine(Copy, "Game.exe"), "half a copy"); + Assert.False(OwnClient.Finish(Folder)); + Assert.True(IsLink(Client)); + Assert.True(File.Exists(Path.Combine(Client, "Content.ggpk"))); + Assert.False(Directory.Exists(Aside)); + Assert.True(Directory.Exists(Copy)); + } + + [Fact] + public void A_client_folder_of_its_own_is_never_replaced() + { + MakeClient(Client); + File.WriteAllText(Path.Combine(Client, "mine.txt"), "mine"); + MakeClient(Copy); + File.WriteAllText(Path.Combine(Copy, OwnClient.Complete), ""); + Assert.False(OwnClient.Finish(Folder)); + Assert.Equal("mine", File.ReadAllText(Path.Combine(Client, "mine.txt"))); + } + + [Fact] + public void An_abandoned_copy_goes_only_when_no_link_waits_for_it() + { + Junction(Client, Retail); + Directory.CreateDirectory(Copy); + File.WriteAllText(Path.Combine(Copy, "Game.exe"), "half a copy"); + OwnClient.Discard(Folder); + Assert.True(Directory.Exists(Copy)); + Directory.Delete(Client); + MakeClient(Client); + OwnClient.Discard(Folder); + Assert.False(Directory.Exists(Copy)); + Assert.True(File.Exists(Path.Combine(Client, "Content.ggpk"))); + } + + [Fact] + public void The_copy_is_asked_and_only_Copy_now_agrees() + { + Junction(Client, Retail); + var plan = OwnClient.Check(Folder)!; + string[]? shown = null; + Assert.True(OwnClient.Ask(plan, (_, _, _, buttons) => { shown = buttons; return 0; }, _ => { })); + Assert.Equal(["Copy now", "Open folder", "Cancel"], shown!); + // The last button, and a box closed without an answer, change nothing. + Assert.False(OwnClient.Ask(plan, (_, _, _, _) => 2, _ => { })); + Assert.False(OwnClient.Ask(plan, (_, _, _, _) => -1, _ => { })); + } + + [Fact] + public void Without_the_room_it_only_tells() + { + Junction(Client, Retail); + var plan = OwnClient.Check(Folder)! with { Free = 1000 }; + Assert.False(plan.HasSpace); + string[]? shown = null; + string? said = null; + // OK is last: it is the button Enter and Esc press. Open folder would only bring the box back. + Assert.False(OwnClient.Ask(plan, (_, message, _, buttons) => { shown = buttons; said = message; return 1; }, _ => { })); + Assert.Equal(["Open folder", "OK"], shown!); + Assert.Contains("too full", said); + Assert.Contains("nothing changes", said); + } + + [Fact] + public void Open_folder_shows_the_users_folder_and_asks_again() + { + Junction(Client, Retail); + var plan = OwnClient.Check(Folder)!; + var answers = new Queue([1, 0]); + string? opened = null; + Assert.True(OwnClient.Ask(plan, (_, _, _, _) => answers.Dequeue(), path => opened = path)); + Assert.Equal(Retail, opened, StringComparer.OrdinalIgnoreCase); + } + + [Fact] + public async Task Without_the_users_word_nothing_changes() + { + Junction(Client, Retail); + var result = await OwnClient.MakeCopyAsync(Folder, _ => false, null, Hold, default); + Assert.Equal(OwnClient.Outcome.None, result.Outcome); + Assert.NotNull(result.Plan); + Assert.True(IsLink(Client)); + Assert.False(Directory.Exists(Copy)); + } + + [Fact] + public async Task Copy_now_moves_and_a_busy_folder_or_a_failure_leaves_the_link() + { + Junction(Client, Retail); + var busy = await OwnClient.MakeCopyAsync(Folder, _ => true, null, _ => Task.FromResult(false), default); + Assert.Equal(OwnClient.Outcome.Failed, busy.Outcome); + Assert.True(IsLink(Client)); + + // The copy cannot be written: a file stands where its folder would be. + File.WriteAllText(Copy, "in the way"); + var failed = await OwnClient.MakeCopyAsync(Folder, _ => true, null, Hold, default); + Assert.Equal(OwnClient.Outcome.Failed, failed.Outcome); + Assert.NotNull(failed.Reason); + Assert.True(IsLink(Client)); + Assert.True(File.Exists(Path.Combine(Client, "Content.ggpk"))); + Assert.Contains(Retail, OwnClient.FailedText(failed.Plan!, failed.Reason!)); + File.Delete(Copy); + + using var stop = new CancellationTokenSource(); + stop.Cancel(); + var stopped = await OwnClient.MakeCopyAsync(Folder, _ => true, null, Hold, stop.Token); + Assert.Equal(OwnClient.Outcome.Stopped, stopped.Outcome); + Assert.True(IsLink(Client)); + + var moved = await OwnClient.MakeCopyAsync(Folder, _ => true, null, Hold, default); + Assert.Equal(OwnClient.Outcome.Moved, moved.Outcome); + Assert.False(IsLink(Client)); + Assert.Equal(OwnClient.Outcome.None, (await OwnClient.MakeCopyAsync(Folder, _ => throw new InvalidOperationException("asked"), null, Hold, default)).Outcome); + } + + [Fact] + public void What_LocalExile_left_in_the_users_folder_is_named_not_removed() + { + Assert.Equal(["Game.exe", "Game.patched.exe"], OwnClient.Leftovers(Retail)); + // The user's own config.json is not LocalExile's. + File.WriteAllText(Path.Combine(Retail, "config.json"), "{}"); + Assert.Equal(["Game.exe", "Game.patched.exe"], OwnClient.Leftovers(Retail)); + File.WriteAllText(Path.Combine(Retail, "config.json"), """{"GGG_CONFIG_FILE_NAME":"LocalExile\\production_Config.ini"}"""); + Assert.Equal(["Game.exe", "Game.patched.exe", "config.json"], OwnClient.Leftovers(Retail)); + Junction(Client, Retail); + Assert.Contains("config.json", OwnClient.DoneText(OwnClient.Check(Folder)!)); + Assert.True(File.Exists(Path.Combine(Retail, "Game.patched.exe"))); + } + + static async Task Hold(Func work) + { + await work(); + return true; + } + + static void Junction(string link, string target) + { + using var process = Process.Start(new ProcessStartInfo("cmd.exe", $"/c mklink /J \"{link}\" \"{target}\"") { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true })!; + process.WaitForExit(); + Assert.True(new DirectoryInfo(link).LinkTarget is not null, "the junction was made"); + } +} diff --git a/tools/Get-DepotDownloader.ps1 b/tools/Get-DepotDownloader.ps1 new file mode 100644 index 0000000..03fdba5 --- /dev/null +++ b/tools/Get-DepotDownloader.ps1 @@ -0,0 +1,42 @@ +# Fetches the DepotDownloader release that Waypoint.exe carries (docs/launcher.md, "The game client from Steam"), once, at +# build time, and holds it to the SHA-256 written here: a user's Waypoint never downloads it. The zip goes to +# tools\bundled\, which git ignores; src\Waypoint\Waypoint.csproj embeds it when it is there. With -Source it also fetches +# the source of that same release, which the release workflow attaches beside Waypoint.exe (DepotDownloader is GPL-2.0: +# THIRD-PARTY-NOTICES.md). +# +# pwsh tools/Get-DepotDownloader.ps1 the program, for a build +# pwsh tools/Get-DepotDownloader.ps1 -Source the program and its source, for a release +# +# A new version of the tool: change $version and both hashes here, and DepotTool's in src\Launcher.Core\SteamDownload.cs. +param([switch]$Source) +$ErrorActionPreference = 'Stop' + +$version = '3.4.0' +$tag = "DepotDownloader_$version" +$files = @( + @{ Name = 'DepotDownloader-windows-x64.zip'; Url = "https://github.com/SteamRE/DepotDownloader/releases/download/$tag/DepotDownloader-windows-x64.zip" + Sha256 = '41c9e9f0df54b3ad02e67a11726756e5c73283bd7c2e1b04acfa5ae4c2ed3767' } +) +# GitHub makes a tag's source archive when it is asked for, and its bytes are not promised to stay the same: no hash. +if ($Source) { $files += @{ Name = "DepotDownloader-$version-source.zip"; Url = "https://github.com/SteamRE/DepotDownloader/archive/refs/tags/$tag.zip"; Sha256 = $null } } + +$folder = Join-Path $PSScriptRoot 'bundled' +New-Item -ItemType Directory -Force $folder | Out-Null +foreach ($file in $files) { + $path = Join-Path $folder $file.Name + $have = (Test-Path $path) -and (-not $file.Sha256 -or (Get-FileHash $path -Algorithm SHA256).Hash.ToLowerInvariant() -eq $file.Sha256) + if (-not $have) { + Write-Host "fetching $($file.Name) ..." + $partial = "$path.partial" + Invoke-WebRequest -Uri $file.Url -OutFile $partial -UseBasicParsing + if ($file.Sha256) { + $hash = (Get-FileHash $partial -Algorithm SHA256).Hash.ToLowerInvariant() + if ($hash -ne $file.Sha256) { + Remove-Item $partial -Force + throw "$($file.Name) is not the release this script expects (SHA-256 $hash)" + } + } + Move-Item $partial $path -Force + } + Write-Host "$($file.Name) is in $folder" +}