Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08d29563ff | ||
|
|
2982679fc1 | ||
|
|
76e89b65de | ||
|
|
712146685f | ||
|
|
86dffa660f | ||
|
|
81e95c5a72 | ||
|
|
babd500ec3 |
No files matched your search
+89
-9
@@ -28,16 +28,82 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Security
|
||||
### Fixed
|
||||
|
||||
- **Four itch.io downloads this project's documentation used as examples carry malware.** HELLO, HELLO WORLD!, A Doll's
|
||||
Locket - Remake, City of Bones and Träumerei Chapter 2 put the same 213 MB program in front of their RPG Maker game.
|
||||
Read without running it, it ships a registry file that switches off Windows' script scanning (AMSI) and adds
|
||||
Microsoft Defender exclusions, carries an encrypted payload, and checks for virtual machines and debuggers before it
|
||||
starts the game. The documentation called it a launcher and, for A Doll's Locket, said to measure it with the agent
|
||||
running as administrator: that advice is withdrawn. If you installed one of them, remove it and scan your PC.
|
||||
FrameLedger itself does not change: it reads a game's files to find its engine and anti-cheat, and does not judge
|
||||
whether a game is safe (`docs/spike-notes.md` §20).
|
||||
- **A game's page opens and changes session without freezing the window** (owner request 2026-10-14). Measured on the
|
||||
dev PC over a ledger shaped like the owner's (`docs/spike-notes.md` §21): a game with 100 sessions took 1.2–1.5 s to
|
||||
open — its Sessions list built every row, now only the rows on screen (it scrolls itself and hands the wheel to the
|
||||
page at its ends) — 0.37 s now; choosing a two-million-frame session froze the window 0.8–1.0 s — the session was read
|
||||
and decoded on the UI thread, then sorted three times for the Distribution tab — 17 ms now: it is read on the thread
|
||||
pool and what the charts need from all of it is worked out there once. The page also asks whether the game's `.exe` is
|
||||
on disk off the UI thread (a USB drive that sleeps answered on it), and no longer summarises every game to show one.
|
||||
- **Each visit to the Dashboard or Logs no longer stays in memory.** Every Dashboard ever opened stayed alive and kept
|
||||
listening to the capture agent, so at each session's end each one reloaded its lists and raised its own "Session
|
||||
saved" notice — twenty visits, twenty notices, the last one shown. The Dashboard listens only while it is on screen,
|
||||
and the notice has one home for the App's life, shown once whichever page is open; each Logs page kept its tail of up
|
||||
to 2 MB, twice.
|
||||
- **The Logs page reads its file only when it changed**, not every two seconds, and filters it off the UI thread; **Play**
|
||||
reads the stores' lists of installed games off the UI thread (Steam's manifests sit on whatever drive its libraries
|
||||
are on). At Debug level the App now logs how long each page took to appear (`ui: page … shown … ms`).
|
||||
- **The native ring-buffer tests no longer pass or fail by the scheduler's luck** (developers only). The
|
||||
hammering-writer test required the reader to keep more than half of the stream, which measured how the operating
|
||||
system scheduled two threads: on a hybrid Intel processor it failed 5 of 200 runs with the ring correct every time.
|
||||
Both concurrency tests now start the writer only once the reader is running, repeat until the reader really read
|
||||
the ring while the writer wrote it, and require that; the small-ring test's old check also passed a reader that
|
||||
started after the writer had finished (`src/native/tests/ring_test.cpp`).
|
||||
|
||||
## [0.1.0-beta.22] - 2026-10-13
|
||||
|
||||
**The twenty-second pre-release: a request the capture agent never answered is said as such, never as a crash.** The
|
||||
same unsigned installer: verify its hash against `SHA256SUMS.txt`, then *More info → Run anyway*.
|
||||
|
||||
**Updating from `0.1.0-beta.21`:** Help ▸ Check for updates, then *Restart to update* with no game running. Nothing is
|
||||
shown to accept and no game is read again: the legal documents and the detection rules (`2026.10.4`) are beta.21's.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A request the capture agent never answered is said as such, never as a crash.** When the agent stopped, or restarted
|
||||
for an update, while FrameLedger was asking it something, deleting sessions ended in the crash dialog, and turning a
|
||||
game's hooking on or off or making or withdrawing an anti-cheat exception showed *IOException* or *TimeoutException* as
|
||||
its notice. Each now says that the agent did not answer and that whether it was done is not known, and the page shows
|
||||
what is stored; Play says the same (it said the agent was not running). A request that could not be sent because the
|
||||
agent was already gone still says that nothing was changed (`docs/07_IPC.md` §Client behavior).
|
||||
|
||||
## [0.1.0-beta.21] - 2026-10-13
|
||||
|
||||
**The twenty-first pre-release: an anti-cheat kept beside a game's executable found before anything is injected, four
|
||||
itch.io downloads that carry malware, documents that scroll further and smoothly, and Play.** The same unsigned
|
||||
installer: verify its hash against `SHA256SUMS.txt`, then *More info → Run anyway*.
|
||||
|
||||
**Updating from `0.1.0-beta.20`:** Help ▸ Check for updates, then *Restart to update* with no game running. The Privacy
|
||||
Policy (2.10) is shown once for you to accept. Every game is read and checked for anti-cheat once more (detection rules
|
||||
`2026.10.4`): Wuthering Waves, and any game that keeps an anti-cheat beside its executable, has its hooking turned off.
|
||||
If you installed HELLO, HELLO WORLD!, A Doll's Locket - Remake, City of Bones or Träumerei Chapter 2 from itch.io, read
|
||||
*Security* below first.
|
||||
|
||||
### 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
|
||||
Legal Gate and the update notes. A wheel notch moved them a fixed short step whatever the wheel or touchpad sent;
|
||||
it now moves the number of lines Windows is set to scroll (a screen if it is set to that), about twice as far by
|
||||
default, in proportion for a touchpad, and glides there unless Windows' animations are off. At the end of the update
|
||||
notes the wheel scrolls the window instead; Ctrl+wheel still zooms. A page is drawn once when it is opened, not two or
|
||||
three times, and going back to a page you have read in the same window is immediate.
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -50,6 +116,20 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
Steam id (owner decision D58), and ACE's files, its second driver, its driver's service and its module are named (detection
|
||||
rules `2026.10.4`). Every game is checked for anti-cheat once more after the update; one found this way has its hooking
|
||||
turned off, as any finding does (`docs/19_SAFETY_AND_ANTICHEAT.md` §Pre-injection checks, item 4).
|
||||
- **A game's Supports card said *Not scanned yet* for a game the agent had read** whenever the game ships none of the
|
||||
upscaler, frame-generation or Vulkan files the rules name — beside a Details card the same read had filled. It says
|
||||
so now only until the agent has read the game, then *None found*.
|
||||
|
||||
### Security
|
||||
|
||||
- **Four itch.io downloads this project's documentation used as examples carry malware.** HELLO, HELLO WORLD!, A Doll's
|
||||
Locket - Remake, City of Bones and Träumerei Chapter 2 put the same 213 MB program in front of their RPG Maker game.
|
||||
Read without running it, it ships a registry file that switches off Windows' script scanning (AMSI) and adds
|
||||
Microsoft Defender exclusions, carries an encrypted payload, and checks for virtual machines and debuggers before it
|
||||
starts the game. The documentation called it a launcher and, for A Doll's Locket, said to measure it with the agent
|
||||
running as administrator: that advice is withdrawn. If you installed one of them, remove it and scan your PC.
|
||||
FrameLedger itself does not change: it reads a game's files to find its engine and anti-cheat, and does not judge
|
||||
whether a game is safe (`docs/spike-notes.md` §20).
|
||||
|
||||
## [0.1.0-beta.20] - 2026-10-12
|
||||
|
||||
|
||||
+12
-2
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
|
||||
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
|
||||
page lists them in plain words; each item links to the document that has the details.
|
||||
|
||||
*Beta software: this page describes version 0.1.0-beta.20.*
|
||||
*Beta software: this page describes version 0.1.0-beta.22.*
|
||||
|
||||
## Games it will not measure
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,8 +11,8 @@ guide, Help ▸ Limitations), and on the project's [wiki](https://github.com/pol
|
||||
pages.
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.20`** (2026-10-12), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-13.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.22`** (2026-10-13), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -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
|
||||
@@ -166,7 +167,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
|
||||
|
||||
## Install
|
||||
|
||||
> **The latest pre-release is `v0.1.0-beta.20` (2026-10-12); before it `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
|
||||
> **The latest pre-release is `v0.1.0-beta.22` (2026-10-13); before it `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read `CHANGELOG.md`'s section for the one you install — what it measures, what it does not yet, and how to update — before installing. A source build is `docs/12_BUILD.md`.
|
||||
|
||||
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
|
||||
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
|
||||
@@ -215,4 +216,4 @@ GPU telemetry is layered so the project never depends on a proprietary vendor li
|
||||
|
||||
---
|
||||
|
||||
**Status:** pre-release (beta). Twenty tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
|
||||
**Status:** pre-release (beta). Twenty-two tagged pre-releases so far; see `CHANGELOG.md` for what each one changed and the accuracy block at the top of this file for what is and is not measured. It is not feature-complete, it certainly still has bugs, and `legal/DISCLAIMER.md` §0 says what that means for you.
|
||||
+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) |
|
||||
|
||||
+10
-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.)* |
|
||||
@@ -482,6 +482,15 @@ message, and that message always re-scans.
|
||||
and SYSTEM) each carry an explicit descriptor. The instance lock and the elevation marker are only ever probed, and a
|
||||
probe that is refused reads as "held".
|
||||
- Treat the pipe as unreliable: library, history and charts must all work with the Agent offline. Only live status degrades.
|
||||
- **A request the Agent never answered is neither a failure nor a refusal (beta.22).** `IAgentRequests.RequestAsync` fails
|
||||
in one of four ways: `InvalidOperationException` — not connected, nothing was sent; `IpcRequestException` — the Agent
|
||||
answered `Error`; `TimeoutException`; and `IOException` — the connection closed before the answer, whatever closed it
|
||||
(`AgentConnection.AnsweredAsync` turns the `IpcFramingException` and `ObjectDisposedException` that `PipeClient` can fail a
|
||||
request in flight with into it, so a caller handles one). The last two mean *whether it was carried out is not known*
|
||||
(`AgentAnswers.IsUnanswered`): the caller says so in words (`Agent_Unanswered`) and reads what is stored again — deleting
|
||||
sessions, the hooking switch, the anti-cheat exception and Play alike. Until beta.22 deleting sessions caught no
|
||||
`IOException` (the App's crash dialog) and showed a timeout's own message, and the hooking switch and the exception
|
||||
showed `IOException` or `TimeoutException` as their notice.
|
||||
- SQLite is the source of truth for anything persisted; pipe events are refresh signals (except `SessionProgress`, which is live-only by design).
|
||||
- `CaptureRefused`, `SafetyUnhook` and (since 2026-09-25) `HookingTurnedOff` are **never** collapsed into a generic error toast — they get dedicated, explanatory UI (`08_UI` §Notifications).
|
||||
|
||||
|
||||
+40
-3
@@ -66,7 +66,14 @@ WPF + **WPF UI (Wpf.Ui, Fluent)**. Shell = `ui:FluentWindow` with custom `ui:Tit
|
||||
> off** — a tag is shown as the text it is; **no image is fetched** — its description stands in; a node the renderer
|
||||
> does not know is shown as its own source text, and `MarkdownRendererTests` proves for every embedded document that
|
||||
> no word of its plain text is lost and no table is left as `|---|` source. The GPL's `LICENSE` is not Markdown: it is
|
||||
> shown as written, monospace. Colours and the font are theme resources (`16_WPFUI_SYNTAX` §FlowDocument). Links
|
||||
> shown as written, monospace. Colours and the font are theme resources (`16_WPFUI_SYNTAX` §FlowDocument).
|
||||
> **The wheel and the render, beta.21 (owner request 2026-10-13: "scrolling the documents is slow"):** a notch moves
|
||||
> Windows' *lines to scroll* at a browser's line (100/3 DIP; three lines = 100 DIP, scaled by the zoom; a delta in
|
||||
> proportion, so a touchpad's small deltas move a little; Windows' *one screen at a time* a screen) and eases there in
|
||||
> about 120 ms unless Windows' animations are off — WPF moved a fixed 48 DIP per message, whatever its delta. At its ends
|
||||
> the view leaves the wheel to what holds it (the update notes' dialog), and Ctrl+wheel stays the zoom. A page is
|
||||
> rendered once (`MarkdownView.Show`; three bindings changing ask for one render, ahead of layout), and a view keeps the
|
||||
> last 16 documents it rendered, so going back to a page costs its layout only (`MarkdownViewTests`). Links
|
||||
> follow `Markdown/MarkdownLinks`: http, https and mailto through `IUrlOpener`; `#section` scrolls to the heading
|
||||
> (GitHub's anchors); a relative path resolves against the document's place in the repository and opens in the App
|
||||
> when the window holds that page, on GitHub otherwise — **at this build's own source** (`Services/RepositoryLinks`:
|
||||
@@ -121,8 +128,12 @@ The Menu sits in its own row **below** the TitleBar (never inside the drag regio
|
||||
> Dashboard), Exit (a real exit through `ShellHost.Quit`, whatever minimize-to-tray says); a left click opens the
|
||||
> window. **Minimize to tray on close** hides the live window when `ui.minimize_to_tray` is on and a tray icon
|
||||
> exists (`WindowClosePolicy`); a language rebuild's old window is unaffected. **FR-3.8's balloon** — "Session
|
||||
> saved — <game> — click to view" — is raised only while the window is off screen; on screen, the Dashboard's
|
||||
> snackbar carries the same event (one event, exactly one channel), and its click opens the summary window.
|
||||
> saved — <game> — click to view" — is raised only while the window is off screen; on screen, ~~the Dashboard's~~ the
|
||||
> App's snackbar carries the same event (one event, exactly one channel), and its click opens the summary window.
|
||||
> *(Corrected 2026-10-14, beta.23: the snackbar's notice was raised by the Dashboard's view model, and it reached the
|
||||
> other pages only because no Dashboard ever went away — each visit made one, the root container kept every one, each
|
||||
> subscribed, so twenty visits were twenty notices for one session. It is `Services.SessionNotices` now, one
|
||||
> subscription for the App's life; the Dashboard listens only while it is on screen.)*
|
||||
> A safety event is never a balloon (`TrayViewModelTests` asserts it). Tools ▸ Agent status… and Tools ▸ Vulkan
|
||||
> layer registration… now navigate (Dashboard, Settings) instead of saying "not yet".
|
||||
|
||||
@@ -298,6 +309,17 @@ All screens are `Page`s registered with the navigation page provider and navigat
|
||||
- **Last session measured** — accent chips with real values ("DLSS Quality · 1440p → 2160p", "Frame Generation DLSS-G ×1.9", "Ray Tracing: Yes"). Measured.
|
||||
- **Hooking control** (`ui:CardControl` with `ToggleSwitch`): off by default. Turning it on opens the consent dialog (FR-2.1). When the static anti-cheat pre-scan blocked it, the switch is **disabled** with the reason shown inline and no way to force it. When auto-disabled after crashes, an `InfoBar` explains and offers manual re-enable.
|
||||
|
||||
> **What opening the page and choosing a session cost, beta.23 (owner request 2026-10-14; `spike-notes` §21).** The
|
||||
> Sessions grid is bounded (`MaxHeight` 520, as Compare's list is): inside the page's own scroller it was measured with no
|
||||
> height limit and built every row — 100 sessions were 100 rows of 17 columns, 1.2–1.5 s to open the page; it builds the
|
||||
> rows on screen now, scrolls itself, and hands the wheel to the page at its ends
|
||||
> (`PagesLoadTests.TheSessionsGridBuildsTheRowsOnScreenAndHandsTheWheelOnAtItsEnd`). A session's series is read and
|
||||
> decoded on the thread pool — Microsoft.Data.Sqlite completes its asynchronous calls synchronously, so the decode of a
|
||||
> two-million-frame session ran on the UI thread whatever `ConfigureAwait` said — and what the charts derive from the whole
|
||||
> session (one sort of its frames where the Distribution tab did three, the histogram, the percentile curve, the presents
|
||||
> line) is worked out there once (`Charts.SeriesDigest`): choosing such a session froze the window 0.8–1.0 s, 17 ms now.
|
||||
> Whether the executable is on disk is asked off the UI thread, as the library page has asked since beta.19.
|
||||
|
||||
> **Built 2026-09-14 (P3 PR-5): the grid, the detail page's header, the two rows, the hooking control and
|
||||
> the Sessions tab.** Grid: `ui:CardAction` cards with platform / engine / hooking badges, sessions, playtime,
|
||||
> last played (~~the sparkline is PR-6's~~ no sparkline was built — corrected 2026-10-04); search and sort in memory; FR-1.1 by File ▸ Add game…, the page's
|
||||
@@ -496,6 +518,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.
|
||||
|
||||
|
||||
@@ -250,6 +250,20 @@ On startup and on `ApplicationThemeManager.Changed`: for every live plot set fig
|
||||
A `ContentDialog` whose content should not scroll as a whole sets `ScrollViewer.VerticalScrollBarVisibility="Disabled"`
|
||||
on the dialog: its content row then has the window's height, and a `*` row inside it can hold a list that scrolls alone
|
||||
(`ImportReviewPrompt`).
|
||||
- [ ] **A `ScrollViewer` moves a FIXED 48 DIP per wheel message, whatever its delta** (`ScrollViewer._mouseWheelDelta`,
|
||||
read from .NET 10.0.12; measured on a `FlowDocumentScrollViewer`: deltas of −1, −15, −120 and −360 each moved 48). It
|
||||
ignores Windows' *lines to scroll*, and a precision touchpad's small deltas each jump the whole step — a long document
|
||||
read as slow and jerky while its layout cost about a millisecond a step. `Controls/MarkdownView` handles
|
||||
`PreviewMouseWheel` itself (beta.21): the delta in proportion at Windows' lines, eased, unhandled at its ends.
|
||||
- [ ] **Microsoft.Data.Sqlite completes its "async" calls synchronously** (measured 2026-10-14, beta.23): a
|
||||
`ConfigureAwait(false)` after a ledger read does not leave the thread that asked, so a view model's load, a session's
|
||||
decode, a sort over its frames all ran on the UI thread. Work that must not run there goes in `Task.Run` —
|
||||
`Charts.SessionSeriesLoader`, the game page's executable check (`spike-notes` §21).
|
||||
- [ ] **A transient page's view model is never `IDisposable`** (beta.23). Pages and their view models are transient, and
|
||||
the root container keeps every transient disposable it makes until the App exits: every Dashboard and Logs page ever
|
||||
opened stayed in memory, and each Dashboard stayed subscribed to the Agent — at a session's end every one reloaded its
|
||||
lists on the UI thread and raised its own notice. Listen on Loaded and stop on Unloaded (`Attach`/`Detach`, as Games,
|
||||
the game page and the Dashboard do); `DashboardViewModelTests.ADashboardOffScreenHearsNothing…`.
|
||||
- [ ] **ScottPlot 5 zooms on every wheel and never marks it handled.** Without `Charts/ChartWheel` a wheel over a chart
|
||||
zoomed it and scrolled the page at once; a plain wheel is the page's, Ctrl+wheel the chart's, for every plot that
|
||||
`ChartTheme.Attach` registers.
|
||||
|
||||
+117
-5
@@ -2198,7 +2198,7 @@ a Ren'Py game's engine version from `renpy/vc_version.py` (rules `2026.10.3`, Pr
|
||||
once at the next update; `05_DETECTION` §Engine version — Ren'Py) and strikes item 15. Merged for the next pre-release;
|
||||
no release was asked for.
|
||||
|
||||
## **START HERE** — 2026-10-12, 0.1.0-beta.20: the engine version of Ren'Py games
|
||||
## ~~**START HERE**~~ — 2026-10-12, 0.1.0-beta.20: the engine version of Ren'Py games *(struck 2026-10-13: the head is §beta.21 below)*
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.20]`; this is what no other file carries.* The owner, the same evening as beta.19 and
|
||||
after confirming it on real hardware: "tiếp tục với 1 pr kèm với detect version game dùng ren'py", then "tung bản beta20
|
||||
@@ -2218,6 +2218,93 @@ game's engine" — was shown to the owner with #299 and released on their word.
|
||||
|
||||
**Owner-only, added to the list below:** item 16.
|
||||
|
||||
## ~~**START HERE**~~ — 2026-10-13, 0.1.0-beta.21: an anti-cheat beside the executable, four itch downloads that are malware, documents that scroll, Play *(struck 2026-10-13: the head is §beta.22 below)*
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.21]`; this is what no other file carries. The owner's list (2026-10-13, four items,
|
||||
with screenshots of two game pages): HELLO, HELLO WORLD!'s RPG Maker path is wrong; no anti-cheat is found for Wuthering
|
||||
Waves; the documents in the app scroll slowly; and, if possible, a Play button on a game's page or in the library that
|
||||
points to the platform. Then: once the plan is approved, commit → push → CI → auto-fix → merge → bump the version →
|
||||
release, in one go. Four stacked PRs — #301 check 4 also walks the executable's folder (rules `2026.10.4`), #302 the four
|
||||
itch "launchers" are malware and the Supports card, #303 the documents' wheel and one render per page, #304 Play and the
|
||||
Privacy Policy 2.10 — then the release.*
|
||||
|
||||
**Decisions (owner, 2026-10-13, asked with the plan — do not re-ask):**
|
||||
|
||||
- **D57 — the four itch "launchers" are malware: the documentation is corrected, the import is not changed.** The
|
||||
"wrong path" of HELLO, HELLO WORLD! is itch's own pick: the 213 MB .NET program in front of the RPG Maker runtime,
|
||||
which is not a helper, so the import takes it (D56). Read without running it, that program — the same in A Doll's
|
||||
Locket - Remake, City of Bones and Träumerei Chapter 2 — is malware (`spike-notes.md` §20). D28, D56, item 15(a), the
|
||||
beta.19 entry and `05_DETECTION` are corrected in place, and no document advises running one. The repository records
|
||||
what the files are, never the state of a PC that ran one.
|
||||
- **D58 — Wuthering Waves is on the title list** (Steam `3513350`, Anti-Cheat Expert), beside the fix that finds ACE's
|
||||
folder beside the game's executable.
|
||||
- **D59 — Play, in two modes switched in Settings:** "1: press Play → the platform opens → it runs; 3: it runs at once;
|
||||
let me switch between the two". `ui.play_mode` is `store` (the default) or `direct`; the store is the one whose own
|
||||
records name the game's folder, never the row's `platform`; an App running as administrator never starts a store's
|
||||
app (`08_UI` §Games).
|
||||
- **The train (owner, with the plan):** "Làm trọn mạch ngay" — each PR squash-merged as its CI went green, then the
|
||||
signed tag and the release, without asking again. The Privacy Policy 2.10 wording and the Wuthering Waves row of
|
||||
`LIST_GAME_TESTED.md` (D35) were approved with the plan.
|
||||
|
||||
**Traps met on the way:**
|
||||
|
||||
- **The pre-scan's depth limit is a reach, not a refusal.** A folder at the third level is named and never opened, and
|
||||
the walk reports a complete, clean tree; only the 4096-entry budget refuses. An anti-cheat deeper than three levels
|
||||
under both the install root and the executable's folder is still invisible to check 4 — the 30 s re-check meets it
|
||||
only once its driver is loaded, and a driver is a machine-wide finding that turns nothing off (`spike-notes.md` §19).
|
||||
- **A rules note over 300 characters fails `rules-validate` with a message about something else** ("Value is null …
|
||||
`/engines/4/version`"): `Test-Json` names a branch of the schema, not the long `notes` (`freeText`, maxLength 300).
|
||||
Bisect the edit, not the message.
|
||||
- **The owner's live rules, older than the repository's, make parallel test hosts race**: each reseeds
|
||||
`%LOCALAPPDATA%\FrameLedger\rules`, and `ReplaceFileW` fails one of them ("could not write the rules file"). Before
|
||||
the gate, seed the repository's rules and its `.seeded` marker (the uppercase SHA-256 hex) yourself; after it, put the
|
||||
owner's files back byte for byte.
|
||||
- **WPF's `ScrollViewer` moves 48 DIP per wheel message whatever its delta** (`16_WPFUI_SYNTAX`), so a touchpad's small
|
||||
deltas each jump the whole step; `MarkdownView` handles the wheel itself.
|
||||
- **A review of Play after its gates and its first CI run were green found four defects no gate could** (§beta.19's
|
||||
lesson, again). The pipe fails a request in flight with an `IOException` when the agent stops (`PipeClient` fails every
|
||||
pending request so), nothing on the Play path caught it, and a command's unhandled exception is the App's crash dialog —
|
||||
so pressing Play while the agent restarted for an update would have ended there. A store record whose id builds no
|
||||
link read "GOG GALAXY is not installed"; the agent's `UnknownGame` reached a notice as that token; two notices advised
|
||||
what their own path could not do. All four fixed in #304 before it merged. **Not fixed here:** `SessionDeletion` has the
|
||||
same gap (it catches no `IOException`), and every other caller of the pipe misses the `ObjectDisposedException` and
|
||||
`IpcFramingException` the same failure can raise — the owner asked for it as its own PR after this release, and
|
||||
its own pre-release (beta.22).
|
||||
- **Analyzers met:** MA0048 (one type per file), MA0099 (compare a flags enum with its `None`, not `0`), CS1573 (a
|
||||
`<param>` on some of a record's parameters needs one on all — `<remarks>` instead), IDE1006 (a `private const` takes
|
||||
the `_` prefix). **Mechanical, again:** a Bash heredoc halves `\\`; the Write tool writes LF and `sed -i` turns CRLF
|
||||
into LF.
|
||||
|
||||
**Owner-only, added to the list below:** item 17.
|
||||
|
||||
## **START HERE** — 2026-10-13, 0.1.0-beta.22: a request the capture agent never answered
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.22]`; this is what no other file carries.* The owner, during the beta.21
|
||||
train: "Bạn xử lý chip thành 1 pr mới sau release và thành 1 phiên bản mới nhé" — the chip beta.21's review of Play
|
||||
left (§beta.21's traps): every caller of the pipe, not only Play, as its own PR and its own pre-release. One PR — #306,
|
||||
`AgentConnection.AnsweredAsync` and `AgentAnswers.IsUnanswered`, with deleting sessions, the hooking switch, the anti-cheat
|
||||
exception and Play telling *not sent* from *not answered* — then the release.
|
||||
|
||||
**Decisions:** none new. *Not answered* is said as not known (`Agent_Unanswered`) and never as the old words for *not
|
||||
sent* ("nothing was deleted", "nothing changed"): a request the connection closed under may have been carried out.
|
||||
|
||||
**Traps met on the way:**
|
||||
|
||||
- **VSTHRD003 rejects awaiting a `Task` a method was handed** ("work that was not started within your context"): a helper
|
||||
that wraps a request's exceptions takes a `Func<Task<T>>` and starts it itself — which also catches what the request
|
||||
throws before it returns a task.
|
||||
- **`ObjectDisposedException` derives from `InvalidOperationException`**: a `catch (InvalidOperationException)` for "not
|
||||
connected" would read a disposed pipe as "nothing was sent". `AgentConnection` turns it into the `IOException` first,
|
||||
so the callers' split holds.
|
||||
|
||||
**Owner-only, added to the list below:** item 18 — **passed 2026-10-13**.
|
||||
|
||||
**After the release (owner, 2026-10-13):** "Tất cả các item đã đạt yêu cầu. Bạn có thể xử lý chip, phiên bản mới (nếu
|
||||
cần), cập nhật, rồi đóng phiên nhé" — items 16, 17 and 18 passed; the chip beta.22's local gate left (`fl_ring`'s
|
||||
hammering-writer guard, red on a correct ring) became beta.23 PR-1, #308: both concurrency cases guard on drains that
|
||||
overlapped the writer (§Traps, the native-test entry). Merged for the next pre-release; no release, since nothing a
|
||||
user runs changed.
|
||||
|
||||
## Owner-only — no PR can close these
|
||||
|
||||
1. **§S23-2 — branch protection.** `Rules / validate` is not a required status check on
|
||||
@@ -2335,10 +2422,24 @@ game's engine" — was shown to the owner with #299 and released on their word.
|
||||
together are said in one notice that names both; with the USB drive unplugged nothing is removed; *Remove uninstalled
|
||||
games* off keeps it. (e) The Legal Gate shows the Privacy Policy 2.8
|
||||
once. (f) The `ja` strings marked `review`.
|
||||
16. **beta.20 on real hardware.** (a) **Bound Between Desks:** its page reads *Ren'Py 8.5.0*, and its *Engine version*
|
||||
line says it was read from the engine's version file (`renpy/vc_version.py`); the first sweep after the update reads
|
||||
every game once more (rules `2026.10.3`). (b) The Legal Gate shows the Privacy Policy 2.9 once. (c) The `ja` string
|
||||
marked `review` (`GameDetail_EngineVersion_RenPyVcVersion`).
|
||||
16. ~~**beta.20 on real hardware.**~~ **Passed 2026-10-13** — the owner: "Tất cả các item đã đạt yêu cầu" (every item
|
||||
met its requirement). *(The item as written:)* (a) **Bound Between Desks:** its page reads *Ren'Py 8.5.0*, and its
|
||||
*Engine version* line says it was read from the engine's version file (`renpy/vc_version.py`); the first sweep after
|
||||
the update reads every game once more (rules `2026.10.3`). (b) The Legal Gate shows the Privacy Policy 2.9 once. (c)
|
||||
The `ja` string marked `review` (`GameDetail_EngineVersion_RenPyVcVersion`).
|
||||
17. ~~**beta.21 on real hardware.**~~ **Passed 2026-10-13** — the same answer. *(The item as written:)* (a) **Wuthering
|
||||
Waves:** after the update, before any session, its page says hooking is off — Anti-Cheat Expert beside its
|
||||
executable, and its Steam id on the title list; Neverness To Everness stays blocked, and GIRLS' FRONTLINE 2's
|
||||
exception stays in force. (b) **Play**, in both modes of Settings ▸ Games ▸ *Play button*, with a Steam game, Alan
|
||||
Wake 2 from the Epic Games Launcher (its link has not been tried on a real game), a GOG game and an itch game — and
|
||||
in Task Manager's Details tab the game's *Elevated* column reads *No*. (c) **The wheel and a touchpad** in Help ▸
|
||||
User guide, the licence in Help ▸ About and the Legal Gate: about three lines a notch, gliding; at the end of the
|
||||
update notes the window scrolls instead. (d) The Legal Gate shows the Privacy Policy 2.10 once. (e) The `ja` strings
|
||||
marked `review` (Play, Settings ▸ Games, `GameDetail_Supports_None`).
|
||||
18. ~~**beta.22 on real hardware.**~~ **Passed 2026-10-13** — the same answer. *(The item as written:)* (a) The `ja`
|
||||
string marked `review` (`Agent_Unanswered`). (b) Nothing else to run: the change answers a request the agent drops
|
||||
mid-way, which the tests make happen and a person can only meet by chance — if a notice ever says the capture agent
|
||||
did not answer, the page beside it shows what was stored.
|
||||
|
||||
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
|
||||
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
|
||||
@@ -2581,6 +2682,17 @@ diagnosis*.
|
||||
nothing, and `ring_test.cpp`'s own header already records that two of its four properties
|
||||
have never been shown red.
|
||||
|
||||
> **Amended 2026-10-13 (beta.23 PR-1, #308): both guards now measure overlap.** The hammering case's own guard,
|
||||
> `accepted > kTotal / 2`, failed 5 of 40 runs and then 5 of 200 on the owner's hybrid i7-14700KF — `mixed` clean every
|
||||
> time — and once made a full local gate red. A share of the stream measured the scheduler: a reader on an efficiency
|
||||
> core keeps less than half, and one the OS does not run until the writer is done keeps one lap (accepted 1024). The
|
||||
> tiny ring's `dropped > 0` was weaker the other way: a reader made to wait for the writer to finish drops nearly
|
||||
> everything (1.6 million over eight attempts) and passed it. Both cases now start the writer only once the reader
|
||||
> is about to loop, count the drains that copied records while the writer was still writing, and repeat — every
|
||||
> attempt checked for its properties — until one attempt made 100 such drains, at most eight times; the tiny ring
|
||||
> also holds that attempt's own `dropped > 0`. A start barrier alone left 1 of 200 (one overlapping drain). Measured:
|
||||
> 1,000 runs, no failure, at most 3 attempts; with the waiting reader, both guards fail in every run.
|
||||
|
||||
- **A self-test's cases can all pass while testing nothing, and their NAMES will not tell
|
||||
you.** Found 2026-08-27 in a PowerShell gate's `-SelfTest`: removing the fail-closed guard
|
||||
from a hash comparison left **all ten cases green**. `[string]::Equals` already refuses
|
||||
|
||||
@@ -62,6 +62,7 @@ with the 2026-09-16 recovery and with library entries removed since.
|
||||
| Aniimo | NetEase Yidun with a kernel driver (`NEPKernel.sys`) in the game's folder — never eligible for an exception | 2026-09-25 | [19_SAFETY](19_SAFETY_AND_ANTICHEAT.md) |
|
||||
| Goose Goose Duck | Easy Anti-Cheat's service running, and its folder | 2026-08-04 | [spike-notes §13](spike-notes.md) |
|
||||
| Neverness To Everness | Anti-Cheat Expert's kernel driver in the game's folder | 2026-08-04 | [spike-notes §13](spike-notes.md) |
|
||||
| Wuthering Waves | Anti-Cheat Expert, kept beside the game's executable four folder levels in, where the check did not look before beta.21: a session with hooking on was injected and unhooked 37 seconds later, when the 30-second re-check met ACE's driver (`ACE-BASE.sys`); nothing was measured. Since beta.21 its folder and its Steam id refuse it before any injection *(row added 2026-10-13 from the agent's log)* | 2026-10-12 | [spike-notes §19](spike-notes.md) |
|
||||
| Counter-Strike 2 | Valve Anti-Cheat — refused by FrameLedger's title list since beta.8. On 2026-08-04 the checks alone allowed it (VAC is invisible to them); nothing was injected | 2026-08-04, beta.8 | [spike-notes §13](spike-notes.md), [19_SAFETY](19_SAFETY_AND_ANTICHEAT.md) |
|
||||
|
||||
Also refused before any injection: **Deadly Heart Gambit** — a 32-bit game (2026-08-03).
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2772,3 +2772,44 @@ entry, and the HELLO, HELLO WORLD! row of `LIST_GAME_TESTED.md`; `LIMITATIONS.md
|
||||
game from an unsafe one.
|
||||
|
||||
- **Not measured, and not to be:** what the payload does. Nothing here was run, decrypted or uploaded anywhere.
|
||||
|
||||
## 21 · Opening pages and switching tabs in the App *(2026-10-14, beta.23)*
|
||||
|
||||
The owner asked whether switching pages and tabs is slow. Measured with a harness over the App's own pages and view
|
||||
models — not committed: it times, and a timing assertion in CI is a flake — on the dev PC (i7-14700KF, RTX 5080, Windows
|
||||
11 29648), Release build, each page shown in WPF UI's `NavigationViewContentPresenter` in a real, off-screen window. The
|
||||
ledger is a scratch one shaped like the owner's (its counts read from the owner's ledger without writing to it): 48 games, one with 100 sessions (NFR-4's
|
||||
"opening a game with 100 sessions ≤ 500 ms"), one with a 2,000,000-frame session (the owner's longest: WALTO, 2,057,022
|
||||
frames, with noisy frame times so a sort is a real sort). **Freeze** is the longest stretch the UI thread did not answer
|
||||
(a probe re-posted at idle priority); median of 10 runs, 5 for the selection; *before* is two runs of `main` (2982679).
|
||||
|
||||
**The decision table, written before the first run:** fix what keeps the UI thread busy 50 ms or more, what can block
|
||||
on I/O, and what grows with each visit; record the rest.
|
||||
|
||||
| What | Freeze before | Freeze after | Why it was slow |
|
||||
|---|---|---|---|
|
||||
| Open a game with 100 sessions | 1,175–1,507 ms | 369 ms | the Sessions grid inside the page's scroller had no height limit and built every row: 100 rows of 17 columns |
|
||||
| Choose the 2,000,000-frame session | 843–1,016 ms | 17 ms | the blob read, its decode and the stutter detection ran on the UI thread (Microsoft.Data.Sqlite's async is synchronous), then three sorts of every frame for the Distribution tab (its histogram, its percentile curve, the curve's lows) and two walks for the Frametime chart — for tabs not even shown. The series is ready 0.85 s after the click either way; the window answers meanwhile now |
|
||||
| A session ends after 20 visits to the Dashboard | 46–60 ms, **20 notices** | 18 ms, 1 notice | every Dashboard ever opened stayed alive (a transient `IDisposable` the root container keeps) and subscribed: each reloaded its lists and raised FR-3.8's notice |
|
||||
| Open the library (48 games) | 265–404 ms | 275 ms | not fixed — below |
|
||||
| Open a game with 9 sessions | 148–203 ms | 210 ms | building ≈ 1,750 visuals, the grid's 9 rows ≈ 130 each |
|
||||
| Open Compare | 66–82 ms | 87 ms | building its visuals |
|
||||
| Open Settings | 75–99 ms | 85 ms | building its visuals |
|
||||
| Open the Dashboard | 48–61 ms | 46 ms | — |
|
||||
| Open Logs | 16–23 ms | 23 ms | — |
|
||||
| Switch a game page's tab (Frametime, Distribution, Trend, Sensors, Latency, back) | 1–25 ms | 1–24 ms | already cheap: a hidden tab is not in the visual tree, and its plot renders once when shown |
|
||||
|
||||
Also changed, and held by tests rather than by these numbers: the game page asks whether its executable is on disk off
|
||||
the UI thread (a USB drive that sleeps answered on it — 39 of the owner's 41 Steam games are on one); the Logs page's
|
||||
two-second tick reads nothing when the newest file has not changed (it re-read up to 2 MB and replaced the whole text);
|
||||
Play reads the stores' records on the thread pool (every press listed Steam's manifests and copied itch's database on
|
||||
the UI thread); the game page no longer summarises every game's sessions to show one.
|
||||
|
||||
**Above the bar, and not fixed.** A page that builds 600–2,500 visuals costs 85–370 ms whatever it reads — about 0.1 ms a
|
||||
visual on this PC — and the remaining cost of the game page is its grid's rows (≈ 130 visuals each). The library is the
|
||||
one that grows with the data: 275 ms at 48 games, about 5.7 ms a card, so about 0.6 s at 100. Its grid is a
|
||||
non-virtualizing panel by decision (beta.11, `Controls/UniformWrapPanel`: cards an equal share of the width, each row as
|
||||
tall as its tallest card); a virtualizing one builds only the cards on screen but makes every card one height and the
|
||||
grid scroll under a fixed header — a change to how the page looks, offered to the owner instead of made here. Nor was a
|
||||
schema migration added for an index on `sessions.started_at` (the Dashboard sorts the table): at the owner's 41 sessions
|
||||
it costs nothing measurable, and a new schema version locks the ledger out of every earlier build.
|
||||
+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 |
|
||||
|
||||
+5
-4
@@ -11,8 +11,8 @@
|
||||
that changes what FrameLedger.Overlay or the capture host does; date the change.
|
||||
HTML comments are not part of the block.
|
||||
-->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.20`** (2026-10-12), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-13.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.22`** (2026-10-13), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -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
|
||||
|
||||
+5
-4
@@ -113,8 +113,8 @@ Software running inside another process can, in principle, destabilize it. Frame
|
||||
Frame timing is derived from high-resolution timestamps taken at the moment the game presents each frame; upscaling, frame-generation and ray-tracing state are read from the parameters the game passes to those APIs. This is substantially more accurate than inferring settings from files on disk, but **no measurement is guaranteed to be exact**:
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-06.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.20`** (2026-10-12), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-10-13.** The software is a beta; its latest
|
||||
> **pre-release is `0.1.0-beta.22`** (2026-10-13), an unsigned installer built from that tag with its
|
||||
> checksums published beside it. The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public partial class App : System.Windows.Application
|
||||
_host = BuildHost(_db, appearance, registered, closePolicy);
|
||||
await _host.StartAsync().ConfigureAwait(true);
|
||||
Log.Information("ui: started ({Version}), ledger {Ledger}", UiIdentity.Version, UiPaths.Database);
|
||||
// beta.21: tier 0 is software rendering (a VM without a GPU, Remote Desktop) - every scroll drawn on the CPU.
|
||||
Log.Information("ui: render tier {Tier} (2 = the GPU draws; 0 = software)", System.Windows.Media.RenderCapability.Tier >> 16);
|
||||
if (UiPaths.IsViewer)
|
||||
{
|
||||
Log.Warning("ui: a VIEWER over {Folder} (--data-dir, D52): no Agent is started or contacted, nothing on this PC is changed", UiPaths.DataDirectory);
|
||||
@@ -192,7 +194,8 @@ public partial class App : System.Windows.Application
|
||||
Log.Warning(ex, "diag: the hardware could not be read; its lines are n/a");
|
||||
}
|
||||
|
||||
string report = DiagReport.Build(UiIdentity.Version, UiPaths.DataDirectory, UiPaths.Logs, schema, values, new AgentLauncher().CanLaunch, now, hardware);
|
||||
string report = DiagReport.Build(UiIdentity.Version, UiPaths.DataDirectory, UiPaths.Logs, schema, values, new AgentLauncher().CanLaunch, now, hardware,
|
||||
System.Windows.Media.RenderCapability.Tier >> 16);
|
||||
string path = DiagReport.Write(UiPaths.Logs, report, now);
|
||||
await Console.Out.WriteLineAsync(string.Format(CultureInfo.CurrentCulture, Strings.Diag_Written_Format, path)).ConfigureAwait(true);
|
||||
Log.Information("ui: --diag written to {Path}", path);
|
||||
@@ -418,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>(),
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace FrameLedger.App.Charts;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
|
||||
public partial class DistributionChart : UserControl
|
||||
{
|
||||
private const int _bins = 60;
|
||||
|
||||
public DistributionChart()
|
||||
{
|
||||
@@ -51,7 +50,8 @@ public partial class DistributionChart : UserControl
|
||||
int outside = 0;
|
||||
if (series is { AppFrameTimesMs.Length: > 1 })
|
||||
{
|
||||
FpsHistogram histogram = FpsHistogram.Of(series.AppFrameTimesMs, _bins);
|
||||
// beta.23: the decoded series carries it, worked out off the UI thread (SeriesDigest).
|
||||
FpsHistogram histogram = series.Digest?.Histogram ?? FpsHistogram.OfSorted(SeriesDigest.SortedOf(series), SeriesDigest.HistogramBins);
|
||||
if (histogram.Centers.Length > 0)
|
||||
{
|
||||
BarPlot bars = plot.Add.Bars(histogram.Centers, histogram.Counts);
|
||||
@@ -80,7 +80,8 @@ public partial class DistributionChart : UserControl
|
||||
plot.YLabel(Strings.Chart_Axis_Fps);
|
||||
if (series is { AppFrameTimesMs.Length: > 1 })
|
||||
{
|
||||
(double[] xs, double[] ys) = PercentileCurve.Of(series.AppFrameTimesMs);
|
||||
IReadOnlyList<double>? sorted = series.Digest is null ? SeriesDigest.SortedOf(series) : null;
|
||||
(double[] xs, double[] ys) = series.Digest?.Percentiles ?? PercentileCurve.OfSorted(sorted!);
|
||||
if (xs.Length > 0)
|
||||
{
|
||||
Scatter line = plot.Add.ScatterLine(xs, ys, ChartTheme.Current.Percentile);
|
||||
@@ -88,7 +89,7 @@ public partial class DistributionChart : UserControl
|
||||
line.LegendText = Strings.Chart_Series_Percentile;
|
||||
}
|
||||
|
||||
foreach ((double x, double fps, bool pointOne) in PercentileCurve.Lows(series.AppFrameTimesMs))
|
||||
foreach ((double x, double fps, bool pointOne) in series.Digest?.Lows ?? PercentileCurve.LowsOfSorted(sorted!))
|
||||
{
|
||||
Scatter low = plot.Add.ScatterPoints(new[] { x }, new[] { fps }, ChartTheme.Current.Stutter);
|
||||
low.MarkerSize = 7;
|
||||
|
||||
@@ -23,24 +23,52 @@ public sealed record FpsHistogram(double[] Centers, double[] Counts, double BinW
|
||||
ArgumentNullException.ThrowIfNull(appFrameTimesMs);
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(bins);
|
||||
double[] fps = [.. appFrameTimesMs.Where(static f => f > 0).Select(static f => 1000.0 / f)];
|
||||
if (fps.Length == 0)
|
||||
return FromSortedRates(Percentile.Sorted(fps), bins);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Of"/> over frame times already sorted ascending (beta.23, <see cref="SeriesDigest"/>): the positive ones are
|
||||
/// the tail, and their rates read backwards ascend — the same rates <see cref="Of"/> sorts, without a sort of its own.
|
||||
/// </summary>
|
||||
public static FpsHistogram OfSorted(IReadOnlyList<double> sortedAppFrameTimesMs, int bins = 60)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sortedAppFrameTimesMs);
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(bins);
|
||||
int count = sortedAppFrameTimesMs.Count;
|
||||
int first = 0;
|
||||
while (first < count && !(sortedAppFrameTimesMs[first] > 0))
|
||||
{
|
||||
first++;
|
||||
}
|
||||
|
||||
var fps = new double[count - first];
|
||||
for (int i = 0; i < fps.Length; i++)
|
||||
{
|
||||
fps[i] = 1000.0 / sortedAppFrameTimesMs[count - 1 - i];
|
||||
}
|
||||
|
||||
return FromSortedRates(fps, bins);
|
||||
}
|
||||
|
||||
private static FpsHistogram FromSortedRates(IReadOnlyList<double> sorted, int bins)
|
||||
{
|
||||
if (sorted.Count == 0)
|
||||
{
|
||||
return new FpsHistogram([], [], 0, 0);
|
||||
}
|
||||
|
||||
IReadOnlyList<double> sorted = Percentile.Sorted(fps);
|
||||
double lo = Percentile.Linear(sorted, TailFraction) ?? sorted[0];
|
||||
double hi = Percentile.Linear(sorted, 1 - TailFraction) ?? sorted[^1];
|
||||
if (hi - lo < 1e-9)
|
||||
{
|
||||
// Every frame at one rate: one bar, a frame per second wide, centred on it.
|
||||
return new FpsHistogram([lo], [fps.Length], 1, 0);
|
||||
return new FpsHistogram([lo], [sorted.Count], 1, 0);
|
||||
}
|
||||
|
||||
double width = (hi - lo) / bins;
|
||||
var counts = new double[bins];
|
||||
int outside = 0;
|
||||
foreach (double v in fps)
|
||||
foreach (double v in sorted)
|
||||
{
|
||||
if (v < lo || v > hi)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ public partial class FrametimeChart : UserControl
|
||||
lines.Add(Strings.Chart_Note_PresentsTiming);
|
||||
}
|
||||
|
||||
int gaps = series.Gap.Skip(1).Count(static g => g);
|
||||
int gaps = series.Digest?.GapsAfterFirst ?? series.Gap.Skip(1).Count(static g => g);
|
||||
if (sensors && series.SensorsAligned && gaps > 0)
|
||||
{
|
||||
lines.Add(string.Format(CultureInfo.CurrentCulture, Strings.Chart_Note_GapsClosed_Format, gaps));
|
||||
@@ -128,9 +128,9 @@ public partial class FrametimeChart : UserControl
|
||||
Plot.Refresh();
|
||||
}
|
||||
|
||||
private void DrawSeries(ScottPlot.Plot plot, IReadOnlyList<double> xs, IReadOnlyList<double> ys, Color color, string label)
|
||||
private void DrawSeries(ScottPlot.Plot plot, double[] xs, double[] ys, Color color, string label)
|
||||
{
|
||||
if (xs.Count == 0)
|
||||
if (xs.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -145,17 +145,8 @@ public partial class FrametimeChart : UserControl
|
||||
/// <summary>Every present but those after a gap, whose stored interval is 0 — not a frame, and it was drawn as a 0 ms one.</summary>
|
||||
private void DrawPresents(ScottPlot.Plot plot, ChartPalette p)
|
||||
{
|
||||
var xs = new List<double>(_series!.Presents);
|
||||
var ys = new List<double>(_series.Presents);
|
||||
for (int i = 0; i < _series.Presents; i++)
|
||||
{
|
||||
if (!_series.Gap[i])
|
||||
{
|
||||
xs.Add(_series.TimesS[i]);
|
||||
ys.Add(_series.FrameTimesMs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// beta.23: the decoded series carries the line (SeriesDigest), so the Displayed toggle no longer walks every present.
|
||||
(double[] xs, double[] ys) = _series!.Digest?.Presents ?? SeriesDigest.PresentsWithoutGaps(_series.TimesS, _series.FrameTimesMs, _series.Gap);
|
||||
DrawSeries(plot, xs, ys, p.Displayed, Strings.Chart_Series_Displayed);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,18 @@ public static class PercentileCurve
|
||||
public static (double[] Xs, double[] Ys) Of(IReadOnlyList<double> appFrameTimesMs)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(appFrameTimesMs);
|
||||
if (appFrameTimesMs.Count < 2)
|
||||
return appFrameTimesMs.Count < 2 ? ([], []) : OfSorted(Percentile.Sorted(appFrameTimesMs));
|
||||
}
|
||||
|
||||
/// <summary><see cref="Of"/> over frame times already sorted ascending (beta.23, <see cref="SeriesDigest"/>).</summary>
|
||||
public static (double[] Xs, double[] Ys) OfSorted(IReadOnlyList<double> sorted)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sorted);
|
||||
if (sorted.Count < 2)
|
||||
{
|
||||
return ([], []);
|
||||
}
|
||||
|
||||
IReadOnlyList<double> sorted = Percentile.Sorted(appFrameTimesMs);
|
||||
var xs = new List<double>(103);
|
||||
var ys = new List<double>(103);
|
||||
foreach (double p in Percents())
|
||||
@@ -48,7 +54,13 @@ public static class PercentileCurve
|
||||
public static IReadOnlyList<(double X, double Fps, bool PointOne)> Lows(IReadOnlyList<double> appFrameTimesMs)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(appFrameTimesMs);
|
||||
IReadOnlyList<double> sorted = Percentile.Sorted(appFrameTimesMs);
|
||||
return LowsOfSorted(Percentile.Sorted(appFrameTimesMs));
|
||||
}
|
||||
|
||||
/// <summary><see cref="Lows"/> over frame times already sorted ascending (beta.23, <see cref="SeriesDigest"/>).</summary>
|
||||
public static IReadOnlyList<(double X, double Fps, bool PointOne)> LowsOfSorted(IReadOnlyList<double> sorted)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sorted);
|
||||
var lows = new List<(double, double, bool)>(2);
|
||||
if (Supported(sorted.Count, 99) && Fps(sorted, 99) is double p1)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Domain.Metrics;
|
||||
|
||||
namespace FrameLedger.App.Charts;
|
||||
|
||||
/// <summary>
|
||||
/// What the charts derive from a whole session, worked out ONCE where the series is decoded — off the UI thread since
|
||||
/// beta.23 (<see cref="SessionSeriesLoader.LoadAsync"/>) — instead of on every draw. Measured on 2026-10-14 over a
|
||||
/// two-million-frame session: selecting it froze the window for 0.8–1.0 s, most of it the Distribution tab sorting every
|
||||
/// application frame three times (its histogram, its percentile curve and the curve's lows each sorted their own copy) and
|
||||
/// the Frametime chart counting gaps and copying the presents line, all on the UI thread and for tabs not even shown
|
||||
/// (<c>spike-notes</c> §21). A series a test builds by hand has none: each chart then computes what it needs itself.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "a data carrier for ScottPlot, which draws double[]")]
|
||||
public sealed record SeriesDigest
|
||||
{
|
||||
/// <summary>The bins of <see cref="Histogram"/> — the Distribution tab's.</summary>
|
||||
public const int HistogramBins = 60;
|
||||
|
||||
/// <summary>The application frames' times, ms, ascending.</summary>
|
||||
public required double[] SortedAppFrameTimesMs { get; init; }
|
||||
|
||||
/// <summary><see cref="FpsHistogram.Of"/> over the application frames, at <see cref="HistogramBins"/>.</summary>
|
||||
public required FpsHistogram Histogram { get; init; }
|
||||
|
||||
/// <summary><see cref="PercentileCurve.Of"/> over the application frames.</summary>
|
||||
public required (double[] Xs, double[] Ys) Percentiles { get; init; }
|
||||
|
||||
/// <summary><see cref="PercentileCurve.Lows"/> over the application frames.</summary>
|
||||
public required IReadOnlyList<(double X, double Fps, bool PointOne)> Lows { get; init; }
|
||||
|
||||
/// <summary>How many presents after the first follow a gap.</summary>
|
||||
public required int GapsAfterFirst { get; init; }
|
||||
|
||||
/// <summary>How many presents were generated.</summary>
|
||||
public required int GeneratedCount { get; init; }
|
||||
|
||||
/// <summary>Every present's time and interval but those after a gap — the Frametime chart's presents line; null when nothing was generated, where it is never drawn.</summary>
|
||||
public (double[] TimesS, double[] FrameTimesMs)? Presents { get; init; }
|
||||
|
||||
/// <summary>The digest of a decoded series' arrays.</summary>
|
||||
public static SeriesDigest Of(double[] appFrameTimesMs, double[] timesS, float[] frameTimesMs, bool[] generated, bool[] gap, bool noApplicationFrames)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(appFrameTimesMs);
|
||||
ArgumentNullException.ThrowIfNull(timesS);
|
||||
ArgumentNullException.ThrowIfNull(frameTimesMs);
|
||||
ArgumentNullException.ThrowIfNull(generated);
|
||||
ArgumentNullException.ThrowIfNull(gap);
|
||||
double[] sorted = (double[])appFrameTimesMs.Clone();
|
||||
Array.Sort(sorted);
|
||||
int gaps = 0;
|
||||
int generatedCount = 0;
|
||||
for (int i = 0; i < gap.Length; i++)
|
||||
{
|
||||
if (i > 0 && gap[i])
|
||||
{
|
||||
gaps++;
|
||||
}
|
||||
|
||||
if (i < generated.Length && generated[i])
|
||||
{
|
||||
generatedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return new SeriesDigest
|
||||
{
|
||||
SortedAppFrameTimesMs = sorted,
|
||||
Histogram = FpsHistogram.OfSorted(sorted, HistogramBins),
|
||||
Percentiles = PercentileCurve.OfSorted(sorted),
|
||||
Lows = PercentileCurve.LowsOfSorted(sorted),
|
||||
GapsAfterFirst = gaps,
|
||||
GeneratedCount = generatedCount,
|
||||
Presents = generatedCount > 0 && !noApplicationFrames ? PresentsWithoutGaps(timesS, frameTimesMs, gap) : null,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Every present but those after a gap, whose stored interval is 0 — not a frame.</summary>
|
||||
internal static (double[] TimesS, double[] FrameTimesMs) PresentsWithoutGaps(double[] timesS, float[] frameTimesMs, bool[] gap)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(timesS);
|
||||
ArgumentNullException.ThrowIfNull(frameTimesMs);
|
||||
ArgumentNullException.ThrowIfNull(gap);
|
||||
int n = Math.Min(timesS.Length, Math.Min(frameTimesMs.Length, gap.Length));
|
||||
var xs = new List<double>(n);
|
||||
var ys = new List<double>(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (!gap[i])
|
||||
{
|
||||
xs.Add(timesS[i]);
|
||||
ys.Add(frameTimesMs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ([.. xs], [.. ys]);
|
||||
}
|
||||
|
||||
/// <summary>The ascending application frame times of <paramref name="series"/>: its digest's, or sorted now for a series without one.</summary>
|
||||
internal static IReadOnlyList<double> SortedOf(SessionSeries series)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(series);
|
||||
return series.Digest?.SortedAppFrameTimesMs ?? Percentile.Sorted(series.AppFrameTimesMs);
|
||||
}
|
||||
}
|
||||
@@ -81,9 +81,15 @@ public sealed record SessionSeries
|
||||
/// </summary>
|
||||
public bool SensorsAligned { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// What the charts derive from the whole session, worked out where it was decoded (beta.23); null on a series built by
|
||||
/// hand, whose charts compute it themselves.
|
||||
/// </summary>
|
||||
public SeriesDigest? Digest { get; init; }
|
||||
|
||||
public int Presents => TimesS.Length;
|
||||
|
||||
public bool HasGenerated => Generated.Any(static g => g);
|
||||
public bool HasGenerated => Digest is { } digest ? digest.GeneratedCount > 0 : Generated.Any(static g => g);
|
||||
|
||||
public double DurationS => TimesS.Length == 0 ? 0 : TimesS[^1];
|
||||
|
||||
|
||||
@@ -21,7 +21,23 @@ public sealed class SessionSeriesLoader
|
||||
|
||||
public SessionSeriesLoader(ISessionRepository sessions) => _sessions = sessions ?? throw new ArgumentNullException(nameof(sessions));
|
||||
|
||||
public async Task<SessionSeries?> LoadAsync(long sessionId, CancellationToken ct = default)
|
||||
/// <summary>
|
||||
/// The session's series, read and decoded on the thread pool (beta.23). Microsoft.Data.Sqlite runs its asynchronous
|
||||
/// methods synchronously, so before this the blob read, the decode and the stutter detection of a two-million-frame
|
||||
/// session all ran on the UI thread of whoever asked — the game page, a session's summary, Compare, an export — whatever
|
||||
/// <c>ConfigureAwait</c> said (<c>spike-notes</c> §21).
|
||||
/// </summary>
|
||||
public Task<SessionSeries?> LoadAsync(long sessionId, CancellationToken ct = default) => Task.Run(() => ReadAndDecodeAsync(sessionId, ct), ct);
|
||||
|
||||
/// <summary>
|
||||
/// The sensor series alone, timed from the session's start — what a session that was not hooked has to chart (beta.8: the
|
||||
/// Tier-2 row has kept its sensors since 2026-09-22, and no chart read them). Empty when none were recorded. On the
|
||||
/// thread pool, as <see cref="LoadAsync"/>.
|
||||
/// </summary>
|
||||
public Task<IReadOnlyList<SensorSeries>> LoadSensorsAsync(long sessionId, CancellationToken ct = default) =>
|
||||
Task.Run(async () => (IReadOnlyList<SensorSeries>)DecodeSensors(await _sessions.FindSensorsAsync(sessionId, ct).ConfigureAwait(false), offsetS: 0), ct);
|
||||
|
||||
private async Task<SessionSeries?> ReadAndDecodeAsync(long sessionId, CancellationToken ct)
|
||||
{
|
||||
FrameBlobs? frames = await _sessions.FindFramesAsync(sessionId, ct).ConfigureAwait(false);
|
||||
if (frames is null || !string.Equals(frames.Codec, SeriesCodec.Tag, StringComparison.Ordinal))
|
||||
@@ -34,13 +50,6 @@ public sealed class SessionSeriesLoader
|
||||
return Decode(frames, segments, sensors);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The sensor series alone, timed from the session's start — what a session that was not hooked has to chart (beta.8: the
|
||||
/// Tier-2 row has kept its sensors since 2026-09-22, and no chart read them). Empty when none were recorded.
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<SensorSeries>> LoadSensorsAsync(long sessionId, CancellationToken ct = default) =>
|
||||
DecodeSensors(await _sessions.FindSensorsAsync(sessionId, ct).ConfigureAwait(false), offsetS: 0);
|
||||
|
||||
public static SessionSeries Decode(FrameBlobs frames, IReadOnlyList<SegmentRow> segments, IReadOnlyList<SensorBlob> sensors)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(frames);
|
||||
@@ -71,6 +80,7 @@ public sealed class SessionSeriesLoader
|
||||
StutterResult? stutter = StutterDetector.Detect(appFrametimes);
|
||||
uint[]? frameIndex = frames.FrameIndex is { } fi ? PickOptional(SeriesCodec.DecodeUInt32(fi.ToArray()), keep) : null;
|
||||
double? offsetS = frames.FirstPresentMs / 1000.0;
|
||||
double[] appFrameTimesMs = [.. appFrametimes];
|
||||
return new SessionSeries
|
||||
{
|
||||
TimesS = times,
|
||||
@@ -85,13 +95,14 @@ public sealed class SessionSeriesLoader
|
||||
LatencyUs = frames.LatencyUs is { } lat ? PickOptional(SeriesCodec.DecodeUInt32(lat.ToArray()), keep) : null,
|
||||
RenderRes = frames.RenderRes is { } rr ? PickQuads(SeriesCodec.DecodeUInt16(rr.ToArray()), keep) : null,
|
||||
AppTimesS = [.. appIndex.Select(i => times[i])],
|
||||
AppFrameTimesMs = [.. appFrametimes],
|
||||
AppFrameTimesMs = appFrameTimesMs,
|
||||
AppPresentIndex = [.. appIndex],
|
||||
NoApplicationFrames = noApplicationFrames,
|
||||
Stutter = stutter is null ? null : [.. stutter.IsStutter],
|
||||
Segments = MapSegments([.. segments.Where(s => swapchain is null || s.SwapchainId == swapchain.Value)], times, frameIndex),
|
||||
Sensors = DecodeSensors(sensors, offsetS ?? 0),
|
||||
SensorsAligned = offsetS is not null,
|
||||
Digest = SeriesDigest.Of(appFrameTimesMs, times, frametimes, generated, gap, noApplicationFrames),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +97,8 @@ public partial class DocumentBrowser : UserControl
|
||||
|
||||
private void ShowPage(DocumentPage? page)
|
||||
{
|
||||
View.DocumentPath = page?.Path;
|
||||
View.IsPlainText = page?.IsPlainText ?? false;
|
||||
View.MarkdownText = page?.Text ?? string.Empty;
|
||||
// One render, now (beta.21): the three properties one by one rendered the old text under the new path first.
|
||||
View.Show(page?.Text ?? string.Empty, page?.IsPlainText ?? false, page?.Path);
|
||||
AutomationProperties.SetName(View, page?.Title ?? string.Empty);
|
||||
PageChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Threading;
|
||||
using FrameLedger.App.Markdown;
|
||||
using FrameLedger.App.Services;
|
||||
|
||||
@@ -18,8 +21,32 @@ namespace FrameLedger.App.Controls;
|
||||
/// (<see cref="RepositoryLinkRequested"/>), which shows it when the App embeds it, and otherwise opens on GitHub at this
|
||||
/// build's source (<see cref="RepositoryLinks"/>); anything else is not followed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The wheel (beta.21, owner request 2026-10-13: "scrolling the documents is slow").</b> WPF's scroll viewer moves a
|
||||
/// fixed 48 DIP per wheel message, whatever its delta — about two and a half lines of body text, Windows' "lines to
|
||||
/// scroll" ignored, and a precision touchpad's small deltas each jumping the whole step (measured: −1, −15, −120 and −360
|
||||
/// all moved 48). Layout costs about a millisecond a step, so the step was the problem, not drawing. The view now moves
|
||||
/// <see cref="WheelStep"/>: the delta in proportion, Windows' lines per notch at a browser's line (100/3 DIP), scaled by
|
||||
/// the zoom — and eases there over about 120 ms unless Windows' animations are off. At either end it leaves the wheel
|
||||
/// unhandled, so whatever holds the view (the update notes' dialog) scrolls instead. Ctrl+wheel stays the zoom.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>One render per page.</b> Each of the three properties rendered the whole document on its own, so a page change
|
||||
/// rendered the old text under the new path first, and the Legal Gate's three bindings rendered three times. Property
|
||||
/// changes now ask for one render, posted to the dispatcher ahead of layout; <see cref="Show"/> sets all three and renders
|
||||
/// at once; and a document this view has rendered is kept (<see cref="CacheCapacity"/>), so going back to a page costs
|
||||
/// its layout and nothing else.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class MarkdownView : FlowDocumentScrollViewer
|
||||
{
|
||||
/// <summary>A line of the wheel's step: Chromium scrolls 100 DIP for Windows' default three lines at 100%.</summary>
|
||||
internal const double WheelLineDip = 100.0 / 3.0;
|
||||
|
||||
/// <summary>How many rendered documents one view keeps (the user guide has twelve pages and Limitations).</summary>
|
||||
internal const int CacheCapacity = 16;
|
||||
|
||||
public static readonly DependencyProperty MarkdownTextProperty =
|
||||
DependencyProperty.Register(nameof(MarkdownText), typeof(string), typeof(MarkdownView), new PropertyMetadata(null, OnSourceChanged));
|
||||
|
||||
@@ -29,7 +56,18 @@ public sealed class MarkdownView : FlowDocumentScrollViewer
|
||||
public static readonly DependencyProperty DocumentPathProperty =
|
||||
DependencyProperty.Register(nameof(DocumentPath), typeof(string), typeof(MarkdownView), new PropertyMetadata(null, OnSourceChanged));
|
||||
|
||||
private readonly Dictionary<RenderKey, RenderedMarkdown> _cache = [];
|
||||
private readonly LinkedList<RenderKey> _recent = new();
|
||||
private IReadOnlyDictionary<string, Block> _anchors = new Dictionary<string, Block>(StringComparer.Ordinal);
|
||||
private RenderKey? _shown;
|
||||
private bool _batching;
|
||||
private DispatcherOperation? _pending;
|
||||
|
||||
private ScrollViewer? _scroller;
|
||||
private double _wheelTarget = double.NaN;
|
||||
private double _lastSetOffset = double.NaN;
|
||||
private TimeSpan _lastFrame;
|
||||
private bool _easing;
|
||||
|
||||
public MarkdownView()
|
||||
{
|
||||
@@ -38,7 +76,8 @@ public sealed class MarkdownView : FlowDocumentScrollViewer
|
||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||
Focusable = true;
|
||||
AddHandler(Hyperlink.RequestNavigateEvent, new RequestNavigateEventHandler(OnRequestNavigate));
|
||||
Rebuild();
|
||||
Unloaded += (_, _) => StopEasing();
|
||||
RenderNow();
|
||||
}
|
||||
|
||||
/// <summary>A link to another file of the repository; the host shows it and sets Handled, or it opens on GitHub.</summary>
|
||||
@@ -69,31 +108,226 @@ public sealed class MarkdownView : FlowDocumentScrollViewer
|
||||
public IUrlOpener UrlOpener { get; set; } = new ShellUrlOpener();
|
||||
|
||||
/// <summary>The headings this document can scroll to, by anchor.</summary>
|
||||
public IReadOnlyCollection<string> Anchors => [.. _anchors.Keys];
|
||||
public IReadOnlyCollection<string> Anchors
|
||||
{
|
||||
get
|
||||
{
|
||||
RenderIfPending();
|
||||
return [.. _anchors.Keys];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>How many documents this view has rendered from text — a cache hit is not one (for tests).</summary>
|
||||
internal int Renders { get; private set; }
|
||||
|
||||
/// <summary>Where the wheel is taking the view, or NaN when it is not easing it there (for tests).</summary>
|
||||
internal double ScrollTarget => _wheelTarget;
|
||||
|
||||
/// <summary>The template's scroll viewer, once the template is applied (for tests).</summary>
|
||||
internal ScrollViewer? Scroller => _scroller;
|
||||
|
||||
/// <summary>The modifier keys held, read when the wheel turns; a test gives its own rather than the real keyboard's.</summary>
|
||||
internal Func<ModifierKeys> CurrentModifiers { get; set; } = static () => Keyboard.Modifiers;
|
||||
|
||||
/// <summary>Windows' "lines to scroll" per notch (−1: a screen); a test gives its own.</summary>
|
||||
internal Func<int> WheelScrollLines { get; set; } = static () => SystemParameters.WheelScrollLines;
|
||||
|
||||
/// <summary>Whether the wheel eases to its target; off where Windows' animations are, and in tests.</summary>
|
||||
internal bool EaseWheel { get; set; } = SystemParameters.ClientAreaAnimation;
|
||||
|
||||
/// <summary>Shows a document: the three properties at once, rendered once, now.</summary>
|
||||
public void Show(string? text, bool isPlainText, string? path)
|
||||
{
|
||||
_batching = true;
|
||||
try
|
||||
{
|
||||
DocumentPath = path;
|
||||
IsPlainText = isPlainText;
|
||||
MarkdownText = text;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_batching = false;
|
||||
}
|
||||
|
||||
RenderNow();
|
||||
}
|
||||
|
||||
/// <summary>Brings the heading with <paramref name="anchor"/> into view; whether the document has it.</summary>
|
||||
public bool ScrollTo(string anchor)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(anchor);
|
||||
RenderIfPending();
|
||||
if (!_anchors.TryGetValue(anchor, out Block? block))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
StopEasing();
|
||||
block.BringIntoView();
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((MarkdownView)d).Rebuild();
|
||||
|
||||
private void Rebuild()
|
||||
/// <summary>
|
||||
/// The distance one wheel message moves the view, in DIP (positive: down). <paramref name="delta"/> in proportion (120 is a
|
||||
/// notch); <paramref name="wheelScrollLines"/> lines per notch at <see cref="WheelLineDip"/>, or a screen
|
||||
/// (<paramref name="viewportHeight"/>) when Windows says −1; scaled by <paramref name="zoomPercent"/>.
|
||||
/// </summary>
|
||||
internal static double WheelStep(int delta, int wheelScrollLines, double viewportHeight, double zoomPercent)
|
||||
{
|
||||
string text = MarkdownText ?? string.Empty;
|
||||
RenderedMarkdown rendered = IsPlainText ? MarkdownRenderer.RenderPlainText(text) : MarkdownRenderer.Render(text, DocumentPath);
|
||||
double notches = delta / 120.0;
|
||||
double perNotch = wheelScrollLines < 0 ? viewportHeight : wheelScrollLines * WheelLineDip * zoomPercent / 100.0;
|
||||
return -notches * perNotch;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
StopEasing();
|
||||
_scroller = GetTemplateChild("PART_ContentHost") as ScrollViewer;
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
base.OnPreviewMouseWheel(e);
|
||||
if (e.Handled || _scroller is not { } scroller || (CurrentModifiers() & ModifierKeys.Control) != ModifierKeys.None)
|
||||
{
|
||||
return; // Ctrl+wheel is the zoom
|
||||
}
|
||||
|
||||
double step = WheelStep(e.Delta, WheelScrollLines(), scroller.ViewportHeight, Zoom);
|
||||
if (step == 0 || double.IsNaN(step))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double from = double.IsNaN(_wheelTarget) ? scroller.VerticalOffset : _wheelTarget;
|
||||
double to = Math.Clamp(from + step, 0, scroller.ScrollableHeight);
|
||||
if (Math.Abs(to - scroller.VerticalOffset) < 0.5 && double.IsNaN(_wheelTarget))
|
||||
{
|
||||
return; // at the end it would move toward: the wheel is the host's
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
if (!EaseWheel)
|
||||
{
|
||||
scroller.ScrollToVerticalOffset(to);
|
||||
return;
|
||||
}
|
||||
|
||||
_wheelTarget = to;
|
||||
if (!_easing)
|
||||
{
|
||||
_easing = true;
|
||||
_lastFrame = TimeSpan.Zero;
|
||||
_lastSetOffset = scroller.VerticalOffset;
|
||||
CompositionTarget.Rendering += OnRendering;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((MarkdownView)d).RequestRender();
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; this posts to the view's own dispatcher from its own thread, at a priority ahead of layout, and never waits (ScrollBarHiding does the same)")]
|
||||
private void RequestRender()
|
||||
{
|
||||
if (_batching || _pending is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Ahead of layout, after whatever is setting the other properties has set them.
|
||||
_pending = Dispatcher.InvokeAsync(RenderIfPending, DispatcherPriority.DataBind);
|
||||
}
|
||||
|
||||
private void RenderIfPending()
|
||||
{
|
||||
if (_pending is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RenderNow();
|
||||
}
|
||||
|
||||
private void RenderNow()
|
||||
{
|
||||
if (_pending is { } pending)
|
||||
{
|
||||
_ = pending.Abort();
|
||||
_pending = null;
|
||||
}
|
||||
|
||||
var key = new RenderKey(DocumentPath, IsPlainText, MarkdownText ?? string.Empty);
|
||||
if (_shown is { } shown && shown.Equals(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_cache.TryGetValue(key, out RenderedMarkdown? rendered))
|
||||
{
|
||||
rendered = key.IsPlainText ? MarkdownRenderer.RenderPlainText(key.Text) : MarkdownRenderer.Render(key.Text, key.Path);
|
||||
Renders++;
|
||||
_cache[key] = rendered;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = _recent.Remove(key);
|
||||
}
|
||||
|
||||
_ = _recent.AddFirst(key);
|
||||
while (_recent.Count > CacheCapacity && _recent.Last is { } oldest)
|
||||
{
|
||||
_ = _cache.Remove(oldest.Value);
|
||||
_recent.RemoveLast();
|
||||
}
|
||||
|
||||
StopEasing();
|
||||
_anchors = rendered.Anchors;
|
||||
_shown = key;
|
||||
Document = rendered.Document;
|
||||
}
|
||||
|
||||
private void OnRendering(object? sender, EventArgs e)
|
||||
{
|
||||
if (_scroller is not { } scroller || double.IsNaN(_wheelTarget))
|
||||
{
|
||||
StopEasing();
|
||||
return;
|
||||
}
|
||||
|
||||
// Something else moved the view since the last frame (the scroll bar, the keyboard, a link): it is theirs now.
|
||||
if (Math.Abs(scroller.VerticalOffset - _lastSetOffset) > 1)
|
||||
{
|
||||
StopEasing();
|
||||
return;
|
||||
}
|
||||
|
||||
TimeSpan now = (e as RenderingEventArgs)?.RenderingTime ?? TimeSpan.Zero;
|
||||
double elapsedMs = _lastFrame == TimeSpan.Zero ? 16 : Math.Clamp((now - _lastFrame).TotalMilliseconds, 1, 100);
|
||||
_lastFrame = now;
|
||||
|
||||
// Exponential ease-out: about 95% of the way in 120 ms, however many notches have been added on the way.
|
||||
double remaining = _wheelTarget - scroller.VerticalOffset;
|
||||
double next = Math.Abs(remaining) < 0.5 ? _wheelTarget : scroller.VerticalOffset + (remaining * (1 - Math.Exp(-elapsedMs / 40.0)));
|
||||
scroller.ScrollToVerticalOffset(next);
|
||||
_lastSetOffset = next;
|
||||
if (next == _wheelTarget)
|
||||
{
|
||||
StopEasing();
|
||||
}
|
||||
}
|
||||
|
||||
private void StopEasing()
|
||||
{
|
||||
_wheelTarget = double.NaN;
|
||||
if (_easing)
|
||||
{
|
||||
_easing = false;
|
||||
CompositionTarget.Rendering -= OnRendering;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
@@ -116,4 +350,7 @@ public sealed class MarkdownView : FlowDocumentScrollViewer
|
||||
_ = ScrollTo(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>What a rendered document depends on: theme and language are not in it — its colours are resource references.</summary>
|
||||
private readonly record struct RenderKey(string? Path, bool IsPlainText, string Text);
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Threading;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.App.ViewModels;
|
||||
using Serilog;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Abstractions;
|
||||
using Wpf.Ui.Controls;
|
||||
@@ -48,6 +51,27 @@ public partial class MainWindow : FluentWindow
|
||||
dialogs.SetDialogHost(DialogHost);
|
||||
|
||||
Loaded += (_, _) => theme.Apply(appearance.Theme, this);
|
||||
TimeNavigations();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.23 (<c>spike-notes</c> §21): how long each page takes to be on screen once WPF UI navigates to it — its layout,
|
||||
/// its templates, its first render — logged at Debug (Settings ▸ Logging), so a slow page on a real PC says which it is.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; this posts to the window's own dispatcher from its own thread, at the priority after rendering, and never waits (ScrollBarHiding does the same)")]
|
||||
private void TimeNavigations()
|
||||
{
|
||||
long navigating = 0;
|
||||
RootNavigation.Navigating += (_, _) => navigating = Stopwatch.GetTimestamp();
|
||||
RootNavigation.Navigated += (_, e) =>
|
||||
{
|
||||
long from = navigating;
|
||||
string page = e.Page?.GetType().Name ?? "?";
|
||||
DispatcherOperation logged = Dispatcher.InvokeAsync(
|
||||
() => Log.Debug("ui: page {Page} shown {Ms:0} ms after its navigation", page, Stopwatch.GetElapsedTime(from).TotalMilliseconds),
|
||||
DispatcherPriority.ContextIdle);
|
||||
GC.KeepAlive(logged);
|
||||
};
|
||||
}
|
||||
|
||||
public MainWindowViewModel ViewModel { get; }
|
||||
|
||||
@@ -233,7 +233,7 @@ public static class MarkdownRenderer
|
||||
int columns = Math.Max(table.ColumnDefinitions.Count, rows.Select(static r => r.Count).DefaultIfEmpty(0).Max());
|
||||
for (int i = 0; i < columns; i++)
|
||||
{
|
||||
wpf.Columns.Add(new TableColumn { Width = GridLength.Auto });
|
||||
wpf.Columns.Add(new TableColumn()); // WPF's default width is already Auto (read by reflection, beta.21)
|
||||
}
|
||||
|
||||
var group = new TableRowGroup();
|
||||
|
||||
@@ -13,6 +13,10 @@ public partial class DashboardPage : INavigableView<DashboardViewModel>
|
||||
ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
|
||||
// beta.23: the view model hears the Agent while this page is on screen, never after (each visit makes a new one).
|
||||
Loaded += (_, _) => ViewModel.Attach();
|
||||
Unloaded += (_, _) => ViewModel.Detach();
|
||||
}
|
||||
|
||||
public DashboardViewModel ViewModel { get; }
|
||||
|
||||
@@ -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}" />
|
||||
@@ -236,7 +239,12 @@
|
||||
Content="{x:Static vm:GameDetailViewModel.DeleteAllSessionsText}" Icon="{ui:SymbolIcon Delete24}"
|
||||
IsEnabled="{Binding ViewModel.ActsOnThisPc}" />
|
||||
</StackPanel>
|
||||
<DataGrid x:Name="SessionsGrid" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" HeadersVisibility="Column"
|
||||
<!--
|
||||
beta.23: bounded, as Compare's list is, so the grid scrolls itself and builds only the rows on screen. Inside
|
||||
the page's own scroller it was measured with no height limit and built every row — up to 500 rows of 17
|
||||
columns; 1.2 s to open a game with 100 sessions (spike-notes §21).
|
||||
-->
|
||||
<DataGrid x:Name="SessionsGrid" MaxHeight="520" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" HeadersVisibility="Column"
|
||||
ItemsSource="{Binding ViewModel.Sessions}" SelectionMode="Extended" MouseDoubleClick="OnSessionDoubleClick"
|
||||
SelectedItem="{Binding ViewModel.SelectedSession, Mode=TwoWay}">
|
||||
<DataGrid.Columns>
|
||||
|
||||
@@ -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,18 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: a request the capture agent never answered, told apart from one it refused and from one never sent. The
|
||||
/// connection closed under it (<see cref="IOException"/>, <see cref="AgentConnection.AnsweredAsync"/>) or no answer came in
|
||||
/// time (<see cref="TimeoutException"/>): whether it was carried out is not known, so a caller says so
|
||||
/// (<c>Agent_Unanswered</c>) and reads what is stored again rather than assuming either way (<c>07_IPC</c> §Client behavior).
|
||||
/// An <see cref="InvalidOperationException"/> from the request is the connection gone before it was sent: nothing was asked.
|
||||
/// </summary>
|
||||
public static class AgentAnswers
|
||||
{
|
||||
public static bool IsUnanswered(Exception ex) => ex is IOException or TimeoutException;
|
||||
}
|
||||
@@ -108,7 +108,27 @@ public sealed class AgentConnection : IAgentLink, IAsyncDisposable
|
||||
throw new InvalidOperationException("the Agent is not connected");
|
||||
}
|
||||
|
||||
return client.RequestEnvelopeAsync(type, payload, _options.RequestTimeout, ct);
|
||||
return AnsweredAsync(() => client.RequestEnvelopeAsync(type, payload, _options.RequestTimeout, ct));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: a request's answer, with every way the pipe can close under it said as ONE <see cref="IOException"/>.
|
||||
/// <see cref="PipeClient"/> fails a request in flight with what ended its reader — an <see cref="IOException"/>, an
|
||||
/// <see cref="IpcFramingException"/> or an <see cref="ObjectDisposedException"/> — and a client this connection disposed
|
||||
/// between the check above and the write throws the last; a caller that knew only the first ended in the App's crash
|
||||
/// dialog (beta.21's review of Play). <see cref="IAgentRequests.RequestAsync{TRequest}"/> names what is left.
|
||||
/// </summary>
|
||||
internal static async Task<IpcEnvelope> AnsweredAsync(Func<Task<IpcEnvelope>> request)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
try
|
||||
{
|
||||
return await request().ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex) when (ex is ObjectDisposedException or IpcFramingException)
|
||||
{
|
||||
throw new IOException("the connection to the Agent closed before it answered", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Ask the Agent for its status now; null when not connected or when the request failed.</summary>
|
||||
@@ -126,7 +146,7 @@ public sealed class AgentConnection : IAgentLink, IAsyncDisposable
|
||||
Set(AgentConnectionState.Connected, Hello, status);
|
||||
return status;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or TimeoutException or IpcRequestException or ObjectDisposedException)
|
||||
catch (Exception ex) when (ex is IOException or TimeoutException or IpcRequestException or ObjectDisposedException or IpcFramingException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@ using Microsoft.Extensions.Hosting;
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>Runs <see cref="AgentConnection"/> for the life of the host.</summary>
|
||||
internal sealed class AgentConnectionHostedService(AgentConnection connection, LiveSessions sessions) : BackgroundService
|
||||
internal sealed class AgentConnectionHostedService(AgentConnection connection, LiveSessions sessions, SessionNotices notices) : BackgroundService
|
||||
{
|
||||
// The running-session view is built with this service, before the first round, so the first connect's status seeds
|
||||
// it and no event after it is missed (2026-09-23).
|
||||
// it and no event after it is missed (2026-09-23); so is FR-3.8's notice (beta.23), on the UI thread the host starts on.
|
||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
GC.KeepAlive(sessions);
|
||||
GC.KeepAlive(notices);
|
||||
return connection.RunAsync(stoppingToken);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ public enum AntiCheatExceptionOutcome
|
||||
/// <summary>No connected Agent; nothing was sent.</summary>
|
||||
AgentUnavailable,
|
||||
|
||||
/// <summary>The Agent answered and did not grant (a store outcome, an <c>Error</c>, a timeout); <c>Detail</c> says which.</summary>
|
||||
/// <summary>The Agent answered and did not grant (a store outcome, an <c>Error</c>); <c>Detail</c> says which.</summary>
|
||||
Failed,
|
||||
|
||||
/// <summary>beta.22: the Agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether it granted or withdrew is not known.</summary>
|
||||
Unanswered,
|
||||
}
|
||||
@@ -27,6 +27,7 @@ public sealed record AntiCheatExceptionResult(AntiCheatExceptionOutcome Outcome,
|
||||
// A grant and a withdrawal alike (beta.18): "Nothing was enabled." was the hooking consent's words, untrue for a withdrawal.
|
||||
AntiCheatExceptionOutcome.AgentUnavailable => Strings.Agent_NotConnected_NothingChanged,
|
||||
AntiCheatExceptionOutcome.Failed => Detail ?? Strings.Common_NotAvailable,
|
||||
AntiCheatExceptionOutcome.Unanswered => Strings.Agent_Unanswered,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
using FrameLedger.Shared.Ipc;
|
||||
using FrameLedger.Shared.Safety;
|
||||
@@ -66,17 +65,28 @@ public sealed class AntiCheatExceptions
|
||||
IpcEnvelope ack = await _agent.RequestAsync(IpcMessageType.SetAntiCheatException, request, ct).ConfigureAwait(true);
|
||||
return Interpret(ack, request.Enabled);
|
||||
}
|
||||
catch (Exception ex) when (ex is IpcRequestException or TimeoutException or IOException or InvalidOperationException)
|
||||
catch (IpcRequestException ex)
|
||||
{
|
||||
Log.Warning(ex, "exception: SetAntiCheatException(game {GameId}, {Enabled}) did not complete", request.GameId, request.Enabled);
|
||||
string? code = (ex as IpcRequestException)?.Code;
|
||||
AntiCheatExceptionOutcome outcome = code switch
|
||||
AntiCheatExceptionOutcome outcome = ex.Code switch
|
||||
{
|
||||
IpcErrorCode.DisclosureVersionMismatch => AntiCheatExceptionOutcome.VersionMismatch,
|
||||
IpcErrorCode.ExceptionsOff => AntiCheatExceptionOutcome.OptionOff,
|
||||
_ => AntiCheatExceptionOutcome.Failed,
|
||||
};
|
||||
return new AntiCheatExceptionResult(outcome, code ?? ex.GetType().Name);
|
||||
return new AntiCheatExceptionResult(outcome, ex.Code ?? IpcMessageType.Error);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
// The connection went between the caller's check and the request: nothing was sent.
|
||||
Log.Warning("exception: SetAntiCheatException(game {GameId}, {Enabled}) was not sent ({Message})", request.GameId, request.Enabled, ex.Message);
|
||||
return AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.AgentUnavailable);
|
||||
}
|
||||
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
|
||||
{
|
||||
// beta.22: whether the exception was made or withdrawn is not known — never the exception's type name as the notice.
|
||||
Log.Warning(ex, "exception: SetAntiCheatException(game {GameId}, {Enabled}) had no answer", request.GameId, request.Enabled);
|
||||
return AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.Unanswered);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ public static class DiagReport
|
||||
}
|
||||
|
||||
/// <summary>The report text. <paramref name="settings"/> is every registry key's effective value; <paramref name="schemaVersion"/> null when the ledger could not be opened.</summary>
|
||||
public static string Build(string appVersion, string dataDirectory, string logsDirectory, long? schemaVersion, IReadOnlyDictionary<string, string> settings, bool agentBesideApp, DateTimeOffset now, HardwareSnapshot? hardware = null)
|
||||
public static string Build(string appVersion, string dataDirectory, string logsDirectory, long? schemaVersion, IReadOnlyDictionary<string, string> settings, bool agentBesideApp, DateTimeOffset now, HardwareSnapshot? hardware = null,
|
||||
int? renderTier = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
var sb = new StringBuilder();
|
||||
@@ -48,6 +49,8 @@ public static class DiagReport
|
||||
sb.AppendLine(CultureInfo.InvariantCulture, $"gpu_driver: {hardware?.GpuDriver ?? "n/a"}");
|
||||
sb.AppendLine(CultureInfo.InvariantCulture, $"ram_gb: {(hardware?.RamGb is double gb ? gb.ToString("0.#", CultureInfo.InvariantCulture) : "n/a")}");
|
||||
sb.AppendLine(CultureInfo.InvariantCulture, $"display: {hardware?.DisplayRes ?? "n/a"}{(hardware?.DisplayHz is double hz ? " @ " + hz.ToString("0.#", CultureInfo.InvariantCulture) + " Hz" : string.Empty)}");
|
||||
// beta.21: WPF's rendering tier — 0 is software rendering, where every scroll of a document is drawn on the CPU.
|
||||
sb.AppendLine(CultureInfo.InvariantCulture, $"render_tier: {(renderTier is int tier ? tier.ToString(CultureInfo.InvariantCulture) : "n/a")}");
|
||||
sb.AppendLine("settings:");
|
||||
foreach (SettingDefinition definition in SettingsRegistry.All)
|
||||
{
|
||||
|
||||
@@ -5,9 +5,12 @@ using FrameLedger.Application.Persistence;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>Everything the detail page shows for one game, loaded in one pass: the row, its sessions newest first, their annotations, the aggregate.</summary>
|
||||
/// <summary>
|
||||
/// Everything the detail page shows for one game, loaded in one pass: the row, its sessions newest first, their annotations.
|
||||
/// (It carried the library's aggregate too, read by summarising EVERY game's sessions to keep one, and read by nothing — gone
|
||||
/// in beta.23.)
|
||||
/// </summary>
|
||||
public sealed record GameDetail(
|
||||
GameRow Row,
|
||||
IReadOnlyList<SessionRow> Sessions,
|
||||
IReadOnlyDictionary<long, SessionAnnotation> Annotations,
|
||||
GameSessionSummary? Summary);
|
||||
IReadOnlyDictionary<long, SessionAnnotation> Annotations);
|
||||
@@ -50,8 +50,7 @@ public sealed class GameLibrary
|
||||
|
||||
IReadOnlyList<SessionRow> sessions = await _sessions.ListByGameAsync(gameId, sessionLimit, ct).ConfigureAwait(false);
|
||||
IReadOnlyList<SessionAnnotation> annotations = await _annotations.ListByGameAsync(gameId, ct).ConfigureAwait(false);
|
||||
GameSessionSummary? summary = (await _sessions.SummariseByGameAsync(ct).ConfigureAwait(false)).FirstOrDefault(s => s.GameId == gameId);
|
||||
return new GameDetail(row, sessions, annotations.ToDictionary(static a => a.SessionId), summary);
|
||||
return new GameDetail(row, sessions, annotations.ToDictionary(static a => a.SessionId));
|
||||
}
|
||||
|
||||
/// <summary>FR-1.1: the executable becomes a <c>games</c> row, hooking off; null when the file cannot be read.</summary>
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
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 StoreRecordsReader _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 = new StoreRecordsReader(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 _stores.ReadAsync("play", ct: 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),
|
||||
PlayOutcome.Unanswered => (Strings.Agent_Unanswered, 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<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 (InvalidOperationException ex)
|
||||
{
|
||||
// The connection went between the check above and the request: nothing was sent.
|
||||
Log.Warning("play: LaunchGame for {Game} (id {Id}) was not sent ({Message})", game.Name, game.Id, ex.Message);
|
||||
return new PlayResult(PlayOutcome.AgentUnavailable, Fallback: fallback);
|
||||
}
|
||||
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
|
||||
{
|
||||
// The agent stopping or restarting under the request, or no answer in time (beta.22): whether the game is starting
|
||||
// is not known — and a press never ends in an unhandled exception (beta.21's review).
|
||||
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.Unanswered, 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),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.IO;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
using FrameLedger.Shared.Ipc;
|
||||
using FrameLedger.Shared.Safety;
|
||||
@@ -65,14 +64,26 @@ public sealed class HookingConsent
|
||||
IpcEnvelope ack = await _agent.RequestAsync(IpcMessageType.SetHookEnabled, request, ct).ConfigureAwait(true);
|
||||
return Interpret(ack, request.Enabled, onWritten);
|
||||
}
|
||||
catch (Exception ex) when (ex is IpcRequestException or TimeoutException or IOException or InvalidOperationException)
|
||||
catch (IpcRequestException ex)
|
||||
{
|
||||
Log.Warning(ex, "consent: SetHookEnabled(game {GameId}, {Enabled}) did not complete", request.GameId, request.Enabled);
|
||||
string detail = ex is IpcRequestException ipc ? ipc.Code ?? IpcMessageType.Error : ex.GetType().Name;
|
||||
string detail = ex.Code ?? IpcMessageType.Error;
|
||||
return new HookingConsentResult(
|
||||
string.Equals(detail, IpcErrorCode.DisclosureVersionMismatch, StringComparison.Ordinal) ? HookingConsentOutcome.VersionMismatch : HookingConsentOutcome.Failed,
|
||||
detail);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
// The connection went between the caller's check and the request: nothing was sent.
|
||||
Log.Warning("consent: SetHookEnabled(game {GameId}, {Enabled}) was not sent ({Message})", request.GameId, request.Enabled, ex.Message);
|
||||
return HookingConsentResult.Of(HookingConsentOutcome.AgentUnavailable);
|
||||
}
|
||||
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
|
||||
{
|
||||
// beta.22: whether the Agent stamped or revoked is not known — never the exception's type name as the notice.
|
||||
Log.Warning(ex, "consent: SetHookEnabled(game {GameId}, {Enabled}) had no answer", request.GameId, request.Enabled);
|
||||
return HookingConsentResult.Of(HookingConsentOutcome.Unanswered);
|
||||
}
|
||||
}
|
||||
|
||||
private static HookingConsentResult Interpret(IpcEnvelope ack, bool enabling, HookingConsentOutcome onWritten)
|
||||
|
||||
@@ -24,6 +24,9 @@ public enum HookingConsentOutcome
|
||||
/// <summary>No connected Agent; nothing was sent.</summary>
|
||||
AgentUnavailable,
|
||||
|
||||
/// <summary>The Agent answered but did not stamp (a store outcome other than <c>Written</c>, an <c>Error</c>, a timeout); <c>Detail</c> says which.</summary>
|
||||
/// <summary>The Agent answered but did not stamp (a store outcome other than <c>Written</c>, an <c>Error</c>); <c>Detail</c> says which.</summary>
|
||||
Failed,
|
||||
|
||||
/// <summary>beta.22: the Agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether it stamped or revoked is not known.</summary>
|
||||
Unanswered,
|
||||
}
|
||||
@@ -21,9 +21,14 @@ public interface IAgentRequests
|
||||
/// Sends <paramref name="payload"/> as <paramref name="type"/> and returns whatever non-<c>Error</c> envelope
|
||||
/// answers it — the caller distinguishes the acks (a <c>HookEnabledAck</c> from a <c>Refused</c>).
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Not connected.</exception>
|
||||
/// <exception cref="InvalidOperationException">Not connected: nothing was sent.</exception>
|
||||
/// <exception cref="Infrastructure.Ipc.IpcRequestException">The Agent answered <c>Error</c>.</exception>
|
||||
/// <exception cref="TimeoutException">No answer within the request timeout.</exception>
|
||||
/// <exception cref="TimeoutException">No answer within the request timeout: whether it was carried out is not known.</exception>
|
||||
/// <exception cref="System.IO.IOException">
|
||||
/// The connection closed before the Agent answered — it stopped, or restarted for an update (beta.22: every way the pipe
|
||||
/// closes is this one exception, <see cref="AgentConnection.AnsweredAsync"/>): whether it was carried out is not known.
|
||||
/// <see cref="AgentAnswers.IsUnanswered"/> names this and the timeout.
|
||||
/// </exception>
|
||||
Task<IpcEnvelope> RequestAsync<TRequest>(string type, TRequest payload, CancellationToken ct = default)
|
||||
where TRequest : class;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -50,8 +50,13 @@ internal static class MachineFacingServices
|
||||
services.AddSingleton<IAgentRequests>(static sp => sp.GetRequiredService<AgentConnection>());
|
||||
services.AddSingleton<IAgentLink>(static sp => sp.GetRequiredService<AgentConnection>());
|
||||
|
||||
// FR-3.8's post-session notice (beta.23): one subscription for the App's life, built with the connection's service.
|
||||
services.AddSingleton(static sp => new SessionNotices(sp.GetRequiredService<IAgentLink>(), sp.GetRequiredService<IMessageStrip>(), sp.GetService<IShellPresence>()));
|
||||
|
||||
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 +71,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,35 @@
|
||||
// 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: nothing was sent.</summary>
|
||||
AgentUnavailable,
|
||||
|
||||
/// <summary>beta.22: the agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>): whether the game is starting is not known.</summary>
|
||||
Unanswered,
|
||||
|
||||
/// <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);
|
||||
@@ -39,13 +39,10 @@ public sealed class SessionDeletion
|
||||
return new(SessionDeletionOutcome.AgentUnavailable);
|
||||
}
|
||||
|
||||
IpcEnvelope envelope;
|
||||
try
|
||||
{
|
||||
IpcEnvelope envelope = await _agent.RequestAsync(IpcMessageType.DeleteSessions, new DeleteSessionsRequest(gameId), ct).ConfigureAwait(true);
|
||||
DeleteSessionsAck ack = IpcCodec.Payload<DeleteSessionsAck>(envelope) ?? throw new InvalidOperationException("DeleteSessions answered without a payload");
|
||||
Log.Information("sessions: deleted {Sessions} session(s) of {Games} game(s) ({Scope})", ack.Sessions, ack.Games, gameId is null ? "every game" : "game " + gameId);
|
||||
await ForgetDeletedAsync(ct).ConfigureAwait(true);
|
||||
return new(SessionDeletionOutcome.Deleted, ack.Games, ack.Sessions);
|
||||
envelope = await _agent.RequestAsync(IpcMessageType.DeleteSessions, new DeleteSessionsRequest(gameId), ct).ConfigureAwait(true);
|
||||
}
|
||||
catch (IpcRequestException ex) when (string.Equals(ex.Code, IpcErrorCode.SessionRunning, StringComparison.Ordinal))
|
||||
{
|
||||
@@ -56,14 +53,39 @@ public sealed class SessionDeletion
|
||||
Log.Warning("sessions: the Agent does not know DeleteSessions ({Message})", ex.Message);
|
||||
return new(SessionDeletionOutcome.AgentTooOld);
|
||||
}
|
||||
catch (Exception ex) when (ex is IpcRequestException or InvalidOperationException or TimeoutException)
|
||||
catch (IpcRequestException ex)
|
||||
{
|
||||
Log.Warning("sessions: DeleteSessions failed ({Message})", ex.Message);
|
||||
Log.Warning("sessions: DeleteSessions failed ({Code}: {Message})", ex.Code, ex.Message);
|
||||
return new(SessionDeletionOutcome.Failed, Detail: ex.Message);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
// The connection went between the check above and the request: nothing was sent.
|
||||
Log.Warning("sessions: DeleteSessions was not sent ({Message})", ex.Message);
|
||||
return new(SessionDeletionOutcome.AgentUnavailable);
|
||||
}
|
||||
catch (Exception ex) when (AgentAnswers.IsUnanswered(ex))
|
||||
{
|
||||
// beta.22: the delete may have run before the connection went — it caught no IOException before, and its exception
|
||||
// was the App's crash dialog. What named a deleted session lets go of it, and the page reads what is stored.
|
||||
Log.Warning("sessions: DeleteSessions had no answer ({Kind}: {Message})", ex.GetType().Name, ex.Message);
|
||||
await ForgetDeletedAsync(ct).ConfigureAwait(true);
|
||||
return new(SessionDeletionOutcome.Unanswered);
|
||||
}
|
||||
|
||||
if (IpcCodec.Payload<DeleteSessionsAck>(envelope) is not { } ack)
|
||||
{
|
||||
Log.Warning("sessions: DeleteSessions was answered without a payload");
|
||||
await ForgetDeletedAsync(ct).ConfigureAwait(true);
|
||||
return new(SessionDeletionOutcome.Unanswered);
|
||||
}
|
||||
|
||||
Log.Information("sessions: deleted {Sessions} session(s) of {Games} game(s) ({Scope})", ack.Sessions, ack.Games, gameId is null ? "every game" : "game " + gameId);
|
||||
await ForgetDeletedAsync(ct).ConfigureAwait(true);
|
||||
return new(SessionDeletionOutcome.Deleted, ack.Games, ack.Sessions);
|
||||
}
|
||||
|
||||
/// <summary>The delete happened: what still names a deleted session lets go of it. A failure here is logged, not the delete's.</summary>
|
||||
/// <summary>The delete happened, or may have (beta.22): what still names a deleted session lets go of it. A failure here is logged, not the delete's.</summary>
|
||||
private async Task ForgetDeletedAsync(CancellationToken ct)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -20,4 +20,10 @@ public enum SessionDeletionOutcome
|
||||
|
||||
/// <summary>Anything else; the detail says what.</summary>
|
||||
Failed,
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: the capture agent did not answer (<see cref="AgentAnswers.IsUnanswered"/>), or answered without saying what it
|
||||
/// did: whether anything was deleted is not known, and the page reads what is stored.
|
||||
/// </summary>
|
||||
Unanswered,
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public sealed record SessionDeletionResult(SessionDeletionOutcome Outcome, int G
|
||||
SessionDeletionOutcome.SessionRunning => Strings.DeleteSessions_Running,
|
||||
SessionDeletionOutcome.AgentUnavailable => Strings.DeleteSessions_NoAgent,
|
||||
SessionDeletionOutcome.AgentTooOld => Strings.DeleteSessions_AgentTooOld,
|
||||
SessionDeletionOutcome.Unanswered => Strings.Agent_Unanswered,
|
||||
_ => Detail ?? Strings.Common_NotAvailable,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using FrameLedger.Shared.Ipc;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// FR-3.8's post-session notice inside the App: "saved" or "discarded" in the snackbar while the window is on screen — the
|
||||
/// tray's balloon carries it otherwise (P3 PR-8b, one event → one channel), and a safety stop is never a toast (08_UI
|
||||
/// §Notifications policy). One subscription for the App's life (beta.23).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It lived in the Dashboard's view model, and it reached every page only because no Dashboard ever went away: each visit
|
||||
/// made a new one, the root container kept every one of them (a transient <see cref="IDisposable"/>), and each stayed
|
||||
/// subscribed — twenty visits were twenty notices for one session, of which WPF UI's snackbar showed the last, and twenty
|
||||
/// reloads of the Dashboard's lists on the UI thread (<c>spike-notes</c> §21). The Dashboard now listens only while it is on
|
||||
/// screen, so the notice has its own home.
|
||||
/// </remarks>
|
||||
[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 SessionNotices : IDisposable
|
||||
{
|
||||
private readonly IAgentLink _agent;
|
||||
private readonly IMessageStrip _strip;
|
||||
private readonly IShellPresence? _presence;
|
||||
private readonly UiThread _ui = new();
|
||||
private readonly Lock _lock = new();
|
||||
|
||||
// The names the start events gave, for a completion that carries none (an Agent before 2026-09-23 sent none).
|
||||
private readonly Dictionary<Guid, string> _names = [];
|
||||
|
||||
public SessionNotices(IAgentLink agent, IMessageStrip strip, IShellPresence? presence = null)
|
||||
{
|
||||
_agent = agent ?? throw new ArgumentNullException(nameof(agent));
|
||||
_strip = strip ?? throw new ArgumentNullException(nameof(strip));
|
||||
_presence = presence;
|
||||
_agent.EventReceived += OnAgentEvent;
|
||||
}
|
||||
|
||||
public void Dispose() => _agent.EventReceived -= OnAgentEvent;
|
||||
|
||||
private void OnAgentEvent(object? sender, AgentEventArgs e)
|
||||
{
|
||||
IpcEnvelope envelope = e.Envelope;
|
||||
if (string.Equals(envelope.Type, IpcMessageType.SessionStarted, StringComparison.Ordinal)
|
||||
&& IpcCodec.Payload<SessionStartedEvent>(envelope) is { GameName: { Length: > 0 } started } start)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_names[start.SessionGuid] = started;
|
||||
}
|
||||
}
|
||||
else if (string.Equals(envelope.Type, IpcMessageType.SessionCompleted, StringComparison.Ordinal)
|
||||
&& IpcCodec.Payload<SessionCompletedEvent>(envelope) is { } completed)
|
||||
{
|
||||
string? known;
|
||||
lock (_lock)
|
||||
{
|
||||
_ = _names.Remove(completed.SessionGuid, out known);
|
||||
}
|
||||
|
||||
// The session's own name (2026-09-23): the Dashboard's card may show another session, and a Tier-2 one had none.
|
||||
string? name = completed.GameName is { Length: > 0 } given ? given : known;
|
||||
_ui.Post(() => Notice(completed, name));
|
||||
}
|
||||
}
|
||||
|
||||
private void Notice(SessionCompletedEvent completed, string? name)
|
||||
{
|
||||
// A faulted session is the strip's CaptureError already; "discarded" would say something that did not happen.
|
||||
if (_presence is { IsShown: false } || string.Equals(completed.Finalize, "faulted", StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string game = name is { Length: > 0 } ? name : Strings.Common_NotAvailable;
|
||||
if (completed.SessionId is not null)
|
||||
{
|
||||
_strip.Success(Strings.Dashboard_Live_Header, string.Format(CultureInfo.CurrentCulture, Strings.Dashboard_SessionSaved_Format, game));
|
||||
}
|
||||
else
|
||||
{
|
||||
_strip.Info(Strings.Dashboard_Live_Header, string.Format(CultureInfo.CurrentCulture, Strings.Dashboard_SessionDiscarded_Format, game));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,51 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Import;
|
||||
using Serilog;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// The stores' own records of what they installed (beta.23), the lists Play reads to find the store that installed a game
|
||||
/// (<c>StoreRecords.Owning</c>): read on the thread pool. Every store's reader is synchronous work — Steam's manifests are
|
||||
/// files on whatever drive its libraries are on (the owner's: a USB drive), itch's database is copied before it is read —
|
||||
/// and Play ran all of it on the UI thread at every press.
|
||||
/// </summary>
|
||||
public sealed class StoreRecordsReader
|
||||
{
|
||||
private readonly IReadOnlyList<IStoreLibrarySource> _stores;
|
||||
|
||||
public StoreRecordsReader(IEnumerable<IStoreLibrarySource> stores)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stores);
|
||||
_stores = [.. stores];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Every record of the stores named in <paramref name="platforms"/> (every store when null), read now. One store whose
|
||||
/// records cannot be read is that store's, logged under <paramref name="purpose"/>, never the caller's.
|
||||
/// </summary>
|
||||
public Task<IReadOnlyList<StoreGame>> ReadAsync(string purpose, IReadOnlyCollection<string>? platforms = null, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(purpose);
|
||||
IStoreLibrarySource[] stores = [.. _stores.Where(s => platforms is null || platforms.Contains(s.Platform, StringComparer.Ordinal))];
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
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)
|
||||
{
|
||||
Log.Warning("{Purpose}: {Store}'s records could not be read ({Message})", purpose, store.Platform, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return (IReadOnlyList<StoreGame>)all;
|
||||
}, ct);
|
||||
}
|
||||
}
|
||||
@@ -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
+75
@@ -70,6 +70,7 @@ public static class Strings
|
||||
nameof(Agent_State_Offline),
|
||||
nameof(Agent_State_Starting),
|
||||
nameof(Agent_State_Viewer),
|
||||
nameof(Agent_Unanswered),
|
||||
nameof(App_Title),
|
||||
nameof(Arch_AnyCpu),
|
||||
nameof(Arch_AnyCpu32),
|
||||
@@ -703,6 +704,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 +836,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 +864,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),
|
||||
@@ -1160,6 +1185,8 @@ public static class Strings
|
||||
|
||||
public static string Agent_State_Viewer => ResourceManager.GetString(nameof(Agent_State_Viewer), Culture) ?? nameof(Agent_State_Viewer);
|
||||
|
||||
public static string Agent_Unanswered => ResourceManager.GetString(nameof(Agent_Unanswered), Culture) ?? nameof(Agent_Unanswered);
|
||||
|
||||
public static string App_Title => ResourceManager.GetString(nameof(App_Title), Culture) ?? nameof(App_Title);
|
||||
|
||||
public static string Arch_AnyCpu => ResourceManager.GetString(nameof(Arch_AnyCpu), Culture) ?? nameof(Arch_AnyCpu);
|
||||
@@ -2426,6 +2453,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 +2717,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 +2773,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,104 @@
|
||||
<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>
|
||||
<data name="Agent_Unanswered" xml:space="preserve">
|
||||
<value>キャプチャ エージェントが応答しなかったため、この操作が行われたかどうかは分かりません。エージェントが接続してから、もう一度確認してください。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3176,4 +3176,79 @@ 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>
|
||||
<data name="Agent_Unanswered" xml:space="preserve">
|
||||
<value>The capture agent did not answer, so whether this was done is not known. Check again once it is connected.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3171,4 +3171,79 @@ 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>
|
||||
<data name="Agent_Unanswered" xml:space="preserve">
|
||||
<value>Capture agent không trả lời, nên không biết việc này đã được thực hiện hay chưa. Hãy kiểm tra lại khi agent đã kết nối.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -159,7 +159,7 @@ public sealed partial class CompareViewModel : ObservableObject
|
||||
SessionSeries? series = await _loader.LoadAsync(c.Id).ConfigureAwait(true);
|
||||
if (series is not null)
|
||||
{
|
||||
(double[] xs, double[] ys) = PercentileCurve.Of(series.AppFrameTimesMs);
|
||||
(double[] xs, double[] ys) = series.Digest?.Percentiles ?? PercentileCurve.Of(series.AppFrameTimesMs);
|
||||
curves.Add(new CompareCurve(c.Label, xs, ys));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,15 +16,21 @@ namespace FrameLedger.App.ViewModels;
|
||||
/// value <c>N/A</c> until the Agent answered — never a placeholder that reads as a measurement), the live capture
|
||||
/// card fed by the pipe's events, the recent sessions, and the totals strip.
|
||||
/// </summary>
|
||||
public sealed partial class DashboardViewModel : ObservableObject, IDisposable
|
||||
/// <remarks>
|
||||
/// <b>It listens only while its page is on screen (beta.23):</b> <see cref="Attach"/> on Loaded, <see cref="Detach"/> on
|
||||
/// Unloaded, as the Games and game pages do. It subscribed in its constructor and unsubscribed in a Dispose nothing called —
|
||||
/// the root container kept every Dashboard ever opened, each answering every event and reloading its lists on the UI thread
|
||||
/// at every session's end. FR-3.8's notice, which it raised, is <see cref="SessionNotices"/>'s.
|
||||
/// </remarks>
|
||||
public sealed partial class DashboardViewModel : ObservableObject
|
||||
{
|
||||
private readonly IAgentLink _agent;
|
||||
private readonly GameLibrary _library;
|
||||
private readonly GameSelection _selection;
|
||||
private readonly IPageNavigator _navigator;
|
||||
private readonly ISessionSummaryOpener _summaries;
|
||||
private readonly IMessageStrip _strip;
|
||||
private readonly UiThread _ui = new();
|
||||
private bool _attached;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _agentState = Strings.Agent_State_Connecting;
|
||||
@@ -56,27 +62,17 @@ public sealed partial class DashboardViewModel : ObservableObject, IDisposable
|
||||
[ObservableProperty]
|
||||
private bool _recentEmpty = true;
|
||||
|
||||
private readonly IShellPresence? _presence;
|
||||
private readonly LiveSessions? _sessions;
|
||||
|
||||
public DashboardViewModel(IAgentLink agent, GameLibrary library, GameSelection selection, IPageNavigator navigator, ISessionSummaryOpener summaries, IMessageStrip strip, IShellPresence? presence = null,
|
||||
public DashboardViewModel(IAgentLink agent, GameLibrary library, GameSelection selection, IPageNavigator navigator, ISessionSummaryOpener summaries,
|
||||
LiveSessions? sessions = null)
|
||||
{
|
||||
_presence = presence;
|
||||
_sessions = sessions;
|
||||
_agent = agent ?? throw new ArgumentNullException(nameof(agent));
|
||||
_library = library ?? throw new ArgumentNullException(nameof(library));
|
||||
_selection = selection ?? throw new ArgumentNullException(nameof(selection));
|
||||
_navigator = navigator ?? throw new ArgumentNullException(nameof(navigator));
|
||||
_summaries = summaries ?? throw new ArgumentNullException(nameof(summaries));
|
||||
_strip = strip ?? throw new ArgumentNullException(nameof(strip));
|
||||
_agent.Changed += OnAgentChanged;
|
||||
_agent.EventReceived += OnAgentEvent;
|
||||
if (_sessions is not null)
|
||||
{
|
||||
_sessions.Changed += OnSessionsChanged;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
SeedLive();
|
||||
Pending = LoadAsync();
|
||||
@@ -103,14 +99,44 @@ public sealed partial class DashboardViewModel : ObservableObject, IDisposable
|
||||
/// <summary>The load in flight, for a test to await.</summary>
|
||||
public Task Pending { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
/// <summary>
|
||||
/// Listens to the Agent and to the running sessions while the page is on screen (beta.23): the page calls it on Loaded
|
||||
/// and <see cref="Detach"/> on Unloaded. What changed before it listened is read again here.
|
||||
/// </summary>
|
||||
public void Attach()
|
||||
{
|
||||
if (_attached)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_agent.Changed += OnAgentChanged;
|
||||
_agent.EventReceived += OnAgentEvent;
|
||||
if (_sessions is not null)
|
||||
{
|
||||
_sessions.Changed += OnSessionsChanged;
|
||||
}
|
||||
|
||||
_attached = true;
|
||||
Refresh();
|
||||
SeedLive();
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
{
|
||||
if (!_attached)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_agent.Changed -= OnAgentChanged;
|
||||
_agent.EventReceived -= OnAgentEvent;
|
||||
if (_sessions is not null)
|
||||
{
|
||||
_sessions.Changed -= OnSessionsChanged;
|
||||
}
|
||||
|
||||
_attached = false;
|
||||
}
|
||||
|
||||
public async Task LoadAsync(CancellationToken ct = default)
|
||||
@@ -191,10 +217,8 @@ public sealed partial class DashboardViewModel : ObservableObject, IDisposable
|
||||
Live.Hold(held);
|
||||
break;
|
||||
case IpcMessageType.SessionCompleted when IpcCodec.Payload<SessionCompletedEvent>(envelope) is { } completed:
|
||||
// The session's own name (2026-09-23): the card may show another session, and a Tier-2 one had none here.
|
||||
string? name = completed.GameName ?? (Live.SessionGuid == completed.SessionGuid ? Live.GameName : null);
|
||||
// FR-3.8's notice is SessionNotices' (beta.23); the card and the lists are this page's.
|
||||
Live.Stop(completed);
|
||||
Notice(completed, name);
|
||||
SeedLive();
|
||||
Pending = LoadAsync();
|
||||
break;
|
||||
@@ -203,27 +227,6 @@ public sealed partial class DashboardViewModel : ObservableObject, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>FR-3.8's post-session notice, in-app while the window is on screen; the tray's balloon carries it otherwise (P3 PR-8b, one event → one channel). A safety stop is never a toast (08_UI §Notifications policy) — the shell's notices carry those.</summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format string is a resource that follows the UI culture, which changes at runtime")]
|
||||
private void Notice(SessionCompletedEvent completed, string? name)
|
||||
{
|
||||
// A faulted session is the strip's CaptureError already; "discarded" would say something that did not happen.
|
||||
if (_presence is { IsShown: false } || string.Equals(completed.Finalize, "faulted", StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string game = name is { Length: > 0 } ? name : Strings.Common_NotAvailable;
|
||||
if (completed.SessionId is not null)
|
||||
{
|
||||
_strip.Success(Strings.Dashboard_Live_Header, string.Format(CultureInfo.CurrentCulture, Strings.Dashboard_SessionSaved_Format, game));
|
||||
}
|
||||
else
|
||||
{
|
||||
_strip.Info(Strings.Dashboard_Live_Header, string.Format(CultureInfo.CurrentCulture, Strings.Dashboard_SessionDiscarded_Format, game));
|
||||
}
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
AgentState = AgentStatusPresentation.Pill(_agent.State).Text;
|
||||
|
||||
@@ -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;
|
||||
@@ -48,6 +49,7 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
private readonly RegisteredSettings? _settings;
|
||||
private readonly AntiCheatExceptions? _exceptions;
|
||||
private readonly SessionDeletion? _deletion;
|
||||
private readonly Func<string, bool> _exists;
|
||||
private readonly long? _gameId;
|
||||
|
||||
// ui.hide_anticheat_hooking (2026-09-25), read at each load; on until the settings say otherwise, as its default is.
|
||||
@@ -72,8 +74,24 @@ 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>
|
||||
/// The missing executable's bar (beta.8): the page's sentence, then whether the DRIVE is not connected or the file is gone
|
||||
/// from its path — the two need different things of the user. Worked out with the check, off the UI thread (beta.23): it
|
||||
/// asked the drive from this property's getter, on the UI thread, at every read.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _executableMissingMessage = ExecutableMissingText;
|
||||
|
||||
// Why the executable is missing, from the last load's check (beta.23); null while it was found.
|
||||
private string? _executableMissingWhy;
|
||||
|
||||
/// <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 +245,13 @@ 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, Func<string, bool>? executableExists = null)
|
||||
{
|
||||
// beta.23: whether the executable is on disk is a question for its drive, which can take seconds to answer (the
|
||||
// owner's games are on a USB drive), so it is asked off the UI thread, as the library page has asked since beta.19.
|
||||
_exists = executableExists ?? GameLibrary.ExecutableExists;
|
||||
// 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,20 +289,14 @@ 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;
|
||||
|
||||
public static string ExecutableMissingText => Strings.GameDetail_ExeMissing;
|
||||
|
||||
/// <summary>
|
||||
/// The missing executable's bar (beta.8): the page's sentence, then whether the DRIVE is not connected or the file is gone
|
||||
/// from its path — the two need different things of the user.
|
||||
/// </summary>
|
||||
public string ExecutableMissingMessage => Game is null
|
||||
? ExecutableMissingText
|
||||
: ExecutableMissingText + " " + Formats.ExecutableMissingText(Game.Fingerprint.ExePath);
|
||||
|
||||
public static string LifetimeLabel => Strings.GameDetail_LifetimeAvg;
|
||||
|
||||
public static string SupportsHeader => Strings.GameDetail_Supports_Header;
|
||||
@@ -446,9 +462,18 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
return;
|
||||
}
|
||||
|
||||
string exePath = detail.Row.Fingerprint.ExePath;
|
||||
Func<string, bool> exists = _exists;
|
||||
_executableMissingWhy = await Task.Run(() => exists(exePath) ? null : Formats.ExecutableMissingText(exePath), ct).ConfigureAwait(true);
|
||||
|
||||
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 +740,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 +760,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)
|
||||
{
|
||||
@@ -868,6 +921,12 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
_strip.Warn(Game.Name, result.Message);
|
||||
if (result.Outcome == SessionDeletionOutcome.Unanswered)
|
||||
{
|
||||
// beta.22: the delete may have run — the page shows what is stored, not what it held before the ask.
|
||||
await LoadAsync().ConfigureAwait(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -967,9 +1026,11 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
HookingConsentOutcome.Refused => (result.RefusalText(), InfoBarSeverity.Error),
|
||||
HookingConsentOutcome.VersionMismatch => (Shared.Strings.Safety_Consent_VersionMismatch, InfoBarSeverity.Warning),
|
||||
HookingConsentOutcome.AgentUnavailable => (turningOff ? Strings.Agent_NotConnected_NothingChanged : Shared.Strings.Safety_Consent_AgentUnavailable, InfoBarSeverity.Warning),
|
||||
// beta.22: the page reads what is stored after every ask, so whether hooking changed is shown beside this.
|
||||
HookingConsentOutcome.Unanswered => (Strings.Agent_Unanswered, InfoBarSeverity.Warning),
|
||||
// The Agent could not read the executable (beta.8): say whether its drive or the file is missing, not the IPC code.
|
||||
HookingConsentOutcome.Failed when string.Equals(result.Detail, Shared.Ipc.IpcErrorCode.ExecutableUnreadable, StringComparison.Ordinal) && Game is not null
|
||||
=> (Formats.ExecutableMissingText(Game.Fingerprint.ExePath), InfoBarSeverity.Warning),
|
||||
=> (_executableMissingWhy ?? Formats.ExecutableMissingText(Game.Fingerprint.ExePath), InfoBarSeverity.Warning),
|
||||
HookingConsentOutcome.Failed => (result.Detail ?? Strings.Common_NotAvailable, InfoBarSeverity.Warning),
|
||||
_ => (null, InfoBarSeverity.Informational),
|
||||
};
|
||||
@@ -987,8 +1048,8 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
: [row.Publisher, row.GameVersion, Formats.Platform(row.Platform), EngineText(row)];
|
||||
Subtitle = string.Join(" · ", subtitle.Where(static s => !string.IsNullOrWhiteSpace(s)));
|
||||
ExecutableText = row.Fingerprint.ExePath;
|
||||
ExecutableMissing = !GameLibrary.ExecutableExists(row.Fingerprint.ExePath);
|
||||
OnPropertyChanged(nameof(ExecutableMissingMessage));
|
||||
ExecutableMissing = _executableMissingWhy is not null;
|
||||
ExecutableMissingMessage = _executableMissingWhy is { } why ? ExecutableMissingText + " " + why : ExecutableMissingText;
|
||||
|
||||
SessionRow? last = detail.Sessions.Count > 0 ? detail.Sessions[0] : null;
|
||||
SessionRow? lastHooked = detail.Sessions.FirstOrDefault(static s => s.Tier == CaptureTier.Hooked && s.FrameCount > 0);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace FrameLedger.App.ViewModels;
|
||||
/// Loaded/Unloaded) and never while paused; the read runs off the UI thread and the result lands on it.
|
||||
/// </summary>
|
||||
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
|
||||
public sealed partial class LogsViewModel : ObservableObject, IDisposable
|
||||
public sealed partial class LogsViewModel : ObservableObject
|
||||
{
|
||||
public static readonly TimeSpan RefreshPeriod = TimeSpan.FromSeconds(2);
|
||||
|
||||
@@ -31,6 +31,9 @@ public sealed partial class LogsViewModel : ObservableObject, IDisposable
|
||||
private IReadOnlyList<string> _lines = [];
|
||||
private ITimer? _timer;
|
||||
|
||||
// What the last read read (beta.23): a tick that finds the newest file unchanged reads nothing and redraws nothing.
|
||||
private (string? File, long Length, DateTime WrittenUtc) _read;
|
||||
|
||||
[ObservableProperty]
|
||||
private LogSource _source = LogSource.Ui;
|
||||
|
||||
@@ -93,15 +96,17 @@ public sealed partial class LogsViewModel : ObservableObject, IDisposable
|
||||
_timer = _clock.CreateTimer(_ => _ui.Post(Tick), null, RefreshPeriod, RefreshPeriod);
|
||||
}
|
||||
|
||||
/// <summary>Stops it (the page's Unloaded) — a page that is not shown reads nothing.</summary>
|
||||
/// <summary>
|
||||
/// Stops it (the page's Unloaded) — a page that is not shown reads nothing. Not <see cref="IDisposable"/> (beta.23): the
|
||||
/// root container kept every transient disposable it made, so every Logs page ever opened stayed in memory with its
|
||||
/// up-to-2-MB tail, twice (the lines and the text).
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
_timer?.Dispose();
|
||||
_timer = null;
|
||||
}
|
||||
|
||||
public void Dispose() => Stop();
|
||||
|
||||
public Task RefreshAsync() => Pending = RefreshCoreAsync();
|
||||
|
||||
partial void OnSourceChanged(LogSource value) => Pending = RefreshCoreAsync();
|
||||
@@ -131,28 +136,83 @@ public sealed partial class LogsViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
if (!IsPaused)
|
||||
{
|
||||
Pending = RefreshCoreAsync();
|
||||
Pending = RefreshIfChangedAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RefreshCoreAsync()
|
||||
/// <summary>What a tick does: the tail again only when the newest file changed since the last read.</summary>
|
||||
internal Task RefreshIfChangedAsync() => RefreshCoreAsync(unlessUnchanged: true);
|
||||
|
||||
/// <summary>
|
||||
/// Reads the newest file's tail and shows it through the filters. A tick (<paramref name="unlessUnchanged"/>) whose file
|
||||
/// has the length and the write time of the last read stops there (beta.23): it re-read up to 2 MB and replaced the whole
|
||||
/// text every two seconds while nothing had been written. The filtering and the joining happen off the UI thread too.
|
||||
/// </summary>
|
||||
private async Task RefreshCoreAsync(bool unlessUnchanged = false)
|
||||
{
|
||||
LogSource source = Source;
|
||||
(string? file, IReadOnlyList<string> lines) = await Task.Run(() =>
|
||||
LogLevelFilter level = Level;
|
||||
string search = Search;
|
||||
(string? File, long Length, DateTime WrittenUtc) last = _read;
|
||||
(bool unchanged, (string? File, long Length, DateTime WrittenUtc) read, IReadOnlyList<string> lines, IReadOnlyList<string> shown, string text) = await Task.Run(() =>
|
||||
{
|
||||
string? newest = _tail.NewestFile(source);
|
||||
return (newest, newest is null ? [] : LogTail.ReadLines(newest));
|
||||
(string? File, long Length, DateTime WrittenUtc) stamp = Stamp(newest);
|
||||
if (unlessUnchanged && stamp.File is not null && stamp == last)
|
||||
{
|
||||
return (true, stamp, (IReadOnlyList<string>)[], (IReadOnlyList<string>)[], string.Empty);
|
||||
}
|
||||
|
||||
IReadOnlyList<string> all = newest is null ? [] : LogTail.ReadLines(newest);
|
||||
IReadOnlyList<string> filtered = LogTail.Filter(all, level, search);
|
||||
return (false, stamp, all, filtered, string.Join(Environment.NewLine, filtered));
|
||||
}).ConfigureAwait(true);
|
||||
CurrentFile = file;
|
||||
if (unchanged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_read = read;
|
||||
CurrentFile = read.File;
|
||||
_lines = lines;
|
||||
Apply();
|
||||
if (level == Level && string.Equals(search, Search, StringComparison.Ordinal))
|
||||
{
|
||||
Show(shown, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
Apply(); // the filters changed while the file was read
|
||||
}
|
||||
}
|
||||
|
||||
private static (string? File, long Length, DateTime WrittenUtc) Stamp(string? file)
|
||||
{
|
||||
if (file is null)
|
||||
{
|
||||
return (null, 0, default);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var info = new FileInfo(file);
|
||||
return info.Exists ? (file, info.Length, info.LastWriteTimeUtc) : (file, -1, default);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return (file, -1, default);
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply()
|
||||
{
|
||||
IReadOnlyList<string> shown = LogTail.Filter(_lines, Level, Search);
|
||||
Show(shown, string.Join(Environment.NewLine, shown));
|
||||
}
|
||||
|
||||
private void Show(IReadOnlyList<string> shown, string text)
|
||||
{
|
||||
ShownCount = shown.Count;
|
||||
Text = string.Join(Environment.NewLine, shown);
|
||||
Text = text;
|
||||
Status = CurrentFile is null
|
||||
? Strings.Logs_Empty
|
||||
: string.Format(CultureInfo.CurrentCulture, Strings.Logs_Showing_Format, ShownCount, TotalCount, Path.GetFileName(CurrentFile));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -722,6 +736,14 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.Outcome == HookingConsentOutcome.Unanswered)
|
||||
{
|
||||
// beta.22: whether hooking was turned off is not known — the list is read again from what is stored.
|
||||
_strip.Warn(game.Name, Strings.Agent_Unanswered);
|
||||
await RefreshCoreAsync().ConfigureAwait(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Turning off with no Agent changed nothing (beta.18): it said the enable path's "Nothing was enabled."
|
||||
string body = result.Outcome == HookingConsentOutcome.AgentUnavailable ? Strings.Agent_NotConnected_NothingChanged : result.Detail ?? Strings.Common_NotAvailable;
|
||||
_strip.Warn(game.Name, body);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+124
-70
@@ -33,6 +33,7 @@
|
||||
// added trying to close it and did not; they are kept because they are the right
|
||||
// shape and would catch a wider window.
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstring>
|
||||
@@ -246,6 +247,18 @@ TEST_CASE("a reader stalled exactly ONE FULL LAP does not accept a stale frame",
|
||||
CHECK(out[0].frameIndex == kCap); // the SECOND occupant, not the first
|
||||
}
|
||||
|
||||
// What makes the two concurrency cases below prove anything is that the reader drained the ring WHILE the writer
|
||||
// wrote it (2026-10-13). The hammering case's guard was `accepted > kTotal / 2`, a share of the stream, and that
|
||||
// measured the scheduler rather than the run: on the owner's hybrid i7-14700KF it failed 5 of 40 runs, then 5 of 200,
|
||||
// with `mixed` clean every time. A start barrier (the writer begins only once the reader is about to loop) left 1 of
|
||||
// 200 — a reader the OS did not run while the writer wrote: one drain beside it, accepted 2048. No single run can rule
|
||||
// that out, so each case repeats its run, every attempt checked for its properties, until one attempt made enough
|
||||
// drains that copied records while the writer was still writing. Measured over 1,000 runs: no failure, at most 3
|
||||
// attempts, at least 122 such drains in the best attempt (median 146,981). A reader made to wait for the writer to
|
||||
// finish makes none in all 8 attempts and fails here, where the tiny ring's old `dropped > 0` still passed.
|
||||
constexpr std::uint64_t kMinOverlappedDrains = 100;
|
||||
constexpr int kMaxAttempts = 8;
|
||||
|
||||
TEST_CASE("SPSC under a hammering writer: every accepted record is internally consistent", "[ring]") {
|
||||
// The real concurrency case. The reader may legitimately miss records
|
||||
// (overwrite-oldest) and may see torn ones; what it must NEVER do is accept a
|
||||
@@ -254,44 +267,63 @@ TEST_CASE("SPSC under a hammering writer: every accepted record is internally co
|
||||
constexpr std::uint32_t kBigCap = 1024;
|
||||
constexpr std::uint32_t kTotal = 200000;
|
||||
|
||||
Mapping m{kBigCap};
|
||||
RingWriter w;
|
||||
RingReader rd;
|
||||
REQUIRE(w.Init(m.base(), kBigCap));
|
||||
REQUIRE(rd.Init(m.base(), kBigCap));
|
||||
std::uint64_t mostOverlapped = 0;
|
||||
int attempts = 0;
|
||||
while (mostOverlapped < kMinOverlappedDrains && attempts < kMaxAttempts) {
|
||||
++attempts;
|
||||
Mapping m{kBigCap};
|
||||
RingWriter w;
|
||||
RingReader rd;
|
||||
REQUIRE(w.Init(m.base(), kBigCap));
|
||||
REQUIRE(rd.Init(m.base(), kBigCap));
|
||||
|
||||
std::atomic<bool> done{false};
|
||||
std::thread producer([&] {
|
||||
for (std::uint32_t i = 0; i < kTotal; ++i) {
|
||||
w.Publish(MakeRecord(i));
|
||||
}
|
||||
done.store(true, std::memory_order_release);
|
||||
});
|
||||
|
||||
std::vector<FlFrameRecord> buf(kBigCap);
|
||||
std::uint64_t accepted = 0;
|
||||
std::uint64_t torn = 0;
|
||||
bool mixed = false;
|
||||
|
||||
while (!done.load(std::memory_order_acquire) || rd.ReadIndex() < m.writer()->writeIndex) {
|
||||
const DrainResult r = rd.Drain(buf.data(), kBigCap);
|
||||
for (std::uint32_t i = 0; i < r.copied; ++i) {
|
||||
if (buf[i].qpc != 1000ULL + buf[i].frameIndex) {
|
||||
mixed = true;
|
||||
std::atomic<bool> go{false};
|
||||
std::atomic<bool> done{false};
|
||||
std::thread producer([&] {
|
||||
while (!go.load(std::memory_order_acquire)) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
if (buf[i].swapchainId != (0xABCD0000u | (buf[i].frameIndex & 0xFFFFu))) {
|
||||
mixed = true; // the tail span belongs to the same frame as the head
|
||||
for (std::uint32_t i = 0; i < kTotal; ++i) {
|
||||
w.Publish(MakeRecord(i));
|
||||
}
|
||||
done.store(true, std::memory_order_release);
|
||||
});
|
||||
|
||||
std::vector<FlFrameRecord> buf(kBigCap);
|
||||
std::uint64_t accepted = 0;
|
||||
std::uint64_t torn = 0;
|
||||
std::uint64_t overlapped = 0; // drains that copied records while the writer was writing
|
||||
bool mixed = false;
|
||||
|
||||
go.store(true, std::memory_order_release);
|
||||
while (!done.load(std::memory_order_acquire) || rd.ReadIndex() < m.writer()->writeIndex) {
|
||||
const bool writing = !done.load(std::memory_order_acquire);
|
||||
const DrainResult r = rd.Drain(buf.data(), kBigCap);
|
||||
for (std::uint32_t i = 0; i < r.copied; ++i) {
|
||||
if (buf[i].qpc != 1000ULL + buf[i].frameIndex) {
|
||||
mixed = true;
|
||||
}
|
||||
if (buf[i].swapchainId != (0xABCD0000u | (buf[i].frameIndex & 0xFFFFu))) {
|
||||
mixed = true; // the tail span belongs to the same frame as the head
|
||||
}
|
||||
}
|
||||
if (writing && r.copied > 0) {
|
||||
++overlapped;
|
||||
}
|
||||
accepted += r.copied;
|
||||
torn += r.gaps;
|
||||
}
|
||||
accepted += r.copied;
|
||||
torn += r.gaps;
|
||||
producer.join();
|
||||
|
||||
INFO("attempt " << attempts << ": accepted " << accepted << ", torn " << torn << ", overlapped drains "
|
||||
<< overlapped << " of " << kTotal);
|
||||
CHECK_FALSE(mixed);
|
||||
mostOverlapped = std::max(mostOverlapped, overlapped);
|
||||
}
|
||||
producer.join();
|
||||
|
||||
INFO("accepted " << accepted << ", torn " << torn << " of " << kTotal);
|
||||
CHECK_FALSE(mixed);
|
||||
// Not a vacuous run: the reader must actually have seen most of the stream.
|
||||
CHECK(accepted > kTotal / 2);
|
||||
INFO("attempts " << attempts << ", most overlapped drains " << mostOverlapped);
|
||||
// Not a vacuous run: in one attempt at least, the reader read the ring while the writer was writing it.
|
||||
CHECK(mostOverlapped >= kMinOverlappedDrains);
|
||||
}
|
||||
|
||||
TEST_CASE("a tiny ring, so the writer laps the reader constantly", "[ring]") {
|
||||
@@ -307,50 +339,72 @@ TEST_CASE("a tiny ring, so the writer laps the reader constantly", "[ring]") {
|
||||
constexpr std::uint32_t kTiny = 8;
|
||||
constexpr std::uint32_t kTotal = 200000;
|
||||
|
||||
Mapping m{kTiny};
|
||||
RingWriter w;
|
||||
RingReader rd;
|
||||
REQUIRE(w.Init(m.base(), kTiny));
|
||||
REQUIRE(rd.Init(m.base(), kTiny));
|
||||
std::uint64_t mostOverlapped = 0;
|
||||
std::uint64_t dropped = 0; // the last attempt's: the one that overlapped, when one did
|
||||
int attempts = 0;
|
||||
while (mostOverlapped < kMinOverlappedDrains && attempts < kMaxAttempts) {
|
||||
++attempts;
|
||||
Mapping m{kTiny};
|
||||
RingWriter w;
|
||||
RingReader rd;
|
||||
REQUIRE(w.Init(m.base(), kTiny));
|
||||
REQUIRE(rd.Init(m.base(), kTiny));
|
||||
|
||||
std::atomic<bool> done{false};
|
||||
std::thread producer([&] {
|
||||
for (std::uint32_t i = 0; i < kTotal; ++i) {
|
||||
w.Publish(MakeRecord(i));
|
||||
}
|
||||
done.store(true, std::memory_order_release);
|
||||
});
|
||||
|
||||
FlFrameRecord buf[kTiny]{};
|
||||
std::uint64_t accepted = 0;
|
||||
std::uint64_t dropped = 0;
|
||||
bool mixed = false;
|
||||
bool poisonAccepted = false;
|
||||
|
||||
while (!done.load(std::memory_order_acquire) || rd.ReadIndex() < m.writer()->writeIndex) {
|
||||
const DrainResult r = rd.Drain(buf, kTiny);
|
||||
for (std::uint32_t i = 0; i < r.copied; ++i) {
|
||||
if (buf[i].qpc != 1000ULL + buf[i].frameIndex ||
|
||||
buf[i].swapchainId != (0xABCD0000u | (buf[i].frameIndex & 0xFFFFu))) {
|
||||
mixed = true;
|
||||
std::atomic<bool> go{false};
|
||||
std::atomic<bool> done{false};
|
||||
std::thread producer([&] {
|
||||
while (!go.load(std::memory_order_acquire)) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
// An accepted record's seq is the seqlock counter and must be even.
|
||||
// kPoisonSeq here means the payload write reached the guard field.
|
||||
if (buf[i].seq == kPoisonSeq || (buf[i].seq & 1u) != 0u) {
|
||||
poisonAccepted = true;
|
||||
for (std::uint32_t i = 0; i < kTotal; ++i) {
|
||||
w.Publish(MakeRecord(i));
|
||||
}
|
||||
done.store(true, std::memory_order_release);
|
||||
});
|
||||
|
||||
FlFrameRecord buf[kTiny]{};
|
||||
std::uint64_t accepted = 0;
|
||||
std::uint64_t lost = 0;
|
||||
std::uint64_t overlapped = 0; // drains that copied records while the writer was writing
|
||||
bool mixed = false;
|
||||
bool poisonAccepted = false;
|
||||
|
||||
go.store(true, std::memory_order_release);
|
||||
while (!done.load(std::memory_order_acquire) || rd.ReadIndex() < m.writer()->writeIndex) {
|
||||
const bool writing = !done.load(std::memory_order_acquire);
|
||||
const DrainResult r = rd.Drain(buf, kTiny);
|
||||
for (std::uint32_t i = 0; i < r.copied; ++i) {
|
||||
if (buf[i].qpc != 1000ULL + buf[i].frameIndex ||
|
||||
buf[i].swapchainId != (0xABCD0000u | (buf[i].frameIndex & 0xFFFFu))) {
|
||||
mixed = true;
|
||||
}
|
||||
// An accepted record's seq is the seqlock counter and must be even.
|
||||
// kPoisonSeq here means the payload write reached the guard field.
|
||||
if (buf[i].seq == kPoisonSeq || (buf[i].seq & 1u) != 0u) {
|
||||
poisonAccepted = true;
|
||||
}
|
||||
}
|
||||
if (writing && r.copied > 0) {
|
||||
++overlapped;
|
||||
}
|
||||
accepted += r.copied;
|
||||
lost += r.dropped;
|
||||
}
|
||||
accepted += r.copied;
|
||||
dropped += r.dropped;
|
||||
producer.join();
|
||||
dropped = lost;
|
||||
|
||||
INFO("attempt " << attempts << ": accepted " << accepted << ", overlapped drains " << overlapped << " of "
|
||||
<< kTotal);
|
||||
CHECK_FALSE(mixed);
|
||||
CHECK_FALSE(poisonAccepted);
|
||||
mostOverlapped = std::max(mostOverlapped, overlapped);
|
||||
}
|
||||
producer.join();
|
||||
|
||||
INFO("accepted " << accepted << ", dropped " << dropped << " of " << kTotal);
|
||||
CHECK_FALSE(mixed);
|
||||
CHECK_FALSE(poisonAccepted);
|
||||
// Not vacuous in the other direction either: with 8 slots the writer MUST
|
||||
// have lapped us, so a run reporting no drops means the threads never
|
||||
// actually overlapped and the case proved nothing.
|
||||
INFO("attempts " << attempts << ", most overlapped drains " << mostOverlapped << ", dropped " << dropped);
|
||||
// Not vacuous: the reader read the ring while the writer was writing it. `dropped > 0` alone could not say so — a
|
||||
// reader that started after the writer had finished drops nearly everything — and with eight slots the attempt
|
||||
// that overlapped (the last one) is lapped, which the second check holds it to.
|
||||
CHECK(mostOverlapped >= kMinOverlappedDrains);
|
||||
CHECK(dropped > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -316,6 +316,33 @@ public sealed class AgentConnectionTests : IAsyncDisposable
|
||||
}
|
||||
|
||||
/// <summary>beta.10 (the admin mode): a start that asks Windows for administrator rights says so on the pill while it waits.</summary>
|
||||
/// <summary>
|
||||
/// beta.22: every way the pipe can close under a request reaches a caller as ONE exception, an IOException. PipeClient fails a
|
||||
/// request in flight with what ended its reader — an IpcFramingException or an ObjectDisposedException among them — and a
|
||||
/// caller that knew only IOException ended in the App's crash dialog (beta.21's review of Play). What is not a closed pipe
|
||||
/// passes through as it was, and an answer is the answer.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task EveryWayThePipeClosesUnderARequestIsOneIOException()
|
||||
{
|
||||
foreach (Exception closed in new Exception[] { new ObjectDisposedException("pipe"), new IpcFramingException("the frame ended early") })
|
||||
{
|
||||
Func<Task> request = () => AgentConnection.AnsweredAsync(() => Task.FromException<IpcEnvelope>(closed));
|
||||
IOException said = (await request.Should().ThrowAsync<IOException>()).Which;
|
||||
said.InnerException.Should().BeSameAs(closed, closed.GetType().Name);
|
||||
}
|
||||
|
||||
Exception[] kept = [new IOException("the pipe closed before the Agent answered"), new TimeoutException(), new IpcRequestException(IpcErrorCode.SessionRunning, "running")];
|
||||
foreach (Exception ex in kept)
|
||||
{
|
||||
Func<Task> request = () => AgentConnection.AnsweredAsync(() => Task.FromException<IpcEnvelope>(ex));
|
||||
(await request.Should().ThrowAsync<Exception>()).Which.Should().BeSameAs(ex, ex.GetType().Name);
|
||||
}
|
||||
|
||||
IpcEnvelope answer = IpcCodec.Decode(IpcCodec.Encode(IpcMessageType.DeleteSessionsAck, "1", new DeleteSessionsAck(null, 0, 0)));
|
||||
(await AgentConnection.AnsweredAsync(() => Task.FromResult(answer))).Should().BeSameAs(answer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AStartThatAsksForAdministratorRightsSaysSoOnThePill()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.App.ViewModels;
|
||||
@@ -121,6 +122,31 @@ public sealed class AntiCheatExceptionsTests
|
||||
(await exceptions.GrantAsync(56, _gf2, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.VersionMismatch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: an ask the Agent never answered is not known, and its notice says so in words — it read "IOException"; one the
|
||||
/// connection was gone before is "no agent", which changed nothing.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AnAskTheAgentNeverAnsweredIsNotKnownAndSaidInWords()
|
||||
{
|
||||
var agent = new FakeAgent
|
||||
{
|
||||
Hello = Hello(AntiCheatExceptionDisclosure.Version),
|
||||
Answer = static _ => throw new IOException("the connection to the Agent closed before it answered"),
|
||||
};
|
||||
var exceptions = new AntiCheatExceptions(agent, new FakePrompt { Accepts = true });
|
||||
|
||||
AntiCheatExceptionResult closed = await exceptions.GrantAsync(56, _gf2, Ct);
|
||||
closed.Outcome.Should().Be(AntiCheatExceptionOutcome.Unanswered);
|
||||
closed.MessageFor("GIRLS' FRONTLINE 2").Should().Be(Strings.Agent_Unanswered);
|
||||
|
||||
agent.Answer = static _ => throw new TimeoutException();
|
||||
(await exceptions.WithdrawAsync(56, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.Unanswered);
|
||||
|
||||
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
|
||||
(await exceptions.WithdrawAsync(56, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.AgentUnavailable, "nothing was sent");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AWithdrawalNeedsNoDialog()
|
||||
{
|
||||
|
||||
@@ -47,21 +47,6 @@ public sealed class DashboardViewModelTests
|
||||
public void Open(long sessionId) => Opened.Add(sessionId);
|
||||
}
|
||||
|
||||
private sealed class NoStrip : IMessageStrip
|
||||
{
|
||||
public void Info(string title, string body)
|
||||
{
|
||||
}
|
||||
|
||||
public void Success(string title, string body)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warn(string title, string body)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FakeNavigator : IPageNavigator
|
||||
{
|
||||
public List<string> Pages { get; } = [];
|
||||
@@ -83,7 +68,8 @@ public sealed class DashboardViewModelTests
|
||||
var nav = new FakeNavigator();
|
||||
|
||||
var summaries = new NoSummaries();
|
||||
using var vm = new DashboardViewModel(link, s.Library, selection, nav, summaries, new NoStrip());
|
||||
var vm = new DashboardViewModel(link, s.Library, selection, nav, summaries);
|
||||
vm.Attach();
|
||||
Task pending1 = vm.Pending;
|
||||
await pending1;
|
||||
|
||||
@@ -111,7 +97,8 @@ public sealed class DashboardViewModelTests
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
var link = new FakeLink();
|
||||
using var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries(), new NoStrip());
|
||||
var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries());
|
||||
vm.Attach();
|
||||
Task pending2 = vm.Pending;
|
||||
await pending2;
|
||||
vm.Live.IsActive.Should().BeFalse();
|
||||
@@ -178,7 +165,9 @@ public sealed class DashboardViewModelTests
|
||||
};
|
||||
using var sessions = new LiveSessions(link);
|
||||
var strip = new RecordingStrip();
|
||||
using var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries(), strip, sessions: sessions);
|
||||
using var notices = new SessionNotices(link, strip);
|
||||
var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries(), sessions: sessions);
|
||||
vm.Attach();
|
||||
Task loaded = vm.Pending;
|
||||
await loaded;
|
||||
|
||||
@@ -207,7 +196,9 @@ public sealed class DashboardViewModelTests
|
||||
var link = new FakeLink();
|
||||
using var sessions = new LiveSessions(link);
|
||||
var strip = new RecordingStrip();
|
||||
using var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries(), strip, sessions: sessions);
|
||||
using var notices = new SessionNotices(link, strip);
|
||||
var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries(), sessions: sessions);
|
||||
vm.Attach();
|
||||
Task loaded = vm.Pending;
|
||||
await loaded;
|
||||
var hooked = Guid.NewGuid();
|
||||
@@ -228,4 +219,74 @@ public sealed class DashboardViewModelTests
|
||||
strip.Shown.Should().ContainSingle("a faulted session is the strip's CaptureError already; \"discarded\" would say what did not happen");
|
||||
vm.Live.IsActive.Should().BeFalse();
|
||||
}
|
||||
/// <summary>
|
||||
/// beta.23: a Dashboard hears the Agent only while its page is on screen. Every visit made a new one and none went
|
||||
/// away — the root container kept them all, each subscribed — so each session's end reloaded every Dashboard ever
|
||||
/// opened, on the UI thread, and raised one notice apiece.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ADashboardOffScreenHearsNothingAndASessionHasOneNoticeHoweverManyWereOpened()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
var link = new FakeLink();
|
||||
var strip = new RecordingStrip();
|
||||
using var notices = new SessionNotices(link, strip);
|
||||
var visits = new List<DashboardViewModel>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
// What navigating does: the page on screen is attached, the one it replaced detached.
|
||||
visits.LastOrDefault()?.Detach();
|
||||
var vm = new DashboardViewModel(link, s.Library, new GameSelection(), new FakeNavigator(), new NoSummaries());
|
||||
vm.Attach();
|
||||
visits.Add(vm);
|
||||
Task pending = vm.Pending;
|
||||
await pending;
|
||||
}
|
||||
|
||||
var guid = Guid.NewGuid();
|
||||
link.Raise(IpcMessageType.SessionStarted, new SessionStartedEvent(guid, game.Id, "Alpha", 4242, 1, DateTimeOffset.UtcNow));
|
||||
visits[^1].Live.IsActive.Should().BeTrue("the Dashboard on screen follows the session");
|
||||
visits.Take(4).Should().OnlyContain(static v => !v.Live.IsActive, "a Dashboard that was navigated away from hears nothing");
|
||||
|
||||
long id = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddMinutes(-2), seconds: 65);
|
||||
link.Raise(IpcMessageType.SessionCompleted, new SessionCompletedEvent(guid, id, "normal", 1, "saved", "TargetExited"));
|
||||
Task reloaded = visits[^1].Pending;
|
||||
await reloaded;
|
||||
|
||||
strip.Shown.Should().ContainSingle("one session, one notice — it was one per Dashboard ever opened")
|
||||
.Which.Body.Should().Contain("Alpha", "the name the start gave, for a completion that carries none");
|
||||
visits[^1].Recent.Should().ContainSingle();
|
||||
visits.Take(4).Should().OnlyContain(static v => v.Recent.Count == 0, "only the Dashboard on screen reloads its lists");
|
||||
}
|
||||
|
||||
/// <summary>FR-3.8 (beta.23): the notice is the window's while it is shown; a hidden window leaves it to the tray's balloon.</summary>
|
||||
[Fact]
|
||||
public void ANoticeWaitsForTheWindowAndATrayBalloonCarriesItWhenHidden()
|
||||
{
|
||||
var link = new FakeLink();
|
||||
var strip = new RecordingStrip();
|
||||
var presence = new Presence { IsShown = false };
|
||||
using var notices = new SessionNotices(link, strip, presence);
|
||||
|
||||
link.Raise(IpcMessageType.SessionCompleted, new SessionCompletedEvent(Guid.NewGuid(), 7, "normal", 1, "saved", "TargetExited", 1, "Alpha"));
|
||||
strip.Shown.Should().BeEmpty("the window is hidden: TrayViewModel's balloon says it");
|
||||
|
||||
presence.IsShown = true;
|
||||
link.Raise(IpcMessageType.SessionCompleted, new SessionCompletedEvent(Guid.NewGuid(), 8, "normal", 1, "saved", "TargetExited", 1, "Alpha"));
|
||||
strip.Shown.Should().ContainSingle().Which.Kind.Should().Be("success");
|
||||
}
|
||||
|
||||
private sealed class Presence : IShellPresence
|
||||
{
|
||||
public bool IsShown { get; set; }
|
||||
|
||||
public void Reveal()
|
||||
{
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,9 @@ public sealed class DiagReportTests
|
||||
}
|
||||
|
||||
report.Should().Contain(" capture.min_session_s = 30", "a key with no row reports its default");
|
||||
report.Should().Contain("render_tier: n/a", "no tier given");
|
||||
DiagReport.Build("1.2.3", @"C:\data", @"C:\data\logs", 2, values, agentBesideApp: true, now, renderTier: 0)
|
||||
.Should().Contain("render_tier: 0", "beta.21: software rendering, where every scroll is drawn on the CPU, is named");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1032,6 +1032,47 @@ public sealed class GameDetailViewModelTests
|
||||
vm.Sessions.Should().HaveCount(2, "the page left: nothing listens");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.23: whether the executable is on disk is asked off the UI thread — a USB drive that sleeps, or one that fails,
|
||||
/// answered on the UI thread while the page opened (the library page has asked off it since beta.19) — and the bar says
|
||||
/// why from that one answer, with no drive asked again by a property getter.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheExecutableIsLookedForOffTheThreadThatOpensThePage()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
var asked = new List<int>();
|
||||
bool Exists(string path)
|
||||
{
|
||||
lock (asked)
|
||||
{
|
||||
asked.Add(Environment.CurrentManagedThreadId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int opener = 0;
|
||||
GameDetailViewModel? vm = null;
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
opener = Environment.CurrentManagedThreadId;
|
||||
vm = new GameDetailViewModel(s.Library, new GameSelection { GameId = game.Id }, new HookingConsent(new FakeAgent(), new FakePrompt()), new FakeNavigator(),
|
||||
new FakeConfirmations(RemoveGameChoice.Cancel), new FakeEdit(null), new FakeStrip(), new NoSummaries(),
|
||||
new Charts.SessionSeriesLoader(s.Sessions), new Infrastructure.Persistence.SqliteHardwareSnapshotRepository(s.Db), new SessionSelection(),
|
||||
new FakePicker(null), executableExists: Exists);
|
||||
});
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
Task loaded = vm!.Pending;
|
||||
await loaded;
|
||||
|
||||
asked.Should().ContainSingle().Which.Should().NotBe(opener, "the drive is asked on the thread pool, never on the thread that opens the page");
|
||||
vm.ExecutableMissing.Should().BeTrue();
|
||||
vm.ExecutableMissingMessage.Should().StartWith(GameDetailViewModel.ExecutableMissingText).And.Contain(Path.GetFileName(game.Fingerprint.ExePath));
|
||||
}
|
||||
|
||||
/// <summary>beta.8: a session that was not hooked has its sensors, and the Sensors tab draws them instead of saying "not hooked".</summary>
|
||||
[Fact]
|
||||
public async Task ATierTwoSessionsSensorsAreTheSensorsTabs()
|
||||
|
||||
@@ -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>
|
||||
/// The pipe fails a request in flight when the agent stops, and a command's unhandled exception is the App's crash dialog
|
||||
/// (beta.21's review). Since beta.22 an answer that never came — the connection closed (one IOException, AgentConnection) or no
|
||||
/// answer in time — is "not known": the game may be starting. The connection gone before the request is "not running".
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AnAnswerThatNeverCameIsNotKnownAndARequestNeverSentIsNotRunning()
|
||||
{
|
||||
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);
|
||||
foreach (Exception ex in new Exception[] { new IOException("the connection to the Agent closed before it answered"), new TimeoutException() })
|
||||
{
|
||||
PlayResult result = await Player(s, new Shell(), new Agent(fails: ex), new Stores()).PlayAsync(game, Ct);
|
||||
result.Should().Be(new PlayResult(PlayOutcome.Unanswered), ex.GetType().Name);
|
||||
GamePlayer.Describe(result, "W").Should().Be((Strings.Agent_Unanswered, true));
|
||||
}
|
||||
|
||||
(await Player(s, new Shell(), new Agent(fails: new InvalidOperationException("the Agent is not connected")), new Stores()).PlayAsync(game, Ct))
|
||||
.Should().Be(new PlayResult(PlayOutcome.AgentUnavailable), "nothing was sent");
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.App.ViewModels;
|
||||
@@ -148,6 +149,28 @@ public sealed class HookingConsentTests
|
||||
agent.Sent.Last().Payload.Should().Be(new SetHookEnabledRequest(7, false, null), "a revoke names no disclosure");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: an ask the Agent never answered — the connection closed under it, or no answer in time — is not known, never the
|
||||
/// exception's type name as the notice (it read "IOException"); one the connection was gone before is "no agent".
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AnAskTheAgentNeverAnsweredIsNotKnownAndOneNeverSentIsNoAgent()
|
||||
{
|
||||
var agent = new FakeAgent { Hello = Hello(SafetyDisclosure.Version) };
|
||||
var consent = new HookingConsent(agent, new FakePrompt { Accepts = true });
|
||||
|
||||
agent.Answer = static _ => throw new IOException("the connection to the Agent closed before it answered");
|
||||
HookingConsentResult closed = await consent.EnableAsync(7, "Title", Ct);
|
||||
closed.Outcome.Should().Be(HookingConsentOutcome.Unanswered);
|
||||
closed.Detail.Should().BeNull("no exception's name is a notice");
|
||||
|
||||
agent.Answer = static _ => throw new TimeoutException();
|
||||
(await consent.DisableAsync(7, Ct)).Outcome.Should().Be(HookingConsentOutcome.Unanswered);
|
||||
|
||||
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
|
||||
(await consent.DisableAsync(7, Ct)).Outcome.Should().Be(HookingConsentOutcome.AgentUnavailable, "nothing was sent");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("I ACCEPT THE INJECTION RISK", true)]
|
||||
[InlineData(" I ACCEPT THE INJECTION RISK ", true)]
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed class LogsViewModelTests : IDisposable
|
||||
Write("ui-20260914.log", "[12:00:00.000 INF] hello\n[12:00:00.001 WRN] careful\n");
|
||||
Write("agent-20260914.log", "[12:00:00.000 INF] agent here\n");
|
||||
var strip = new RecordingStrip();
|
||||
using var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
Task pending1 = vm.Pending;
|
||||
await pending1;
|
||||
|
||||
@@ -69,11 +69,36 @@ public sealed class LogsViewModelTests : IDisposable
|
||||
vm.Text.Should().Contain("agent here");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.23: the tail's two-second tick re-read up to 2 MB and replaced the whole text while nothing had been written; it
|
||||
/// reads again only when the newest file's length or write time changed.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ATickReadsTheTailAgainOnlyWhenTheFileChanged()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
Write("ui-20260914.log", "[12:00:00.000 INF] one\n");
|
||||
var strip = new RecordingStrip();
|
||||
var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
Task first = vm.Pending;
|
||||
await first;
|
||||
vm.Text.Should().Be("[12:00:00.000 INF] one");
|
||||
|
||||
vm.Text = "drawn";
|
||||
await vm.RefreshIfChangedAsync();
|
||||
vm.Text.Should().Be("drawn", "nothing was written since the last read: a tick reads nothing and redraws nothing");
|
||||
|
||||
await File.AppendAllTextAsync(Path.Combine(_dir, "ui-20260914.log"), "[12:00:01.000 INF] two\n", TestContext.Current.CancellationToken);
|
||||
await vm.RefreshIfChangedAsync();
|
||||
vm.Text.Should().Contain("two").And.Contain("one");
|
||||
vm.TotalCount.Should().Be(2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithoutAFileTheStatusSaysSo()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
using var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), new RecordingStrip()), new RecordingStrip());
|
||||
var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), new RecordingStrip()), new RecordingStrip());
|
||||
Task pending = vm.Pending;
|
||||
await pending;
|
||||
|
||||
@@ -91,7 +116,7 @@ public sealed class LogsViewModelTests : IDisposable
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(zip)!);
|
||||
var saver = new PathSaver(zip);
|
||||
var strip = new RecordingStrip();
|
||||
using var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), saver, new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), saver, new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
Task pending1 = vm.Pending;
|
||||
await pending1;
|
||||
|
||||
@@ -109,7 +134,7 @@ public sealed class LogsViewModelTests : IDisposable
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var strip = new RecordingStrip();
|
||||
using var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
var vm = new LogsViewModel(new LogTail(_dir), new BugReportFlow(new BugBundleBuilder(_dir, new RegisteredSettings(new SqliteSettingsStore(s.Db))), new PathSaver(null), new FakeAgentLink(), new ClosePreview(), new NoUrlOpener(), new NoClipboard(), strip), strip);
|
||||
|
||||
await vm.ExportBundleCommand.ExecuteAsync(null);
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Controls;
|
||||
using Xunit;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// beta.21 (owner request 2026-10-13: "scrolling the documents in the app is slow"): the wheel moves a document by Windows'
|
||||
/// lines at a browser's line instead of WPF's fixed 48 DIP, in proportion to the delta, and leaves its ends to the host; a
|
||||
/// page is rendered once, and a page shown before is not rendered again.
|
||||
/// </summary>
|
||||
public sealed class MarkdownViewTests
|
||||
{
|
||||
private static readonly string _longText = string.Join("\n\n", Enumerable.Range(1, 400).Select(static i => "Paragraph " + i + ": a few words that wrap."));
|
||||
|
||||
[Fact]
|
||||
public void TheWheelStepFollowsTheDeltaWindowsLinesAndTheZoom()
|
||||
{
|
||||
MarkdownView.WheelStep(-120, 3, 600, 100).Should().BeApproximately(100, 1e-9, "three lines at a browser's line, downwards");
|
||||
MarkdownView.WheelStep(120, 3, 600, 100).Should().BeApproximately(-100, 1e-9);
|
||||
MarkdownView.WheelStep(-15, 3, 600, 100).Should().BeApproximately(12.5, 1e-9, "a touchpad's small delta moves in proportion");
|
||||
MarkdownView.WheelStep(-120, 3, 600, 200).Should().BeApproximately(200, 1e-9, "zoomed in, a line is taller");
|
||||
MarkdownView.WheelStep(-120, -1, 600, 100).Should().BeApproximately(600, 1e-9, "Windows' \"one screen at a time\"");
|
||||
MarkdownView.WheelStep(-120, 0, 600, 100).Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TheWheelMovesTheDocumentByItsStepAndLeavesItsEndsToTheHost()
|
||||
{
|
||||
(double notch, double touch, bool atEnd, bool withCtrl) = await PagesLoadTests.OnStaAsync(static () =>
|
||||
{
|
||||
var view = new MarkdownView { EaseWheel = false, WheelScrollLines = static () => 3, CurrentModifiers = static () => ModifierKeys.None };
|
||||
view.Show(_longText, isPlainText: false, path: "LIMITATIONS.md");
|
||||
Layout(view);
|
||||
ScrollViewer scroller = view.Scroller ?? throw new InvalidOperationException("the template has no PART_ContentHost");
|
||||
scroller.ScrollableHeight.Should().BeGreaterThan(1000, "the document is longer than its view");
|
||||
|
||||
Wheel(view, -120).Should().BeTrue();
|
||||
Layout(view);
|
||||
double afterNotch = scroller.VerticalOffset;
|
||||
|
||||
Wheel(view, -15).Should().BeTrue();
|
||||
Layout(view);
|
||||
double afterTouch = scroller.VerticalOffset;
|
||||
|
||||
scroller.ScrollToVerticalOffset(scroller.ScrollableHeight);
|
||||
Layout(view);
|
||||
bool handledAtEnd = Wheel(view, -120);
|
||||
|
||||
scroller.ScrollToVerticalOffset(0);
|
||||
Layout(view);
|
||||
view.CurrentModifiers = static () => ModifierKeys.Control;
|
||||
bool handledWithCtrl = Wheel(view, -120);
|
||||
return (afterNotch, afterTouch, handledAtEnd, handledWithCtrl);
|
||||
});
|
||||
|
||||
notch.Should().BeApproximately(100, 0.5, "one notch is three lines of 100/3 DIP, not WPF's fixed 48");
|
||||
touch.Should().BeApproximately(112.5, 0.5, "a delta of 15 is an eighth of a notch");
|
||||
atEnd.Should().BeFalse("at the end the wheel is the host's — the update notes' dialog scrolls instead");
|
||||
withCtrl.Should().BeFalse("Ctrl+wheel is the zoom's, never the scroll's");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EasingAddsEveryNotchToTheTargetAndANewPageStopsIt()
|
||||
{
|
||||
(double first, double second, double afterShow) = await PagesLoadTests.OnStaAsync(static () =>
|
||||
{
|
||||
var view = new MarkdownView { EaseWheel = true, WheelScrollLines = static () => 3, CurrentModifiers = static () => ModifierKeys.None };
|
||||
view.Show(_longText, isPlainText: false, path: "LIMITATIONS.md");
|
||||
Layout(view);
|
||||
Wheel(view, -120).Should().BeTrue();
|
||||
double target1 = view.ScrollTarget;
|
||||
Wheel(view, -120).Should().BeTrue();
|
||||
double target2 = view.ScrollTarget;
|
||||
view.Show("# Another page", isPlainText: false, path: "guide/README.md");
|
||||
return (target1, target2, view.ScrollTarget);
|
||||
});
|
||||
|
||||
first.Should().BeApproximately(100, 0.5);
|
||||
second.Should().BeApproximately(200, 0.5, "a notch turned while easing adds to where the view is going, not to where it is");
|
||||
double.IsNaN(afterShow).Should().BeTrue("a new page ends the easing");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task APageIsRenderedOnceAndAPageShownBeforeIsNotRenderedAgain()
|
||||
{
|
||||
(int one, int two, int back, int evicted) = await PagesLoadTests.OnStaAsync(static () =>
|
||||
{
|
||||
var view = new MarkdownView();
|
||||
int start = view.Renders; // the constructor's empty document
|
||||
view.Show("# One\n\ntext", isPlainText: false, path: "guide/a.md");
|
||||
int afterOne = view.Renders - start;
|
||||
view.Show("# Two\n\ntext", isPlainText: false, path: "guide/b.md");
|
||||
int afterTwo = view.Renders - start;
|
||||
view.Show("# One\n\ntext", isPlainText: false, path: "guide/a.md");
|
||||
int afterBack = view.Renders - start;
|
||||
|
||||
for (int i = 0; i < MarkdownView.CacheCapacity; i++)
|
||||
{
|
||||
view.Show("# Page " + i, isPlainText: false, path: "guide/p" + i + ".md");
|
||||
}
|
||||
|
||||
int beforeEvicted = view.Renders;
|
||||
view.Show("# Two\n\ntext", isPlainText: false, path: "guide/b.md");
|
||||
return (afterOne, afterTwo, afterBack, view.Renders - beforeEvicted);
|
||||
});
|
||||
|
||||
one.Should().Be(1, "Show sets the three properties and renders once");
|
||||
two.Should().Be(2);
|
||||
back.Should().Be(2, "a page this view has rendered is kept");
|
||||
evicted.Should().Be(1, "past the cache's capacity the oldest page is rendered again");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PropertiesSetOneByOneAreRenderedOnceAheadOfLayout()
|
||||
{
|
||||
(int beforePump, int afterPump, bool hasAnchor) = await PagesLoadTests.OnStaAsync(static () =>
|
||||
{
|
||||
var view = new MarkdownView();
|
||||
int start = view.Renders;
|
||||
view.DocumentPath = "guide/a.md";
|
||||
view.IsPlainText = false;
|
||||
view.MarkdownText = "# Heading\n\ntext";
|
||||
int before = view.Renders - start;
|
||||
Visuals.Pump();
|
||||
int after = view.Renders - start;
|
||||
return (before, after, view.Anchors.Count > 0);
|
||||
});
|
||||
|
||||
beforePump.Should().Be(0, "a binding's change asks for a render; it does not render the half-set page");
|
||||
afterPump.Should().Be(1, "three changes, one render");
|
||||
hasAnchor.Should().BeTrue();
|
||||
}
|
||||
|
||||
private static void Layout(FrameworkElement element)
|
||||
{
|
||||
element.Measure(new Size(700, 600));
|
||||
element.Arrange(new Rect(0, 0, 700, 600));
|
||||
element.UpdateLayout();
|
||||
}
|
||||
|
||||
private static bool Wheel(UIElement over, int delta)
|
||||
{
|
||||
var wheel = new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, delta) { RoutedEvent = UIElement.PreviewMouseWheelEvent };
|
||||
over.RaiseEvent(wheel);
|
||||
return wheel.Handled;
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,11 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Charts;
|
||||
using FrameLedger.App.Pages;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.App.ViewModels;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Infrastructure.Persistence;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
@@ -49,7 +51,6 @@ public sealed partial class PagesLoadTests
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
(SettingsViewModel settings, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, new NoStrip());
|
||||
using LogsViewModel ownedLogs = logs;
|
||||
|
||||
(bool Wrapped, double Offset) result = await OnStaAsync(() =>
|
||||
{
|
||||
@@ -71,7 +72,6 @@ public sealed partial class PagesLoadTests
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
(_, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, new NoStrip());
|
||||
using LogsViewModel ownedLogs = logs;
|
||||
|
||||
(double Height, double Offset) tail = await OnStaAsync(() =>
|
||||
{
|
||||
@@ -87,4 +87,46 @@ public sealed partial class PagesLoadTests
|
||||
tail.Height.Should().BeLessThan(500, "the tail has the height the page leaves it, not one tall enough for every line");
|
||||
tail.Offset.Should().BeGreaterThan(0, "so it scrolls, and ScrollToEnd (autoscroll) shows the newest line");
|
||||
}
|
||||
/// <summary>
|
||||
/// beta.23: the game page's Sessions grid is bounded, so it builds the rows on screen and scrolls itself. Inside the page's
|
||||
/// own scroller it was measured with no height limit and built every row - 100 sessions were 100 rows of 17 columns at
|
||||
/// every open, 1.2 s (spike-notes 21). The wheel over it still reaches the page once the grid can scroll no further.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheSessionsGridBuildsTheRowsOnScreenAndHandsTheWheelOnAtItsEnd()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-i - 1));
|
||||
}
|
||||
|
||||
var detail = new GameDetailViewModel(s.Library, new GameSelection { GameId = game.Id }, new HookingConsent(new NoAgent(), new NoPrompt()), new NoNavigation(),
|
||||
new NoConfirm(), new NoEdit(), new NoStrip(), new NoSummaries(), new SessionSeriesLoader(s.Sessions),
|
||||
new SqliteHardwareSnapshotRepository(s.Db), new SessionSelection(), new NoPicker());
|
||||
Task pending = detail.Pending;
|
||||
await pending;
|
||||
|
||||
(int Rows, double PageBefore, double PageAfter, double GridOffset) result = await OnStaAsync(() =>
|
||||
{
|
||||
var page = new GameDetailPage(detail);
|
||||
NavigationViewContentPresenter presenter = Navigated(page, 900);
|
||||
int rows = Visuals.FindAll<DataGridRow>(page).Count();
|
||||
System.Windows.Controls.DataGrid grid = Visuals.Find<System.Windows.Controls.DataGrid>(page)!;
|
||||
System.Windows.Controls.ScrollViewer gridScroller = Visuals.Find<System.Windows.Controls.ScrollViewer>(grid)!;
|
||||
System.Windows.Controls.ScrollViewer root = Visuals.Find<System.Windows.Controls.ScrollViewer>(page)!;
|
||||
gridScroller.ScrollToEnd();
|
||||
presenter.UpdateLayout();
|
||||
double before = root.VerticalOffset;
|
||||
Wheel(Visuals.Leaf(Visuals.FindAll<DataGridRow>(grid).Last()), -120);
|
||||
presenter.UpdateLayout();
|
||||
return (rows, before, root.VerticalOffset, gridScroller.VerticalOffset);
|
||||
});
|
||||
|
||||
detail.Sessions.Should().HaveCount(100);
|
||||
result.Rows.Should().BeInRange(1, 40, "only the rows the bounded grid shows are built");
|
||||
result.GridOffset.Should().BeGreaterThan(0, "the grid scrolls its own rows");
|
||||
result.PageAfter.Should().BeGreaterThan(result.PageBefore, "at the grid's end the wheel scrolls the page");
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public sealed partial class PagesLoadTests
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
|
||||
// The view models load off the STA thread; the pages bind to them on it.
|
||||
Dashboard = Own(new DashboardViewModel(new NoAgent(), s.Library, selection, nav, new NoSummaries(), strip));
|
||||
Dashboard = new DashboardViewModel(new NoAgent(), s.Library, selection, nav, new NoSummaries());
|
||||
Task pending1 = Dashboard.Pending;
|
||||
await pending1.ConfigureAwait(false);
|
||||
Games = new GamesViewModel(s.Library, selection, nav, new AddGameFlow(s.Library, new NoPicker(), selection, nav, strip));
|
||||
@@ -95,7 +95,7 @@ public sealed partial class PagesLoadTests
|
||||
await pending4.ConfigureAwait(false);
|
||||
(SettingsViewModel settings, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, strip).ConfigureAwait(false);
|
||||
Settings = settings;
|
||||
Logs = Own(logs);
|
||||
Logs = logs;
|
||||
}
|
||||
|
||||
/// <summary>Every surface by name, each with a builder to call on the STA thread.</summary>
|
||||
|
||||
@@ -547,7 +547,7 @@ public sealed partial class PagesLoadTests
|
||||
var consent = new HookingConsent(new NoAgent(), new NoPrompt());
|
||||
|
||||
// The view models load off the STA thread; the pages bind to them on it.
|
||||
using var dashboard = new DashboardViewModel(new NoAgent(), s.Library, selection, nav, new NoSummaries(), strip);
|
||||
var dashboard = new DashboardViewModel(new NoAgent(), s.Library, selection, nav, new NoSummaries());
|
||||
Task pending1 = dashboard.Pending;
|
||||
await pending1;
|
||||
var games = new GamesViewModel(s.Library, selection, nav, addGame);
|
||||
@@ -561,7 +561,6 @@ public sealed partial class PagesLoadTests
|
||||
Task pending4 = compare.Pending;
|
||||
await pending4;
|
||||
(SettingsViewModel settings, LogsViewModel logs) = await SettingsAndLogsAsync(s, consent, strip);
|
||||
using LogsViewModel _ = logs;
|
||||
|
||||
(string loaded, List<string> wrapped) = await OnStaAsync(() =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Charts;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Infrastructure.Blobs;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// beta.23 (<c>spike-notes</c> §21): what the charts derive from a whole session is worked out once, off the UI thread, and
|
||||
/// it is exactly what each chart computed for itself before — one sort where there were three.
|
||||
/// </summary>
|
||||
public sealed class SeriesDigestTests
|
||||
{
|
||||
private static CancellationToken Ct => TestContext.Current.CancellationToken;
|
||||
|
||||
/// <summary>Frame times with what a real stream has: zeros after gaps, ties, a long tail, one negative a corrupt blob could hold.</summary>
|
||||
private static double[] Noisy(int count, int seed)
|
||||
{
|
||||
// A fixed scramble, the same on every run (a Random would be CA5394 here and adds nothing).
|
||||
uint state = (uint)seed | 1;
|
||||
var times = new double[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
state = (state * 1_664_525) + 1_013_904_223;
|
||||
double jitter = (state >> 8) / (double)(1 << 24);
|
||||
times[i] = i % 97 == 0 ? 0 : i % 211 == 0 ? 6.25 : 4 + (jitter * 3) + (i % 503 == 0 ? 40 : 0);
|
||||
}
|
||||
|
||||
times[count / 2] = -1;
|
||||
return times;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(2)]
|
||||
[InlineData(1_000)]
|
||||
[InlineData(25_000)]
|
||||
public void TheSortedFormsAreTheSameAsTheChartsOwn(int count)
|
||||
{
|
||||
double[] times = Noisy(count, count);
|
||||
double[] sorted = (double[])times.Clone();
|
||||
Array.Sort(sorted);
|
||||
|
||||
FpsHistogram own = FpsHistogram.Of(times, SeriesDigest.HistogramBins);
|
||||
FpsHistogram fromSorted = FpsHistogram.OfSorted(sorted, SeriesDigest.HistogramBins);
|
||||
fromSorted.Centers.Should().Equal(own.Centers);
|
||||
fromSorted.Counts.Should().Equal(own.Counts);
|
||||
fromSorted.BinWidth.Should().Be(own.BinWidth);
|
||||
fromSorted.Outside.Should().Be(own.Outside);
|
||||
|
||||
(double[] xs, double[] ys) = PercentileCurve.Of(times);
|
||||
(double[] sortedXs, double[] sortedYs) = PercentileCurve.OfSorted(sorted);
|
||||
sortedXs.Should().Equal(xs);
|
||||
sortedYs.Should().Equal(ys);
|
||||
PercentileCurve.LowsOfSorted(sorted).Should().Equal(PercentileCurve.Lows(times));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OneRateAndNoFramesStayWhatTheyWere()
|
||||
{
|
||||
double[] flat = [5, 5, 5, 5];
|
||||
FpsHistogram.OfSorted(flat).Should().BeEquivalentTo(FpsHistogram.Of(flat));
|
||||
FpsHistogram.OfSorted([0, 0]).Should().BeEquivalentTo(FpsHistogram.Of([0, 0]));
|
||||
FpsHistogram.OfSorted([]).Centers.Should().BeEmpty();
|
||||
PercentileCurve.OfSorted([7]).Xs.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheDecodedSeriesCarriesItsDigest()
|
||||
{
|
||||
// 6 presents: the first and the fifth follow a gap, the third is generated.
|
||||
float[] frametimes = [0, 10, 10, 10, 0, 40];
|
||||
byte[] flags = [4, 0, 1, 0, 4, 0];
|
||||
var frames = new FrameBlobs
|
||||
{
|
||||
Codec = SeriesCodec.Tag,
|
||||
SampleCount = 6,
|
||||
FrameTimes = SeriesCodec.EncodeFloat32(frametimes),
|
||||
FrameFlags = SeriesCodec.EncodeBytes(flags),
|
||||
};
|
||||
|
||||
SessionSeries s = SessionSeriesLoader.Decode(frames, [], []);
|
||||
|
||||
SeriesDigest digest = s.Digest!;
|
||||
digest.SortedAppFrameTimesMs.Should().Equal(10, 20, 40);
|
||||
digest.GapsAfterFirst.Should().Be(1, "the first present's gap is every stream's start, not one the chart notes");
|
||||
digest.GeneratedCount.Should().Be(1);
|
||||
s.HasGenerated.Should().BeTrue();
|
||||
(double[] presentTimes, double[] presentIntervals) = digest.Presents!.Value;
|
||||
presentTimes.Should().Equal(0.01, 0.02, 0.03, 0.07);
|
||||
presentIntervals.Should().Equal(10, 10, 10, 40);
|
||||
FrametimeChart.NoteFor(s, displayed: false, sensors: false).Should().Be(FrametimeChart.NoteFor(s with { Digest = null }, displayed: false, sensors: false));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Microsoft.Data.Sqlite completes its "async" calls synchronously, so whatever ConfigureAwait said, the blob read and the
|
||||
/// decode ran on the caller's thread — the UI's (beta.23). They run on the thread pool now.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheBlobIsReadAndDecodedOffTheCallersThread()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
long id = await s.SessionWithFramesAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-1), frames: 600, spikeEvery: 200);
|
||||
var reads = new ThreadRecordingSessions(s.Sessions);
|
||||
var loader = new SessionSeriesLoader(reads);
|
||||
|
||||
int caller = 0;
|
||||
Task<SessionSeries?>? loading = null;
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
caller = Environment.CurrentManagedThreadId;
|
||||
loading = loader.LoadAsync(id, Ct);
|
||||
});
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
SessionSeries? series = await loading!;
|
||||
|
||||
series.Should().NotBeNull();
|
||||
reads.Threads.Should().NotBeEmpty().And.NotContain(caller, "the read and the decode happen on the thread pool, never on the thread that asked");
|
||||
}
|
||||
|
||||
/// <summary>The scratch ledger's repository, noting the thread each blob read runs on.</summary>
|
||||
private sealed class ThreadRecordingSessions(ISessionRepository inner) : ISessionRepository
|
||||
{
|
||||
public List<int> Threads { get; } = [];
|
||||
|
||||
public ValueTask<FrameBlobs?> FindFramesAsync(long sessionId, CancellationToken ct = default)
|
||||
{
|
||||
lock (Threads)
|
||||
{
|
||||
Threads.Add(Environment.CurrentManagedThreadId);
|
||||
}
|
||||
|
||||
return inner.FindFramesAsync(sessionId, ct);
|
||||
}
|
||||
|
||||
public ValueTask<IReadOnlyList<SegmentRow>> FindSegmentsAsync(long sessionId, CancellationToken ct = default) => inner.FindSegmentsAsync(sessionId, ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<SensorBlob>> FindSensorsAsync(long sessionId, CancellationToken ct = default) => inner.FindSensorsAsync(sessionId, ct);
|
||||
|
||||
public ValueTask<long> InsertFinalizedAsync(FinalizedSession session, CancellationToken ct = default) => inner.InsertFinalizedAsync(session, ct);
|
||||
|
||||
public ValueTask<long?> ResolveOwnerAsync(long gameId, string? exePath, DateTimeOffset startedAt, CancellationToken ct = default) => inner.ResolveOwnerAsync(gameId, exePath, startedAt, ct);
|
||||
|
||||
public ValueTask<bool> ExistsAsync(Guid sessionGuid, CancellationToken ct = default) => inner.ExistsAsync(sessionGuid, ct);
|
||||
|
||||
public ValueTask<SessionRow?> FindAsync(Guid sessionGuid, CancellationToken ct = default) => inner.FindAsync(sessionGuid, ct);
|
||||
|
||||
public ValueTask<SessionRow?> FindByIdAsync(long sessionId, CancellationToken ct = default) => inner.FindByIdAsync(sessionId, ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<SessionRow>> ListRecentAsync(int count, CancellationToken ct = default) => inner.ListRecentAsync(count, ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<SessionRow>> ListByGameAsync(long gameId, int limit, CancellationToken ct = default) => inner.ListByGameAsync(gameId, limit, ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<GameSessionSummary>> SummariseByGameAsync(CancellationToken ct = default) => inner.SummariseByGameAsync(ct);
|
||||
|
||||
public ValueTask<long> CountSinceAsync(DateTimeOffset since, CancellationToken ct = default) => inner.CountSinceAsync(since, ct);
|
||||
|
||||
public ValueTask<int> CountSuccessfulUnderGrantAsync(long gameId, string family, DateTimeOffset grantedAt, CancellationToken ct = default) => inner.CountSuccessfulUnderGrantAsync(gameId, family, grantedAt, ct);
|
||||
|
||||
public ValueTask<int> SweepRetentionAsync(long gameId, int keep, CancellationToken ct = default) => inner.SweepRetentionAsync(gameId, keep, ct);
|
||||
|
||||
public ValueTask<RetentionSweepResult> SweepRetentionAllAsync(int keep, CancellationToken ct = default) => inner.SweepRetentionAllAsync(keep, ct);
|
||||
|
||||
public ValueTask<RetentionSweepResult> DeleteSessionsAsync(long? gameId, CancellationToken ct = default) => inner.DeleteSessionsAsync(gameId, ct);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.Charts;
|
||||
using FrameLedger.App.Services;
|
||||
@@ -221,6 +222,50 @@ public sealed class SessionDeletionAndOverviewTests
|
||||
windows.Asked.Should().Be(2, "nothing was deleted");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.22: a delete the Agent never answered — the connection closed under it, or no answer in time — is said as not known;
|
||||
/// what named a deleted session lets go of it (the delete may have run), and the game page reads what is stored. It caught
|
||||
/// no IOException before, and that exception was the App's crash dialog. The connection gone before the ask deleted nothing.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ADeleteTheAgentNeverAnsweredIsSaidAsNotKnownAndThePageReadsWhatIsStored()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
long gone = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-2));
|
||||
|
||||
var windows = new Windows();
|
||||
var selection = new SessionSelection();
|
||||
selection.Set(gone);
|
||||
var agent = new ScriptedAgent { Answer = static _ => Task.FromException<IpcEnvelope>(new TimeoutException()) };
|
||||
var deletion = new SessionDeletion(agent, s.Sessions, selection, windows);
|
||||
|
||||
SessionDeletionResult timedOut = await deletion.DeleteAsync(game.Id, Ct);
|
||||
timedOut.Outcome.Should().Be(SessionDeletionOutcome.Unanswered);
|
||||
timedOut.Message.Should().Be(Strings.Agent_Unanswered);
|
||||
windows.Asked.Should().Be(1, "the delete may have run: what named a deleted session lets go of it");
|
||||
selection.SessionId.Should().Be(gone, "the session is still stored, so it stays selected");
|
||||
|
||||
agent.Answer = static _ => throw new InvalidOperationException("the Agent is not connected");
|
||||
(await deletion.DeleteAsync(game.Id, Ct)).Outcome.Should().Be(SessionDeletionOutcome.AgentUnavailable, "nothing was sent");
|
||||
windows.Asked.Should().Be(1, "nothing was asked, so nothing can be gone");
|
||||
|
||||
// The delete ran and its answer was lost on the way back: the page says it is not known and shows what is stored.
|
||||
agent.Answer = async r =>
|
||||
{
|
||||
await DeletesFrom(s)(r).ConfigureAwait(false);
|
||||
throw new IOException("the connection to the Agent closed before it answered");
|
||||
};
|
||||
var strip = new Strip();
|
||||
GameDetailViewModel page = await PageAsync(s, game.Id, new Confirm(true), deletion, strip, selection);
|
||||
page.Sessions.Should().ContainSingle();
|
||||
await page.DeleteAllSessionsCommand.ExecuteAsync(null);
|
||||
|
||||
strip.Lines.Should().Equal("warn:" + Strings.Agent_Unanswered);
|
||||
page.Sessions.Should().BeEmpty("the page read what is stored after an answer that never came");
|
||||
selection.SessionId.Should().BeNull("the selected session is gone, and its id can be reused");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D39: the overview draws every hooked session's rate and lows; the Trend draws a ticked metric beside the selected
|
||||
/// one, a second unit on the right, and offers no third unit.
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -7,7 +7,11 @@ WPF UI 4.3.0 (pinned), CommunityToolkit.Mvvm, ScottPlot for charts and Markdig f
|
||||
## How it is put together
|
||||
|
||||
- A .NET Generic Host with dependency injection. Pages and their view models are transient — a page is made again on
|
||||
every navigation, so state lives in the view models' services and the database, never in a page.
|
||||
every navigation, so state lives in the view models' services and the database, never in a page. A view model that
|
||||
listens to a service attaches on its page's Loaded and detaches on Unloaded, and is never `IDisposable`: the container
|
||||
keeps every transient disposable it makes until the App exits.
|
||||
- The ledger's reads run on the thread that calls them (Microsoft.Data.Sqlite completes its asynchronous calls
|
||||
synchronously): anything heavy after one — decoding a session, sorting its frames — is put on the thread pool.
|
||||
- Navigation goes only through WPF UI's `INavigationService`; a page implements `INavigableView<TViewModel>`.
|
||||
- The App opens `ledger.db` itself to read; anything that acts on the PC — hooking, deleting sessions, pausing — is a
|
||||
request to the agent over the pipe.
|
||||
|
||||
Reference in new issue
Block a user