Compare commits
2
Commits
main
...
beta21/pr4-play
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4368f31c63 | ||
|
|
e4b56c6de5 |
No files matched your search
@@ -28,6 +28,21 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **Play, on a game's page and on each game in the library.** Through the store that installed the game — Steam or the
|
||||
Epic Games Launcher starts it, GOG GALAXY runs it, the itch app asks which copy to launch — or started directly by
|
||||
FrameLedger, recorded from its first frame: **Settings ▸ Games ▸ Play button** switches between the two. A game no
|
||||
store installed, and a GOG game without GOG GALAXY, is started directly. FrameLedger never starts a game as
|
||||
administrator: *Start directly* does not start one that asks for it, and while FrameLedger itself runs as
|
||||
administrator, Play starts every game directly so that the game does not. A game whose recording is off is started
|
||||
only through its store. The Epic Games Launcher's link is the one its own shortcuts carry and has not been tried on a
|
||||
real Epic game yet (`docs/08_UI.md` §Games).
|
||||
- **The Privacy Policy (version 2.10)** names the store records Play and the library import read — the lists of installed
|
||||
games the Steam, GOG GALAXY, Epic Games and itch apps keep on your disk, and where GOG GALAXY is installed; the import
|
||||
read the Epic and itch lists before and the policy did not say so — and that Play hands a game to its store's app,
|
||||
which may connect to its store while FrameLedger itself connects to nothing. It is shown once for you to accept.
|
||||
|
||||
### Changed
|
||||
|
||||
- **The documents in the app scroll further and smoothly** — the user guide, Help ▸ Limitations, About's documents, the
|
||||
|
||||
+11
-1
@@ -21,7 +21,8 @@ page lists them in plain words; each item links to the document that has the det
|
||||
- **32-bit games and Direct3D 9 games.** Only 64-bit Direct3D 11, Direct3D 12 and OpenGL games are measured
|
||||
from their own calls; a 32-bit or Direct3D 9 game is recorded without measurement.
|
||||
- **Vulkan games, unless FrameLedger starts them.** A Vulkan game is measured only when FrameLedger launches it
|
||||
with its Vulkan layer switched on; one started another way is not observed by the layer.
|
||||
with its Vulkan layer switched on — **Play** set to *Start directly* does; one started another way is not observed by
|
||||
the layer.
|
||||
- **Games that run as administrator,** unless you turn on *Run the agent as administrator* in Settings
|
||||
(off by default; Windows asks every time the agent starts). **A process Windows protects** stays closed
|
||||
either way.
|
||||
@@ -167,6 +168,15 @@ you accept the prompt. Turn it on only if you trust everything that runs under y
|
||||
anti-cheat, never to judge it, and recording or measuring a game vouches for nothing. Four itch.io downloads this
|
||||
project once used as examples turned out to carry malware ([details](docs/spike-notes.md)).
|
||||
|
||||
## Play
|
||||
|
||||
- **Through GOG GALAXY or itch, you finish in their app.** GOG GALAXY runs the game as its own shortcuts do, and the
|
||||
itch app asks which copy to launch. The Epic Games Launcher's link is the one its own shortcuts carry, and has not
|
||||
been tried on a real Epic game yet.
|
||||
- **FrameLedger never starts a game as administrator.** *Start directly* does not start a game that asks for it — start
|
||||
that one from its store or its own shortcut — nor a game whose recording is off: FrameLedger starts only what it
|
||||
records. While FrameLedger itself runs as administrator, Play starts every game directly, with your standard rights.
|
||||
|
||||
## Your data
|
||||
|
||||
- Everything stays on your computer (`%LOCALAPPDATA%\FrameLedger`). FrameLedger sends no telemetry; its only
|
||||
|
||||
@@ -21,8 +21,9 @@ pages.
|
||||
>
|
||||
> - **Frame times and output resolution:** measured from the present call for Direct3D 11/12 and
|
||||
> OpenGL titles FrameLedger injects into. Vulkan titles are measured only when FrameLedger itself
|
||||
> starts the game with its Vulkan layer enabled, which today only the Agent's command-line launch
|
||||
> does. A Vulkan title started any other way is not observed by the layer; FrameLedger injects its
|
||||
> starts the game with its Vulkan layer enabled, which the Play button set to *Start directly* (since
|
||||
> beta.21) and the Agent's command-line launch do. A Vulkan title started any other way is not
|
||||
> observed by the layer; FrameLedger injects its
|
||||
> Direct3D component into it instead, and what that records on a Vulkan title has not been
|
||||
> verified. Direct3D 9 and every 32-bit title are not measured.
|
||||
> - **Which upscaler is running:** measured from the API a Direct3D title calls — DLSS or NIS through
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ Requirement IDs (`FR-x`, `NFR-x`) are referenced by other docs, commits, and tes
|
||||
- FR-1.5 "Supports" row shows shipped-capability hints (DLSS/FSR/XeSS/FG) — visually distinct from measured per-session values (`05_DETECTION` §Capability hints).
|
||||
- FR-1.7 Delete all sessions (beta.11, owner decision D40): of one game from its page, or of every game from Settings ▸ Data, after a confirmation that says how many — with their frame and sensor series and notes; the library, the settings and every consent stay. The Agent deletes them (the rows are its, `06_DATA_MODEL` §Writer ownership) and refuses while a session it would delete under is being recorded.
|
||||
- FR-1.8 Uninstalled games leave the library by themselves (beta.19, owner decision D55, amending D41): an entry whose executable has been gone for ten minutes — its drive connected and the folder it was installed in still there, so an unplugged or re-lettered drive never counts, and neither does a folder Windows will not list (`ExecutablePresenceProbeTests`) — and that has no session (stored, being recorded or waiting to be recovered) is removed by the Agent, behind Settings ▸ Data ▸ *Remove uninstalled games* (on by default). Never an entry carrying an anti-cheat block, an exception or a failed-trial mark (FR-2.2, rule 2). The App is told (`GameRemoved`).
|
||||
- FR-1.9 Play (beta.21, owner decision D59): a game's page and each library entry start the game — through the app of the store whose own records name its folder (Steam, the Epic Games Launcher, GOG GALAXY, itch), or by the agent's launch mode (FR-3.2), as Settings ▸ Games says; never as administrator, and never in a viewer (`08_UI` §Games).
|
||||
- FR-1.6 Recording switch per entry (2026-09-23, HANDOFF D29): off, the program is not watched at all — no session, no measurement, no injection — and a session of it that is running stops. On by default; entries an old import made for Steam's own tools start with it off. The library card says "Not recorded".
|
||||
|
||||
### FR-2 Hooking consent & control (new, safety-critical — see `19_SAFETY`)
|
||||
@@ -26,7 +27,7 @@ Requirement IDs (`FR-x`, `NFR-x`) are referenced by other docs, commits, and tes
|
||||
|
||||
### FR-3 Session capture
|
||||
- FR-3.1 Watcher detects tracked exe launches (1 Hz) and captures automatically at the highest permitted tier.
|
||||
- FR-3.2 Launch mode: start the game from FrameLedger for suspended-launch injection (catches startup-time upscaler init).
|
||||
- FR-3.2 Launch mode: start the game from FrameLedger for suspended-launch injection (catches startup-time upscaler init). *(The App reaches it since beta.21: Play set to Start directly sends `LaunchGame` — FR-1.9.)*
|
||||
- FR-3.3 Attach mode for games launched externally; sessions flagged `late_attach`.
|
||||
- FR-3.4 Track the process tree; capture the descendant that actually presents.
|
||||
- FR-3.5 Per-frame records for the whole session; telemetry at 1 Hz (configurable 0.5–2 s).
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ which makes the notification more important than it was, not less.
|
||||
|
||||
## Launch mode vs attach mode
|
||||
|
||||
**Launch mode (preferred).** User starts the game from FrameLedger ~~(or FrameLedger is set as the launch wrapper)~~ *(corrected 2026-10-04: no wrapper exists, and no App button sends `LaunchGame` yet — the pipe command has no caller; launch mode runs from the Agent's developer verb `--console launch --exe`)*: `CreateProcess(CREATE_SUSPENDED)` → guard → inject → `ResumeThread`. Catches swapchain creation and upscaler init, which attach mode can miss entirely — a game that creates its DLSS feature during startup will otherwise report `upscaler = unknown` for the whole session.
|
||||
**Launch mode (preferred).** User starts the game from FrameLedger ~~(or FrameLedger is set as the launch wrapper)~~ *(corrected 2026-10-04: no wrapper exists, and no App button sends `LaunchGame` yet — the pipe command has no caller; launch mode runs from the Agent's developer verb `--console launch --exe`. Since beta.21 one does: **Play** set to *Start directly* — D59, `08_UI` §Games)*: `CreateProcess(CREATE_SUSPENDED)` → guard → inject → `ResumeThread`. Catches swapchain creation and upscaler init, which attach mode can miss entirely — a game that creates its DLSS feature during startup will otherwise report `upscaler = unknown` for the whole session.
|
||||
|
||||
> **An elevated Agent starts the game as a standard user (beta.10, the admin mode, D34).** `ProcessLauncher` checks its
|
||||
> own token: elevated, it starts the game with the desktop shell's token (`Infrastructure.Startup.UnelevatedProcess` —
|
||||
|
||||
@@ -436,7 +436,8 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
|
||||
| `ui.fps_decimals` | bool | `0` | | UI (beta.8, 2026-09-25): every FPS figure with two decimals ("62.40") instead of a whole number |
|
||||
| `ui.hide_scrollbars` | bool | `0` | | UI (beta.14, 2026-10-05): no scroll bar drawn anywhere; every scroller still scrolls with the wheel, the keyboard and touch (`App.Services.ScrollBarHiding`, `08_UI` §Settings) |
|
||||
| `ui.library_view` | choice `grid`\|`list` | `grid` | | UI (beta.11, 2026-10-03): the Games library as a grid of cards that fills the width, or as a list; written by the page's own switch, no Settings row (`08_UI` §Games) |
|
||||
| `capture.background` | bool | `1` | | ~~Agent~~ nobody *(corrected 2026-10-04: no Agent code ever read it, so the watcher recorded every tracked game whatever it said; beta.12 removed its switch from Settings and reserved the key — `SettingsRegistry.CaptureBackground`)* |
|
||||
| `ui.play_mode` | choice `store`\|`direct` | `store` | | UI (beta.21, owner decision D59): what Play does — `store` hands the game to the app of the store whose own records name its folder, and the agent starts it where none does; `direct` has the agent start it (`LaunchGame`, launch mode). Settings ▸ Games (`08_UI` §Games) |
|
||||
| `capture.background` | bool | `1` | | ~~Agent~~ nobody *(corrected 2026-10-04: no Agent code ever read it, so the watcher recorded every tracked game whatever it said; beta.12 removed its switch from Settings and reserved the key — `SettingsRegistry.CaptureBackground`. Since beta.21 the App can start a game (Play), and the key stays reserved: a game Play starts is recorded as any other start)* |
|
||||
| `hooking.kill_switch` | bool | `0` | | Agent (FR-2.4, since P2 PR-F) |
|
||||
| `hooking.usermode_ac_exceptions` | bool | `0` | | Agent, at every session start and command (FR-2.8, D33, 2026-09-26): off suspends every user-mode exception without deleting any; on, the user still grants each eligible game |
|
||||
| `capture.run_elevated` | bool | `0` | | The App when it starts the Agent, and an Agent the logon task started — both BEFORE the Agent exists, through `Infrastructure.Startup.RunElevatedSetting` (one row, `PRAGMA query_only`, no version gate, anything but `1` is off) (D34, beta.10): on, Windows is asked for administrator rights at every Agent start (`01_ARCHITECTURE` ADR-9) |
|
||||
|
||||
+1
-1
@@ -393,7 +393,7 @@ Unchanged in spirit from v1, bumped to `v2` for the new message set.
|
||||
| `Hello` | UI→A | `{ appVersion, protocol: 2 }` → `HelloAck { agentVersion, protocol, pid, elevated, overlayBuildId, vulkanLayerRegistered, telemetrySource /* composite, e.g. l1+lhm+nvapi */, cpuTempAvailable, disclosureVersion /* P3 PR-4, D14: the FR-2.1 text this Agent stamps against */, exceptionDisclosureVersion /* D33, 2026-09-26: the user-mode exception's disclosure this Agent grants against */, elevationOutcome /* beta.10, D34: the admin mode's answer at this start — granted, declined, other-account, failed — or null when nobody asked */, ~~etwAvailable~~ }` — `etwAvailable` struck 2026-09-13 with the tier it described (2026-08-28); `pid` added. ~~`vulkanLayerRegistered` is **false by construction** today (the layer is per-launch, never registered)~~ `vulkanLayerRegistered` is the HKCU implicit-layer registration as the Agent found it at start *(corrected 2026-10-04: since P3 PR-8b; true while `VkLayerReconciler` keeps the layer registered for a hook-enabled Vulkan game, P4 PR-2)* and `cpuTempAvailable` false unelevated; `telemetrySource` is the composite stood up once on the first `Hello` |
|
||||
| `GetStatus` | UI→A | → `StatusAck { state, activeSession?, tier? }` — and `activeSessions[]`, one `{ sessionGuid, gameId, gameName?, pid, tier, startedAt, hold? }` per running session. **`hold` added 2026-09-23, optional:** present on a session held unhooked (Tier 2), with the same words `SessionStarted.hold` carries; a session listed at tier 2 WITHOUT a `hold` has not attached yet — it is starting, not held. The App reads this list on every (re)connect (§Client behavior) |
|
||||
| `SetWatchlist` | UI→A | `{ entries: [{ gameId?, exePath }] }` — ~~full replace~~ **ensure, never remove** (built 2026-09-13, PR-1b): each entry's path is normalised by the Agent, its row ensured with hooking OFF when new, and the ack is `WatchlistAck { games: [{ gameId, exePath, name }], unreadable: [exePath] }`; `gameId` in a request is a hint and never trusted over the path. UI re-sends on connect. **Carries no hooking state** (see §The pipe is not a trust boundary). *Since the App writes `games` rows itself under `06_DATA_MODEL` §Writer ownership (HANDOFF §P3 D15), this is the pipe's way of adding a row, not the only one; the watcher reads the table at 1 Hz either way.* |
|
||||
| `LaunchGame` | UI→A | `{ gameId, arguments? }` → ~~suspended-launch~~ launch mode as built ("inject late", `04_CAPTURE` §Launch mode) → `LaunchAck { gameId, accepted, outcome, sessionGuid? }` — `outcome` is `Accepted` · `UnknownGame` · `SessionRunning` (one per game at a time) · `Unavailable` · `RecordingOff` (2026-09-23: the entry's recording switch is off, FR-1.6 — FrameLedger does not start what it will not record). *(Built 2026-09-13, PR-1b: `CaptureOrchestrator.LaunchAsync` over an `ILaunchRecorderFactory` the Agent composes with the Vulkan layer's environment — or none when FR-2.4's switch is on — and the launcher election runs after, as the console's `launch` does; the elected session is not addressable by the launch's guid.)* |
|
||||
| `LaunchGame` | UI→A *(the App sends it since beta.21: Play in its Start directly mode, and in the store mode where no store installed the game — `App.Services.GamePlayer`, D59)* | `{ gameId, arguments? }` → ~~suspended-launch~~ launch mode as built ("inject late", `04_CAPTURE` §Launch mode) → `LaunchAck { gameId, accepted, outcome, sessionGuid? }` — `outcome` is `Accepted` · `UnknownGame` · `SessionRunning` (one per game at a time) · `Unavailable` · `RecordingOff` (2026-09-23: the entry's recording switch is off, FR-1.6 — FrameLedger does not start what it will not record). *(Built 2026-09-13, PR-1b: `CaptureOrchestrator.LaunchAsync` over an `ILaunchRecorderFactory` the Agent composes with the Vulkan layer's environment — or none when FR-2.4's switch is on — and the launcher election runs after, as the console's `launch` does; the elected session is not addressable by the launch's guid.)* |
|
||||
| `SetHookEnabled` | UI→A | `{ gameId, enabled, disclosureVersion? }` — Agent re-runs the static AC pre-scan and may reply `Refused`. **The Agent stamps the consent timestamp itself.** *(Built 2026-09-13, PR-1b, as far as it can be: `enabled: false` → `RevokeAsync` → `HookEnabledAck { gameId, enabled: false, outcome }`; `enabled: true` → the pre-scan of the executable's directory, a refusal or a "could not verify" recorded through `RecordGuardBlockAsync` and answered `Refused { gameId, reason, family?, signal? }`; a clean scan → ~~**`Error DisclosureUnavailable`, nothing stamped** — the reviewed FR-2.1 text does not exist, and a client's `disclosureVersion` is a claim, not a disclosure shown. PR-4 replaces that last branch with the stamp~~ **since PR-4 (2026-09-13): the client's `disclosureVersion` compared with the Agent's own `SafetyDisclosure.Version`; equal → the stamp from the Agent's clock with `ConsentProvenance.ConsentDialog`, answered `HookEnabledAck { enabled, outcome, prescan: "clean" }`; anything else → `Error DisclosureVersionMismatch`, nothing written (D14). `DisclosureUnavailable` remains for a composition that wired no version, which `--serve` never is.)* **Since beta.8 (2026-09-25):** the pre-scan is of the executable (the guard resolves the install root, PR-2 of that train), and BEFORE it an executable known not to run as x64 is answered `Refused { gameId, reason: "ExecutableNotX64", signal: "x86" | "anycpu32" | "arm64" | "arm" }` with nothing scanned and nothing written — not a guard reason and not a block (`05_DETECTION` §What the files say about themselves). **Since D33 (2026-09-26):** for a blocked game whose user-mode exception is in force for the executable on disk (the option on, a grant made on these bytes, the block naming that family) the pre-scan NAMES the family, and a pass under it is stamped as ever and answered `prescan: "exception"`; a finding about the game under it also ends the exception. |
|
||||
| `SetAntiCheatException` | UI→A | **Added 2026-09-26 (D33).** `{ gameId, enabled, disclosureVersion? }` — grant or withdraw a game's user-mode anti-cheat exception (`19_SAFETY` §The user-mode exception). `enabled: false` → the exception ends (`Withdrawn`), hooking goes off while the block stands → `AntiCheatExceptionAck { gameId, granted: false, outcome, family? }`. `enabled: true` → `Error DisclosureVersionMismatch` unless `disclosureVersion` is the Agent's `AntiCheatExceptionDisclosure.Version`; `Error ExceptionsOff` while `hooking.usermode_ac_exceptions` is off; `Refused { reason: "BlockNotExceptionable" }` for a title list or an unreadable block; then the Agent's OWN facts — ~~the successful Tier-1 sessions (`Refused { reason: "TooFewSessions", signal: <count> }` under two)~~ *(D38, 2026-10-03: no session is needed)*; a game an exception of which ended during its trial is refused before anything is scanned (`Refused { reason: "TrialFailed", family, signal: <unix ms> }`); a tolerant pre-scan of the executable on disk naming the block's family (`Refused { reason, family, signal }` unless the guard let exactly that family through) — and the store writes the grant only over facts that make the game eligible, and never over a failed trial → `AntiCheatExceptionAck { granted, outcome, family }`. **A grant turns nothing on**: hooking is FR-2.1's `SetHookEnabled`, afterwards. Not answered (`UnknownType`) by an Agent composed without the exception. |
|
||||
| `PauseCapture` / `ResumeCapture` | UI→A | global → `PauseAck { paused }`; `StatusAck.paused` reports it. *(Built 2026-09-13, PR-1b: one in-memory flag, `CapturePause`, read by every session loop at its tick and told to the ring once per transition; supervision — the guard scan, the kill switch, the safety stop — never pauses. Not persisted: an Agent that restarts resumes.)* |
|
||||
|
||||
@@ -503,6 +503,21 @@ All screens are `Page`s registered with the navigation page provider and navigat
|
||||
> rows rank nothing; the percentile axis is 0–100 again (`AutoScale` ran after `SetLimitsX` and undid it); exported
|
||||
> PNGs have an opaque background (`ChartTheme.SavePng`: the window's colour under the transparent figure).
|
||||
|
||||
> **Play, beta.21 (owner decision D59: "1: press Play → the platform opens → it runs; 3: it runs at once; let me switch
|
||||
> between the two").** A **Play** button heads a game's page (before Edit…, Primary) and sits on each library card's
|
||||
> corner — over the card, not inside it, so the card stays one button — and in the list's first column. **Settings ▸
|
||||
> Games ▸ Play button** (`ui.play_mode`): *Through the store* (the default) hands the game to the app of the store whose
|
||||
> own records name its folder — the records the import reads (`Application.Play.StoreRecords`; the row's `platform` is not
|
||||
> trusted, detection may have rewritten it while `store_id` stayed the importer's) — Steam `steam://rungameid/<id>`, the
|
||||
> Epic Games Launcher `com.epicgames.launcher://apps/<ns>%3A<item>%3A<app>?action=launch&silent=true`, GOG GALAXY
|
||||
> `GalaxyClient.exe /command=runGame /gameId=<id> /path="<folder>"`, the itch app `itch://install?game_id=<id>&launch`
|
||||
> (`StoreLaunches`: the forms the stores' own shortcuts and code use, measured on the owner's PC except Epic's; every id
|
||||
> checked against its store's shape before the shell gets it). No store, GOG without GALAXY, or the App itself running as
|
||||
> administrator: the agent starts the game instead, and the notice says why. *Start directly* sends `LaunchGame` (launch
|
||||
> mode): recorded from the first frame, never as administrator, refused for a recording-off entry. A viewer's (D52) Play is
|
||||
> off and its composition holds no `ShellStarter`. Tests: `StoreLaunchesTests`, `StoreRecordsTests`, `GamePlayerTests`,
|
||||
> `ViewerModeTests`.
|
||||
|
||||
### Session summary (secondary `FluentWindow`, also the post-session toast target)
|
||||
Stat cards (Avg uses `FpsReadout`, Median, 1% Low, 0.1% Low, Min/Max, σ, stutter %, duration, **Display** — beta.10: the mode shown longest with its share and the window's size, both tiers; **VRAM (this game)** and **RAM (this game)** — beta.12: the median with the peak beneath, both tiers), **Statistics per series** (beta.12: every stored series' mean / median / minimum / peak), TriState chips, API/PresentMode/upscaler line, **the display line** (beta.10: every mode's share, the changes, the window on its monitor at its refresh rate, the back buffer and swap effect, and what the facts rested on — "the swap chain said whether it was exclusive" or "from the window alone: exclusive fullscreen cannot be told from borderless"; absent for a session recorded before), crash `InfoBar` (Severity=Error) when `crashed`, frametime chart, sensor strip, tags/notes editor, Export buttons.
|
||||
|
||||
|
||||
@@ -63,6 +63,15 @@ are kept because they record what each version changed and why (owner decision D
|
||||
>
|
||||
> Version 2.5 (2026-09-27, 0.1.0-beta.10) adds how a tracked game's window is shown — read from Windows — and the engine build name read from an Unreal Engine game's executable. It is also the first version to say two things the software already did: it reads the **content** of a library game's executable (markers in its first 8 MB and its import table, since the detection of engines and features; and, when a session starts, the graphics-library markers in the whole file), and it reads the processor load and the memory in use (since 0.1.0-beta.3). Nothing here leaves your device, as before.
|
||||
|
||||
### What version 2.10 of the Privacy Policy changed (0.1.0-beta.21)
|
||||
|
||||
§4 names the lists of installed games the Steam, GOG GALAXY, Epic Games and itch apps keep on the disk, and where GOG
|
||||
GALAXY is installed, read when the library is imported and when Play is pressed (beta.21 PR-4, owner decision D59; the
|
||||
wording approved with the plan). The import has read the Epic Games Launcher's manifests and itch's records since
|
||||
0.1.0-beta.1 without a word here — §4 named only "the store files that name it (Steam's and GOG's, on your disk)", read for
|
||||
detection; this version is the first to say so. §2 says that Play hands a game to its store's app, which may connect to
|
||||
its store, and that FrameLedger itself connects to nothing. Nothing here leaves your device, as before.
|
||||
|
||||
### What version 2.9 of the Privacy Policy changed (0.1.0-beta.20)
|
||||
|
||||
§4's list of the version marks an engine keeps in its own files gains one: the version file of a Ren'Py game's engine
|
||||
|
||||
+4
-2
@@ -65,12 +65,14 @@ stopped, hooking turned off — each with one button that only says you have rea
|
||||
- **Add game…** — or drop `.exe` files onto the page.
|
||||
- Each game shows its name, its store and engine, and one state: **Hooking on**, **Hooking off**, **Anti-cheat** (found,
|
||||
so it is not hooked), **Exception** (a user-mode exception is in force) or **Not recorded**; then its sessions,
|
||||
playtime and last play. Click it to open its page (in the list: double-click, or Enter).
|
||||
playtime and last play. Click it to open its page (in the list: double-click, or Enter). Its **Play** button (on the
|
||||
card's corner; the list's first column) starts it as the game's page does.
|
||||
|
||||
## A game's page
|
||||
|
||||
- **At the top:** the name, publisher, version, store and engine, the `.exe` path, the last session, the last measured
|
||||
session's frame rate and its ray-tracing chips. **Edit…** changes the name, publisher, version and notes. **Change
|
||||
session's frame rate and its ray-tracing chips. **Play** starts the game: through the store that installed it, or
|
||||
directly — **Settings ▸ Games ▸ Play button** chooses. **Edit…** changes the name, publisher, version and notes. **Change
|
||||
executable…** points the entry at another `.exe` and turns hooking back off; its file dialog opens in the game's own
|
||||
folder. **Remove…** asks whether to keep the game's sessions.
|
||||
- **Recording** — off, FrameLedger ignores the program completely: for a launcher or a tool that is not a game.
|
||||
|
||||
@@ -11,7 +11,7 @@ by the capture agent; unless the row says otherwise, a change applies from the n
|
||||
| **Games with hooking on** | Shown while any game has hooking on: one **Turn off** per game. | — |
|
||||
| **Hide hooking on anti-cheat games** | On, the page of a game where anti-cheat was found shows only what was found; off, it also shows the Hooking switch, greyed out. Such a game is never hooked either way. | On |
|
||||
| **Allow hooking in games whose only anti-cheat runs in user mode** | Turns on the one narrow exception ([Anti-cheat and safety](04-anti-cheat-and-safety.md#the-one-exception-you-can-make)). The games that qualify are listed under it, each with **Make exception…** (after a warning) or **Withdraw**. *Agent.* | Off |
|
||||
| **Vulkan layer** | The component that measures Vulkan games — but only a game FrameLedger starts itself, which the App cannot do yet, so a Vulkan game you start is recorded, not measured. The agent registers and removes it by itself; **Register** and **Unregister** repair that, for your Windows user only. | — |
|
||||
| **Vulkan layer** | The component that measures Vulkan games — but only a game FrameLedger starts itself: **Play** set to *Start directly* (Games, below) does; a Vulkan game started any other way is recorded, not measured. The agent registers and removes it by itself; **Register** and **Unregister** repair that, for your Windows user only. | — |
|
||||
|
||||
The link under them, *Read what the hook does and does not do*, opens the safety document on GitHub.
|
||||
|
||||
@@ -44,6 +44,12 @@ The link under them, *Read what the hook does and does not do*, opens the safety
|
||||
| **Theme** | Follow system, Light or Dark. Applies at once. | Follow system |
|
||||
| **Language** | English, Tiếng Việt or 日本語. The window is rebuilt in the new language at once. | English |
|
||||
|
||||
## Games
|
||||
|
||||
| Setting | What it does | Default |
|
||||
|---|---|---|
|
||||
| **Play button** | What **Play** does, on a game's page and on each game in the library. *Through the store*: Steam or the Epic Games Launcher starts the game, GOG GALAXY runs it, and the itch app asks which copy to launch — each store's app does what it does when you start a game from it. A game no store installed, and a GOG game without GOG GALAXY, is started by FrameLedger instead; so is every game while FrameLedger itself runs as administrator, so that the game does not. *Start directly*: FrameLedger's agent starts the game, recorded from its first frame, with your standard rights; it does not start a game whose recording is off, or one that asks to run as administrator. | Through the store |
|
||||
|
||||
## Window
|
||||
|
||||
| Setting | What it does | Default |
|
||||
|
||||
+3
-2
@@ -21,8 +21,9 @@
|
||||
>
|
||||
> - **Frame times and output resolution:** measured from the present call for Direct3D 11/12 and
|
||||
> OpenGL titles FrameLedger injects into. Vulkan titles are measured only when FrameLedger itself
|
||||
> starts the game with its Vulkan layer enabled, which today only the Agent's command-line launch
|
||||
> does. A Vulkan title started any other way is not observed by the layer; FrameLedger injects its
|
||||
> starts the game with its Vulkan layer enabled, which the Play button set to *Start directly* (since
|
||||
> beta.21) and the Agent's command-line launch do. A Vulkan title started any other way is not
|
||||
> observed by the layer; FrameLedger injects its
|
||||
> Direct3D component into it instead, and what that records on a Vulkan title has not been
|
||||
> verified. Direct3D 9 and every 32-bit title are not measured.
|
||||
> - **Which upscaler is running:** measured from the API a Direct3D title calls — DLSS or NIS through
|
||||
|
||||
+3
-2
@@ -123,8 +123,9 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
|
||||
>
|
||||
> - **Frame times and output resolution:** measured from the present call for Direct3D 11/12 and
|
||||
> OpenGL titles FrameLedger injects into. Vulkan titles are measured only when FrameLedger itself
|
||||
> starts the game with its Vulkan layer enabled, which today only the Agent's command-line launch
|
||||
> does. A Vulkan title started any other way is not observed by the layer; FrameLedger injects its
|
||||
> starts the game with its Vulkan layer enabled, which the Play button set to *Start directly* (since
|
||||
> beta.21) and the Agent's command-line launch do. A Vulkan title started any other way is not
|
||||
> observed by the layer; FrameLedger injects its
|
||||
> Direct3D component into it instead, and what that records on a Vulkan title has not been
|
||||
> verified. Direct3D 9 and every 32-bit title are not measured.
|
||||
> - **Which upscaler is running:** measured from the API a Direct3D title calls — DLSS or NIS through
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FrameLedger — Privacy Policy
|
||||
|
||||
**Version:** 2.9 · **Effective:** {{RELEASE_DATE}}
|
||||
**Version:** 2.10 · **Effective:** {{RELEASE_DATE}}
|
||||
|
||||
**Short version: everything stays on your PC. FrameLedger has no accounts, no telemetry, no analytics, and never uploads your data anywhere.**
|
||||
|
||||
@@ -29,6 +29,8 @@ There is no other request. In particular, the anti-cheat safety list and the det
|
||||
|
||||
GitHub's own privacy practices apply to requests it receives: <https://docs.github.com/privacy>.
|
||||
|
||||
Pressing Play hands the game to its store's app on your PC, which may connect to its store as it does whenever you start a game from it; FrameLedger itself connects to nothing.
|
||||
|
||||
## 3. Bug reports — always manual
|
||||
|
||||
The "Report a bug" feature builds a zip file **on your device**, shows you exactly which files it contains, and lets you inspect them. Nothing is transmitted by the app; **you** decide whether to attach the file to a GitHub issue in your browser. Logs are redacted (user directory paths removed) before bundling. Optional items (crash dumps, last-session metadata) are included only when you tick their checkboxes.
|
||||
@@ -39,7 +41,7 @@ An exported session (CSV or JSON) and a bug report can contain your games' names
|
||||
|
||||
## 4. What the app can technically observe
|
||||
|
||||
To do its job, FrameLedger observes: which of *your tracked* executables — the entries in your library whose recording is on — are running, and their process trees; the parameters your games pass to the graphics APIs it intercepts (presentation, upscaling, ray tracing, pipeline creation); the memory use of a tracked game's process — its dedicated and shared video memory, from Windows' GPU performance counters, and its working sets and commit, from Windows' process-memory information, for which a game it does not inject into is opened with the least access Windows offers and closed again (never its memory's content); loaded module names of a game being captured (for detection and for the anti-cheat safety check); the names of the files in each library game's install folder, the version information of its executable and of the upscaling libraries it ships, the content of its executable file (the markers of the engine and of the graphics libraries it carries, the libraries it imports, and the engine build name an Unreal Engine game carries), the version marks an engine keeps in its own files (Unity's player library and the header of its data file, the header of a Godot data pack, an RPG Maker game's title, core script and Game.ini, the library Game.ini names, and the version file of a Ren'Py game's engine), and the store files that name it (Steam's and GOG's, on your disk) — to detect its engine, its engine version and its features and to check it for anti-cheat before any injection is possible; the size, position and state of a tracked game's window and the monitor it is on, read from Windows and not from the game, and — for a game FrameLedger injects into — whether the game asked for exclusive full-screen; the NVIDIA driver's settings for your tracked executables (read only: the DLSS and frame-generation overrides the NVIDIA App set); hardware sensor values from your graphics driver's own libraries; how busy the processor is and how much memory is in use, from Windows' own counters; the crash reports Windows keeps in its Application log about a tracked game's executable while it ran (to tell a crash from an ordinary exit — the reports are read, never sent anywhere); and the names of the programs a tracked game starts, so that a game's own crash reporter is recognised.
|
||||
To do its job, FrameLedger observes: which of *your tracked* executables — the entries in your library whose recording is on — are running, and their process trees; the parameters your games pass to the graphics APIs it intercepts (presentation, upscaling, ray tracing, pipeline creation); the memory use of a tracked game's process — its dedicated and shared video memory, from Windows' GPU performance counters, and its working sets and commit, from Windows' process-memory information, for which a game it does not inject into is opened with the least access Windows offers and closed again (never its memory's content); loaded module names of a game being captured (for detection and for the anti-cheat safety check); the names of the files in each library game's install folder, the version information of its executable and of the upscaling libraries it ships, the content of its executable file (the markers of the engine and of the graphics libraries it carries, the libraries it imports, and the engine build name an Unreal Engine game carries), the version marks an engine keeps in its own files (Unity's player library and the header of its data file, the header of a Godot data pack, an RPG Maker game's title, core script and Game.ini, the library Game.ini names, and the version file of a Ren'Py game's engine), and the store files that name it (Steam's and GOG's, on your disk) — to detect its engine, its engine version and its features and to check it for anti-cheat before any injection is possible; the lists of installed games that the Steam, GOG GALAXY, Epic Games and itch apps keep on your disk, and where GOG GALAXY is installed — read when you import your library and when you press Play, to find the store that installed a game and hand the game to that store's app; the size, position and state of a tracked game's window and the monitor it is on, read from Windows and not from the game, and — for a game FrameLedger injects into — whether the game asked for exclusive full-screen; the NVIDIA driver's settings for your tracked executables (read only: the DLSS and frame-generation overrides the NVIDIA App set); hardware sensor values from your graphics driver's own libraries; how busy the processor is and how much memory is in use, from Windows' own counters; the crash reports Windows keeps in its Application log about a tracked game's executable while it ran (to tell a crash from an ordinary exit — the reports are read, never sent anywhere); and the names of the programs a tracked game starts, so that a game's own crash reporter is recognised.
|
||||
|
||||
It does **not** read game memory outside those API parameters, and does not read game saves, chat, input content, network traffic, or anything unrelated to performance measurement. It records only for programs you added to your library and did not switch recording off for — a program whose recording is off is not watched at all — and injects only into games you individually enabled.
|
||||
|
||||
|
||||
@@ -421,6 +421,14 @@ public partial class App : System.Windows.Application
|
||||
services.AddSingleton<IStoreLibrarySource>(static _ => new EpicLibrarySource());
|
||||
services.AddSingleton<IStoreLibrarySource>(static _ => new ItchLibrarySource(log: static line => Serilog.Log.Information("{Line}", line)));
|
||||
services.AddSingleton<IExecutableLocator, ExecutableLocator>();
|
||||
// beta.21 (D59): Play reads the same records to find the store that installed a game, and GOG GALAXY's program.
|
||||
services.AddSingleton<Application.Play.IGogGalaxyLocator>(static _ => new GogGalaxyLocator());
|
||||
services.AddSingleton(static sp => new GamePlayer(
|
||||
sp.GetRequiredService<Application.Settings.RegisteredSettings>(),
|
||||
sp.GetServices<IStoreLibrarySource>(),
|
||||
sp.GetRequiredService<Application.Play.IGogGalaxyLocator>(),
|
||||
sp.GetRequiredService<IShellStarter>(),
|
||||
sp.GetRequiredService<IAgentRequests>()));
|
||||
services.AddSingleton<IExecutableIdentitySource, ExecutableIdentitySource>();
|
||||
services.AddSingleton(static sp => new LibraryImporter(
|
||||
sp.GetServices<IStoreLibrarySource>(),
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top">
|
||||
<!-- beta.21 (D59): Play, through the store that installed the game or started directly (Settings ▸ Games). -->
|
||||
<ui:Button Margin="0,0,8,0" Appearance="Primary" Command="{Binding ViewModel.PlayCommand}" Content="{x:Static vm:GameDetailViewModel.PlayText}"
|
||||
Icon="{ui:SymbolIcon Play24}" IsEnabled="{Binding ViewModel.ActsOnThisPc}" ToolTip="{Binding ViewModel.PlayToolTip}" />
|
||||
<ui:Button Margin="0,0,8,0" Command="{Binding ViewModel.EditCommand}" Content="{x:Static vm:GameDetailViewModel.EditText}" Icon="{ui:SymbolIcon Edit24}" />
|
||||
<ui:Button Margin="0,0,8,0" Command="{Binding ViewModel.ChangeExecutableCommand}" Content="{x:Static vm:GameDetailViewModel.ChangeExecutableText}" Icon="{ui:SymbolIcon DocumentArrowRight24}" />
|
||||
<ui:Button Appearance="Danger" Command="{Binding ViewModel.RemoveCommand}" Content="{x:Static vm:GameDetailViewModel.RemoveText}" Icon="{ui:SymbolIcon Delete24}" />
|
||||
|
||||
@@ -79,36 +79,46 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:GameCardViewModel}">
|
||||
<ui:CardAction IsChevronVisible="False" VerticalAlignment="Stretch" VerticalContentAlignment="Top"
|
||||
Command="{Binding DataContext.ViewModel.OpenCommand, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
<Grid>
|
||||
<ui:CardAction IsChevronVisible="False" VerticalAlignment="Stretch" VerticalContentAlignment="Top"
|
||||
Command="{Binding DataContext.ViewModel.OpenCommand, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
CommandParameter="{Binding}"
|
||||
Icon="{ui:SymbolIcon Games24}">
|
||||
<StackPanel>
|
||||
<ui:TextBlock Margin="0,0,40,0" FontTypography="BodyStrong" Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
|
||||
<!-- Pills wrap to a second line rather than being cut (the third one was, at 300 px). -->
|
||||
<WrapPanel Margin="0,4,0,0">
|
||||
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
Visibility="{Binding HasPlatform, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding PlatformText}" />
|
||||
</Border>
|
||||
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
Visibility="{Binding HasEngine, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding EngineText}" />
|
||||
</Border>
|
||||
<Border Style="{StaticResource HookStatePill}" Margin="0,0,6,4">
|
||||
<TextBlock Style="{StaticResource HookStatePillText}" Text="{Binding HookText}" />
|
||||
</Border>
|
||||
<Border x:Name="NotInstalledPill" Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
ToolTip="{Binding NotInstalledToolTip}"
|
||||
Visibility="{Binding NotInstalled, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{x:Static res:Strings.Games_Card_NotInstalled}" />
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
<ui:TextBlock Margin="0,2,0,0" Style="{StaticResource SecondaryText}" Text="{Binding SessionsText}" />
|
||||
<ui:TextBlock Style="{StaticResource SecondaryText}" Text="{Binding PlaytimeText}" />
|
||||
<ui:TextBlock Style="{StaticResource SecondaryText}" Text="{Binding LastPlayedText}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
<!-- beta.21 (D59): Play, over the card's corner rather than inside it, so the card stays one button. -->
|
||||
<ui:Button Margin="0,10,10,0" Padding="6,4" HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||
AutomationProperties.Name="{x:Static res:Strings.Play_Button}"
|
||||
Command="{Binding DataContext.ViewModel.PlayCommand, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
CommandParameter="{Binding}"
|
||||
Icon="{ui:SymbolIcon Games24}">
|
||||
<StackPanel>
|
||||
<ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
|
||||
<!-- Pills wrap to a second line rather than being cut (the third one was, at 300 px). -->
|
||||
<WrapPanel Margin="0,4,0,0">
|
||||
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
Visibility="{Binding HasPlatform, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding PlatformText}" />
|
||||
</Border>
|
||||
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
Visibility="{Binding HasEngine, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding EngineText}" />
|
||||
</Border>
|
||||
<Border Style="{StaticResource HookStatePill}" Margin="0,0,6,4">
|
||||
<TextBlock Style="{StaticResource HookStatePillText}" Text="{Binding HookText}" />
|
||||
</Border>
|
||||
<Border x:Name="NotInstalledPill" Style="{StaticResource TagPill}" Margin="0,0,6,4"
|
||||
ToolTip="{Binding NotInstalledToolTip}"
|
||||
Visibility="{Binding NotInstalled, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Style="{StaticResource TagPillText}" Text="{x:Static res:Strings.Games_Card_NotInstalled}" />
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
<ui:TextBlock Margin="0,2,0,0" Style="{StaticResource SecondaryText}" Text="{Binding SessionsText}" />
|
||||
<ui:TextBlock Style="{StaticResource SecondaryText}" Text="{Binding PlaytimeText}" />
|
||||
<ui:TextBlock Style="{StaticResource SecondaryText}" Text="{Binding LastPlayedText}" />
|
||||
</StackPanel>
|
||||
</ui:CardAction>
|
||||
Icon="{ui:SymbolIcon Play24}"
|
||||
IsEnabled="{Binding DataContext.ViewModel.ActsOnThisPc, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
ToolTip="{Binding DataContext.ViewModel.PlayToolTip, RelativeSource={RelativeSource AncestorType=Page}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -120,6 +130,20 @@
|
||||
MouseDoubleClick="OnListDoubleClick" KeyDown="OnListKeyDown"
|
||||
Visibility="{Binding ViewModel.ListView, Converter={StaticResource BoolToVis}}">
|
||||
<DataGrid.Columns>
|
||||
<!-- beta.21 (D59): Play, as on the cards. -->
|
||||
<DataGridTemplateColumn Header="{x:Static res:Strings.Play_Button}" Width="Auto">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:Button Margin="2,0" Padding="6,2" Appearance="Transparent"
|
||||
AutomationProperties.Name="{x:Static res:Strings.Play_Button}"
|
||||
Command="{Binding DataContext.ViewModel.PlayCommand, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
CommandParameter="{Binding}"
|
||||
Icon="{ui:SymbolIcon Play24}"
|
||||
IsEnabled="{Binding DataContext.ViewModel.ActsOnThisPc, RelativeSource={RelativeSource AncestorType=Page}}"
|
||||
ToolTip="{Binding DataContext.ViewModel.PlayToolTip, RelativeSource={RelativeSource AncestorType=Page}}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Name}" Binding="{Binding Name}" Width="3*" />
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Store}" Binding="{Binding PlatformText}" Width="Auto" />
|
||||
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Engine}" Binding="{Binding EngineText}" Width="*" />
|
||||
|
||||
@@ -299,6 +299,24 @@
|
||||
SelectedValuePath="Value" />
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- beta.21 (owner decision D59): what Play does. The App's own setting; the Agent never reads it. -->
|
||||
<ui:TextBlock FontTypography="Subtitle" Margin="0,20,0,8" Text="{x:Static res:Strings.Settings_Games_Header}" />
|
||||
<ui:CardControl Margin="0,4,0,0" Icon="{ui:SymbolIcon Play24}">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<ui:TextBlock FontTypography="BodyStrong" Text="{x:Static res:Strings.Settings_PlayMode_Label}" />
|
||||
<ui:TextBlock MaxWidth="520" HorizontalAlignment="Left" Style="{StaticResource SecondaryText}" TextWrapping="Wrap"
|
||||
Text="{x:Static res:Strings.Settings_PlayMode_Body}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ComboBox MinWidth="160"
|
||||
AutomationProperties.Name="{x:Static res:Strings.Settings_PlayMode_Label}"
|
||||
DisplayMemberPath="Label"
|
||||
ItemsSource="{Binding ViewModel.PlayModes}"
|
||||
SelectedValue="{Binding ViewModel.PlayMode, Mode=TwoWay}"
|
||||
SelectedValuePath="Value" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:TextBlock FontTypography="Subtitle" Margin="0,20,0,8" Text="{x:Static res:Strings.Settings_Window_Header}" />
|
||||
<ui:CardControl Margin="0,4,0,0" Icon="{ui:SymbolIcon Power24}">
|
||||
<ui:CardControl.Header>
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using FrameLedger.Application.Import;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Application.Play;
|
||||
using FrameLedger.Application.Settings;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
using FrameLedger.Shared.Ipc;
|
||||
using Serilog;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// The Play button (beta.21, owner decision D59: "1: press Play → the platform opens → it runs; 3: it runs at once; let me
|
||||
/// switch between the two"). <c>ui.play_mode</c> = <c>store</c> (the default) hands the game to the app of the store whose own
|
||||
/// records name the folder it is installed in (<see cref="StoreRecords"/>, <see cref="StoreLaunches"/>); a game no store
|
||||
/// installed, a GOG game without GOG GALAXY, and every press while the App runs as administrator are started directly
|
||||
/// instead, and the notice says why. <c>direct</c> has the capture agent start it (<c>LaunchGame</c>, launch mode): recorded
|
||||
/// from its first frame, never as administrator (<c>UnelevatedProcess</c>), hooked only where the gate allows exactly as for any
|
||||
/// start (CLAUDE.md rule 1). FrameLedger itself connects to nothing (rule 8): a store's app does what it does when a game is
|
||||
/// started from it.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
|
||||
public sealed class GamePlayer
|
||||
{
|
||||
private readonly RegisteredSettings _settings;
|
||||
private readonly IReadOnlyList<IStoreLibrarySource> _stores;
|
||||
private readonly IGogGalaxyLocator _galaxy;
|
||||
private readonly IShellStarter _shell;
|
||||
private readonly IAgentRequests _agent;
|
||||
private readonly Func<bool> _elevated;
|
||||
|
||||
public GamePlayer(RegisteredSettings settings, IEnumerable<IStoreLibrarySource> stores, IGogGalaxyLocator galaxy, IShellStarter shell,
|
||||
IAgentRequests agent, Func<bool>? elevated = null)
|
||||
{
|
||||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
ArgumentNullException.ThrowIfNull(stores);
|
||||
_stores = [.. stores];
|
||||
_galaxy = galaxy ?? throw new ArgumentNullException(nameof(galaxy));
|
||||
_shell = shell ?? throw new ArgumentNullException(nameof(shell));
|
||||
_agent = agent ?? throw new ArgumentNullException(nameof(agent));
|
||||
_elevated = elevated ?? (static () => Environment.IsPrivilegedProcess);
|
||||
}
|
||||
|
||||
/// <summary>The mode Play is in now (<c>ui.play_mode</c>), for a tooltip.</summary>
|
||||
public async Task<bool> IsDirectAsync(CancellationToken ct = default) =>
|
||||
PlayMode.IsDirect(await _settings.GetAsync(SettingsRegistry.UiPlayMode, ct).ConfigureAwait(false));
|
||||
|
||||
public async Task<PlayResult> PlayAsync(GameRow game, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
PlayFallback fallback = PlayFallback.None;
|
||||
if (!await IsDirectAsync(ct).ConfigureAwait(false))
|
||||
{
|
||||
if (_elevated())
|
||||
{
|
||||
fallback = PlayFallback.Elevated;
|
||||
}
|
||||
else
|
||||
{
|
||||
StoreGame? record = StoreRecords.Owning(game.Fingerprint.ExePath, game.StoreId, await RecordsAsync(ct).ConfigureAwait(false));
|
||||
if (record is null)
|
||||
{
|
||||
fallback = PlayFallback.NoStore;
|
||||
}
|
||||
else
|
||||
{
|
||||
string? galaxy = string.Equals(record.Platform, "gog", StringComparison.Ordinal) ? _galaxy.ClientPath() : null;
|
||||
if (StoreLaunches.For(record, galaxy) is { } launch)
|
||||
{
|
||||
return HandOff(game, launch);
|
||||
}
|
||||
|
||||
fallback = WhyNoHandOff(game, record, galaxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return await StartDirectlyAsync(game, fallback, ct).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>The notice a result is said with: its text, and whether it is a warning.</summary>
|
||||
public static (string Text, bool Warning) Describe(PlayResult result, string gameName)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(result);
|
||||
return result.Outcome switch
|
||||
{
|
||||
PlayOutcome.HandedToStore => (result.Store switch
|
||||
{
|
||||
"steam" => string.Format(CultureInfo.CurrentCulture, Strings.Play_Steam_Format, gameName),
|
||||
"epic" => string.Format(CultureInfo.CurrentCulture, Strings.Play_Epic_Format, gameName),
|
||||
"gog" => string.Format(CultureInfo.CurrentCulture, Strings.Play_Gog_Format, gameName),
|
||||
_ => string.Format(CultureInfo.CurrentCulture, Strings.Play_Itch_Format, gameName),
|
||||
}, false),
|
||||
PlayOutcome.StartedByAgent => (result.Fallback switch
|
||||
{
|
||||
PlayFallback.NoStore => string.Format(CultureInfo.CurrentCulture, Strings.Play_NoStore_Format, gameName),
|
||||
PlayFallback.NoGalaxy => string.Format(CultureInfo.CurrentCulture, Strings.Play_NoGalaxy_Format, gameName),
|
||||
PlayFallback.Elevated => string.Format(CultureInfo.CurrentCulture, Strings.Play_Elevated_Format, gameName),
|
||||
_ => string.Format(CultureInfo.CurrentCulture, Strings.Play_Started_Format, gameName),
|
||||
}, false),
|
||||
PlayOutcome.AgentUnavailable => (string.Format(CultureInfo.CurrentCulture, Strings.Play_AgentUnavailable_Format, gameName), true),
|
||||
// "Set Play to go through the store" only where Play was not already going through it.
|
||||
PlayOutcome.RecordingOff => (string.Format(CultureInfo.CurrentCulture,
|
||||
result.Fallback == PlayFallback.None ? Strings.Play_RecordingOff_Format : Strings.Play_RecordingOff_Fallback_Format, gameName), true),
|
||||
PlayOutcome.AlreadyRunning => (string.Format(CultureInfo.CurrentCulture, Strings.Play_AlreadyRunning_Format, gameName), false),
|
||||
PlayOutcome.NotInLibrary => (string.Format(CultureInfo.CurrentCulture, Strings.Play_NotInLibrary_Format, gameName), true),
|
||||
_ when result.Detail is null => (string.Format(CultureInfo.CurrentCulture, Strings.Play_HandOffFailed_Format, gameName), true),
|
||||
_ => (string.Format(CultureInfo.CurrentCulture, Strings.Play_Failed_Format, gameName, result.Detail), true),
|
||||
};
|
||||
}
|
||||
|
||||
private PlayResult HandOff(GameRow game, StoreLaunch launch)
|
||||
{
|
||||
bool handed = launch.Kind == StoreLaunchKind.RunProgram
|
||||
? _shell.StartProgram(launch.Target, launch.Arguments ?? string.Empty, launch.WorkingDirectory)
|
||||
: _shell.OpenLink(launch.Target);
|
||||
Log.Information("play: {Game} (id {Id}) through {Store}: {Handed}", game.Name, game.Id, launch.Platform, handed ? "handed to its app" : "Windows did not take it");
|
||||
return handed ? new PlayResult(PlayOutcome.HandedToStore, launch.Platform) : new PlayResult(PlayOutcome.Failed, launch.Platform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A store's record with no hand-off: a GOG game without GOG GALAXY, or — never seen, and logged — an id or a folder of a
|
||||
/// shape that store's own never have, which <see cref="StoreLaunches"/> puts in no link.
|
||||
/// </summary>
|
||||
private static PlayFallback WhyNoHandOff(GameRow game, StoreGame record, string? galaxy)
|
||||
{
|
||||
if (string.Equals(record.Platform, "gog", StringComparison.Ordinal) && galaxy is null)
|
||||
{
|
||||
return PlayFallback.NoGalaxy;
|
||||
}
|
||||
|
||||
Log.Warning("play: {Game} (id {Id}): {Store}'s record of it names nothing FrameLedger may hand to its app; the agent starts it",
|
||||
game.Name, game.Id, record.Platform);
|
||||
return PlayFallback.NoLink;
|
||||
}
|
||||
|
||||
private async Task<IReadOnlyList<StoreGame>> RecordsAsync(CancellationToken ct)
|
||||
{
|
||||
List<StoreGame> all = [];
|
||||
foreach (IStoreLibrarySource store in _stores)
|
||||
{
|
||||
try
|
||||
{
|
||||
all.AddRange(await store.ListAsync(ct).ConfigureAwait(false));
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException and not OutOfMemoryException)
|
||||
{
|
||||
// One store's records that cannot be read are that store's, never the press's.
|
||||
Log.Warning("play: {Store}'s records could not be read ({Message})", store.Platform, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
private async Task<PlayResult> StartDirectlyAsync(GameRow game, PlayFallback fallback, CancellationToken ct)
|
||||
{
|
||||
if (!_agent.IsConnected)
|
||||
{
|
||||
return new PlayResult(PlayOutcome.AgentUnavailable, Fallback: fallback);
|
||||
}
|
||||
|
||||
LaunchAck? ack;
|
||||
try
|
||||
{
|
||||
IpcEnvelope envelope = await _agent.RequestAsync(IpcMessageType.LaunchGame, new LaunchGameRequest(game.Id, null), ct).ConfigureAwait(false);
|
||||
ack = IpcCodec.Payload<LaunchAck>(envelope);
|
||||
}
|
||||
catch (Exception ex) when (ex is InvalidOperationException or TimeoutException or IOException or ObjectDisposedException or IpcFramingException)
|
||||
{
|
||||
// The connection went between the check above and the answer — the agent stopping, or restarting for an update:
|
||||
// the pipe fails a request in flight with these (PipeClient), and a press never ends in an unhandled exception.
|
||||
Log.Warning("play: LaunchGame for {Game} (id {Id}) had no answer ({Kind}: {Message})", game.Name, game.Id, ex.GetType().Name, ex.Message);
|
||||
return new PlayResult(PlayOutcome.AgentUnavailable, Fallback: fallback);
|
||||
}
|
||||
catch (Exception ex) when (ex is IpcRequestException or JsonException)
|
||||
{
|
||||
Log.Warning("play: LaunchGame for {Game} (id {Id}) failed ({Kind}: {Message})", game.Name, game.Id, ex.GetType().Name, ex.Message);
|
||||
return new PlayResult(PlayOutcome.Failed, Fallback: fallback, Detail: (ex as IpcRequestException)?.Code ?? ex.GetType().Name);
|
||||
}
|
||||
|
||||
if (ack is null)
|
||||
{
|
||||
Log.Warning("play: LaunchGame for {Game} (id {Id}) was answered without a payload", game.Name, game.Id);
|
||||
return new PlayResult(PlayOutcome.Failed, Fallback: fallback, Detail: IpcMessageType.LaunchAck);
|
||||
}
|
||||
|
||||
Log.Information("play: {Game} (id {Id}) through the agent: {Outcome}", game.Name, game.Id, ack.Outcome);
|
||||
return ack.Outcome switch
|
||||
{
|
||||
_ when ack.Accepted => new PlayResult(PlayOutcome.StartedByAgent, Fallback: fallback),
|
||||
"RecordingOff" => new PlayResult(PlayOutcome.RecordingOff, Fallback: fallback),
|
||||
"SessionRunning" => new PlayResult(PlayOutcome.AlreadyRunning, Fallback: fallback),
|
||||
"UnknownGame" => new PlayResult(PlayOutcome.NotInLibrary, Fallback: fallback),
|
||||
_ => new PlayResult(PlayOutcome.Failed, Fallback: fallback, Detail: ack.Outcome),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// How Play hands a game to its store's app (beta.21, D59): a link the shell opens with the app registered for it, or the
|
||||
/// store's own program. Behind a port so a test starts nothing and a viewer (D52) cannot (<see cref="ViewerShellStarter"/>).
|
||||
/// </summary>
|
||||
public interface IShellStarter
|
||||
{
|
||||
/// <summary>Opens <paramref name="link"/> with the app Windows has for its scheme; whether Windows took it.</summary>
|
||||
bool OpenLink(string link);
|
||||
|
||||
/// <summary>Starts <paramref name="path"/> with <paramref name="arguments"/> in <paramref name="workingDirectory"/>; whether it started.</summary>
|
||||
bool StartProgram(string path, string arguments, string? workingDirectory);
|
||||
}
|
||||
@@ -52,6 +52,8 @@ internal static class MachineFacingServices
|
||||
|
||||
services.AddSingleton<IRunAtLogon, RunAtLogonRegistry>();
|
||||
services.AddSingleton<IAgentTool, AgentTool>();
|
||||
// beta.21 (D59): Play hands a game to its store's app.
|
||||
services.AddSingleton<IShellStarter, ShellStarter>();
|
||||
|
||||
// The startup check is a hosted service; after an update's restart it also repairs the logon task.
|
||||
services.AddSingleton<IUpdateClient, VelopackUpdateClient>();
|
||||
@@ -66,6 +68,7 @@ internal static class MachineFacingServices
|
||||
services.AddSingleton<IAgentLink>(static sp => sp.GetRequiredService<ViewerAgentLink>());
|
||||
services.AddSingleton<IRunAtLogon, ViewerRunAtLogon>();
|
||||
services.AddSingleton<IAgentTool, ViewerAgentTool>();
|
||||
services.AddSingleton<IShellStarter, ViewerShellStarter>();
|
||||
services.AddSingleton<IUpdateClient, ViewerUpdateClient>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>Why a press in the store mode was started directly instead.</summary>
|
||||
public enum PlayFallback
|
||||
{
|
||||
None = 0,
|
||||
|
||||
/// <summary>No store's records name the folder the executable is in.</summary>
|
||||
NoStore,
|
||||
|
||||
/// <summary>GOG's records name it, and GOG GALAXY is not installed.</summary>
|
||||
NoGalaxy,
|
||||
|
||||
/// <summary>The App runs as administrator, and a store's app it started would too — and so would the game.</summary>
|
||||
Elevated,
|
||||
|
||||
/// <summary>A store's records name it with an id or a folder FrameLedger puts in no link (never seen; logged).</summary>
|
||||
NoLink,
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>What one press of Play did.</summary>
|
||||
public enum PlayOutcome
|
||||
{
|
||||
/// <summary>Nobody decided. The zero value, never a result.</summary>
|
||||
NotEvaluated = 0,
|
||||
|
||||
/// <summary>The store's app has the game (<see cref="PlayResult.Store"/> names the store).</summary>
|
||||
HandedToStore,
|
||||
|
||||
/// <summary>The capture agent accepted the launch (<c>LaunchGame</c>).</summary>
|
||||
StartedByAgent,
|
||||
|
||||
/// <summary>Direct, and no capture agent is connected.</summary>
|
||||
AgentUnavailable,
|
||||
|
||||
/// <summary>Direct, and the entry's recording is off: FrameLedger starts only what it records (schema 0009).</summary>
|
||||
RecordingOff,
|
||||
|
||||
/// <summary>A session of the game is already running.</summary>
|
||||
AlreadyRunning,
|
||||
|
||||
/// <summary>The agent has no entry with the game's id (<c>UnknownGame</c>): it left the library since the page was read.</summary>
|
||||
NotInLibrary,
|
||||
|
||||
/// <summary>Windows would not open the store's app, or the agent refused for another reason (<see cref="PlayResult.Detail"/>).</summary>
|
||||
Failed,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>One press of Play: what happened, which store's app has it, why it fell back, and the agent's own word on a failure.</summary>
|
||||
public sealed record PlayResult(PlayOutcome Outcome, string? Store = null, PlayFallback Fallback = PlayFallback.None, string? Detail = null);
|
||||
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Serilog;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>The shell's own hand-off. The App runs with the user's standard rights; an elevated App never reaches here (<see cref="GamePlayer"/>).</summary>
|
||||
public sealed class ShellStarter : IShellStarter
|
||||
{
|
||||
public bool OpenLink(string link)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(link);
|
||||
try
|
||||
{
|
||||
using Process? started = Process.Start(new ProcessStartInfo(link) { UseShellExecute = true });
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or FileNotFoundException)
|
||||
{
|
||||
Log.Warning("play: Windows did not open {Link} ({Message})", link, ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartProgram(string path, string arguments, string? workingDirectory)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(path);
|
||||
try
|
||||
{
|
||||
using Process? started = Process.Start(new ProcessStartInfo(path, arguments ?? string.Empty)
|
||||
{
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = workingDirectory ?? string.Empty,
|
||||
});
|
||||
return started is not null;
|
||||
}
|
||||
catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or FileNotFoundException)
|
||||
{
|
||||
Log.Warning("play: {Program} did not start ({Message})", path, ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>A viewer's (D52): nothing on this PC is started.</summary>
|
||||
public sealed class ViewerShellStarter : IShellStarter
|
||||
{
|
||||
public bool OpenLink(string link) => false;
|
||||
|
||||
public bool StartProgram(string path, string arguments, string? workingDirectory) => false;
|
||||
}
|
||||
Generated
+72
@@ -703,6 +703,25 @@ public static class Strings
|
||||
nameof(Override_Default),
|
||||
nameof(Override_Keep),
|
||||
nameof(Override_Title_Format),
|
||||
nameof(Play_AgentUnavailable_Format),
|
||||
nameof(Play_AlreadyRunning_Format),
|
||||
nameof(Play_Button),
|
||||
nameof(Play_Elevated_Format),
|
||||
nameof(Play_Epic_Format),
|
||||
nameof(Play_Failed_Format),
|
||||
nameof(Play_Gog_Format),
|
||||
nameof(Play_HandOffFailed_Format),
|
||||
nameof(Play_Itch_Format),
|
||||
nameof(Play_NoGalaxy_Format),
|
||||
nameof(Play_NoStore_Format),
|
||||
nameof(Play_NotInLibrary_Format),
|
||||
nameof(Play_RecordingOff_Fallback_Format),
|
||||
nameof(Play_RecordingOff_Format),
|
||||
nameof(Play_Started_Format),
|
||||
nameof(Play_Steam_Format),
|
||||
nameof(Play_Title),
|
||||
nameof(Play_ToolTip_Direct),
|
||||
nameof(Play_ToolTip_Store),
|
||||
nameof(RemoveGame_Body),
|
||||
nameof(RemoveGame_Delete),
|
||||
nameof(RemoveGame_Keep),
|
||||
@@ -816,6 +835,7 @@ public static class Strings
|
||||
nameof(Settings_Exceptions_Withdraw),
|
||||
nameof(Settings_FpsDecimals_Body),
|
||||
nameof(Settings_FpsDecimals_Label),
|
||||
nameof(Settings_Games_Header),
|
||||
nameof(Settings_Header),
|
||||
nameof(Settings_HideAntiCheatHooking_Body),
|
||||
nameof(Settings_HideAntiCheatHooking_Label),
|
||||
@@ -843,6 +863,10 @@ public static class Strings
|
||||
nameof(Settings_MinSession_Label),
|
||||
nameof(Settings_OnlineMetadata_Body),
|
||||
nameof(Settings_OnlineMetadata_Label),
|
||||
nameof(Settings_PlayMode_Body),
|
||||
nameof(Settings_PlayMode_Direct),
|
||||
nameof(Settings_PlayMode_Label),
|
||||
nameof(Settings_PlayMode_Store),
|
||||
nameof(Settings_Policy_Header),
|
||||
nameof(Settings_Privacy_Header),
|
||||
nameof(Settings_RemoveUninstalled_Applied),
|
||||
@@ -2426,6 +2450,44 @@ public static class Strings
|
||||
|
||||
public static string Override_Title_Format => ResourceManager.GetString(nameof(Override_Title_Format), Culture) ?? nameof(Override_Title_Format);
|
||||
|
||||
public static string Play_AgentUnavailable_Format => ResourceManager.GetString(nameof(Play_AgentUnavailable_Format), Culture) ?? nameof(Play_AgentUnavailable_Format);
|
||||
|
||||
public static string Play_AlreadyRunning_Format => ResourceManager.GetString(nameof(Play_AlreadyRunning_Format), Culture) ?? nameof(Play_AlreadyRunning_Format);
|
||||
|
||||
public static string Play_Button => ResourceManager.GetString(nameof(Play_Button), Culture) ?? nameof(Play_Button);
|
||||
|
||||
public static string Play_Elevated_Format => ResourceManager.GetString(nameof(Play_Elevated_Format), Culture) ?? nameof(Play_Elevated_Format);
|
||||
|
||||
public static string Play_Epic_Format => ResourceManager.GetString(nameof(Play_Epic_Format), Culture) ?? nameof(Play_Epic_Format);
|
||||
|
||||
public static string Play_Failed_Format => ResourceManager.GetString(nameof(Play_Failed_Format), Culture) ?? nameof(Play_Failed_Format);
|
||||
|
||||
public static string Play_Gog_Format => ResourceManager.GetString(nameof(Play_Gog_Format), Culture) ?? nameof(Play_Gog_Format);
|
||||
|
||||
public static string Play_HandOffFailed_Format => ResourceManager.GetString(nameof(Play_HandOffFailed_Format), Culture) ?? nameof(Play_HandOffFailed_Format);
|
||||
|
||||
public static string Play_Itch_Format => ResourceManager.GetString(nameof(Play_Itch_Format), Culture) ?? nameof(Play_Itch_Format);
|
||||
|
||||
public static string Play_NoGalaxy_Format => ResourceManager.GetString(nameof(Play_NoGalaxy_Format), Culture) ?? nameof(Play_NoGalaxy_Format);
|
||||
|
||||
public static string Play_NoStore_Format => ResourceManager.GetString(nameof(Play_NoStore_Format), Culture) ?? nameof(Play_NoStore_Format);
|
||||
|
||||
public static string Play_NotInLibrary_Format => ResourceManager.GetString(nameof(Play_NotInLibrary_Format), Culture) ?? nameof(Play_NotInLibrary_Format);
|
||||
|
||||
public static string Play_RecordingOff_Fallback_Format => ResourceManager.GetString(nameof(Play_RecordingOff_Fallback_Format), Culture) ?? nameof(Play_RecordingOff_Fallback_Format);
|
||||
|
||||
public static string Play_RecordingOff_Format => ResourceManager.GetString(nameof(Play_RecordingOff_Format), Culture) ?? nameof(Play_RecordingOff_Format);
|
||||
|
||||
public static string Play_Started_Format => ResourceManager.GetString(nameof(Play_Started_Format), Culture) ?? nameof(Play_Started_Format);
|
||||
|
||||
public static string Play_Steam_Format => ResourceManager.GetString(nameof(Play_Steam_Format), Culture) ?? nameof(Play_Steam_Format);
|
||||
|
||||
public static string Play_Title => ResourceManager.GetString(nameof(Play_Title), Culture) ?? nameof(Play_Title);
|
||||
|
||||
public static string Play_ToolTip_Direct => ResourceManager.GetString(nameof(Play_ToolTip_Direct), Culture) ?? nameof(Play_ToolTip_Direct);
|
||||
|
||||
public static string Play_ToolTip_Store => ResourceManager.GetString(nameof(Play_ToolTip_Store), Culture) ?? nameof(Play_ToolTip_Store);
|
||||
|
||||
public static string RemoveGame_Body => ResourceManager.GetString(nameof(RemoveGame_Body), Culture) ?? nameof(RemoveGame_Body);
|
||||
|
||||
public static string RemoveGame_Delete => ResourceManager.GetString(nameof(RemoveGame_Delete), Culture) ?? nameof(RemoveGame_Delete);
|
||||
@@ -2652,6 +2714,8 @@ public static class Strings
|
||||
|
||||
public static string Settings_FpsDecimals_Label => ResourceManager.GetString(nameof(Settings_FpsDecimals_Label), Culture) ?? nameof(Settings_FpsDecimals_Label);
|
||||
|
||||
public static string Settings_Games_Header => ResourceManager.GetString(nameof(Settings_Games_Header), Culture) ?? nameof(Settings_Games_Header);
|
||||
|
||||
public static string Settings_Header => ResourceManager.GetString(nameof(Settings_Header), Culture) ?? nameof(Settings_Header);
|
||||
|
||||
public static string Settings_HideAntiCheatHooking_Body => ResourceManager.GetString(nameof(Settings_HideAntiCheatHooking_Body), Culture) ?? nameof(Settings_HideAntiCheatHooking_Body);
|
||||
@@ -2706,6 +2770,14 @@ public static class Strings
|
||||
|
||||
public static string Settings_OnlineMetadata_Label => ResourceManager.GetString(nameof(Settings_OnlineMetadata_Label), Culture) ?? nameof(Settings_OnlineMetadata_Label);
|
||||
|
||||
public static string Settings_PlayMode_Body => ResourceManager.GetString(nameof(Settings_PlayMode_Body), Culture) ?? nameof(Settings_PlayMode_Body);
|
||||
|
||||
public static string Settings_PlayMode_Direct => ResourceManager.GetString(nameof(Settings_PlayMode_Direct), Culture) ?? nameof(Settings_PlayMode_Direct);
|
||||
|
||||
public static string Settings_PlayMode_Label => ResourceManager.GetString(nameof(Settings_PlayMode_Label), Culture) ?? nameof(Settings_PlayMode_Label);
|
||||
|
||||
public static string Settings_PlayMode_Store => ResourceManager.GetString(nameof(Settings_PlayMode_Store), Culture) ?? nameof(Settings_PlayMode_Store);
|
||||
|
||||
public static string Settings_Policy_Header => ResourceManager.GetString(nameof(Settings_Policy_Header), Culture) ?? nameof(Settings_Policy_Header);
|
||||
|
||||
public static string Settings_Privacy_Header => ResourceManager.GetString(nameof(Settings_Privacy_Header), Culture) ?? nameof(Settings_Privacy_Header);
|
||||
|
||||
@@ -4221,4 +4221,100 @@
|
||||
<value>見つかりません — ゲームのフォルダーには、ルールが挙げるアップスケーラー、フレーム生成、Vulkan のファイルがありません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Button" xml:space="preserve">
|
||||
<value>プレイ</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Store" xml:space="preserve">
|
||||
<value>ゲームをインストールしたストア経由でプレイします。Steam または Epic Games Launcher が起動し、GOG GALAXY が実行し、itch アプリは先に確認します。どのストアからもインストールされていないゲームは FrameLedger が起動します。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Direct" xml:space="preserve">
|
||||
<value>プレイ: FrameLedger がゲームを自分で起動します。最初のフレームから記録し、通常の権限で実行します。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Title" xml:space="preserve">
|
||||
<value>プレイ</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Steam_Format" xml:space="preserve">
|
||||
<value>Steam が {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Epic_Format" xml:space="preserve">
|
||||
<value>Epic Games Launcher が {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Gog_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY が {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Itch_Format" xml:space="preserve">
|
||||
<value>itch アプリが起動する {0} のコピーを確認します。そちらで確定してください。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Started_Format" xml:space="preserve">
|
||||
<value>FrameLedger が {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_NoStore_Format" xml:space="preserve">
|
||||
<value>{0} のフォルダーを記録しているストアがないため、FrameLedger が起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_NoGalaxy_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY がインストールされていないため、FrameLedger が {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Elevated_Format" xml:space="preserve">
|
||||
<value>FrameLedger が管理者として実行されているため、ストアではなくキャプチャ エージェントが通常の権限で {0} を起動しています。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_AgentUnavailable_Format" xml:space="preserve">
|
||||
<value>キャプチャ エージェントが実行されていないため、FrameLedger は {0} を起動できません。ご自分で起動するか、エージェントが接続してからもう一度お試しください。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Format" xml:space="preserve">
|
||||
<value>{0} の記録がオフで、FrameLedger は記録するゲームしか起動しません。記録をオンにするか、プレイをストア経由にしてください(設定 ▸ ゲーム)。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_AlreadyRunning_Format" xml:space="preserve">
|
||||
<value>{0} はすでに実行中です。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_Failed_Format" xml:space="preserve">
|
||||
<value>{0} を起動できませんでした({1})。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_HandOffFailed_Format" xml:space="preserve">
|
||||
<value>Windows は {0} のストア アプリを開けませんでした。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Games_Header" xml:space="preserve">
|
||||
<value>ゲーム</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Label" xml:space="preserve">
|
||||
<value>プレイ ボタン</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Body" xml:space="preserve">
|
||||
<value>ストア経由: Steam と Epic Games Launcher がゲームを起動し、GOG GALAXY が実行し、itch アプリは先に確認します。どのストアからもインストールされていないゲームは FrameLedger が起動します。直接: FrameLedger がゲームを自分で起動します。最初のフレームから記録し、通常の権限で実行します。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Store" xml:space="preserve">
|
||||
<value>ストア経由</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Direct" xml:space="preserve">
|
||||
<value>直接起動</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Fallback_Format" xml:space="preserve">
|
||||
<value>{0} の記録がオフで、FrameLedger は記録するゲームしか起動しません。記録をオンにするか、ご自分で起動してください。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Play_NotInLibrary_Format" xml:space="preserve">
|
||||
<value>{0} はもうライブラリにないため、起動しませんでした。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3176,4 +3176,76 @@ The documents below are the full terms; this summary does not replace them.</val
|
||||
<data name="GameDetail_Supports_None" xml:space="preserve">
|
||||
<value>None found — the game's folder holds no upscaler, frame-generation or Vulkan file the rules name.</value>
|
||||
</data>
|
||||
<data name="Play_Button" xml:space="preserve">
|
||||
<value>Play</value>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Store" xml:space="preserve">
|
||||
<value>Play through the store that installed the game: Steam or the Epic Games Launcher starts it, GOG GALAXY runs it, the itch app asks first. A game no store installed is started by FrameLedger.</value>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Direct" xml:space="preserve">
|
||||
<value>Play: FrameLedger starts the game itself, recorded from its first frame, with your standard rights.</value>
|
||||
</data>
|
||||
<data name="Play_Title" xml:space="preserve">
|
||||
<value>Play</value>
|
||||
</data>
|
||||
<data name="Play_Steam_Format" xml:space="preserve">
|
||||
<value>Steam is starting {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Epic_Format" xml:space="preserve">
|
||||
<value>The Epic Games Launcher is starting {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Gog_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY is starting {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Itch_Format" xml:space="preserve">
|
||||
<value>The itch app asks which copy of {0} to launch — confirm there.</value>
|
||||
</data>
|
||||
<data name="Play_Started_Format" xml:space="preserve">
|
||||
<value>FrameLedger is starting {0}.</value>
|
||||
</data>
|
||||
<data name="Play_NoStore_Format" xml:space="preserve">
|
||||
<value>No store's records name the folder of {0}, so FrameLedger is starting it.</value>
|
||||
</data>
|
||||
<data name="Play_NoGalaxy_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY is not installed, so FrameLedger is starting {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Elevated_Format" xml:space="preserve">
|
||||
<value>FrameLedger is running as administrator, so the capture agent is starting {0} with your standard rights instead of its store.</value>
|
||||
</data>
|
||||
<data name="Play_AgentUnavailable_Format" xml:space="preserve">
|
||||
<value>The capture agent is not running, so FrameLedger cannot start {0}. Start it yourself, or try again when the agent is connected.</value>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Format" xml:space="preserve">
|
||||
<value>Recording is off for {0}, and FrameLedger starts only games it records. Turn recording on, or set Play to go through the store (Settings ▸ Games).</value>
|
||||
</data>
|
||||
<data name="Play_AlreadyRunning_Format" xml:space="preserve">
|
||||
<value>{0} is already running.</value>
|
||||
</data>
|
||||
<data name="Play_Failed_Format" xml:space="preserve">
|
||||
<value>{0} could not be started ({1}).</value>
|
||||
</data>
|
||||
<data name="Play_HandOffFailed_Format" xml:space="preserve">
|
||||
<value>Windows could not open the store's app for {0}.</value>
|
||||
</data>
|
||||
<data name="Settings_Games_Header" xml:space="preserve">
|
||||
<value>Games</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Label" xml:space="preserve">
|
||||
<value>Play button</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Body" xml:space="preserve">
|
||||
<value>Through the store: Steam and the Epic Games Launcher start the game, GOG GALAXY runs it, the itch app asks first; a game no store installed is started by FrameLedger. Directly: FrameLedger starts the game itself — recorded from its first frame, with your standard rights.</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Store" xml:space="preserve">
|
||||
<value>Through the store</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Direct" xml:space="preserve">
|
||||
<value>Start directly</value>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Fallback_Format" xml:space="preserve">
|
||||
<value>Recording is off for {0}, and FrameLedger starts only games it records. Turn its recording on, or start it yourself.</value>
|
||||
</data>
|
||||
<data name="Play_NotInLibrary_Format" xml:space="preserve">
|
||||
<value>{0} is no longer in the library, so it was not started.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3171,4 +3171,76 @@ Các văn bản bên dưới là điều khoản đầy đủ; bản tóm tắt
|
||||
<data name="GameDetail_Supports_None" xml:space="preserve">
|
||||
<value>Không tìm thấy — thư mục game không có file upscaler, frame generation hay Vulkan nào mà bộ quy tắc liệt kê.</value>
|
||||
</data>
|
||||
<data name="Play_Button" xml:space="preserve">
|
||||
<value>Chơi</value>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Store" xml:space="preserve">
|
||||
<value>Chơi qua store đã cài game: Steam hoặc Epic Games Launcher sẽ chạy game, GOG GALAXY chạy game, app itch hỏi trước. Game không do store nào cài thì FrameLedger tự chạy.</value>
|
||||
</data>
|
||||
<data name="Play_ToolTip_Direct" xml:space="preserve">
|
||||
<value>Chơi: FrameLedger tự chạy game, ghi lại từ khung hình đầu tiên, với quyền thường của bạn.</value>
|
||||
</data>
|
||||
<data name="Play_Title" xml:space="preserve">
|
||||
<value>Chơi</value>
|
||||
</data>
|
||||
<data name="Play_Steam_Format" xml:space="preserve">
|
||||
<value>Steam đang chạy {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Epic_Format" xml:space="preserve">
|
||||
<value>Epic Games Launcher đang chạy {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Gog_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY đang chạy {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Itch_Format" xml:space="preserve">
|
||||
<value>App itch sẽ hỏi chạy bản nào của {0} — hãy xác nhận ở đó.</value>
|
||||
</data>
|
||||
<data name="Play_Started_Format" xml:space="preserve">
|
||||
<value>FrameLedger đang chạy {0}.</value>
|
||||
</data>
|
||||
<data name="Play_NoStore_Format" xml:space="preserve">
|
||||
<value>Không store nào ghi nhận thư mục của {0}, nên FrameLedger tự chạy game.</value>
|
||||
</data>
|
||||
<data name="Play_NoGalaxy_Format" xml:space="preserve">
|
||||
<value>GOG GALAXY chưa được cài, nên FrameLedger tự chạy {0}.</value>
|
||||
</data>
|
||||
<data name="Play_Elevated_Format" xml:space="preserve">
|
||||
<value>FrameLedger đang chạy với quyền quản trị, nên capture agent sẽ chạy {0} với quyền thường của bạn thay vì qua store.</value>
|
||||
</data>
|
||||
<data name="Play_AgentUnavailable_Format" xml:space="preserve">
|
||||
<value>Capture agent không chạy, nên FrameLedger không thể chạy {0}. Hãy tự chạy game, hoặc thử lại khi agent đã kết nối.</value>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Format" xml:space="preserve">
|
||||
<value>Việc ghi đang tắt cho {0}, và FrameLedger chỉ chạy game mà nó ghi. Hãy bật ghi, hoặc đặt nút Chơi đi qua store (Cài đặt ▸ Game).</value>
|
||||
</data>
|
||||
<data name="Play_AlreadyRunning_Format" xml:space="preserve">
|
||||
<value>{0} đang chạy rồi.</value>
|
||||
</data>
|
||||
<data name="Play_Failed_Format" xml:space="preserve">
|
||||
<value>Không chạy được {0} ({1}).</value>
|
||||
</data>
|
||||
<data name="Play_HandOffFailed_Format" xml:space="preserve">
|
||||
<value>Windows không mở được app của store cho {0}.</value>
|
||||
</data>
|
||||
<data name="Settings_Games_Header" xml:space="preserve">
|
||||
<value>Game</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Label" xml:space="preserve">
|
||||
<value>Nút Chơi</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Body" xml:space="preserve">
|
||||
<value>Qua store: Steam và Epic Games Launcher chạy game, GOG GALAXY chạy game, app itch hỏi trước; game không do store nào cài thì FrameLedger tự chạy. Chạy trực tiếp: FrameLedger tự chạy game — ghi lại từ khung hình đầu tiên, với quyền thường của bạn.</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Store" xml:space="preserve">
|
||||
<value>Qua store</value>
|
||||
</data>
|
||||
<data name="Settings_PlayMode_Direct" xml:space="preserve">
|
||||
<value>Chạy trực tiếp</value>
|
||||
</data>
|
||||
<data name="Play_RecordingOff_Fallback_Format" xml:space="preserve">
|
||||
<value>Việc ghi đang tắt cho {0}, và FrameLedger chỉ chạy game mà nó ghi. Hãy bật ghi, hoặc tự chạy game.</value>
|
||||
</data>
|
||||
<data name="Play_NotInLibrary_Format" xml:space="preserve">
|
||||
<value>{0} không còn trong thư viện, nên không được chạy.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -37,6 +37,7 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
private readonly IEditGamePrompt _edit;
|
||||
private readonly IGamePicker _picker;
|
||||
private readonly IMessageStrip _strip;
|
||||
private readonly GamePlayer? _player;
|
||||
private readonly ISessionSummaryOpener _summaries;
|
||||
private readonly SessionSeriesLoader _loader;
|
||||
private readonly IAgentLink? _agent;
|
||||
@@ -72,8 +73,13 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
/// itself when the file is under another drive letter, so this clears on the next visit once it has.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlayCommand))]
|
||||
private bool _executableMissing;
|
||||
|
||||
/// <summary>What Play will do, in the mode Settings ▸ Games has now (beta.21, D59).</summary>
|
||||
[ObservableProperty]
|
||||
private string _playToolTip = Strings.Play_ToolTip_Store;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _lastSessionText = string.Empty;
|
||||
|
||||
@@ -227,9 +233,10 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
IConfirmations confirmations, IEditGamePrompt edit, IMessageStrip strip, ISessionSummaryOpener summaries,
|
||||
SessionSeriesLoader loader, IHardwareSnapshotRepository hardware, SessionSelection sessionSelection, IGamePicker picker,
|
||||
RegisteredSettings? settings = null, IAgentLink? agent = null, AntiCheatExceptions? exceptions = null, SessionDeletion? deletion = null,
|
||||
UiMode? mode = null)
|
||||
UiMode? mode = null, GamePlayer? player = null)
|
||||
{
|
||||
// beta.15 (D52): a viewer over a copy has no Agent to ask; a composition without a mode (a test) is the profile's App.
|
||||
_player = player;
|
||||
_mode = mode ?? UiMode.Profile;
|
||||
_deletion = deletion;
|
||||
_exceptions = exceptions;
|
||||
@@ -267,6 +274,8 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
|
||||
public static string EditText => Strings.GameDetail_Edit;
|
||||
|
||||
public static string PlayText => Strings.Play_Button;
|
||||
|
||||
public static string RemoveText => Strings.GameDetail_Remove;
|
||||
|
||||
public static string ChangeExecutableText => Strings.GameDetail_ChangeExe;
|
||||
@@ -449,6 +458,11 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
Game = detail.Row;
|
||||
_detail = detail;
|
||||
NotFound = false;
|
||||
if (_player is not null)
|
||||
{
|
||||
PlayToolTip = await _player.IsDirectAsync(ct).ConfigureAwait(true) ? Strings.Play_ToolTip_Direct : Strings.Play_ToolTip_Store;
|
||||
}
|
||||
|
||||
if (_settings is not null)
|
||||
{
|
||||
_hideAntiCheatHooking = await _settings.GetBooleanAsync(SettingsRegistry.UiHideAntiCheatHooking, ct).ConfigureAwait(true);
|
||||
@@ -715,6 +729,13 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private Task ReEnableHookingAsync() => RunAsync(EnableAsync);
|
||||
|
||||
/// <summary>
|
||||
/// beta.21 (owner decision D59): Play — through the store that installed the game, or started by the capture agent
|
||||
/// (Settings ▸ Games); <see cref="GamePlayer"/> says what each does. A game whose executable is not there has none.
|
||||
/// </summary>
|
||||
[RelayCommand(CanExecute = nameof(CanPlay))]
|
||||
private Task PlayAsync() => RunAsync(PlayCoreAsync);
|
||||
|
||||
[RelayCommand]
|
||||
private Task EditAsync() => RunAsync(EditCoreAsync);
|
||||
|
||||
@@ -728,6 +749,27 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private Task ChangeExecutableAsync() => RunAsync(ChangeExecutableCoreAsync);
|
||||
|
||||
private bool CanPlay() => _player is not null && !ExecutableMissing;
|
||||
|
||||
private async Task PlayCoreAsync()
|
||||
{
|
||||
if (_player is null || Game is not { } game)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayResult result = await _player.PlayAsync(game).ConfigureAwait(true);
|
||||
(string message, bool warning) = GamePlayer.Describe(result, game.Name);
|
||||
if (warning)
|
||||
{
|
||||
_strip.Warn(Strings.Play_Title, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
_strip.Info(Strings.Play_Title, message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One action at a time, and the one in flight is <see cref="Pending"/> for a test to await.</summary>
|
||||
private async Task RunAsync(Func<Task> work)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,8 @@ public sealed partial class GamesViewModel : ObservableObject
|
||||
private readonly IAgentLink? _agent;
|
||||
private readonly LibraryChanges? _changes;
|
||||
private readonly IMessageStrip? _strip;
|
||||
private readonly GamePlayer? _player;
|
||||
private readonly UiMode _mode;
|
||||
private readonly TimeProvider _clock;
|
||||
private readonly Func<string, bool> _exists;
|
||||
private readonly UiThread _ui = new();
|
||||
@@ -65,11 +67,17 @@ public sealed partial class GamesViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _listView;
|
||||
|
||||
/// <summary>What Play will do, in the mode Settings ▸ Games has now (beta.21, D59).</summary>
|
||||
[ObservableProperty]
|
||||
private string _playToolTip = Strings.Play_ToolTip_Store;
|
||||
|
||||
public GamesViewModel(GameLibrary library, GameSelection selection, IPageNavigator navigator, AddGameFlow addGame, ImportLibraryFlow? import = null,
|
||||
RegisteredSettings? settings = null, IAgentLink? agent = null, LibraryChanges? changes = null, IMessageStrip? strip = null, TimeProvider? clock = null,
|
||||
Func<string, bool>? executableExists = null)
|
||||
Func<string, bool>? executableExists = null, GamePlayer? player = null, UiMode? mode = null)
|
||||
{
|
||||
_strip = strip;
|
||||
_player = player;
|
||||
_mode = mode ?? UiMode.Profile;
|
||||
_clock = clock ?? TimeProvider.System;
|
||||
_exists = executableExists ?? GameLibrary.ExecutableExists;
|
||||
_library = library ?? throw new ArgumentNullException(nameof(library));
|
||||
@@ -85,6 +93,9 @@ public sealed partial class GamesViewModel : ObservableObject
|
||||
|
||||
public static string EmptyText => Strings.Games_Empty;
|
||||
|
||||
/// <summary>beta.21 (D52's rule for Play): a viewer over a copy starts no game.</summary>
|
||||
public bool ActsOnThisPc => _mode.ActsOnThisPc;
|
||||
|
||||
public static string NoMatchText => Strings.Games_NoMatch;
|
||||
|
||||
public static string AddText => Strings.Games_Add;
|
||||
@@ -129,6 +140,11 @@ public sealed partial class GamesViewModel : ObservableObject
|
||||
{
|
||||
int read = Interlocked.Increment(ref _reads);
|
||||
await ReadViewAsync(ct).ConfigureAwait(true);
|
||||
if (_player is not null)
|
||||
{
|
||||
PlayToolTip = await _player.IsDirectAsync(ct).ConfigureAwait(true) ? Strings.Play_ToolTip_Direct : Strings.Play_ToolTip_Store;
|
||||
}
|
||||
|
||||
IReadOnlyList<GameCard> cards = await _library.ListCardsAsync(ct).ConfigureAwait(true);
|
||||
// Whether each executable is on disk is a file-system question per entry — a drive that is gone can take a moment
|
||||
// to say so — so it is asked off the UI thread, the game page's own way (GameLibrary.ExecutableExists).
|
||||
@@ -216,6 +232,29 @@ public sealed partial class GamesViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private async Task AddGameAsync() => _ = await _addGame.RunAsync().ConfigureAwait(true);
|
||||
|
||||
/// <summary>beta.21 (D59): a card's or a row's Play — as the game's page plays it (<see cref="GamePlayer"/>).</summary>
|
||||
[RelayCommand(CanExecute = nameof(CanPlay))]
|
||||
private async Task PlayAsync(GameCardViewModel? card)
|
||||
{
|
||||
if (_player is null || card is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayResult result = await _player.PlayAsync(card.Card.Row).ConfigureAwait(true);
|
||||
(string message, bool warning) = GamePlayer.Describe(result, card.Name);
|
||||
if (warning)
|
||||
{
|
||||
_strip?.Warn(Strings.Play_Title, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
_strip?.Info(Strings.Play_Title, message);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanPlay(GameCardViewModel? card) => _player is not null && card is { NotInstalled: false };
|
||||
|
||||
[RelayCommand]
|
||||
private void Open(GameCardViewModel? card)
|
||||
{
|
||||
|
||||
@@ -123,6 +123,10 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _updateChannel = "stable";
|
||||
|
||||
/// <summary>beta.21 (owner decision D59): what Play does — <c>ui.play_mode</c>.</summary>
|
||||
[ObservableProperty]
|
||||
private string _playMode = Application.Play.PlayMode.Store;
|
||||
|
||||
/// <summary><c>11_UPDATER</c> §Flow: the startup silent check, on by default (P4 PR-5).</summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoCheckUpdates = true;
|
||||
@@ -240,6 +244,13 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
new(Update.UpdateChannelPolicy.Beta, Strings.Settings_Channel_Beta),
|
||||
];
|
||||
|
||||
/// <summary>Play's two modes (beta.21, D59), labelled in the language this page opened in.</summary>
|
||||
public IReadOnlyList<Choice<string>> PlayModes { get; } =
|
||||
[
|
||||
new(Application.Play.PlayMode.Store, Strings.Settings_PlayMode_Store),
|
||||
new(Application.Play.PlayMode.Direct, Strings.Settings_PlayMode_Direct),
|
||||
];
|
||||
|
||||
public static double MinSessionMinimum => SettingsRegistry.CaptureMinSessionSeconds.Minimum;
|
||||
|
||||
public static double MinSessionMaximum => SettingsRegistry.CaptureMinSessionSeconds.Maximum;
|
||||
@@ -482,6 +493,8 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
|
||||
partial void OnUpdateChannelChanged(string value) => Persist(SettingsRegistry.UpdateChannel, value);
|
||||
|
||||
partial void OnPlayModeChanged(string value) => Persist(SettingsRegistry.UiPlayMode, value);
|
||||
|
||||
partial void OnAutoCheckUpdatesChanged(bool value) => Persist(SettingsRegistry.UpdateAutoCheck, value);
|
||||
|
||||
partial void OnStartWithWindowsChanged(bool value)
|
||||
@@ -550,6 +563,7 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
HideScrollBars = await _settings.GetBooleanAsync(SettingsRegistry.UiHideScrollBars).ConfigureAwait(true);
|
||||
OnlineMetadata = await _settings.GetBooleanAsync(SettingsRegistry.PrivacyOnlineMetadata).ConfigureAwait(true);
|
||||
UpdateChannel = await _settings.GetAsync(SettingsRegistry.UpdateChannel).ConfigureAwait(true);
|
||||
PlayMode = await _settings.GetAsync(SettingsRegistry.UiPlayMode).ConfigureAwait(true);
|
||||
AutoCheckUpdates = await _settings.GetBooleanAsync(SettingsRegistry.UpdateAutoCheck).ConfigureAwait(true);
|
||||
LogDebug = await _settings.GetBooleanAsync(SettingsRegistry.LogDebug).ConfigureAwait(true);
|
||||
|
||||
|
||||
@@ -9,4 +9,9 @@ namespace FrameLedger.Application.Import;
|
||||
/// executable when the store names one (GOG and Epic do; Steam and itch do not), and the store's version string.
|
||||
/// Read from local launcher files and registry keys only — nothing is fetched (CLAUDE.md rule 8).
|
||||
/// </summary>
|
||||
public sealed record StoreGame(string Platform, string StoreId, string Name, string InstallDirectory, string? ExePath, string? Version);
|
||||
/// <remarks>
|
||||
/// <c>LaunchKey</c> (beta.21, Play, D59): what the store's own launch link names where that is more than the store id —
|
||||
/// the Epic Games Launcher's <c>CatalogNamespace:CatalogItemId:AppName</c>; null for every other store.
|
||||
/// </remarks>
|
||||
public sealed record StoreGame(string Platform, string StoreId, string Name, string InstallDirectory, string? ExePath, string? Version,
|
||||
string? LaunchKey = null);
|
||||
@@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>Where GOG GALAXY's program is (beta.21, Play): the GOG game shortcuts' own command needs it.</summary>
|
||||
public interface IGogGalaxyLocator
|
||||
{
|
||||
/// <summary>The full path of <c>GalaxyClient.exe</c> as GOG's own registry entries name it, or null when it is not installed.</summary>
|
||||
string? ClientPath();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>The Play button's two modes (beta.21, owner decision D59): <c>ui.play_mode</c>'s choices.</summary>
|
||||
public static class PlayMode
|
||||
{
|
||||
/// <summary>Through the store that installed the game — the default; a game no store installed starts directly.</summary>
|
||||
public const string Store = "store";
|
||||
|
||||
/// <summary>The capture agent starts the game itself, recorded from its first frame, never as administrator.</summary>
|
||||
public const string Direct = "direct";
|
||||
|
||||
/// <summary>Whether a stored value is the direct mode; anything else is the store's.</summary>
|
||||
public static bool IsDirect(string? value) => string.Equals(value, Direct, StringComparison.Ordinal);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>
|
||||
/// One hand-off to a store's app: built by <see cref="StoreLaunches.For"/> from a record the store itself keeps, with every
|
||||
/// id checked against what that store's ids look like — never from a string a caller or a ledger row hands in, because a
|
||||
/// games row is a file any program of the user can write and a link is something the shell will open.
|
||||
/// </summary>
|
||||
/// <param name="Platform">The store, in <c>games.platform</c>'s vocabulary.</param>
|
||||
/// <param name="Kind">Whether <paramref name="Target"/> is a link or a program.</param>
|
||||
/// <param name="Target">The link, or the program's full path.</param>
|
||||
/// <param name="Arguments">The program's arguments; null for a link.</param>
|
||||
/// <param name="WorkingDirectory">The program's folder; null for a link.</param>
|
||||
public sealed record StoreLaunch(string Platform, StoreLaunchKind Kind, string Target, string? Arguments = null, string? WorkingDirectory = null);
|
||||
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>How Play hands a game to its store's app (beta.21, owner decision D59).</summary>
|
||||
public enum StoreLaunchKind
|
||||
{
|
||||
/// <summary>Nobody decided. The zero value, never a launch.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>A link the shell opens with the store's registered app (<c>steam://</c>, <c>com.epicgames.launcher://</c>, <c>itch://</c>).</summary>
|
||||
OpenLink,
|
||||
|
||||
/// <summary>The store's own program with arguments — GOG GALAXY's <c>/command=runGame</c>, as its shortcuts start a game.</summary>
|
||||
RunProgram,
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Import;
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>
|
||||
/// The store's own way to start a game it installed (beta.21, Play, owner decision D59), read from the forms the stores
|
||||
/// themselves write — measured on the owner's PC on 2026-10-13, read-only:
|
||||
/// <list type="bullet">
|
||||
/// <item><b>Steam</b>: <c>steam://rungameid/<appid></c>, the link of every game shortcut Steam made there (20 of them);
|
||||
/// Steam starts the game.</item>
|
||||
/// <item><b>Epic Games Launcher</b>: <c>com.epicgames.launcher://apps/<namespace>%3A<item>%3A<app>?action=launch&silent=true</c>,
|
||||
/// the form the launcher's own desktop shortcuts carry, or the <c>AppName</c> alone where the manifest names no catalog —
|
||||
/// UNMEASURED: no Epic shortcut was on the PC.</item>
|
||||
/// <item><b>GOG GALAXY</b>: <c>GalaxyClient.exe /command=runGame /gameId=<id> /path="<folder>"</c>, the command line of
|
||||
/// the game shortcut GALAXY made there; GALAXY starts the game.</item>
|
||||
/// <item><b>itch</b>: <c>itch://install?game_id=<id>&launch</c>, which the itch app (26.22.0, read from its own code)
|
||||
/// answers by asking which installed copy to launch — the user confirms there.</item>
|
||||
/// </list>
|
||||
/// Every id is checked against what that store's ids look like before it is put in a link the shell will open.
|
||||
/// </summary>
|
||||
public static class StoreLaunches
|
||||
{
|
||||
/// <summary>The hand-off for <paramref name="record"/>, or null when its store has none FrameLedger may use.</summary>
|
||||
/// <param name="record">The store's record of the game (<see cref="StoreRecords.Owning"/>).</param>
|
||||
/// <param name="galaxyClientPath">GOG GALAXY's program, when it is installed; a GOG game without it has no hand-off.</param>
|
||||
public static StoreLaunch? For(StoreGame record, string? galaxyClientPath)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(record);
|
||||
return record.Platform switch
|
||||
{
|
||||
"steam" when IsDigits(record.StoreId) =>
|
||||
new StoreLaunch("steam", StoreLaunchKind.OpenLink, "steam://rungameid/" + record.StoreId),
|
||||
"epic" => Epic(record),
|
||||
"gog" when IsDigits(record.StoreId) && galaxyClientPath is { Length: > 0 } && IsPlainFolder(record.InstallDirectory) =>
|
||||
new StoreLaunch("gog", StoreLaunchKind.RunProgram, galaxyClientPath,
|
||||
"/command=runGame /gameId=" + record.StoreId + " /path=\"" + record.InstallDirectory.TrimEnd('\\', '/') + "\"",
|
||||
Path.GetDirectoryName(galaxyClientPath)),
|
||||
"itch" when IsDigits(record.StoreId) =>
|
||||
new StoreLaunch("itch", StoreLaunchKind.OpenLink, "itch://install?game_id=" + record.StoreId + "&launch"),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
private static StoreLaunch? Epic(StoreGame record)
|
||||
{
|
||||
string? key = record.LaunchKey?.Split(':') is [var ns, var item, var app]
|
||||
&& IsEpicToken(ns) && IsEpicToken(item) && IsEpicToken(app) && string.Equals(app, record.StoreId, StringComparison.Ordinal)
|
||||
? ns + "%3A" + item + "%3A" + app
|
||||
: IsEpicToken(record.StoreId) ? record.StoreId : null;
|
||||
return key is null ? null : new StoreLaunch("epic", StoreLaunchKind.OpenLink, "com.epicgames.launcher://apps/" + key + "?action=launch&silent=true");
|
||||
}
|
||||
|
||||
/// <summary>Steam's app ids, GOG's product ids and itch's game ids are whole numbers.</summary>
|
||||
private static bool IsDigits(string id) => id.Length is > 0 and <= 20 && id.All(char.IsAsciiDigit);
|
||||
|
||||
/// <summary>Epic's AppName, CatalogNamespace and CatalogItemId: letters, digits, '-', '_' and '.'.</summary>
|
||||
private static bool IsEpicToken(string token) =>
|
||||
token.Length is > 0 and <= 128 && token.All(static c => char.IsAsciiLetterOrDigit(c) || c is '-' or '_' or '.');
|
||||
|
||||
/// <summary>A folder that can stand inside one pair of quotes on GALAXY's command line.</summary>
|
||||
private static bool IsPlainFolder(string folder) =>
|
||||
folder.Length is > 3 and < 1024 && Path.IsPathFullyQualified(folder) && !folder.Contains('"', StringComparison.Ordinal);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Import;
|
||||
|
||||
namespace FrameLedger.Application.Play;
|
||||
|
||||
/// <summary>Which store installed a library entry's game (beta.21, Play): asked of the stores' own records, as the import reads them.</summary>
|
||||
public static class StoreRecords
|
||||
{
|
||||
/// <summary>
|
||||
/// The record whose install folder holds <paramref name="exePath"/> — the deepest such folder, and among equals the one
|
||||
/// whose id is the entry's <paramref name="storeId"/> — or null when no store installed it. The entry's own platform is
|
||||
/// not asked: detection may have rewritten it (an itch or GOG build that ships Steam's API reads as Steam) while its store
|
||||
/// id stayed the importer's, and a Steam link built from an itch id would start some other game.
|
||||
/// </summary>
|
||||
public static StoreGame? Owning(string exePath, string? storeId, IEnumerable<StoreGame> records)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
ArgumentNullException.ThrowIfNull(records);
|
||||
string exe = Full(exePath);
|
||||
StoreGame? best = null;
|
||||
int bestLength = -1;
|
||||
foreach (StoreGame record in records)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(record.InstallDirectory))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string folder = Full(record.InstallDirectory).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar;
|
||||
if (!exe.StartsWith(folder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool deeper = folder.Length > bestLength;
|
||||
bool sameButNamed = folder.Length == bestLength && storeId is not null
|
||||
&& string.Equals(record.StoreId, storeId, StringComparison.Ordinal)
|
||||
&& !string.Equals(best?.StoreId, storeId, StringComparison.Ordinal);
|
||||
if (deeper || sameButNamed)
|
||||
{
|
||||
best = record;
|
||||
bestLength = folder.Length;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
private static string Full(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or PathTooLongException)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,12 +89,27 @@ public static class SettingsRegistry
|
||||
Choices = ["grid", "list"],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// What the Play button does (beta.21, owner decision D59): <c>store</c> hands the game to the app of the store that
|
||||
/// installed it — Steam and the Epic Games Launcher start it, GOG GALAXY runs it as its own shortcuts do, itch asks
|
||||
/// first — and has the capture agent start it when no store did; <c>direct</c> has the capture agent start it, recorded
|
||||
/// from its first frame and never as administrator. Settings ▸ Games; the Agent never reads it.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition UiPlayMode = new()
|
||||
{
|
||||
Key = "ui.play_mode",
|
||||
Kind = SettingKind.Choice,
|
||||
Default = "store",
|
||||
Choices = ["store", "direct"],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether the Agent's watcher records tracked games that the App did not launch (FR-3.1/FR-3.3). <b>Reserved since
|
||||
/// beta.12:</b> the App showed a switch for it ("Record games launched outside FrameLedger") and no Agent code ever read
|
||||
/// it, so turning it off recorded every game anyway; and the App has no way to start a game, so "off" could only have
|
||||
/// it, so turning it off recorded every game anyway; and the App had no way to start a game, so "off" could only have
|
||||
/// meant recording nothing. The switch is gone and the key stays, read by nobody, until a launch path exists
|
||||
/// (<c>06_DATA_MODEL</c> §Settings registry).
|
||||
/// (<c>06_DATA_MODEL</c> §Settings registry). One does since beta.21 — Play, through the store or the capture agent —
|
||||
/// and the key stays reserved: a game Play starts is recorded exactly as a game started any other way.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition CaptureBackground = new()
|
||||
{
|
||||
@@ -229,7 +244,7 @@ public static class SettingsRegistry
|
||||
/// <summary>Every definition, in the order <c>06_DATA_MODEL</c> lists them.</summary>
|
||||
public static IReadOnlyList<SettingDefinition> All { get; } =
|
||||
[
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiHideScrollBars, UiLibraryView,
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiHideScrollBars, UiLibraryView, UiPlayMode,
|
||||
CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, RetentionRawSessionsPerGame,
|
||||
RetentionRemoveUninstalledGames, UpdateChannel, UpdateAutoCheck, PrivacyOnlineMetadata, LogDebug,
|
||||
];
|
||||
|
||||
@@ -9,7 +9,9 @@ namespace FrameLedger.Infrastructure.Import;
|
||||
/// <summary>
|
||||
/// The Epic Games Launcher's installed library (FR-1.2): one <c>*.item</c> JSON per title under
|
||||
/// <c>%ProgramData%\Epic\EpicGamesLauncher\Data\Manifests</c> — <c>DisplayName</c>, <c>InstallLocation</c>,
|
||||
/// <c>LaunchExecutable</c> (relative to the install), <c>AppName</c> (the store id) and <c>AppVersionString</c>.
|
||||
/// <c>LaunchExecutable</c> (relative to the install), <c>AppName</c> (the store id) and <c>AppVersionString</c>; since beta.21
|
||||
/// also <c>CatalogNamespace</c> and <c>CatalogItemId</c>, which with the AppName are what the launcher's own launch link names
|
||||
/// (<see cref="StoreGame.LaunchKey"/>, for Play).
|
||||
/// Read with <c>JsonDocument</c> so an unexpected shape costs that one file, never the import.
|
||||
/// </summary>
|
||||
public sealed class EpicLibrarySource(string? manifestsDirectory = null) : IStoreLibrarySource
|
||||
@@ -55,7 +57,10 @@ public sealed class EpicLibrarySource(string? manifestsDirectory = null) : IStor
|
||||
|
||||
string? launch = Text(root, "LaunchExecutable");
|
||||
string? exe = string.IsNullOrWhiteSpace(launch) ? null : Path.Combine(location, launch);
|
||||
return new StoreGame("epic", id, name, location, exe, Text(root, "AppVersionString"));
|
||||
string? ns = Text(root, "CatalogNamespace");
|
||||
string? catalogItem = Text(root, "CatalogItemId");
|
||||
string? launchKey = string.IsNullOrWhiteSpace(ns) || string.IsNullOrWhiteSpace(catalogItem) ? null : ns + ":" + catalogItem + ":" + id;
|
||||
return new StoreGame("epic", id, name, location, exe, Text(root, "AppVersionString"), launchKey);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Play;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Import;
|
||||
|
||||
/// <summary>
|
||||
/// GOG GALAXY's program, as GOG's own registry entries name it (beta.21, Play): <c>HKLM\SOFTWARE\WOW6432Node\GOG.com\GalaxyClient</c>'s
|
||||
/// <c>clientExecutable</c> (<c>GalaxyClient.exe</c>) in the folder its <c>paths\client</c> holds — read on the owner's PC on
|
||||
/// 2026-10-13 as <c>C:\Program Files\GOG Galaxy</c>, the folder of the program its game shortcuts start. Read-only, whichever
|
||||
/// hive and key the caller names (a test uses its own HKCU key); a key that is not there, or a file that is not, is "not
|
||||
/// installed".
|
||||
/// </summary>
|
||||
public sealed class GogGalaxyLocator(RegistryHive hive = RegistryHive.LocalMachine, string keyPath = GogGalaxyLocator.DefaultKeyPath) : IGogGalaxyLocator
|
||||
{
|
||||
public const string DefaultKeyPath = @"SOFTWARE\WOW6432Node\GOG.com\GalaxyClient";
|
||||
|
||||
public string? ClientPath()
|
||||
{
|
||||
try
|
||||
{
|
||||
using RegistryKey baseKey = RegistryKey.OpenBaseKey(hive, RegistryView.Default);
|
||||
using RegistryKey? client = baseKey.OpenSubKey(keyPath, writable: false);
|
||||
using RegistryKey? paths = client?.OpenSubKey("paths", writable: false);
|
||||
if (client?.GetValue("clientExecutable") is not string exe || paths?.GetValue("client") is not string folder
|
||||
|| string.IsNullOrWhiteSpace(exe) || string.IsNullOrWhiteSpace(folder) || exe.IndexOfAny(['\\', '/']) >= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string path = Path.Combine(folder, exe);
|
||||
return Path.IsPathFullyQualified(path) && File.Exists(path) ? path : null;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.Security.SecurityException or ArgumentException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.Application.Import;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Application.Play;
|
||||
using FrameLedger.Application.Settings;
|
||||
using FrameLedger.Domain.Consent;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
using FrameLedger.Infrastructure.Persistence;
|
||||
using FrameLedger.Shared.Ipc;
|
||||
using Xunit;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// beta.21 (owner decision D59): Play hands a game to the app of the store whose own records name its folder, or has the
|
||||
/// capture agent start it — directly when asked, and when no store installed it, GOG GALAXY is missing or the App runs as
|
||||
/// administrator — and says which happened.
|
||||
/// </summary>
|
||||
[Collection(StringsCultureCollection.Name)]
|
||||
public sealed class GamePlayerTests
|
||||
{
|
||||
private const string _steam = @"D:\SteamLibrary\steamapps\common\Wuthering Waves";
|
||||
|
||||
private static CancellationToken Ct => TestContext.Current.CancellationToken;
|
||||
|
||||
private sealed class Stores(params StoreGame[] games) : IStoreLibrarySource
|
||||
{
|
||||
public string Platform => "test";
|
||||
|
||||
public ValueTask<IReadOnlyList<StoreGame>> ListAsync(CancellationToken ct = default) => ValueTask.FromResult<IReadOnlyList<StoreGame>>(games);
|
||||
}
|
||||
|
||||
private sealed class BrokenStore : IStoreLibrarySource
|
||||
{
|
||||
public string Platform => "broken";
|
||||
|
||||
public ValueTask<IReadOnlyList<StoreGame>> ListAsync(CancellationToken ct = default) => throw new IOException("unreadable");
|
||||
}
|
||||
|
||||
private sealed class Galaxy(string? path) : IGogGalaxyLocator
|
||||
{
|
||||
public string? ClientPath() => path;
|
||||
}
|
||||
|
||||
private sealed class Shell(bool takes = true) : IShellStarter
|
||||
{
|
||||
public List<string> Opened { get; } = [];
|
||||
|
||||
public List<(string Path, string Arguments, string? Folder)> Started { get; } = [];
|
||||
|
||||
public bool OpenLink(string link)
|
||||
{
|
||||
Opened.Add(link);
|
||||
return takes;
|
||||
}
|
||||
|
||||
public bool StartProgram(string path, string arguments, string? workingDirectory)
|
||||
{
|
||||
Started.Add((path, arguments, workingDirectory));
|
||||
return takes;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class Agent(bool connected = true, string outcome = "Accepted", Exception? fails = null) : IAgentRequests
|
||||
{
|
||||
public HelloAck? Hello => null;
|
||||
|
||||
public bool IsConnected => connected;
|
||||
|
||||
public List<LaunchGameRequest> Sent { get; } = [];
|
||||
|
||||
public Task<IpcEnvelope> RequestAsync<TRequest>(string type, TRequest payload, CancellationToken ct = default)
|
||||
where TRequest : class
|
||||
{
|
||||
type.Should().Be(IpcMessageType.LaunchGame);
|
||||
var request = (LaunchGameRequest)(object)payload;
|
||||
Sent.Add(request);
|
||||
if (fails is not null)
|
||||
{
|
||||
return Task.FromException<IpcEnvelope>(fails);
|
||||
}
|
||||
|
||||
bool accepted = string.Equals(outcome, "Accepted", StringComparison.Ordinal);
|
||||
return Task.FromResult(IpcCodec.Decode(IpcCodec.Encode(IpcMessageType.LaunchAck, "1",
|
||||
new LaunchAck(request.GameId, accepted, outcome, accepted ? Guid.NewGuid() : null))));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThroughTheStoreSteamGetsItsOwnLink()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var shell = new Shell();
|
||||
var agent = new Agent();
|
||||
GamePlayer player = Player(s, shell, agent, new Stores(new StoreGame("steam", "3513350", "Wuthering Waves", _steam, null, null)));
|
||||
|
||||
PlayResult result = await player.PlayAsync(Game(_steam + @"\Client\Binaries\Win64\Client-Win64-Shipping.exe", "3513350"), Ct);
|
||||
|
||||
result.Should().Be(new PlayResult(PlayOutcome.HandedToStore, "steam"));
|
||||
shell.Opened.Should().Equal("steam://rungameid/3513350");
|
||||
agent.Sent.Should().BeEmpty("the store's app starts the game; the watcher records it as any start");
|
||||
GamePlayer.Describe(result, "Wuthering Waves").Text.Should().Contain("Steam").And.Contain("Wuthering Waves");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GogRunsGalaxyAndWithoutGalaxyTheAgentStartsTheGame()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var record = new StoreGame("gog", "1125815775", "A Space for the Unbound", @"D:\another\gog\A Space for the Unbound - Prologue", null, null);
|
||||
GameRow game = Game(@"D:\another\gog\A Space for the Unbound - Prologue\A Space for the Unbound.exe", "1125815775");
|
||||
|
||||
var shell = new Shell();
|
||||
PlayResult handed = await Player(s, shell, new Agent(), new Stores(record), galaxy: @"C:\Program Files\GOG Galaxy\GalaxyClient.exe").PlayAsync(game, Ct);
|
||||
handed.Outcome.Should().Be(PlayOutcome.HandedToStore);
|
||||
shell.Started.Should().ContainSingle().Which.Arguments.Should().Contain("/command=runGame /gameId=1125815775");
|
||||
|
||||
var agent = new Agent();
|
||||
PlayResult direct = await Player(s, new Shell(), agent, new Stores(record), galaxy: null).PlayAsync(game, Ct);
|
||||
direct.Should().Be(new PlayResult(PlayOutcome.StartedByAgent, Fallback: PlayFallback.NoGalaxy));
|
||||
agent.Sent.Should().ContainSingle().Which.GameId.Should().Be(game.Id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AGameNoStoreInstalledIsStartedDirectlyAndSaysWhy()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var agent = new Agent();
|
||||
var shell = new Shell();
|
||||
|
||||
PlayResult result = await Player(s, shell, agent, new BrokenStore(), new Stores()).PlayAsync(Game(@"D:\Games\Loose\game.exe", null), Ct);
|
||||
|
||||
result.Should().Be(new PlayResult(PlayOutcome.StartedByAgent, Fallback: PlayFallback.NoStore), "a store whose records cannot be read costs its own records only");
|
||||
shell.Opened.Should().BeEmpty();
|
||||
agent.Sent.Should().ContainSingle();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AnElevatedAppNeverStartsAStoresAppAndHasTheAgentStartTheGame()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var shell = new Shell();
|
||||
var agent = new Agent();
|
||||
GamePlayer player = Player(s, shell, agent, new Stores(new StoreGame("steam", "3513350", "W", _steam, null, null)), elevated: true);
|
||||
|
||||
PlayResult result = await player.PlayAsync(Game(_steam + @"\game.exe", "3513350"), Ct);
|
||||
|
||||
result.Fallback.Should().Be(PlayFallback.Elevated);
|
||||
result.Outcome.Should().Be(PlayOutcome.StartedByAgent);
|
||||
shell.Opened.Should().BeEmpty("a store's app started from an administrator would start the game as administrator too");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DirectAsksTheAgentAndSaysEachOfItsAnswers()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
await new RegisteredSettings(new SqliteSettingsStore(s.Db)).SetAsync(SettingsRegistry.UiPlayMode, PlayMode.Direct, Ct);
|
||||
var steam = new Stores(new StoreGame("steam", "3513350", "W", _steam, null, null));
|
||||
GameRow game = Game(_steam + @"\game.exe", "3513350");
|
||||
|
||||
var shell = new Shell();
|
||||
var agent = new Agent();
|
||||
(await Player(s, shell, agent, steam).PlayAsync(game, Ct)).Should().Be(new PlayResult(PlayOutcome.StartedByAgent));
|
||||
shell.Opened.Should().BeEmpty("direct never asks the store, even for a store's game");
|
||||
|
||||
(await Player(s, new Shell(), new Agent(connected: false), steam).PlayAsync(game, Ct)).Outcome.Should().Be(PlayOutcome.AgentUnavailable);
|
||||
(await Player(s, new Shell(), new Agent(outcome: "RecordingOff"), steam).PlayAsync(game, Ct)).Outcome.Should().Be(PlayOutcome.RecordingOff);
|
||||
(await Player(s, new Shell(), new Agent(outcome: "SessionRunning"), steam).PlayAsync(game, Ct)).Outcome.Should().Be(PlayOutcome.AlreadyRunning);
|
||||
PlayResult failed = await Player(s, new Shell(), new Agent(outcome: "Unavailable"), steam).PlayAsync(game, Ct);
|
||||
failed.Should().Be(new PlayResult(PlayOutcome.Failed, Detail: "Unavailable"));
|
||||
|
||||
(await Player(s, shell, agent, steam).IsDirectAsync(Ct)).Should().BeTrue();
|
||||
GamePlayer.Describe(failed, "W").Warning.Should().BeTrue();
|
||||
GamePlayer.Describe(new PlayResult(PlayOutcome.RecordingOff), "W").Text.Should().Contain("Settings");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// From the review before the merge: the pipe fails a request in flight with an IOException when the agent stops (PipeClient),
|
||||
/// and a command's unhandled exception is the App's crash dialog. Each way the connection can go mid-request is "not running".
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AConnectionThatGoesMidRequestIsTheAgentNotRunningNeverAnException()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
await new RegisteredSettings(new SqliteSettingsStore(s.Db)).SetAsync(SettingsRegistry.UiPlayMode, PlayMode.Direct, Ct);
|
||||
GameRow game = Game(@"D:\Games\Loose\game.exe", null);
|
||||
Exception[] gone =
|
||||
[
|
||||
new IOException("the pipe closed before the Agent answered"), new ObjectDisposedException("pipe"), new TimeoutException(),
|
||||
new InvalidOperationException("the Agent is not connected"), new IpcFramingException("truncated frame"),
|
||||
];
|
||||
foreach (Exception ex in gone)
|
||||
{
|
||||
PlayResult result = await Player(s, new Shell(), new Agent(fails: ex), new Stores()).PlayAsync(game, Ct);
|
||||
result.Should().Be(new PlayResult(PlayOutcome.AgentUnavailable), ex.GetType().Name);
|
||||
}
|
||||
|
||||
PlayResult refused = await Player(s, new Shell(), new Agent(fails: new IpcRequestException("UnknownType", "no such command")), new Stores())
|
||||
.PlayAsync(game, Ct);
|
||||
refused.Should().Be(new PlayResult(PlayOutcome.Failed, Detail: "UnknownType"));
|
||||
}
|
||||
|
||||
/// <summary>From the review before the merge: each notice is true on the path it is said on.</summary>
|
||||
[Fact]
|
||||
public async Task EachNoticeIsTrueOnThePathItIsSaidOn()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
|
||||
// A Steam record whose id is not a Steam id builds no link — and is not "GOG GALAXY is not installed".
|
||||
var odd = new Stores(new StoreGame("steam", "not-an-app-id", "W", _steam, null, null));
|
||||
PlayResult noLink = await Player(s, new Shell(), new Agent(), odd).PlayAsync(Game(_steam + @"\game.exe", null), Ct);
|
||||
noLink.Should().Be(new PlayResult(PlayOutcome.StartedByAgent, Fallback: PlayFallback.NoLink));
|
||||
GamePlayer.Describe(noLink, "W").Text.Should().NotContain("GOG").And.NotContain("store");
|
||||
|
||||
// The store mode fell back and recording is off: switching Play to the store is no advice.
|
||||
PlayResult storeModeOff = await Player(s, new Shell(), new Agent(outcome: "RecordingOff"), new Stores())
|
||||
.PlayAsync(Game(@"D:\Games\Loose\game.exe", null), Ct);
|
||||
storeModeOff.Should().Be(new PlayResult(PlayOutcome.RecordingOff, Fallback: PlayFallback.NoStore));
|
||||
GamePlayer.Describe(storeModeOff, "W").Text.Should().NotContain("Settings");
|
||||
|
||||
// The agent's UnknownGame is said in words, never as the token.
|
||||
PlayResult gone = await Player(s, new Shell(), new Agent(outcome: "UnknownGame"), new Stores())
|
||||
.PlayAsync(Game(@"D:\Games\Loose\game.exe", null), Ct);
|
||||
gone.Outcome.Should().Be(PlayOutcome.NotInLibrary);
|
||||
GamePlayer.Describe(gone, "W").Text.Should().NotContain("UnknownGame").And.Contain("W");
|
||||
GamePlayer.Describe(new PlayResult(PlayOutcome.AgentUnavailable, Fallback: PlayFallback.NoStore), "W").Text.Should().NotContain("its store");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AStoreAppWindowsWillNotOpenIsAFailureNamedAsSuch()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
PlayResult result = await Player(s, new Shell(takes: false), new Agent(), new Stores(new StoreGame("itch", "5015466", "H", @"D:\another\it\h", null, null)))
|
||||
.PlayAsync(Game(@"D:\another\it\h\H\h.exe", "5015466"), Ct);
|
||||
|
||||
result.Should().Be(new PlayResult(PlayOutcome.Failed, "itch"));
|
||||
GamePlayer.Describe(result, "H").Warning.Should().BeTrue();
|
||||
GamePlayer.Describe(result, "H").Text.Should().Contain("H").And.NotContain("{0}");
|
||||
}
|
||||
|
||||
private static GamePlayer Player(ScratchLedger s, Shell shell, Agent agent, IStoreLibrarySource store, string? galaxy = null, bool elevated = false) =>
|
||||
Player(s, shell, agent, galaxy, elevated, store);
|
||||
|
||||
private static GamePlayer Player(ScratchLedger s, Shell shell, Agent agent, IStoreLibrarySource first, IStoreLibrarySource second) =>
|
||||
Player(s, shell, agent, null, false, first, second);
|
||||
|
||||
private static GamePlayer Player(ScratchLedger s, Shell shell, Agent agent, string? galaxy, bool elevated, params IStoreLibrarySource[] stores) =>
|
||||
new(new RegisteredSettings(new SqliteSettingsStore(s.Db)), stores, new Galaxy(galaxy), shell, agent, () => elevated);
|
||||
|
||||
private static GameRow Game(string exe, string? storeId) => new()
|
||||
{
|
||||
Id = 7,
|
||||
Name = "Game",
|
||||
Fingerprint = new ExecutableFingerprint { ExePath = exe, SizeBytes = 1, MtimeUnixMs = 1 },
|
||||
HookEnabled = false,
|
||||
HookCrashCount = 0,
|
||||
AddedAt = DateTimeOffset.UnixEpoch,
|
||||
UpdatedAt = DateTimeOffset.UnixEpoch,
|
||||
StoreId = storeId,
|
||||
};
|
||||
}
|
||||
@@ -80,6 +80,8 @@ public sealed class ViewerModeTests
|
||||
provider.GetRequiredService<IUpdateClient>().IsInstalled.Should().BeFalse("a viewer never looks for, downloads or applies an update");
|
||||
(await provider.GetRequiredService<IAgentTool>().RunAsync("--install-task", TestContext.Current.CancellationToken)).ExitCode.Should().Be(ViewerAgentTool.ExitViewer);
|
||||
provider.GetRequiredService<UiMode>().Should().Be(_viewer);
|
||||
provider.GetRequiredService<IShellStarter>().Should().BeOfType<ViewerShellStarter>("beta.21: Play hands nothing to a store's app");
|
||||
provider.GetRequiredService<IShellStarter>().OpenLink("steam://rungameid/1").Should().BeFalse();
|
||||
provider.GetRequiredService<LiveSessions>().Should().NotBeNull();
|
||||
}
|
||||
|
||||
@@ -96,12 +98,14 @@ public sealed class ViewerModeTests
|
||||
services.Should().Contain(static d => d.ImplementationType == typeof(RunAtLogonRegistry));
|
||||
services.Should().Contain(static d => d.ImplementationType == typeof(AgentTool));
|
||||
services.Should().Contain(static d => d.ImplementationType == typeof(VelopackUpdateClient));
|
||||
services.Should().Contain(static d => d.ImplementationType == typeof(ShellStarter));
|
||||
}
|
||||
|
||||
/// <summary>Every control that asks the Agent or changes this PC binds the viewer's switch, page by page.</summary>
|
||||
[Theory]
|
||||
[InlineData("MainWindow.xaml", "Command", "UpdateRulesCommand")]
|
||||
[InlineData("MainWindow.xaml", "Command", "CheckForUpdatesCommand")]
|
||||
[InlineData("Pages/GameDetailPage.xaml", "Command", "PlayCommand")]
|
||||
[InlineData("Pages/GameDetailPage.xaml", "Command", "GrantExceptionCommand")]
|
||||
[InlineData("Pages/GameDetailPage.xaml", "Command", "WithdrawExceptionCommand")]
|
||||
[InlineData("Pages/GameDetailPage.xaml", "Command", "ReEnableHookingCommand")]
|
||||
@@ -125,6 +129,19 @@ public sealed class ViewerModeTests
|
||||
((string?)control.Attribute("IsEnabled")).Should().Be("{Binding ViewModel.ActsOnThisPc}", $"{file}: {binding}");
|
||||
}
|
||||
|
||||
/// <summary>beta.21 (D59): every Play on the library — a card's and a row's — binds the page's viewer switch too.</summary>
|
||||
[Fact]
|
||||
public void EveryPlayOnTheLibraryIsOffInAViewer()
|
||||
{
|
||||
const string Through = ", RelativeSource={RelativeSource AncestorType=Page}}";
|
||||
XDocument xaml = AccessibilityTests.AppXaml().Single(static x => string.Equals(x.File, Path.Combine("Pages", "GamesPage.xaml"), StringComparison.Ordinal)).Xaml;
|
||||
|
||||
List<XElement> plays = [.. xaml.Descendants().Where(static e => string.Equals((string?)e.Attribute("Command"), "{Binding DataContext.ViewModel.PlayCommand" + Through, StringComparison.Ordinal))];
|
||||
|
||||
plays.Should().HaveCount(2, "the card's and the row's");
|
||||
plays.Should().AllSatisfy(static e => ((string?)e.Attribute("IsEnabled")).Should().Be("{Binding DataContext.ViewModel.ActsOnThisPc" + Through));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.18: every setting the Agent reads is off in a viewer, which has no Agent — the exception option and the three
|
||||
/// Recording numbers stayed live, and a change said "Applied. The capture agent reads it at the next session start." The
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Application.Import;
|
||||
using FrameLedger.Application.Play;
|
||||
|
||||
namespace FrameLedger.Application.Tests.Play;
|
||||
|
||||
/// <summary>
|
||||
/// beta.21 (Play, owner decision D59): each store's own way to start a game it installed, in the forms the stores write —
|
||||
/// and nothing built from an id that does not look like that store's, because the link is handed to the shell.
|
||||
/// </summary>
|
||||
public sealed class StoreLaunchesTests
|
||||
{
|
||||
private const string _galaxy = @"C:\Program Files\GOG Galaxy\GalaxyClient.exe";
|
||||
|
||||
[Fact]
|
||||
public void SteamStartsItsGameByAppId()
|
||||
{
|
||||
StoreLaunch? launch = StoreLaunches.For(Record("steam", "3513350", @"D:\SteamLibrary\steamapps\common\Wuthering Waves"), null);
|
||||
|
||||
launch.Should().Be(new StoreLaunch("steam", StoreLaunchKind.OpenLink, "steam://rungameid/3513350"), "the link of Steam's own game shortcuts");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EpicNamesTheCatalogWhenTheManifestDoesAndTheAppNameOtherwise()
|
||||
{
|
||||
StoreGame withCatalog = Record("epic", "dc9d2e595d0e4650b35d659f90d41059", @"D:\Epic Games\AlanWake2") with
|
||||
{
|
||||
LaunchKey = "c4763f236d08423eb47b4c3008779c84:93f2a8c3547846eda966cb3c152a026e:dc9d2e595d0e4650b35d659f90d41059",
|
||||
};
|
||||
StoreLaunches.For(withCatalog, null)!.Target.Should().Be(
|
||||
"com.epicgames.launcher://apps/c4763f236d08423eb47b4c3008779c84%3A93f2a8c3547846eda966cb3c152a026e%3Adc9d2e595d0e4650b35d659f90d41059?action=launch&silent=true");
|
||||
|
||||
StoreLaunches.For(Record("epic", "Fortnite", @"D:\Epic Games\Fortnite"), null)!.Target
|
||||
.Should().Be("com.epicgames.launcher://apps/Fortnite?action=launch&silent=true", "a manifest with no catalog names the AppName alone");
|
||||
|
||||
StoreLaunches.For(withCatalog with { LaunchKey = "ns:item:another-app" }, null)!.Target
|
||||
.Should().Be("com.epicgames.launcher://apps/dc9d2e595d0e4650b35d659f90d41059?action=launch&silent=true", "a key naming another app is not this game's");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GogRunsGalaxysOwnShortcutCommandAndNothingWithoutGalaxy()
|
||||
{
|
||||
StoreGame record = Record("gog", "1125815775", @"D:\another\gog\A Space for the Unbound - Prologue\");
|
||||
|
||||
StoreLaunch? launch = StoreLaunches.For(record, _galaxy);
|
||||
|
||||
launch.Should().NotBeNull();
|
||||
launch!.Kind.Should().Be(StoreLaunchKind.RunProgram);
|
||||
launch.Target.Should().Be(_galaxy);
|
||||
launch.Arguments.Should().Be("/command=runGame /gameId=1125815775 /path=\"D:\\another\\gog\\A Space for the Unbound - Prologue\"",
|
||||
"GALAXY's shortcut on the owner's PC, and no trailing backslash to escape the closing quote");
|
||||
launch.WorkingDirectory.Should().Be(@"C:\Program Files\GOG Galaxy");
|
||||
StoreLaunches.For(record, null).Should().BeNull("a GOG game without GALAXY has no hand-off; it is started directly");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItchAsksItsAppToLaunchTheGame()
|
||||
{
|
||||
StoreLaunches.For(Record("itch", "5015466", @"D:\another\it\hello-hello-world"), null)!.Target
|
||||
.Should().Be("itch://install?game_id=5015466&launch");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("steam", "730&evil=1")]
|
||||
[InlineData("steam", "")]
|
||||
[InlineData("steam", "12345678901234567890123")]
|
||||
[InlineData("gog", "1207658924 /command=x")]
|
||||
[InlineData("itch", "../games/1")]
|
||||
[InlineData("epic", "app?action=uninstall")]
|
||||
[InlineData("epic", "app name")]
|
||||
[InlineData("none", "730")]
|
||||
[InlineData("xbox", "730")]
|
||||
public void AnIdThatIsNotThatStoresShapeBuildsNothing(string platform, string id)
|
||||
{
|
||||
StoreLaunches.For(Record(platform, id, @"D:\Games\Some Game"), _galaxy).Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AGogFolderThatCannotStandInsideQuotesBuildsNothing()
|
||||
{
|
||||
StoreLaunches.For(Record("gog", "1", "relative\\folder"), _galaxy).Should().BeNull();
|
||||
StoreLaunches.For(Record("gog", "1", "D:\\a\"b"), _galaxy).Should().BeNull();
|
||||
}
|
||||
|
||||
private static StoreGame Record(string platform, string id, string folder) => new(platform, id, "Name", folder, null, null);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Application.Import;
|
||||
using FrameLedger.Application.Play;
|
||||
|
||||
namespace FrameLedger.Application.Tests.Play;
|
||||
|
||||
/// <summary>beta.21 (Play): the store that installed a game is the one whose own record names the folder its executable is in.</summary>
|
||||
public sealed class StoreRecordsTests
|
||||
{
|
||||
[Fact]
|
||||
public void TheRecordWhoseFolderHoldsTheExecutableIsTheGamesStore()
|
||||
{
|
||||
StoreGame wuwa = new("steam", "3513350", "Wuthering Waves", @"D:\SteamLibrary\steamapps\common\Wuthering Waves", null, null);
|
||||
StoreGame other = new("steam", "1091500", "Cyberpunk 2077", @"D:\SteamLibrary\steamapps\common\Cyberpunk 2077", null, null);
|
||||
|
||||
StoreRecords.Owning(@"D:\SteamLibrary\steamapps\common\Wuthering Waves\Client\Binaries\Win64\Client-Win64-Shipping.exe", "3513350", [other, wuwa])
|
||||
.Should().BeSameAs(wuwa);
|
||||
StoreRecords.Owning(@"d:\steamlibrary\STEAMAPPS\common\wuthering waves\Client-Win64-Shipping.exe", null, [wuwa])
|
||||
.Should().BeSameAs(wuwa, "Windows paths are not case-sensitive, and an entry the user added has no store id");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFolderThatOnlySharesAPrefixIsNotTheGames()
|
||||
{
|
||||
StoreGame half = new("steam", "1", "Half", @"D:\Games\Half", null, null);
|
||||
|
||||
StoreRecords.Owning(@"D:\Games\Half-Life 2\hl2.exe", null, [half]).Should().BeNull("`Half` is not the folder of `Half-Life 2`");
|
||||
StoreRecords.Owning(@"D:\Games\Elsewhere\game.exe", null, [half]).Should().BeNull("no store installed it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheDeepestFolderWinsAndThenTheEntrysOwnStoreId()
|
||||
{
|
||||
StoreGame outer = new("itch", "10", "Bundle", @"D:\Games\Bundle", null, null);
|
||||
StoreGame inner = new("gog", "20", "Game", @"D:\Games\Bundle\Game", null, null);
|
||||
StoreRecords.Owning(@"D:\Games\Bundle\Game\game.exe", null, [outer, inner]).Should().BeSameAs(inner);
|
||||
|
||||
StoreGame steam = new("steam", "30", "Twin", @"D:\Games\Twin", null, null);
|
||||
StoreGame itch = new("itch", "40", "Twin", @"D:\Games\Twin\", null, null);
|
||||
StoreRecords.Owning(@"D:\Games\Twin\twin.exe", "40", [steam, itch]).Should().BeSameAs(itch, "two stores name one folder: the entry's own id decides");
|
||||
StoreRecords.Owning(@"D:\Games\Twin\twin.exe", "30", [itch, steam]).Should().BeSameAs(steam);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The case the entry's platform column cannot settle: detection rewrites a platform it finds (an itch build that ships
|
||||
/// Steam's API reads as Steam) while the store id stays the importer's — a Steam link built from that id would start some
|
||||
/// other game. The records decide, not the column.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AnItchBuildThatShipsSteamsApiIsStillItchs()
|
||||
{
|
||||
StoreGame itch = new("itch", "5015466", "Some Game", @"D:\another\it\some-game", null, null);
|
||||
|
||||
StoreGame? owner = StoreRecords.Owning(@"D:\another\it\some-game\Game\Game.exe", "5015466", [itch]);
|
||||
|
||||
owner.Should().BeSameAs(itch);
|
||||
StoreLaunches.For(owner!, null)!.Target.Should().StartWith("itch://");
|
||||
}
|
||||
}
|
||||
@@ -107,12 +107,49 @@ public sealed class StoreLibrarySourcesTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>beta.21 (Play): GOG GALAXY's program, from GOG's own registry entries, and only when the file is there.</summary>
|
||||
[Fact]
|
||||
public void GalaxysProgramIsWhereGogsKeysNameIt()
|
||||
{
|
||||
string own = @"SOFTWARE\FrameLedger.Test\" + Guid.NewGuid().ToString("N");
|
||||
string key = own + @"\GOG.com\GalaxyClient";
|
||||
string folder = Sub("GOG Galaxy");
|
||||
try
|
||||
{
|
||||
new GogGalaxyLocator(RegistryHive.CurrentUser, key).ClientPath().Should().BeNull("no key, no GALAXY");
|
||||
using (RegistryKey client = Registry.CurrentUser.CreateSubKey(key, writable: true))
|
||||
{
|
||||
client.SetValue("clientExecutable", "GalaxyClient.exe");
|
||||
}
|
||||
|
||||
using (RegistryKey paths = Registry.CurrentUser.CreateSubKey(key + @"\paths", writable: true))
|
||||
{
|
||||
paths.SetValue("client", folder);
|
||||
}
|
||||
|
||||
new GogGalaxyLocator(RegistryHive.CurrentUser, key).ClientPath().Should().BeNull("the keys name a file that is not there");
|
||||
File.WriteAllText(Path.Combine(folder, "GalaxyClient.exe"), "MZ");
|
||||
new GogGalaxyLocator(RegistryHive.CurrentUser, key).ClientPath().Should().Be(Path.Combine(folder, "GalaxyClient.exe"));
|
||||
|
||||
using (RegistryKey client = Registry.CurrentUser.CreateSubKey(key, writable: true))
|
||||
{
|
||||
client.SetValue("clientExecutable", @"..\elsewhere\GalaxyClient.exe");
|
||||
}
|
||||
|
||||
new GogGalaxyLocator(RegistryHive.CurrentUser, key).ClientPath().Should().BeNull("a program name, never a path out of its folder");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Registry.CurrentUser.DeleteSubKeyTree(own, throwOnMissingSubKey: false);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EpicReadsItemManifestsAndItchReadsGzippedReceipts()
|
||||
{
|
||||
string manifests = Sub("Manifests");
|
||||
await File.WriteAllTextAsync(Path.Combine(manifests, "A1.item"),
|
||||
"{\"DisplayName\":\"Alan Wake 2\",\"InstallLocation\":\"D:\\\\Epic Games\\\\AlanWake2\",\"LaunchExecutable\":\"AlanWake2.exe\",\"AppName\":\"dcbb1ebd\",\"AppVersionString\":\"1.2.3\"}", Ct);
|
||||
"{\"DisplayName\":\"Alan Wake 2\",\"InstallLocation\":\"D:\\\\Epic Games\\\\AlanWake2\",\"LaunchExecutable\":\"AlanWake2.exe\",\"AppName\":\"dcbb1ebd\",\"AppVersionString\":\"1.2.3\",\"CatalogNamespace\":\"c4763f23\",\"CatalogItemId\":\"93f2a8c3\"}", Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(manifests, "B2.item"), "{\"DisplayName\":\"No location\"}", Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(manifests, "C3.item"), "{ not json", Ct);
|
||||
IReadOnlyList<StoreGame> epic = await new EpicLibrarySource(manifests).ListAsync(Ct);
|
||||
@@ -121,6 +158,7 @@ public sealed class StoreLibrarySourcesTests : IDisposable
|
||||
aw.StoreId.Should().Be("dcbb1ebd");
|
||||
aw.ExePath.Should().Be(@"D:\Epic Games\AlanWake2\AlanWake2.exe");
|
||||
aw.Version.Should().Be("1.2.3");
|
||||
aw.LaunchKey.Should().Be("c4763f23:93f2a8c3:dcbb1ebd", "beta.21: what the launcher's own launch link names");
|
||||
|
||||
string itch = Sub("itch");
|
||||
string install = Sub("itch", "apps", "celeste");
|
||||
|
||||
Reference in new issue
Block a user