Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7b612ffd6
|
||
|
|
3f798ad364 | ||
|
|
38fdb6bd32 | ||
|
|
6ed7851d90 | ||
|
|
dadcacf1a0 | ||
|
|
1d0e8407bd |
No files matched your search
@@ -116,6 +116,22 @@ jobs:
|
||||
"dry_run=$($dry.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "$(if ($dry) { 'DRY RUN of' } else { 'releasing' }) $full (pre-release: $pre)"
|
||||
|
||||
# The Overlay's build id is `git describe --dirty` at CMake's configure
|
||||
# (src/native/FrameLedger.Shm/CMakeLists.txt), and the next step edits tracked
|
||||
# files: every release until beta.18 shipped "<tag>-dirty". So the id is read
|
||||
# here, from the clean checkout, and handed to CMake through the environment;
|
||||
# buildid-check reads it back out of the published binaries.
|
||||
- name: Build id (the clean checkout)
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$id = "$(git describe --always --dirty --abbrev=12)".Trim()
|
||||
if ($LASTEXITCODE -ne 0 -or -not $id) { throw 'git describe failed' }
|
||||
if ($id.EndsWith('-dirty')) { throw "the checkout is dirty before the release has touched it: $id" }
|
||||
if ($id.Length -gt 31) { throw "build id '$id' is $($id.Length) characters; FlShmHandshake::buildId holds 31" }
|
||||
"FL_BUILD_ID=$id" >> $env:GITHUB_ENV
|
||||
Write-Host "FL_BUILD_ID = $id"
|
||||
|
||||
# 12_BUILD §Release-time token substitution: the effective date of a legal
|
||||
# document is the date it ships. The only placeholder that survives into the
|
||||
# repository, substituted here and nowhere else; the App embeds legal/*.md at
|
||||
@@ -200,6 +216,9 @@ jobs:
|
||||
# beta.14 (D50): the managed half too - the eight managed binaries, carrying the tag's full version.
|
||||
./tools/versioninfo-check.ps1 -BuildDir out/app -ManagedDir out/app -ExpectedProductVersion '${{ steps.version.outputs.version }}'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'versioninfo-check over the published tree' }
|
||||
# beta.18: the native binaries carry the build id read from the clean checkout, exactly - never "<tag>-dirty".
|
||||
./tools/buildid-check.ps1 -BuildDir out/app -Expected $env:FL_BUILD_ID
|
||||
if ($LASTEXITCODE -ne 0) { throw 'buildid-check over the published tree' }
|
||||
$size = (Get-ChildItem out/app -Recurse -File | Measure-Object Length -Sum).Sum / 1MB
|
||||
Write-Host ("published tree: {0:N0} MB" -f $size)
|
||||
|
||||
|
||||
@@ -28,6 +28,46 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **The engine version of Unity, Godot and RPG Maker games**, as Unreal Engine's has been shown since beta.10 — on the game's
|
||||
page with what it was read from, and the maker on the library card too: *Unity 2022.3.39f1* (from the player library,
|
||||
else its data file; a game whose data file is encrypted reads without the release letter, *2019.4.40*), *Godot 4.4.1*
|
||||
(from its data pack), *RPG Maker MZ 1.10.0* and *MV 1.6.2* (from the core script), *RPG Maker VX Ace (RGSS 3.0.1)*
|
||||
(from the runtime library its `Game.ini` names — that number is the library's, not the editor's). A Unity version used
|
||||
to read as its library's build number (`2022.3.39.5118735`), and a Godot one was never found. Every game is read once
|
||||
more after the update (detection rules `2026.10.2`). RPG Maker 2000/2003 is not recognised (`docs/05_DETECTION.md`
|
||||
§Engine version — Unity, Godot, RPG Maker).
|
||||
- **The Privacy Policy (version 2.8)** names the files those versions are read from, and two that were already read and
|
||||
never named (Unity's player library and an RPG Maker game's title); it is shown once for you to accept.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Change executable… opens in the game's own folder** — the install folder a store made (`steamapps\common\<game>`
|
||||
and the like), or above an Unreal game's `Binaries\Win64`, else the folder the executable is in — instead of wherever
|
||||
the last file dialog was. For a game whose folder is gone it opens at the nearest folder still there
|
||||
(`docs/08_UI.md` §Games).
|
||||
|
||||
### Fixed
|
||||
|
||||
- **An imported game is no longer one of its helpers, and an RPG Maker MV/MZ game behind a launcher is its runtime.**
|
||||
A Doll's Locket - Remake (itch) was added as `notification_helper.exe`, NW.js's notification helper, because the itch
|
||||
app's own record named only that file (it leaves out a launcher that asks for administrator and anything a folder
|
||||
deeper) and the import took it as the game. A helper named by the store is skipped now and the executable is guessed —
|
||||
the import list says so — and the guess takes the executable beside NW.js's `nw.dll` and `package.json`, the process
|
||||
that draws (`css\Game.exe` there; its launcher asks for administrator, so it is measured with *Run the agent as
|
||||
administrator* on). The import also no longer offers a store's game again when the library has it at another
|
||||
executable: an entry already there is re-pointed with *Change executable…* (`docs/05_DETECTION.md` §Library import).
|
||||
|
||||
## [0.1.0-beta.18] - 2026-10-07
|
||||
|
||||
**The eighteenth pre-release: every page readable in the dark theme, notices that say what happened in words, and a
|
||||
release whose build no longer calls itself dirty.** The same unsigned installer: verify its hash against
|
||||
`SHA256SUMS.txt`, then *More info → Run anyway*.
|
||||
|
||||
**Updating from `0.1.0-beta.17`:** Help ▸ Check for updates, then *Restart to update* with no game running. Nothing in
|
||||
the database changes and nothing is shown again for you to accept; sessions already stored keep their status.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Page titles and section headings read in the dark theme again.** Every page's title and its section headings — Dashboard,
|
||||
@@ -54,6 +94,16 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
- **A viewer over a copy leaves every agent setting alone.** The user-mode exception option, the three Recording numbers
|
||||
and the update channel stayed live in `--data-dir`, where no agent reads them (`ViewerModeTests`).
|
||||
- `docs/08_UI.md` listed a "PawnIO missing" banner that was never built; struck, with the banners that do exist.
|
||||
- **A release's overlay build no longer calls itself dirty.** The Dashboard read *Overlay build v0.1.0-beta.17-dirty* (and
|
||||
beta.16's, and every release's before): the release workflow writes the release date into the legal documents before
|
||||
the build, and the build id was read from the tree after that. It is read from the clean checkout first and handed to
|
||||
the build, and `tools/buildid-check.ps1` reads it back out of the published binaries (`docs/12_BUILD.md` §Release-time
|
||||
token substitution). Nothing changes for a game: both sides of the ring's handshake always carried the same id.
|
||||
- **Two end-to-end tests no longer fail CI by a race** (developers only). The Vulkan launch test asks the test harness
|
||||
whether this machine can present through Vulkan before it starts the capture host: on GitHub's runners the harness's
|
||||
own "skip" line never reached the host's output, and a scan of the exiting harness failed the test instead of skipping
|
||||
it. The target-exit test holds its harness 15 seconds instead of 6, the margin a slow runner's host needed
|
||||
(`docs/13_CI_CD.md`).
|
||||
|
||||
## [0.1.0-beta.17] - 2026-10-07
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ tools/ # accuracy-check, changelog-check, chokepoint-che
|
||||
# (+ license-overrides/), notice-check, package-closure-check,
|
||||
# release-notes, rules-validate, test-artifacts-check, vendor-exports,
|
||||
# versioninfo-check, vklayer-blastradius, fps-impact-runbook,
|
||||
# wiki-build (beta.17: builds and checks the wiki; the wiki-check gate)
|
||||
# wiki-build (beta.17: builds and checks the wiki; the wiki-check gate),
|
||||
# buildid-check (beta.18: the release's build id in the shipped natives)
|
||||
# (six names added 2026-10-04)
|
||||
# (PowerShell). This line used to name three, one of which
|
||||
# — resx-audit — ~~does not exist~~ exists since 2026-09-13 with
|
||||
|
||||
+8
-3
@@ -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.17.*
|
||||
*Beta software: this page describes version 0.1.0-beta.18.*
|
||||
|
||||
## Games it will not measure
|
||||
|
||||
@@ -117,8 +117,13 @@ shown is recorded too, from outside the game. ([Capture](docs/04_CAPTURE.md))
|
||||
|
||||
- The exact version is read for **Unreal Engine 4 and 5** games, from the game's executable file on disk.
|
||||
A studio can remove or rename what it is read from; then the page says the version was not found.
|
||||
**Unreal Engine 3 and older are not recognised.** Other engines show a version only where their files
|
||||
state one. ([Detection](docs/05_DETECTION.md))
|
||||
**Unreal Engine 3 and older are not recognised.**
|
||||
- Since beta.19 also **Unity**, **Godot** and **RPG Maker** (MV, MZ, XP, VX, VX Ace): from the engine's own files —
|
||||
Unity's player library or data file, Godot's data pack, RPG Maker's core script or the runtime library its `Game.ini`
|
||||
names. A Unity game whose data file is encrypted shows the version without its release letter (`2019.4.40`, not
|
||||
`2019.4.40f1`); an XP, VX or VX Ace game shows its runtime library's number, which is not the editor's.
|
||||
**RPG Maker 2000 and 2003 are not recognised.** Other engines show a version only where their files state one.
|
||||
([Detection](docs/05_DETECTION.md))
|
||||
|
||||
## Sensors
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ 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.17`** (2026-10-07), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.18`** (2026-10-07), 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
|
||||
@@ -63,8 +63,11 @@ pages.
|
||||
> swap chain; for every other session the window alone is read, and a window covering its monitor reads
|
||||
> *full-screen or borderless*. What Windows does behind the game (fullscreen optimizations) is not visible.
|
||||
> - **Engine version:** the exact Unreal Engine 4 or 5 version, read from the game's executable on disk and
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Other engines show what their own
|
||||
> files state.
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Since beta.19 also Unity's (from its
|
||||
> player library or its data file — without the release letter where only the library's number is readable),
|
||||
> Godot's (from its data pack) and RPG Maker's maker and version (MV and MZ from their core script; XP, VX and VX
|
||||
> Ace by their runtime library's version, which is not the editor's). RPG Maker 2000/2003 is not detected. Other
|
||||
> engines show what their own files state.
|
||||
> - **The game's own memory (since beta.12):** its dedicated and shared GPU memory and its private
|
||||
> working set — the numbers Task Manager's Details tab shows — with its working set and commit, read
|
||||
> once a second from Windows' own counters, from outside the game, in every session: a game
|
||||
@@ -163,7 +166,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
|
||||
|
||||
## Install
|
||||
|
||||
> **The latest pre-release is `v0.1.0-beta.17` (2026-10-07); before it `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.18` (2026-10-07); before it `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**.
|
||||
@@ -212,4 +215,4 @@ GPU telemetry is layered so the project never depends on a proprietary vendor li
|
||||
|
||||
---
|
||||
|
||||
**Status:** pre-release (beta). Seventeen 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). Eighteen 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.
|
||||
@@ -488,6 +488,12 @@ function Invoke-ProjectGates {
|
||||
Write-Step 'release-notes'
|
||||
Invoke-Checked 'release-notes (self-test)' { & (Join-Path $repo 'tools/release-notes.ps1') -SelfTest }
|
||||
|
||||
# beta.18: the build id a release hands CMake (read from the clean checkout before the date substitution edits
|
||||
# legal/*.md) is read back out of the published native binaries by release.yml. Self-test only here — the live
|
||||
# pass needs that id, which only a release has (12_BUILD §Release-time token substitution).
|
||||
Write-Step 'buildid-check'
|
||||
Invoke-Checked 'buildid-check (self-test)' { & (Join-Path $repo 'tools/buildid-check.ps1') -SelfTest }
|
||||
|
||||
# 09_I18N's gate, built with the first .resx family (P3 PR-2, 2026-09-13): every key in en/vi/ja, ja
|
||||
# Safety_* marked for human review, the generated accessor current. Self-test first (at least four
|
||||
# cases must go red), then the live pass; a tree with no family is red, not skipped.
|
||||
|
||||
+68
-4
@@ -143,12 +143,12 @@ Recorded as a residual risk, not as a solved problem.
|
||||
|
||||
| Engine | Signals | Version |
|
||||
|---|---|---|
|
||||
| Unity | `UnityPlayer.dll` sibling **or** `<Exe>_Data/` dir | FileVersion of `UnityPlayer.dll` |
|
||||
| Unity | `UnityPlayer.dll` sibling **or** `<Exe>_Data/` dir | `unity_build` (since 2026-10-12, §Engine version — Unity, Godot, RPG Maker): the player library's ProductVersion, the data file's header, the library's numeric version. ~~FileVersion of `UnityPlayer.dll`~~ — the string as it is, `2022.3.39.5118735`, the build number where the release letter belongs |
|
||||
| Unreal 4/5 | exe matches `*-Win64-Shipping.exe` **or** `*/Content/Paks/*.pak` | `unreal_build` (since 2026-09-27, §Engine version): the shipping executable's numeric file version and the engine's branch name inside it. ~~ProductVersion regex `\+\+UE(4\|5)\+Release-(\d+\.\d+)`~~ — two capture groups, of which the evaluator returns the first, so every Unreal version it ever stored was a bare `4` or `5` |
|
||||
| Godot | `.pck` sibling **or** `strings_contains("Godot Engine v")` | strings regex `Godot Engine v(\d+\.\d+[\.\d]*)` |
|
||||
| Godot | `.pck` sibling **or** `strings_contains("Godot Engine v")` | `godot_build` (since 2026-10-12): a data pack's header, beside the executable or appended to it. ~~strings regex `Godot Engine v(\d+\.\d+[\.\d]*)`~~ — the string sits 57–78 MB into a real export, past the 8 MiB scan, so it never read one |
|
||||
| GameMaker | `data.win` | `N/A` |
|
||||
| RPG Maker MV/MZ | `nw.dll` **and** `package.json` siblings (since 2026-09-16) | `N/A` — the `.js` header needs a `from` that `strings_regex` lacks |
|
||||
| RPG Maker XP/VX/VX Ace | `RGSS1*`/`RGSS2*`/`RGSS3*.dll` sibling **or** a `*.rgssad`/`*.rgss2a`/`*.rgss3a` archive (since 2026-09-16) | `N/A` — one rule, the variant unnamed |
|
||||
| RPG Maker MV/MZ | `nw.dll` **and** `package.json` siblings (since 2026-09-16) | `rpgmaker_build` (since 2026-10-12): the core script's header, which also names the maker (MZ or MV). ~~`N/A` — the `.js` header needs a `from` that `strings_regex` lacks~~ |
|
||||
| RPG Maker XP/VX/VX Ace | `RGSS1*`/`RGSS2*`/`RGSS3*.dll` sibling **or** a `*.rgssad`/`*.rgss2a`/`*.rgss3a` archive (since 2026-09-16) | `rpgmaker_build` (since 2026-10-12): the RGSS library `Game.ini` names — its generation names the maker (XP, VX, VX Ace), its version is the library's. ~~`N/A` — one rule, the variant unnamed~~ |
|
||||
| RE Engine (Capcom) | `re_chunk_000.pak` sibling, the exact name (since 2026-09-23) | `N/A` |
|
||||
| FromSoftware | a `*.bhd` **and** a `*.bdt` sibling (since 2026-09-23) | `N/A` |
|
||||
| Ren'Py | `renpy/` dir **or** `*.rpa` | ~~`renpy/__init__` strings / `log.txt` first line~~ `N/A` *(corrected 2026-10-04: no extractor — `strings_regex` reads only the executable)* |
|
||||
@@ -246,6 +246,47 @@ numbered release lines to report. A version the user typed is never overwritten
|
||||
`2026.09.6` change the key, so every library entry is read again once; schema 0015 removes the bare `4`/`5` the old rule
|
||||
wrote, where detection wrote it.
|
||||
|
||||
### Engine version — Unity, Godot, RPG Maker (beta.19, 2026-10-12, rules 2026.10.2)
|
||||
|
||||
The owner asked for the version of RPG Maker, Unity and Godot games ("if possible"). What the rules gave: Unity's
|
||||
`pe_file_version` stored `UnityPlayer.dll`'s FileVersion string as it is (`2022.3.39.5118735`, the build number where the
|
||||
release letter belongs); Godot's `strings_regex` scanned the executable's first 8 MiB, and in both Godot exports on the
|
||||
owner's disk the `Godot Engine v…` string sits 57–78 MB in, so it never read one; both RPG Maker rules had `version: null`.
|
||||
**Measured before anything was written, read-only, on 23 installs** (`spike-notes` §17), and decided in code as Unreal's
|
||||
is — three extractor types that take no parameter (`unity_build`, `godot_build`, `rpgmaker_build`; the schema's enum),
|
||||
one second read by `StaticGameDetector` for the engine that matched, a decider in `Domain.Detection` and the witness in
|
||||
`games.engine_version_source`:
|
||||
|
||||
| Engine | Witness, strongest first | Source id | On the owner's disk |
|
||||
|---|---|---|---|
|
||||
| Unity | `UnityPlayer.dll`'s ProductVersion is an editor version (`2022.3.39f1 (4e1b…)` → `2022.3.39f1`) | `unity_player` | 13 of 15 |
|
||||
| | the header of `<Game>_Data\globalgamemanagers` (first 256 bytes) names one | `unity_data` | A Space for the Unbound, 2019.4.1f1 |
|
||||
| | the library's numeric file version, MAJOR.MINOR.PATCH and no release letter — Unity's own binary, so the engine's, only shorter | `unity_player_file` | GIRLS' FRONTLINE 2 (data file encrypted), 2019.4.40 |
|
||||
| Godot | the 20-byte header of the data pack beside the executable (`<exe>.pck`, else the only `.pck` there): `GDPC`, format, MAJOR, MINOR, PATCH | `godot_pck` | both: 4.2.2, 4.4.1 |
|
||||
| | the same header of a pack appended to the executable, found through its 12-byte trailer (size + `GDPC`) | `godot_pck_embedded` | none (synthetic files only) |
|
||||
| | the executable's ProductVersion while its ProductName is still `Godot Engine` (a project that set its own carries the game's: 衔蝶 `0.1.0.3`) | `godot_exe` | — |
|
||||
| RPG Maker MV/MZ | line 2 of the core script: `js/rmmz_core.js` → MZ, `www/js/rpg_core.js` or `js/rpg_core.js` → MV (first 4 KiB) | `rpgmaker_mz_core`, `rpgmaker_mv_core` | MZ 1.10.0; MV 1.6.2, 1.6.2, 1.6.1 |
|
||||
| RPG Maker XP/VX/VX Ace | the RGSS library `Game.ini`'s `Library=` names: RGSS1 → XP, RGSS2 → VX, RGSS3 → VX Ace; its numeric version when it is its generation's, else the one its name carries (`RGSS301` → 3.0.1) | `rgss1_library`, `rgss2_library`, `rgss3_library` | VX Ace 3.0.1, twice |
|
||||
|
||||
A Godot version leaves out a zero patch, as Godot names its releases (4.3, 4.2.2). The App names the maker from the
|
||||
witness — the two RPG Maker rules each cover several makers — and says that an RGSS number is the runtime library's, not
|
||||
the editor's: *RPG Maker MZ 1.10.0*, *RPG Maker VX Ace (RGSS 3.0.1)* (`Formats.Engine(id, source)`,
|
||||
`Formats.EngineWithVersion`); the game page's *Engine version* row says what each version was read from, and *Not found in
|
||||
the game's files* once the sweep has read a row of these engines and found none.
|
||||
|
||||
**Where it is read.** Beside the row's executable first: `UnityPlayer.dll` (else the shallowest one the walk listed) and
|
||||
`<exe>_Data` (else a `*_Data` beside that player); `<exe>.pck`. RPG Maker's files are looked for beside the executable and
|
||||
up to two folders above it, as `RpgMakerTitle` already looked for a title — a launcher-fronted game keeps its runtime in
|
||||
a subfolder (A Doll's Locket's `css\`, HELLO, HELLO WORLD!'s `swiftshader\`); a `Library=` that points outside the ini's
|
||||
folder is named and not read. Version resources and at most a few kilobytes of any file; the whole detection of one entry
|
||||
measured 24 ms to 4.1 s on the owner's USB drive, nearly all of it the install's walk, once per executable and rules
|
||||
version. The Privacy Policy says so since 2.8 (§4).
|
||||
|
||||
**What it is not.** RPG Maker 2000/2003 is not detected at all (no install to measure, no rule). XP and VX libraries are
|
||||
read by the VX Ace rule's reader unmeasured. A Unity build older than 2019 keeps its player in the executable (no
|
||||
`UnityPlayer.dll`): its data file's header is the only witness. Rules `2026.10.2` change the detection key, so every
|
||||
library entry is read again once; a Unity row keeps the old raw string only if none of its witnesses can be read now.
|
||||
|
||||
### Platform signatures & metadata
|
||||
|
||||
| Platform | Signals | Metadata |
|
||||
@@ -293,6 +334,29 @@ wrote, where detection wrote it.
|
||||
> is fetched (CLAUDE.md rule 8's "opt-in store metadata" is the online lookup, which does not exist). First-run
|
||||
> step 4 now points at File ▸ Import library… rather than saying "later build".
|
||||
|
||||
> **beta.19 (owner report 2026-10-12): a store's own pick can be a helper, and a launcher is not the game.** The owner's
|
||||
> A Doll's Locket - Remake (itch 5085165, RPG Maker MZ) was imported as `Dolls Locket\notification_helper.exe` — NW.js's
|
||||
> toast helper. The pick was **butler's verdict**, taken as is: butler stores a *filtered* verdict (the shallowest
|
||||
> candidates, minus those whose manifest asks for elevation) and does not rank what is left, and on that install the
|
||||
> 213 MB `DollsLocket.exe` launcher asks for administrator while the NW.js runtime sits a level deeper in `css\`, so the
|
||||
> helper was the whole verdict (read from the owner's `butler.db`, read-only). Three changes:
|
||||
> **(1)** a verdict candidate whose whole name is a runtime helper (`ExecutableLocator.RuntimeHelperNames`:
|
||||
> `notification_helper`, `crashpad_handler`, `UnityCrashHandler64/32`, `CrashReportClient`, NW.js's `nwjc` and
|
||||
> `chromedriver`) or that sits in a Unity plugin folder is skipped, and with nothing left the locator guesses and the
|
||||
> review marks the row *guessed* — whole names, because the locator's fragments are inside real games' names (`node` in
|
||||
> *Nodebuster*) and a store's pick is overruled only when it cannot be the game; the locator's `HelperFragments` gain the
|
||||
> same three NW.js names. **(2)** The locator ranks **an executable beside `nw.dll` + `package.json`** — the `rpgmaker_mv`
|
||||
> rule's own signal — as an NW.js runtime (owner decision D56), below the Unity and Unreal layouts (an NW.js folder can
|
||||
> be a tool shipped beside such a game) and above a name match (the launcher in front of the runtime is named after the
|
||||
> install): the install's guess is `css\Game.exe`, the process that draws, as D28 pointed HELLO, HELLO WORLD!'s entry at
|
||||
> its runtime by hand. That runtime starts elevated (its launcher asks for administrator), so it is measured with the
|
||||
> admin mode on (D34). **(3)** Discovery matches a store title to an entry by **platform + store id** as well as by
|
||||
> path: the entry an earlier import made at another executable is "already in the library" (the log names its path),
|
||||
> so a corrected guess never adds the same game a second time — that entry is re-pointed with Change executable…, and
|
||||
> nothing rewrites it by itself (D25/D27). Tests: `ExecutableLocatorTests.AnNwjsRuntimeBeatsTheLauncherNamedAfterTheInstallAndItsHelpersAreDropped`,
|
||||
> `StoreLibrarySourcesTests.ItchSkipsAVerdictCandidateThatIsARuntimeHelper` (the verdict as stored),
|
||||
> `LibraryImporterTests.AStoreTitleAlreadyInTheLibraryAtAnotherExecutableIsNotOfferedAgain`.
|
||||
|
||||
**Publisher/version order:** store manifest → PE `CompanyName`/`ProductVersion` → *(opt-in)* Steam `appdetails` lookup, cached 7 days. *(Since beta.8 the PE versions are stored beside the store's rather than instead of it — §What the files say about themselves; the page labels a store's value with its store, "Steam build 20374416".)*
|
||||
|
||||
## Capability hints (explicitly labelled as such)
|
||||
|
||||
@@ -47,8 +47,10 @@ CREATE TABLE games (
|
||||
store_id TEXT,
|
||||
engine TEXT, engine_version TEXT,
|
||||
-- (schema 0015, ALTERed last) engine_version_source TEXT: where engine_version came from — a
|
||||
-- Domain.Detection.EngineVersionSource id (unreal_branch_file | unreal_branch | unreal_file_version, or the rule's
|
||||
-- extractor type); NULL for a version the user typed. Written with the version only (05_DETECTION §Engine version)
|
||||
-- Domain.Detection.EngineVersionSource id (unreal_branch_file | unreal_branch | unreal_file_version; since beta.19
|
||||
-- unity_player | unity_data | unity_player_file | godot_pck | godot_pck_embedded | godot_exe | rpgmaker_mz_core |
|
||||
-- rpgmaker_mv_core | rgss1_library | rgss2_library | rgss3_library — the RPG Maker ids also name the maker; or the
|
||||
-- rule's extractor type); NULL for a version the user typed. Written with the version only (05_DETECTION §Engine version)
|
||||
publisher TEXT, game_version TEXT,
|
||||
cover_path TEXT, notes TEXT,
|
||||
removed_at INTEGER, -- schema 0002 (P3 PR-3): FR-1.4 "remove, keep sessions" — the row stays
|
||||
|
||||
+11
-1
@@ -299,7 +299,10 @@ All screens are `Page`s registered with the navigation page provider and navigat
|
||||
> fields), **the row's executable path under the subtitle and Change executable… since 2026-09-21** (a store import
|
||||
> guesses the executable and everything downstream is keyed on it; the pick re-points the row, which comes back
|
||||
> hooking-off and unconsented like a new game, consent revoked over the pipe first, a block never cleared —
|
||||
> `05_DETECTION` §Library import), **one App per data folder since 2026-09-21** (`Services.SingleInstance`: a named mutex and a named event keyed on a hash of the data directory, claimed in `Program.Main` after Velopack's hooks and before any window; a later start sets the event and exits 0, and the first instance brings its window forward through `ShellHost.Reveal` — from the tray too. Nothing stopped a second App before: the owner's log shows two started 360 ms apart, two tray icons, a second log file. `--diag` never claims), ~~**the guard-bypass switch since 2026-09-21**~~ **withdrawn 2026-09-22** (the card, its dialog, the session mark and the export line are gone; a blocked row's toggle is disabled and `Safety_Blocked_Toggle_Format` is the whole story; a refusal or unhook notice that turned hooking off ends with `Safety_HookingTurnedOff` — `19_SAFETY` §What a finding does to the game), **Supports** (from `capability_flags`; ~~empty until P4's scan writes it, and the card says so~~ **written by the Agent's detection sweep since P4 PR-1, 2026-09-14** — the rule ids as product names via `CapabilityNames`, "not scanned yet" only until the Agent's next tick) beside
|
||||
> `05_DETECTION` §Library import; **since beta.19 the file dialog opens in the game's own folder** — `GameFolder.StartFolder`:
|
||||
> the store boundary's install folder (`InstallRoot`), an Unreal package's root above `<Project>\Binaries\Win64`, else
|
||||
> the executable's folder, and the nearest folder still there when that one is gone; nothing for a drive that is not
|
||||
> connected, where Windows opens its last folder; owner request 2026-10-12, `GameFolderTests`), **one App per data folder since 2026-09-21** (`Services.SingleInstance`: a named mutex and a named event keyed on a hash of the data directory, claimed in `Program.Main` after Velopack's hooks and before any window; a later start sets the event and exits 0, and the first instance brings its window forward through `ShellHost.Reveal` — from the tray too. Nothing stopped a second App before: the owner's log shows two started 360 ms apart, two tray icons, a second log file. `--diag` never claims), ~~**the guard-bypass switch since 2026-09-21**~~ **withdrawn 2026-09-22** (the card, its dialog, the session mark and the export line are gone; a blocked row's toggle is disabled and `Safety_Blocked_Toggle_Format` is the whole story; a refusal or unhook notice that turned hooking off ends with `Safety_HookingTurnedOff` — `19_SAFETY` §What a finding does to the game), **Supports** (from `capability_flags`; ~~empty until P4's scan writes it, and the card says so~~ **written by the Agent's detection sweep since P4 PR-1, 2026-09-14** — the rule ids as product names via `CapabilityNames`, "not scanned yet" only until the Agent's next tick) beside
|
||||
> **Last session measured** (upscaler · resolution, frame generation, the non-N/A chips — accent pills, from the
|
||||
> hooks). Hooking: the toggle is `OneWay` from the row and its command runs `HookingConsent`; a refusal, a
|
||||
> mismatch or a failure is a persistent `InfoBar` on the page (never a toast); a blocked row disables the
|
||||
@@ -374,6 +377,13 @@ All screens are `Page`s registered with the navigation page provider and navigat
|
||||
> `FormatsTests`, and the page renders in `PagesLoadTests`. **The Details card's *NVIDIA App override* row** (same day)
|
||||
> is the newest session that read a driver profile, in the same words; no row where none did. Tests:
|
||||
> `NvidiaOverridesTests`, `GameDetailViewModelTests.TheDetailsCardNamesTheNvidiaAppsOverridesFromTheNewestSessionThatReadThem`.
|
||||
> **The *Engine* row carries the version, and an *Engine version* row says what it was read from** (beta.10 for Unreal;
|
||||
> beta.19 for Unity, Godot and RPG Maker — `05_DETECTION` §Engine version): the player library, the data file's header, a
|
||||
> data pack, a core script or the RGSS library `Game.ini` names, and *Not found in the game's files* once the Agent has
|
||||
> read such a title and found none. RPG Maker's witness names the maker on the page, the subtitle and the library card
|
||||
> (*RPG Maker MZ 1.10.0*, *RPG Maker VX Ace (RGSS 3.0.1)*; `Formats.Engine(id, source)`). Tests:
|
||||
> `GameDetailViewModelTests.TheDetailsCardSaysWhatAUnityGodotOrRpgMakerVersionWasReadFrom`,
|
||||
> `FormatsTests.TheVersionsWitnessNamesTheMakerAndRgssSaysWhoseNumberItIs`.
|
||||
- Tabs (WPF `TabControl`, Fluent-styled):
|
||||
1. **Sessions** — `DataGrid`: date, duration, **tier badge (T1/T2)**, Native, Displayed, FG×, 1% Low, 0.1% Low, resolution + upscaler, max GPU temp, API, chips, ⚠ crash badge, tags. Row → Session summary. ~~Multi-select → "Compare".~~ (not built; Compare's own picker chooses) Tier-2 rows render ~~`—`~~ `N/A` (not blank, not zero) in Tier-1-only columns, with a tooltip explaining why *(corrected 2026-10-04: as built — `—` means a measured none, §FPS display rule)*.
|
||||
2. **Frametime** — ScottPlot timeline of selected session (decimated), stutter markers, sensor overlay toggle (temp on right axis).
|
||||
|
||||
@@ -272,6 +272,16 @@ substitutes it with ~~the tag date~~ the run's UTC date (corrected 2026-10-04) w
|
||||
address — is resolved in the source files, because an unsubstituted token in a
|
||||
document the app displays for acceptance (FR-11) is a defect, not a template.
|
||||
|
||||
**The build id is read before it (beta.18).** The substitution edits tracked files, and the native build id is
|
||||
`git describe --dirty` at CMake's configure (`src/native/FrameLedger.Shm/CMakeLists.txt`): every release until beta.18
|
||||
shipped `<tag>-dirty` — the owner's Dashboard read *Overlay build v0.1.0-beta.17-dirty*, and that run's log printed
|
||||
`FL_BUILD_ID = v0.1.0-beta.17-dirty` two lines after `RELEASE_DATE = 2026-10-07 in 3 file(s)`. `release.yml` now reads
|
||||
describe from the clean checkout first, refuses one that is already dirty or longer than 31 characters, and passes it
|
||||
as the environment's `FL_BUILD_ID`, which CMake takes as given (checked for the characters a C string literal carries);
|
||||
after the publish, `tools/buildid-check.ps1` reads it back out of the four native binaries that compile it, by their
|
||||
bytes — nothing is loaded. A developer's build still runs describe itself (`+` marks a dirty tree when the long form
|
||||
would not fit).
|
||||
|
||||
## Local quality gate (pre-push)
|
||||
|
||||
`./build.ps1 check`:
|
||||
@@ -301,6 +311,7 @@ Seven self-test cases, both directions; `./tools/notice-check.ps1 -Fix` writes a
|
||||
13d. **`tools/wiki-build.ps1 -SelfTest`, then `-Check`** (beta.17, owner decisions D53/D54, 2026-10-07) — assembles the GitHub Wiki from `wiki/`, `guide/` and `LIMITATIONS.md` into a temporary folder, as `wiki.yml` does at a release (`13_CI_CD` §wiki.yml), and fails on a link to a file, folder or section that does not exist, two sources for one page, a page that neither Home nor the sidebar leads to, a sidebar that lists the guide in another order than `guide/README.md`, a backticked repository path in a `wiki/` page that names nothing, and a version number written into a `wiki/` page (the footer says which release the wiki shows). Nine self-test cases, both directions
|
||||
14. `tools/changelog-check.ps1 -SelfTest` — nine cases, five expected RED. The live half needs a pull request's changed-file list and is supplied by `ci.yml`
|
||||
14b. `tools/release-notes.ps1 -SelfTest` — five cases over a fixture changelog (a dated and an undated section, a missing one, a prefix that must not match, an empty one). The live half needs a tag's version and runs in `release.yml`, where a missing or empty section is a red release (P4 PR-5)
|
||||
14c. **`tools/buildid-check.ps1 -SelfTest`** (beta.18) — eight cases, both directions: a binary built from a dirty tree (`-dirty`, or the short form's `+`), one with no id, a missing one, and an expected id that is dirty or not an id are red. The live half needs the release's clean-checkout id and runs in `release.yml` over the published tree (§Release-time token substitution)
|
||||
15. `tools/resx-audit.ps1` — ~~**skipped loudly; it does not exist, and no `.resx` file does either**~~ **built 2026-09-13 (P3 PR-2)**: `-SelfTest` first (11 fixture cases, both directions), then the live pass over every `Strings.resx` family under `src/` — key sets equal across en/vi/ja, `Safety_*` in `ja` marked for review or signed, `Strings.Designer.cs` current with `tools/resx-gen.ps1`. A tree with no family is red (`09_I18N` §Translation workflow)
|
||||
16. **struct-mirror** — reads this run's `.trx` and fails when `ShmLayoutMirrorTests` did not execute, so deleting the mirror test is red as well as breaking it
|
||||
16b. **`tools/test-artifacts-check.ps1`** — `-SelfTest` first (seven cases, two RED), then live: an `overlay-*.log` created since this gate started, still in the real `%LOCALAPPDATA%\FrameLedger\logs` after the tests, whose first line names a `hook-harness*` image, fails the gate. It is what makes a test binary without its log sweep red (`17_HOOK_ENGINE` §Native logging, 2026-09-15); a game's log never counts
|
||||
|
||||
@@ -52,6 +52,17 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
case. `Kill` now waits for exit (bounded, asserted) and the delete retries. Not §S19(b) either — a test-harness
|
||||
race, and the third flake shape of the day (the registry-subtree race between `VkLayerRegistrationTests` and the
|
||||
GOG reader's test, fixed in #188) was the same kind.
|
||||
- **Two more on 2026-10-07 (beta.18), both re-run green and then fixed the same day.**
|
||||
`WhenTheTargetExitsTheHostStopsAndSaysWhy` ended **`TargetNotRunning`** (#286, run 37619719203): the host resolves its
|
||||
target once, as it starts, and a host slower than the harness's 6 s hold found it gone — the shape recorded since
|
||||
2026-09-21. The hold is 15 s: a margin, not a signal, because the host prints nothing until its session ends.
|
||||
`LaunchModeOnAVulkanTargetAttachesToTheLayersRingAndInjectsNothing` ended **`RefusedByGuard` / `ModuleScanFailed`**
|
||||
(#288, run 37627351438): the hosted runner has the Vulkan loader and no device, so the harness exits 77 with a
|
||||
`[SKIP]` line — but the runner is elevated, the host starts the harness through `CreateProcessWithTokenW`
|
||||
(`UnelevatedProcess`), the child gets no stdout, and the line never reached the host's output; the test then
|
||||
depended on the session reading `LaunchTargetExited`, and a scan that hit the dying harness failed it instead. The
|
||||
test now asks the harness directly, before the host runs (exit 77 = skip, with the harness's own line); hiding the
|
||||
Vulkan ICDs from that probe makes it skip in under a second, and on a machine with a device it runs in full.
|
||||
- **A re-run ERASES the evidence, which is why the count above had to be kept by hand.**
|
||||
`gh run rerun --failed` updates the original run's conclusion, so `gh run list` showed **18 success, 1
|
||||
cancelled, 0 failed** across the twenty runs that contained all three failures above. Anyone measuring
|
||||
@@ -127,6 +138,10 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
`VERSION` file (`12_BUILD` §Version); and `CHANGELOG.md` must carry a **non-empty** `## [x.y.z]` section for the
|
||||
full version, extracted by `tools/release-notes.ps1` (self-tested on every `build.ps1 check`). A missing
|
||||
section is a red release, not an empty note — the ledger's header said the opposite for five weeks.
|
||||
- **The build id from the clean checkout** (beta.18): `git describe --always --dirty --abbrev=12` before anything edits a
|
||||
tracked file — a dirty one or one over 31 characters stops the run — into `FL_BUILD_ID` for CMake. Until beta.18 the
|
||||
substitution below ran first and every release's natives called themselves `<tag>-dirty` (`12_BUILD` §Release-time
|
||||
token substitution).
|
||||
- `{{RELEASE_DATE}}` substituted in `legal/*.md` with the run's UTC date **before the build**, because the App
|
||||
embeds those documents (FR-11); any `{{` token left anywhere after that fails the job.
|
||||
- **The identical gate** — `./build.ps1 check`, native first, every tool including `versioninfo-check` against
|
||||
|
||||
+51
-3
@@ -1410,9 +1410,11 @@ stops there"~~ — the override itself is gone since 2026-09-22 (D22).
|
||||
**Found and NOT fixed — each needs its own PR.**
|
||||
- ~~**A refused session is not recorded, though the notice says it is.**~~ **Fixed 2026-09-22 (D23):** the loop holds a
|
||||
refused session open until the target exits, so Tier 2 has a producer and the sentence is true for every refusal.
|
||||
- **A released Overlay logs its build as `v0.1.0-beta.3-dirty`**: the CI checkout is dirty by the time CMake runs
|
||||
- ~~**A released Overlay logs its build as `v0.1.0-beta.3-dirty`**: the CI checkout is dirty by the time CMake runs
|
||||
`git describe`. Both sides of the handshake compile the same string, so nothing breaks; it is a release that calls
|
||||
itself dirty.
|
||||
itself dirty.~~ **Fixed 2026-10-07 (beta.18 PR-3):** the dirt was `release.yml`'s own date substitution in
|
||||
`legal/*.md`; the workflow reads describe from the clean checkout before it and hands it to CMake as `FL_BUILD_ID`,
|
||||
and `tools/buildid-check.ps1` reads it back out of the published binaries (`12_BUILD` §Release-time token substitution).
|
||||
- ~~**An install over a running Agent half-replaces the folder** (three failed starts, `Microsoft.Data.Sqlite` not
|
||||
found).~~ **A GUESS, WITHDRAWN the same evening, and it had already been published in beta.4's notes.** Nothing was
|
||||
installed between the failures (20:59–21:01) and the start that worked (21:02); the PC had been restarted at 20:57
|
||||
@@ -2039,7 +2041,7 @@ added.*
|
||||
- **The desktop app forbids polling CI** (no `gh` loop, Monitor or ScheduleWakeup): it wakes the session on a failure, a
|
||||
conflict or a review comment, never on green, so a green PR waits for the owner's word or the owner's auto-merge.
|
||||
|
||||
## **START HERE** — 2026-10-07, 0.1.0-beta.17: text that follows a theme switch, scroll bars hidden everywhere, a wiki
|
||||
## ~~**START HERE**~~ — 2026-10-07, 0.1.0-beta.17: text that follows a theme switch, scroll bars hidden everywhere, a wiki *(struck 2026-10-07: the head is §beta.18 below)*
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.17]`; this is what no other file carries. The owner's report (2026-10-07, three
|
||||
screenshots of beta.16): Settings' descriptions kept the old theme's colour after a switch; the Dashboard kept its
|
||||
@@ -2082,6 +2084,45 @@ release.*
|
||||
|
||||
**Owner-only, added to the list below:** item 13.
|
||||
|
||||
## **START HERE** — 2026-10-07, 0.1.0-beta.18: page titles readable in the dark theme, notices in words, a clean build id
|
||||
|
||||
*Status is `CHANGELOG.md` `[0.1.0-beta.18]`; this is what no other file carries. The owner's report (2026-10-07, five
|
||||
screenshots of beta.17 in the dark theme): every page's title and section headings near-black on the dark window — and
|
||||
the two chips beta.17 left (§beta.17, "Found while writing the guide"). Three stacked PRs — #286 the page text, #287
|
||||
the notices and the rest of that list, #288 the release build id — then the release.*
|
||||
|
||||
**No new decisions.** The train is the owner's request of 2026-10-07 ("beta18 with the two chip tasks, and the text that
|
||||
blends into the background in dark mode").
|
||||
|
||||
**Traps met on the way:**
|
||||
|
||||
- **A page in the `NavigationView` inherits nothing.** `NavigationViewContentPresenter` is a `Frame`, and a Frame sets
|
||||
`InheritanceBehavior.SkipToAppNow`; WPF UI 4.3.0 makes the TextBlock default black. A page on screen during a theme
|
||||
switch takes the window's new colour through the switch and a page navigated to afterwards does not, so it came and
|
||||
went. Every check before hosted pages straight in a window and measured a page the App never draws — host a page in the
|
||||
presenter (`PagesLoadTests.Hosted`, `16_WPFUI_SYNTAX` §Gotchas).
|
||||
- **The accent is not in the theme dictionary.** WPF UI writes it into `Application.Resources` at every
|
||||
`ApplicationThemeManager.Apply(…, updateAccent: true)`; a test that swaps only the dictionary measures the other theme's
|
||||
accent (`Visuals.UnderTheme` derives it as the App does; `systemAccentColor: true` reads the machine's own palette).
|
||||
- **The gate's own refusals look like findings on the wire.** `HookedCaptureGate` puts a label ("kill switch", "previously
|
||||
blocked") where a family goes; whatever reads a family as "an anti-cheat was found" asks the end reason first. A test
|
||||
of what the user reads builds the event as the Agent does (`NoticesFromTheAgentTests`), never by hand — the
|
||||
hand-written events were why every notice test was green.
|
||||
- **`Safety_Consent_*` strings are versioned with the consent disclosure** (`SafetyDisclosure`): a message that is wrong
|
||||
on one path gets a key of its own rather than a changed meaning.
|
||||
- **A release's natives were `-dirty` by the release's own hand:** its date substitution edits `legal/*.md` before CMake
|
||||
reads describe. The id is read first, handed in, and read back out of the binaries (`tools/buildid-check.ps1`).
|
||||
- **Met again:** `CaptureHostEndToEndTests.WhenTheTargetExitsTheHostStopsAndSaysWhy` (`TargetNotRunning` on a slow
|
||||
runner) failed #286's first CI run; the job was re-run. **And a new one** failed #288's:
|
||||
`…LaunchModeOnAVulkanTargetAttachesToTheLayersRingAndInjectsNothing`. A hosted runner has the Vulkan loader and no
|
||||
device, so the harness exits 77 with a `[SKIP]` line — but the runner is elevated, the launch goes through
|
||||
`CreateProcessWithTokenW` (`UnelevatedProcess`), the child inherits no stdout, and the line never reaches the host's
|
||||
output; when the guard's scan hits the exiting harness (`ModuleScanFailed`) the test fails instead of skipping. Re-run;
|
||||
~~the deterministic fix is a task of its own~~ fixed the same day by beta.18 PR-5 (the test asks the harness itself,
|
||||
before the host runs), which also gave the `TargetNotRunning` case a 15 s hold (`13_CI_CD` §ci.yml).
|
||||
|
||||
**Owner-only, added to the list below:** item 14.
|
||||
|
||||
## Owner-only — no PR can close these
|
||||
|
||||
1. **§S23-2 — branch protection.** `Rules / validate` is not a required status check on
|
||||
@@ -2177,6 +2218,13 @@ release.*
|
||||
halves and a footer naming `v0.1.0-beta.17` — then tick *Restrict editing to collaborators only* (Settings ▸ General
|
||||
▸ Features ▸ Wikis), or anyone can change a page until the next release overwrites it. (e) The `ja` strings marked
|
||||
`review`.
|
||||
14. ~~**beta.18 on real hardware.**~~ **Passed 2026-10-08** — the owner ran it on real hardware and reported it OK ("Đã
|
||||
test và ok"). *(The item as written:)* (a) **The dark theme:** every page's title and section headings — Dashboard, Games, a
|
||||
game's page, Compare, Settings, Logs — read light on the dark window, after starting in Dark, after Light → Dark, and
|
||||
after moving between pages. (b) **The overlay build** on the Dashboard's *Capture agent* card reads `v0.1.0-beta.18`,
|
||||
without `-dirty`. (c) **Disable all hooking:** turning it on says a game being measured stops within 30 seconds; with
|
||||
it on, a hooked game's notice reads "All hooking is switched off in Settings, so nothing was measured." (d) The `ja`
|
||||
strings marked `review`, `Safety_Unhooked_Unnamed_Format` among them.
|
||||
|
||||
**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
|
||||
|
||||
@@ -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.8 of the Privacy Policy changed (0.1.0-beta.19)
|
||||
|
||||
§4 names the version marks an engine keeps in its own files, read to show a Unity, Godot or RPG Maker game's engine
|
||||
version (beta.19 PR-3, owner request 2026-10-12): Unity's player library (its version information) and the header of its
|
||||
data file, the header of a Godot data pack, an RPG Maker game's core script and `Game.ini` and the library `Game.ini`
|
||||
names. Two of them were read before and never stated: the version information of `UnityPlayer.dll` (the Unity rule's
|
||||
extractor since the detection rules began) and an RPG Maker MV/MZ game's title in `data/System.json`, which the App reads
|
||||
to name a game added by hand (since 2026-09-23). Nothing here leaves your device, as before.
|
||||
|
||||
### What version 2.7 of the Privacy Policy changed (0.1.0-beta.14)
|
||||
|
||||
§4 says two things the software reads to tell a crash from an ordinary exit: the crash reports Windows keeps in its
|
||||
|
||||
@@ -2633,3 +2633,34 @@ from this PR's build):**
|
||||
refused, and the private working set then reads N/A), AMD and Intel GPUs, a laptop with two adapters (the reader sums
|
||||
every adapter's instances for the pid), and a real game — the owner's beta.12 check (HANDOFF owner-only item 9) compares
|
||||
a session's figures with Task Manager's Details tab at the same moment.
|
||||
|
||||
## 17 · Unity, Godot and RPG Maker versions in installed games *(2026-10-12, beta.19)*
|
||||
|
||||
Measured read-only on the owner's machine (i7-14700KF, RTX 5080, Windows 11 29648) before the readers were written:
|
||||
every `UnityPlayer.dll`, `*.pck`, `rmmz_core.js`, `rpg_core.js` and `RGSS*.dll` up to five levels under `D:\another`
|
||||
(GOG, itch and loose installs), `D:\SteamLibrary\steamapps\common`, Steam's own `common` and `G:\` — 23 installs, read in
|
||||
9.6 s. Then again through the shipped pipeline (`StaticGameDetector` over `GameFileProbe`, rules `2026.10.2`), which read
|
||||
every install as tabled. Nothing was copied or written; the decision rules are in `05_DETECTION` §Engine version — Unity,
|
||||
Godot, RPG Maker.
|
||||
|
||||
| Engine | Installs | What the files say | Read as (shipped) | Detect time |
|
||||
|---|---|---|---|---|
|
||||
| Unity 2020+ | DONT GO, Dialoop, Broken Shell Demo, Deadly Heart Gambit, DreadFields, Kemono Teatime, March Out!, Umamusume, Walto, Yasha, Yu-Gi-Oh! Master Duel, 帰路, Legends of Runeterra | `UnityPlayer.dll` ProductVersion `2022.3.39f1 (4e1b0f82c39a)` … `6000.3.17f1 (cf0352b38e81)`; FileVersion `2022.3.39.5118735` (the build number where the release letter belongs) | the ProductVersion's editor version (`unity_player`) | 26 ms – 4.1 s |
|
||||
| Unity 2019.4 | A Space for the Unbound - Prologue (GOG) | ProductVersion = FileVersion `2019.4.1.15122501`; `*_Data/globalgamemanagers` byte 20: `2019.4.1f1` | `2019.4.1f1` (`unity_data`) | 102 ms |
|
||||
| Unity 2019.4 | GIRLS' FRONTLINE 2: EXILIUM | ProductVersion `2019.4.40.16762411`; the data file's header is not readable (encrypted) | `2019.4.40` (`unity_player_file`) | 2.2 s |
|
||||
| Godot 4 | Plethora of Bullets 2 (itch), 衔蝶 (Steam) | `<exe>.pck` header `GDPC`, format 2, `4.2.2` / `4.4.1`; the exe's `Godot Engine v4.4.1.stable.official` sits 57–78 MB in; 衔蝶's version resource is the studio's (`0.1.0.3`) | `4.2.2`, `4.4.1` (`godot_pck`) | 24–41 ms |
|
||||
| RPG Maker MZ | A Doll's Locket - Remake (itch) | `js/rmmz_core.js` line 2 `// rmmz_core.js v1.10.0` (also under the runtime's `css\js\`) | MZ `1.10.0` | 41–53 ms |
|
||||
| RPG Maker MV | Flower in Us (Steam), 996IR, HELLO, HELLO WORLD! (itch) | `www/js/rpg_core.js` `v1.6.2`, `v1.6.2`, `v1.6.1` (HHW's one folder above its runtime) | MV `1.6.x` | 70–275 ms |
|
||||
| RPG Maker VX Ace | City of Bones, Träumerei Chapter 2 (itch) | `Game.ini`: `Library=System\RGSS301.dll`; the DLL's version `3, 0, 1, 1` | VX Ace, RGSS `3.0.1` | 427–442 ms |
|
||||
|
||||
- **Detect time** is the whole detection of one entry — the install's walk, the rules and the second read — on the USB
|
||||
drive; the second read itself is a version resource and at most a few kilobytes. It runs once per executable and rules
|
||||
version, like Unreal's.
|
||||
- **Four of the itch installs front their runtime with a 213 MB .NET launcher** (HELLO, HELLO WORLD!, A Doll's Locket -
|
||||
Remake — whose launcher asks for administrator —, City of Bones and Träumerei) — the reason the import's choice of
|
||||
executable changed in the same train (`05_DETECTION` §Library import, D56).
|
||||
- **Not measured:** RPG Maker 2000/2003 (`RPG_RT.exe`; none installed, and no rule detects it), XP and VX (no install —
|
||||
their RGSS1/RGSS2 libraries are read by the same rule as VX Ace's, unmeasured), a Unity build older than 2019 (its
|
||||
player is the executable, with no `UnityPlayer.dll`), a Godot 3 export, and a Godot pack appended to the executable
|
||||
(both installs ship the pack beside it; the trailer the reader follows is Godot's documented layout, tested on
|
||||
synthetic files only).
|
||||
+2
-2
@@ -69,8 +69,8 @@ stopped, hooking turned off — each with one button that only says you have rea
|
||||
|
||||
- **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
|
||||
executable…** points the entry at another `.exe` and turns hooking back off. **Remove…** asks whether to keep the
|
||||
game's sessions.
|
||||
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.
|
||||
- **Hooking** — on, the game is measured. A warning comes first, and you type `I ACCEPT THE INJECTION RISK` to go on.
|
||||
Read [Anti-cheat and safety](04-anti-cheat-and-safety.md) before you do.
|
||||
|
||||
+6
-3
@@ -12,7 +12,7 @@
|
||||
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.17`** (2026-10-07), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.18`** (2026-10-07), 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
|
||||
@@ -63,8 +63,11 @@
|
||||
> swap chain; for every other session the window alone is read, and a window covering its monitor reads
|
||||
> *full-screen or borderless*. What Windows does behind the game (fullscreen optimizations) is not visible.
|
||||
> - **Engine version:** the exact Unreal Engine 4 or 5 version, read from the game's executable on disk and
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Other engines show what their own
|
||||
> files state.
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Since beta.19 also Unity's (from its
|
||||
> player library or its data file — without the release letter where only the library's number is readable),
|
||||
> Godot's (from its data pack) and RPG Maker's maker and version (MV and MZ from their core script; XP, VX and VX
|
||||
> Ace by their runtime library's version, which is not the editor's). RPG Maker 2000/2003 is not detected. Other
|
||||
> engines show what their own files state.
|
||||
> - **The game's own memory (since beta.12):** its dedicated and shared GPU memory and its private
|
||||
> working set — the numbers Task Manager's Details tab shows — with its working set and commit, read
|
||||
> once a second from Windows' own counters, from outside the game, in every session: a game
|
||||
|
||||
+6
-3
@@ -114,7 +114,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
|
||||
|
||||
<!-- 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.17`** (2026-10-07), an unsigned installer built from that tag with its
|
||||
> **pre-release is `0.1.0-beta.18`** (2026-10-07), 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
|
||||
@@ -165,8 +165,11 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
|
||||
> swap chain; for every other session the window alone is read, and a window covering its monitor reads
|
||||
> *full-screen or borderless*. What Windows does behind the game (fullscreen optimizations) is not visible.
|
||||
> - **Engine version:** the exact Unreal Engine 4 or 5 version, read from the game's executable on disk and
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Other engines show what their own
|
||||
> files state.
|
||||
> labelled with what it rests on; `N/A` where the executable names none. Since beta.19 also Unity's (from its
|
||||
> player library or its data file — without the release letter where only the library's number is readable),
|
||||
> Godot's (from its data pack) and RPG Maker's maker and version (MV and MZ from their core script; XP, VX and VX
|
||||
> Ace by their runtime library's version, which is not the editor's). RPG Maker 2000/2003 is not detected. Other
|
||||
> engines show what their own files state.
|
||||
> - **The game's own memory (since beta.12):** its dedicated and shared GPU memory and its private
|
||||
> working set — the numbers Task Manager's Details tab shows — with its working set and commit, read
|
||||
> once a second from Windows' own counters, from outside the game, in every session: a game
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FrameLedger — Privacy Policy
|
||||
|
||||
**Version:** 2.7 · **Effective:** {{RELEASE_DATE}}
|
||||
**Version:** 2.8 · **Effective:** {{RELEASE_DATE}}
|
||||
|
||||
**Short version: everything stays on your PC. FrameLedger has no accounts, no telemetry, no analytics, and never uploads your data anywhere.**
|
||||
|
||||
@@ -39,7 +39,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), 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, and the library Game.ini names), 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"level, which made it a check that could not fire."
|
||||
],
|
||||
"schemaVersion": 2,
|
||||
"rulesVersion": "2026.10.1",
|
||||
"rulesVersion": "2026.10.2",
|
||||
|
||||
"engines": [
|
||||
{
|
||||
@@ -52,7 +52,7 @@
|
||||
{ "type": "sibling_glob", "value": "UnityPlayer.dll" },
|
||||
{ "type": "dir_exists", "value": "${ExeName}_Data" }
|
||||
] },
|
||||
"version": { "type": "pe_file_version", "from": "UnityPlayer.dll" }
|
||||
"version": { "type": "unity_build" }
|
||||
},
|
||||
{
|
||||
"id": "unreal",
|
||||
@@ -70,7 +70,7 @@
|
||||
{ "type": "sibling_glob", "value": "nw.dll" },
|
||||
{ "type": "sibling_glob", "value": "package.json" }
|
||||
] },
|
||||
"version": null
|
||||
"version": { "type": "rpgmaker_build" }
|
||||
},
|
||||
{
|
||||
"id": "rpgmaker_rgss",
|
||||
@@ -83,7 +83,7 @@
|
||||
{ "type": "sibling_glob", "value": "*.rgss2a" },
|
||||
{ "type": "sibling_glob", "value": "*.rgss3a" }
|
||||
] },
|
||||
"version": null
|
||||
"version": { "type": "rpgmaker_build" }
|
||||
},
|
||||
{
|
||||
"id": "re_engine",
|
||||
@@ -109,7 +109,7 @@
|
||||
{ "type": "sibling_glob", "value": "*.pck" },
|
||||
{ "type": "strings_contains", "value": "Godot Engine v" }
|
||||
] },
|
||||
"version": { "type": "strings_regex", "value": "Godot Engine v(\\d+\\.\\d+[\\.\\d]*)" }
|
||||
"version": { "type": "godot_build" }
|
||||
},
|
||||
{
|
||||
"id": "gamemaker",
|
||||
|
||||
@@ -198,12 +198,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"$comment": "beta.10: Unreal Engine's build facts (the shipping executable's numeric file version and the engine's branch name inside it), decided in code (Domain.Detection.UnrealVersion) rather than by a pattern - which is why it takes no parameter.",
|
||||
"$comment": "beta.10: Unreal Engine's build facts (the shipping executable's numeric file version and the engine's branch name inside it), decided in code (Domain.Detection.UnrealVersion) rather than by a pattern - which is why it takes no parameter. beta.19 adds Unity's (the player library's version resource, the data file's header), Godot's (a data pack's header, the executable's version resource) and RPG Maker's (MV/MZ's core-script header, the RGSS library Game.ini names), decided by UnityVersion, GodotVersion and RpgMakerVersion.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": { "const": "unreal_build" }
|
||||
"type": { "enum": ["unreal_build", "unity_build", "godot_build", "rpgmaker_build"] }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -202,6 +202,38 @@ public static class Formats
|
||||
_ => id,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The engine's name as its version's witness names it (beta.19): each RPG Maker rule covers several makers, and the
|
||||
/// file the version was read from says which — MZ's or MV's core script, an RGSS1, RGSS2 or RGSS3 library (XP, VX,
|
||||
/// VX Ace). Any other engine, or no witness, is <see cref="Engine(string?)"/>.
|
||||
/// </summary>
|
||||
public static string Engine(string? id, string? versionSource) => (id, versionSource) switch
|
||||
{
|
||||
("rpgmaker_mv", EngineVersionSource.RpgMakerMzCore) => "RPG Maker MZ",
|
||||
("rpgmaker_mv", EngineVersionSource.RpgMakerMvCore) => "RPG Maker MV",
|
||||
("rpgmaker_rgss", EngineVersionSource.Rgss1Library) => "RPG Maker XP",
|
||||
("rpgmaker_rgss", EngineVersionSource.Rgss2Library) => "RPG Maker VX",
|
||||
("rpgmaker_rgss", EngineVersionSource.Rgss3Library) => "RPG Maker VX Ace",
|
||||
_ => Engine(id),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The engine and its version as one text (beta.19): "Unreal Engine 5.4.4", "Unity 2022.3.39f1", "Godot 4.4.1", "RPG Maker
|
||||
/// MZ 1.10.0" — and "RPG Maker VX Ace (RGSS 3.0.1)", whose number is its runtime library's, not the maker's.
|
||||
/// </summary>
|
||||
public static string EngineWithVersion(string? id, string? version, string? versionSource)
|
||||
{
|
||||
string name = Engine(id, versionSource);
|
||||
if (id is null || string.IsNullOrWhiteSpace(version))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
return versionSource is EngineVersionSource.Rgss1Library or EngineVersionSource.Rgss2Library or EngineVersionSource.Rgss3Library
|
||||
? string.Create(CultureInfo.InvariantCulture, $"{name} (RGSS {version})")
|
||||
: string.Create(CultureInfo.InvariantCulture, $"{name} {version}");
|
||||
}
|
||||
|
||||
/// <summary>What an executable runs as (<c>games.exe_machine</c>, beta.8), in the user's language.</summary>
|
||||
public static string Architecture(string? id) => id switch
|
||||
{
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// 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.Detection;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// The folder Change executable… opens in (beta.19, owner request 2026-10-12): the game's own root folder rather than
|
||||
/// wherever Windows' dialog was last — the pick is almost always another file of the same install.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The root is <see cref="InstallRoot.Resolve"/>'s — the folder a store boundary names (<c>steamapps\common\X</c>,
|
||||
/// <c>GOG Galaxy\Games\X</c>, <c>Epic Games\X</c>, <c>GamesInstalled\X</c>) — and, where no boundary is recognised, out of
|
||||
/// an Unreal package's <c><root>\<Project>\Binaries\Win64</c> to <c><root></c>, else the executable's own
|
||||
/// folder. Only the row's path is stored (no install folder), so this is derived, never remembered.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// An entry whose folder is gone (*Not installed*) opens at the nearest folder above it that is still there; an entry on a
|
||||
/// drive that is not connected gets null, and the dialog opens where Windows last was. It asks the file system, so its
|
||||
/// caller runs it off the UI thread: a share that went away can take seconds to answer.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static class GameFolder
|
||||
{
|
||||
/// <summary>The folder to open the pick in for an entry at <paramref name="exePath"/>, or null when there is none.</summary>
|
||||
public static string? StartFolder(string exePath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
string full;
|
||||
try
|
||||
{
|
||||
full = Path.GetFullPath(exePath);
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or PathTooLongException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string? drive = Path.GetPathRoot(full);
|
||||
if (string.IsNullOrEmpty(drive) || !Directory.Exists(drive))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string exeDirectory = Path.GetDirectoryName(full) ?? drive;
|
||||
string root = InstallRoot.Resolve(full);
|
||||
if (string.Equals(root, exeDirectory, StringComparison.OrdinalIgnoreCase) && UnrealRoot(exeDirectory) is { } unreal)
|
||||
{
|
||||
root = unreal;
|
||||
}
|
||||
|
||||
for (string? folder = root; !string.IsNullOrEmpty(folder); folder = Path.GetDirectoryName(folder))
|
||||
{
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
|
||||
return drive;
|
||||
}
|
||||
|
||||
/// <summary><c><root>\<Project>\Binaries\Win64</c> (or <c>WinGDK</c>) → <c><root></c>; null for any other folder.</summary>
|
||||
private static string? UnrealRoot(string exeDirectory)
|
||||
{
|
||||
string platform = Path.GetFileName(exeDirectory);
|
||||
string? binaries = Path.GetDirectoryName(exeDirectory);
|
||||
bool unreal = (string.Equals(platform, "Win64", StringComparison.OrdinalIgnoreCase) || string.Equals(platform, "WinGDK", StringComparison.OrdinalIgnoreCase))
|
||||
&& binaries is not null && string.Equals(Path.GetFileName(binaries), "Binaries", StringComparison.OrdinalIgnoreCase);
|
||||
string? project = unreal ? Path.GetDirectoryName(binaries) : null;
|
||||
return project is null ? null : Path.GetDirectoryName(project);
|
||||
}
|
||||
}
|
||||
@@ -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 Microsoft.Win32;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
@@ -8,7 +9,7 @@ namespace FrameLedger.App.Services;
|
||||
/// <summary>The WPF <see cref="OpenFileDialog"/> for FR-1.1.</summary>
|
||||
public sealed class GamePicker : IGamePicker
|
||||
{
|
||||
public string? PickExecutable()
|
||||
public string? PickExecutable(string? initialDirectory = null)
|
||||
{
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
@@ -17,6 +18,13 @@ public sealed class GamePicker : IGamePicker
|
||||
CheckFileExists = true,
|
||||
Multiselect = false,
|
||||
};
|
||||
|
||||
// InitialDirectory opens the dialog there whatever folder it remembers (DefaultDirectory would only be a fallback).
|
||||
if (!string.IsNullOrEmpty(initialDirectory) && Directory.Exists(initialDirectory))
|
||||
{
|
||||
dialog.InitialDirectory = initialDirectory;
|
||||
}
|
||||
|
||||
return dialog.ShowDialog() == true ? dialog.FileName : null;
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,9 @@ namespace FrameLedger.App.Services;
|
||||
public interface IGamePicker
|
||||
{
|
||||
/// <summary>The chosen executable's full path, or null when the user cancelled.</summary>
|
||||
string? PickExecutable();
|
||||
/// <param name="initialDirectory">
|
||||
/// The folder the dialog opens in (beta.19: Change executable… opens in the game's own folder, <see cref="GameFolder"/>);
|
||||
/// null leaves it to Windows, which opens where the last pick was.
|
||||
/// </param>
|
||||
string? PickExecutable(string? initialDirectory = null);
|
||||
}
|
||||
Generated
+27
@@ -446,8 +446,17 @@ public static class Strings
|
||||
nameof(GameDetail_Edit),
|
||||
nameof(GameDetail_EngineVersion_Branch),
|
||||
nameof(GameDetail_EngineVersion_BranchAndFile),
|
||||
nameof(GameDetail_EngineVersion_CoreScript_Format),
|
||||
nameof(GameDetail_EngineVersion_FileVersion),
|
||||
nameof(GameDetail_EngineVersion_GodotExe),
|
||||
nameof(GameDetail_EngineVersion_GodotPack),
|
||||
nameof(GameDetail_EngineVersion_GodotPackEmbedded),
|
||||
nameof(GameDetail_EngineVersion_NotFound),
|
||||
nameof(GameDetail_EngineVersion_NotFoundInFiles),
|
||||
nameof(GameDetail_EngineVersion_Rgss),
|
||||
nameof(GameDetail_EngineVersion_UnityData),
|
||||
nameof(GameDetail_EngineVersion_UnityPlayer),
|
||||
nameof(GameDetail_EngineVersion_UnityPlayerFile),
|
||||
nameof(GameDetail_Exception_Grant),
|
||||
nameof(GameDetail_Exception_Granted_Format),
|
||||
nameof(GameDetail_Exception_Header),
|
||||
@@ -1894,10 +1903,28 @@ public static class Strings
|
||||
|
||||
public static string GameDetail_EngineVersion_BranchAndFile => ResourceManager.GetString(nameof(GameDetail_EngineVersion_BranchAndFile), Culture) ?? nameof(GameDetail_EngineVersion_BranchAndFile);
|
||||
|
||||
public static string GameDetail_EngineVersion_CoreScript_Format => ResourceManager.GetString(nameof(GameDetail_EngineVersion_CoreScript_Format), Culture) ?? nameof(GameDetail_EngineVersion_CoreScript_Format);
|
||||
|
||||
public static string GameDetail_EngineVersion_FileVersion => ResourceManager.GetString(nameof(GameDetail_EngineVersion_FileVersion), Culture) ?? nameof(GameDetail_EngineVersion_FileVersion);
|
||||
|
||||
public static string GameDetail_EngineVersion_GodotExe => ResourceManager.GetString(nameof(GameDetail_EngineVersion_GodotExe), Culture) ?? nameof(GameDetail_EngineVersion_GodotExe);
|
||||
|
||||
public static string GameDetail_EngineVersion_GodotPack => ResourceManager.GetString(nameof(GameDetail_EngineVersion_GodotPack), Culture) ?? nameof(GameDetail_EngineVersion_GodotPack);
|
||||
|
||||
public static string GameDetail_EngineVersion_GodotPackEmbedded => ResourceManager.GetString(nameof(GameDetail_EngineVersion_GodotPackEmbedded), Culture) ?? nameof(GameDetail_EngineVersion_GodotPackEmbedded);
|
||||
|
||||
public static string GameDetail_EngineVersion_NotFound => ResourceManager.GetString(nameof(GameDetail_EngineVersion_NotFound), Culture) ?? nameof(GameDetail_EngineVersion_NotFound);
|
||||
|
||||
public static string GameDetail_EngineVersion_NotFoundInFiles => ResourceManager.GetString(nameof(GameDetail_EngineVersion_NotFoundInFiles), Culture) ?? nameof(GameDetail_EngineVersion_NotFoundInFiles);
|
||||
|
||||
public static string GameDetail_EngineVersion_Rgss => ResourceManager.GetString(nameof(GameDetail_EngineVersion_Rgss), Culture) ?? nameof(GameDetail_EngineVersion_Rgss);
|
||||
|
||||
public static string GameDetail_EngineVersion_UnityData => ResourceManager.GetString(nameof(GameDetail_EngineVersion_UnityData), Culture) ?? nameof(GameDetail_EngineVersion_UnityData);
|
||||
|
||||
public static string GameDetail_EngineVersion_UnityPlayer => ResourceManager.GetString(nameof(GameDetail_EngineVersion_UnityPlayer), Culture) ?? nameof(GameDetail_EngineVersion_UnityPlayer);
|
||||
|
||||
public static string GameDetail_EngineVersion_UnityPlayerFile => ResourceManager.GetString(nameof(GameDetail_EngineVersion_UnityPlayerFile), Culture) ?? nameof(GameDetail_EngineVersion_UnityPlayerFile);
|
||||
|
||||
public static string GameDetail_Exception_Grant => ResourceManager.GetString(nameof(GameDetail_Exception_Grant), Culture) ?? nameof(GameDetail_Exception_Grant);
|
||||
|
||||
public static string GameDetail_Exception_Granted_Format => ResourceManager.GetString(nameof(GameDetail_Exception_Granted_Format), Culture) ?? nameof(GameDetail_Exception_Granted_Format);
|
||||
|
||||
@@ -2921,6 +2921,42 @@
|
||||
<value>ゲームの実行ファイル内に見つかりません。実行ファイルが圧縮・保護されているか、スタジオがエンジンのビルド名を変更している可能性があります。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayer" xml:space="preserve">
|
||||
<value>ゲームの Unity プレーヤーライブラリ(UnityPlayer.dll)のバージョンから。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityData" xml:space="preserve">
|
||||
<value>ゲームの Unity データファイル(globalgamemanagers)の先頭から。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayerFile" xml:space="preserve">
|
||||
<value>Unity プレーヤーライブラリのバージョン番号のみから。リリースを示す文字(f1 など)はそこに記録されていません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPack" xml:space="preserve">
|
||||
<value>ゲームの Godot データパック(.pck)の先頭から。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPackEmbedded" xml:space="preserve">
|
||||
<value>ゲームの実行ファイルに含まれる Godot データパックの先頭から。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotExe" xml:space="preserve">
|
||||
<value>Godot がゲームの実行ファイルに残したバージョン情報から。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_CoreScript_Format" xml:space="preserve">
|
||||
<value>ゲームの {0} の最初の行から。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_Rgss" xml:space="preserve">
|
||||
<value>ゲームの Game.ini が指定する RPG Maker のランタイムライブラリ(RGSS)から。この番号はエディターではなくライブラリのものです。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_NotFoundInFiles" xml:space="preserve">
|
||||
<value>ゲームのファイルには見つかりません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_Details_Libraries" xml:space="preserve">
|
||||
<value>同梱ライブラリ</value>
|
||||
<comment>review</comment>
|
||||
|
||||
@@ -2201,6 +2201,33 @@ The documents below are the full terms; this summary does not replace them.</val
|
||||
<data name="GameDetail_EngineVersion_NotFound" xml:space="preserve">
|
||||
<value>Not found in the game's executable. It may be packed or protected, or the studio renamed the engine's build.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayer" xml:space="preserve">
|
||||
<value>From the version of the game's Unity player library (UnityPlayer.dll).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityData" xml:space="preserve">
|
||||
<value>From the header of the game's Unity data file (globalgamemanagers).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayerFile" xml:space="preserve">
|
||||
<value>From the Unity player library's version number only. The release letter (such as f1) is not recorded there.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPack" xml:space="preserve">
|
||||
<value>From the header of the game's Godot data pack (.pck).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPackEmbedded" xml:space="preserve">
|
||||
<value>From the header of the Godot data pack inside the game's executable.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotExe" xml:space="preserve">
|
||||
<value>From the version information Godot left in the game's executable.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_CoreScript_Format" xml:space="preserve">
|
||||
<value>From the first lines of the game's {0}.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_Rgss" xml:space="preserve">
|
||||
<value>From the RPG Maker runtime library (RGSS) that the game's Game.ini names. The number is the library's, not the editor's.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_NotFoundInFiles" xml:space="preserve">
|
||||
<value>Not found in the game's files.</value>
|
||||
</data>
|
||||
<data name="GameDetail_Details_Libraries" xml:space="preserve">
|
||||
<value>Ships with</value>
|
||||
</data>
|
||||
|
||||
@@ -2196,6 +2196,33 @@ 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_EngineVersion_NotFound" xml:space="preserve">
|
||||
<value>Không tìm thấy trong file thực thi của game. File có thể đã bị nén hoặc bảo vệ, hoặc studio đã đổi tên bản dựng của engine.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayer" xml:space="preserve">
|
||||
<value>Lấy từ phiên bản thư viện Unity player của game (UnityPlayer.dll).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityData" xml:space="preserve">
|
||||
<value>Lấy từ phần đầu file dữ liệu Unity của game (globalgamemanagers).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_UnityPlayerFile" xml:space="preserve">
|
||||
<value>Chỉ lấy từ số phiên bản của thư viện Unity player. Chữ cái của bản phát hành (như f1) không được ghi ở đó.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPack" xml:space="preserve">
|
||||
<value>Lấy từ phần đầu gói dữ liệu Godot của game (.pck).</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotPackEmbedded" xml:space="preserve">
|
||||
<value>Lấy từ phần đầu gói dữ liệu Godot nằm trong file thực thi của game.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_GodotExe" xml:space="preserve">
|
||||
<value>Lấy từ thông tin phiên bản mà Godot để lại trong file thực thi của game.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_CoreScript_Format" xml:space="preserve">
|
||||
<value>Lấy từ những dòng đầu của {0} trong game.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_Rgss" xml:space="preserve">
|
||||
<value>Lấy từ thư viện runtime RPG Maker (RGSS) mà file Game.ini của game chỉ định. Đây là số phiên bản của thư viện, không phải của trình biên tập.</value>
|
||||
</data>
|
||||
<data name="GameDetail_EngineVersion_NotFoundInFiles" xml:space="preserve">
|
||||
<value>Không tìm thấy trong các file của game.</value>
|
||||
</data>
|
||||
<data name="GameDetail_Details_Libraries" xml:space="preserve">
|
||||
<value>Đi kèm</value>
|
||||
</data>
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class GameCardViewModel
|
||||
Id = card.Row.Id;
|
||||
Name = card.Row.Name;
|
||||
PlatformText = Formats.Platform(card.Row.Platform);
|
||||
EngineText = Formats.Engine(card.Row.Engine);
|
||||
EngineText = Formats.Engine(card.Row.Engine, card.Row.EngineVersionSource);
|
||||
Recorded = card.Row.RecordSessions;
|
||||
HookOn = Recorded && card.Row.HookEnabled;
|
||||
// An entry the guard found anti-cheat in says so (beta.8): its hooking is off for good, and "Hooking off" read as
|
||||
|
||||
@@ -801,7 +801,8 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
/// <summary>
|
||||
/// A store import guesses the executable (Steam names none), and everything downstream is keyed on it: a wrong guess
|
||||
/// is a game that can never be matched. The pick is the user's own; the row comes back hooking-off and unconsented,
|
||||
/// exactly as a new game would, and consent is revoked over the pipe first, as removal does.
|
||||
/// exactly as a new game would, and consent is revoked over the pipe first, as removal does. The dialog opens in the
|
||||
/// game's own folder (beta.19, <see cref="GameFolder"/>), asked off the UI thread.
|
||||
/// </summary>
|
||||
private async Task ChangeExecutableCoreAsync()
|
||||
{
|
||||
@@ -810,7 +811,9 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
return;
|
||||
}
|
||||
|
||||
string? path = _picker.PickExecutable();
|
||||
string current = Game.Fingerprint.ExePath;
|
||||
string? folder = await Task.Run(() => GameFolder.StartFolder(current)).ConfigureAwait(true);
|
||||
string? path = _picker.PickExecutable(folder);
|
||||
if (path is null || string.Equals(ExecutableIdentity.Normalise(path), Game.Fingerprint.ExePath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return;
|
||||
@@ -1166,13 +1169,12 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
SessionsEmpty = Sessions.Count == 0;
|
||||
}
|
||||
|
||||
private static string EngineText(GameRow row) =>
|
||||
row.Engine is null || row.EngineVersion is null ? Formats.Engine(row.Engine) : Formats.Engine(row.Engine) + " " + row.EngineVersion;
|
||||
private static string EngineText(GameRow row) => Formats.EngineWithVersion(row.Engine, row.EngineVersion, row.EngineVersionSource);
|
||||
|
||||
/// <summary>
|
||||
/// Which witness an Unreal Engine version rests on (beta.10, schema 0015) — said, because the executable's version
|
||||
/// number and the engine's build name can each be wrong in their own way (<c>05_DETECTION</c> §Engine version). An
|
||||
/// Unreal title whose executable names no version says so once the sweep has read it; other engines add no line.
|
||||
/// Which witness an engine version rests on (beta.10 for Unreal, schema 0015; beta.19 for Unity, Godot and RPG Maker) —
|
||||
/// said, because each witness can be wrong or short in its own way (<c>05_DETECTION</c> §Engine version). A title of
|
||||
/// these engines whose files name no version says so once the sweep has read it; other engines add no line.
|
||||
/// </summary>
|
||||
internal static string? EngineVersionSourceText(GameRow row)
|
||||
{
|
||||
@@ -1182,8 +1184,19 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
EngineVersionSource.UnrealBranchAndFile => Strings.GameDetail_EngineVersion_BranchAndFile,
|
||||
EngineVersionSource.UnrealBranch => Strings.GameDetail_EngineVersion_Branch,
|
||||
EngineVersionSource.UnrealFileVersion => Strings.GameDetail_EngineVersion_FileVersion,
|
||||
EngineVersionSource.UnityPlayer => Strings.GameDetail_EngineVersion_UnityPlayer,
|
||||
EngineVersionSource.UnityData => Strings.GameDetail_EngineVersion_UnityData,
|
||||
EngineVersionSource.UnityPlayerFile => Strings.GameDetail_EngineVersion_UnityPlayerFile,
|
||||
EngineVersionSource.GodotPack => Strings.GameDetail_EngineVersion_GodotPack,
|
||||
EngineVersionSource.GodotPackEmbedded => Strings.GameDetail_EngineVersion_GodotPackEmbedded,
|
||||
EngineVersionSource.GodotExe => Strings.GameDetail_EngineVersion_GodotExe,
|
||||
EngineVersionSource.RpgMakerMzCore => string.Format(CultureInfo.CurrentCulture, Strings.GameDetail_EngineVersion_CoreScript_Format, "js/rmmz_core.js"),
|
||||
EngineVersionSource.RpgMakerMvCore => string.Format(CultureInfo.CurrentCulture, Strings.GameDetail_EngineVersion_CoreScript_Format, "rpg_core.js"),
|
||||
EngineVersionSource.Rgss1Library or EngineVersionSource.Rgss2Library or EngineVersionSource.Rgss3Library => Strings.GameDetail_EngineVersion_Rgss,
|
||||
null when string.Equals(row.Engine, "unreal", StringComparison.Ordinal) && row.EngineVersion is null && row.ExeMachine is not null
|
||||
=> Strings.GameDetail_EngineVersion_NotFound,
|
||||
null when row.Engine is "unity" or "godot" or "rpgmaker_mv" or "rpgmaker_rgss" && row.EngineVersion is null && row.ExeMachine is not null
|
||||
=> Strings.GameDetail_EngineVersion_NotFoundInFiles,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,4 +24,23 @@ public interface IGameFileProbe
|
||||
/// file. Null when no shipping executable is in the snapshot's listing or it could not be read: no facts, never a guess.
|
||||
/// </summary>
|
||||
ValueTask<UnrealBuildFacts?> ReadUnrealBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Unity's build facts (beta.19) — the player library's version resource and the header of its data file — asked only
|
||||
/// after the rules matched an engine whose extractor is <see cref="VersionExtractorType.UnityBuild"/>. Null when neither
|
||||
/// file is there or could be read.
|
||||
/// </summary>
|
||||
ValueTask<UnityBuildFacts?> ReadUnityBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Godot's build facts (beta.19) — a data pack's header, beside the executable or appended to it, and the executable's
|
||||
/// version resource — for <see cref="VersionExtractorType.GodotBuild"/>. Null when nothing could be read.
|
||||
/// </summary>
|
||||
ValueTask<GodotBuildFacts?> ReadGodotBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// RPG Maker's build facts (beta.19) — MV/MZ's core-script header, or the RGSS library <c>Game.ini</c> names — for
|
||||
/// <see cref="VersionExtractorType.RpgMakerBuild"/>. Null when neither is found.
|
||||
/// </summary>
|
||||
ValueTask<RpgMakerBuildFacts?> ReadRpgMakerBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default);
|
||||
}
|
||||
@@ -59,8 +59,9 @@ public sealed class StaticGameDetector(IDetectionRulesSource rulesSource, IGameF
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The matched engine's version and its witness. Every extractor but one answers from the snapshot; Unreal's is the
|
||||
/// second read (beta.10), made here for the one engine that matched rather than by the probe for every game.
|
||||
/// The matched engine's version and its witness. The rules' own extractors answer from the snapshot; an engine whose
|
||||
/// version is decided in code — Unreal since beta.10, Unity, Godot and RPG Maker since beta.19 — gets one second read,
|
||||
/// made here for the one engine that matched rather than by the probe for every game.
|
||||
/// </summary>
|
||||
private async ValueTask<EngineVersionReading> VersionAsync(EngineMatch engine, GameFileSnapshot snapshot, CancellationToken ct)
|
||||
{
|
||||
@@ -69,12 +70,18 @@ public sealed class StaticGameDetector(IDetectionRulesSource rulesSource, IGameF
|
||||
return EngineVersionReading.None;
|
||||
}
|
||||
|
||||
if (extractor.Type != VersionExtractorType.UnrealBuild)
|
||||
switch (extractor.Type)
|
||||
{
|
||||
return engine.Version is null ? EngineVersionReading.None : new EngineVersionReading(engine.Version, EngineVersionSource.Of(extractor.Type));
|
||||
case VersionExtractorType.UnrealBuild:
|
||||
return await _probe.ReadUnrealBuildAsync(snapshot, ct).ConfigureAwait(false) is { } unreal ? UnrealVersion.Decide(unreal) : EngineVersionReading.None;
|
||||
case VersionExtractorType.UnityBuild:
|
||||
return await _probe.ReadUnityBuildAsync(snapshot, ct).ConfigureAwait(false) is { } unity ? UnityVersion.Decide(unity) : EngineVersionReading.None;
|
||||
case VersionExtractorType.GodotBuild:
|
||||
return await _probe.ReadGodotBuildAsync(snapshot, ct).ConfigureAwait(false) is { } godot ? GodotVersion.Decide(godot) : EngineVersionReading.None;
|
||||
case VersionExtractorType.RpgMakerBuild:
|
||||
return await _probe.ReadRpgMakerBuildAsync(snapshot, ct).ConfigureAwait(false) is { } maker ? RpgMakerVersion.Decide(maker) : EngineVersionReading.None;
|
||||
default:
|
||||
return engine.Version is null ? EngineVersionReading.None : new EngineVersionReading(engine.Version, EngineVersionSource.Of(extractor.Type));
|
||||
}
|
||||
|
||||
UnrealBuildFacts? facts = await _probe.ReadUnrealBuildAsync(snapshot, ct).ConfigureAwait(false);
|
||||
return facts is null ? EngineVersionReading.None : UnrealVersion.Decide(facts);
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,12 @@ public sealed class LibraryImporter
|
||||
bool missing = exe is not null && _identity.Read(exe) is null;
|
||||
bool already = exe is not null && await _games.FindAsync(exe, ct).ConfigureAwait(false) is { InLibrary: true };
|
||||
string? movedFrom = exe is null || already ? null : StaleTwinOf(exe, library)?.Fingerprint.ExePath;
|
||||
if (exe is not null && !already && movedFrom is null && SameStoreTitleOf(game, library) is { } entry)
|
||||
{
|
||||
already = true;
|
||||
_log($"import: {game.Name} ({game.Platform} {game.StoreId}) is already in the library as {entry.Fingerprint.ExePath} — not offered again at {exe}");
|
||||
}
|
||||
|
||||
candidates.Add(new ImportCandidate(game, exe, already, guessed, missing, movedFrom));
|
||||
}
|
||||
|
||||
@@ -130,4 +136,23 @@ public sealed class LibraryImporter
|
||||
/// </summary>
|
||||
private GameRow? StaleTwinOf(string exe, IReadOnlyList<GameRow> library) =>
|
||||
library.FirstOrDefault(r => ExecutableRelocator.IsDriveLetterTwin(r.Fingerprint.ExePath, exe) && _identity.Read(r.Fingerprint.ExePath) is null);
|
||||
|
||||
/// <summary>
|
||||
/// The library entry an earlier import made for this very store title, at another executable (beta.19): the store's id,
|
||||
/// under the same platform or with the entry's executable inside the title's install folder. The import used to compare
|
||||
/// paths only, so a guess that changed between builds — A Doll's Locket - Remake's helper became its NW.js runtime —
|
||||
/// would have offered the same game again beside the entry the user already has; that entry is what Change executable…
|
||||
/// re-points. The folder half is there because the platform is the detection sweep's to refresh: an itch build that
|
||||
/// ships Steam's API reads as Steam. A title with no store id is never matched.
|
||||
/// </summary>
|
||||
private static GameRow? SameStoreTitleOf(StoreGame game, IReadOnlyList<GameRow> library) =>
|
||||
string.IsNullOrEmpty(game.StoreId)
|
||||
? null
|
||||
: library.FirstOrDefault(r => string.Equals(r.StoreId, game.StoreId, StringComparison.Ordinal)
|
||||
&& (string.Equals(r.Platform, game.Platform, StringComparison.OrdinalIgnoreCase)
|
||||
|| IsInside(r.Fingerprint.ExePath, game.InstallDirectory)));
|
||||
|
||||
private static bool IsInside(string path, string directory) =>
|
||||
!string.IsNullOrEmpty(directory)
|
||||
&& path.StartsWith(Path.TrimEndingDirectorySeparator(directory) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
@@ -18,6 +18,39 @@ public static class EngineVersionSource
|
||||
/// <summary>Unreal: the numeric file version alone, where nothing suggests the studio replaced it.</summary>
|
||||
public const string UnrealFileVersion = "unreal_file_version";
|
||||
|
||||
/// <summary>Unity (beta.19): the player library's <c>ProductVersion</c>, an editor version with its release letter.</summary>
|
||||
public const string UnityPlayer = "unity_player";
|
||||
|
||||
/// <summary>Unity: the editor version the data file's header names.</summary>
|
||||
public const string UnityData = "unity_data";
|
||||
|
||||
/// <summary>Unity: the player library's numeric file version — MAJOR.MINOR.PATCH, no release letter.</summary>
|
||||
public const string UnityPlayerFile = "unity_player_file";
|
||||
|
||||
/// <summary>Godot (beta.19): the header of the data pack beside the executable.</summary>
|
||||
public const string GodotPack = "godot_pck";
|
||||
|
||||
/// <summary>Godot: the header of the data pack appended to the executable.</summary>
|
||||
public const string GodotPackEmbedded = "godot_pck_embedded";
|
||||
|
||||
/// <summary>Godot: the executable's version resource, still the engine's (<c>ProductName</c> is "Godot Engine").</summary>
|
||||
public const string GodotExe = "godot_exe";
|
||||
|
||||
/// <summary>RPG Maker MZ (beta.19): the header of <c>js/rmmz_core.js</c>.</summary>
|
||||
public const string RpgMakerMzCore = "rpgmaker_mz_core";
|
||||
|
||||
/// <summary>RPG Maker MV: the header of <c>rpg_core.js</c>.</summary>
|
||||
public const string RpgMakerMvCore = "rpgmaker_mv_core";
|
||||
|
||||
/// <summary>RPG Maker XP: the RGSS1 library <c>Game.ini</c> names.</summary>
|
||||
public const string Rgss1Library = "rgss1_library";
|
||||
|
||||
/// <summary>RPG Maker VX: the RGSS2 library.</summary>
|
||||
public const string Rgss2Library = "rgss2_library";
|
||||
|
||||
/// <summary>RPG Maker VX Ace: the RGSS3 library.</summary>
|
||||
public const string Rgss3Library = "rgss3_library";
|
||||
|
||||
/// <summary>The rule's own extractor, named as the rules file names it (<c>pe_file_version</c>, <c>strings_regex</c>, …).</summary>
|
||||
public static string Of(VersionExtractorType type) => type switch
|
||||
{
|
||||
@@ -26,6 +59,9 @@ public static class EngineVersionSource
|
||||
VersionExtractorType.StringsRegex => "strings_regex",
|
||||
VersionExtractorType.ManifestField => "manifest_field",
|
||||
VersionExtractorType.UnrealBuild => "unreal_build",
|
||||
VersionExtractorType.UnityBuild => "unity_build",
|
||||
VersionExtractorType.GodotBuild => "godot_build",
|
||||
VersionExtractorType.RpgMakerBuild => "rpgmaker_build",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, "not a version extractor"),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// What a Godot title's own files say about the engine it was exported with (beta.19), read from the files on disk.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A Godot export's data pack starts with a header — the magic <c>GDPC</c>, the pack format, then the engine's MAJOR, MINOR
|
||||
/// and PATCH — whether it sits beside the executable (<c>Game.pck</c>) or is appended to it. Measured 2026-10-12 on the
|
||||
/// owner's two Godot installs: Plethora of Bullets 2 (format 2, 4.2.2) and 衔蝶 (format 2, 4.4.1). The executable's
|
||||
/// own <c>Godot Engine v4.4.1.stable.official</c> string sits 57 to 78 MB into it — past the 8 MiB the rules' strings scan
|
||||
/// reads, which is why the old <c>strings_regex</c> extractor never found it.
|
||||
/// </remarks>
|
||||
public sealed record GodotBuildFacts
|
||||
{
|
||||
/// <summary>The engine's MAJOR, MINOR and PATCH from a data pack's header, or null when no header was read.</summary>
|
||||
public IReadOnlyList<int>? PackVersion { get; init; }
|
||||
|
||||
/// <summary>True when that header was read from a pack appended to the executable, not from a <c>.pck</c> beside it.</summary>
|
||||
public bool PackEmbedded { get; init; }
|
||||
|
||||
/// <summary>The executable's <c>ProductName</c>, or null.</summary>
|
||||
public string? ExeProductName { get; init; }
|
||||
|
||||
/// <summary>The executable's <c>ProductVersion</c>, or null.</summary>
|
||||
public string? ExeProductVersion { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// 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.RegularExpressions;
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>The Godot version a title was exported with (beta.19), decided from <see cref="GodotBuildFacts"/> — or nothing.</summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The ladder:</b> (1) a data pack's header, beside the executable or appended to it — the engine writes its own
|
||||
/// version there; (2) the executable's version resource, only while its <c>ProductName</c> is still <c>Godot Engine</c>:
|
||||
/// an export whose project set no version information keeps the engine's (<c>4.2.2.stable.official</c> on Plethora of
|
||||
/// Bullets 2), and one that set its own carries the game's (衔蝶: <c>0.1.0.3</c>), which is not the engine's.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// A zero patch is not written, because Godot does not write it: 4.3, 4.2.2.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static partial class GodotVersion
|
||||
{
|
||||
/// <summary>The product name a Godot export keeps when its project set none.</summary>
|
||||
public const string EngineProductName = "Godot Engine";
|
||||
|
||||
/// <summary>The version these facts establish, and the witness it rests on.</summary>
|
||||
public static EngineVersionReading Decide(GodotBuildFacts facts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
|
||||
if (facts.PackVersion is { Count: >= 3 } pack && Format(pack[0], pack[1], pack[2]) is { } fromPack)
|
||||
{
|
||||
return new EngineVersionReading(fromPack, facts.PackEmbedded ? EngineVersionSource.GodotPackEmbedded : EngineVersionSource.GodotPack);
|
||||
}
|
||||
|
||||
if (string.Equals(facts.ExeProductName?.Trim(), EngineProductName, StringComparison.OrdinalIgnoreCase)
|
||||
&& facts.ExeProductVersion is { } text && ProductShape().Match(text.Trim()) is { Success: true } m
|
||||
&& Format(Parse(m.Groups["major"].Value), Parse(m.Groups["minor"].Value), m.Groups["patch"].Success ? Parse(m.Groups["patch"].Value) : 0) is { } fromExe)
|
||||
{
|
||||
return new EngineVersionReading(fromExe, EngineVersionSource.GodotExe);
|
||||
}
|
||||
|
||||
return EngineVersionReading.None;
|
||||
}
|
||||
|
||||
/// <summary><c>4.2.2</c>, <c>4.3</c> — or null for numbers no Godot release carries (a pack written by something else).</summary>
|
||||
private static string? Format(int major, int minor, int patch) =>
|
||||
major is < 1 or > 9 || minor is < 0 or > 99 || patch is < 0 or > 99
|
||||
? null
|
||||
: patch == 0
|
||||
? string.Create(CultureInfo.InvariantCulture, $"{major}.{minor}")
|
||||
: string.Create(CultureInfo.InvariantCulture, $"{major}.{minor}.{patch}");
|
||||
|
||||
private static int Parse(string digits) =>
|
||||
int.TryParse(digits, NumberStyles.None, CultureInfo.InvariantCulture, out int value) ? value : -1;
|
||||
|
||||
[GeneratedRegex(@"^(?<major>\d{1,2})\.(?<minor>\d{1,2})(?:\.(?<patch>\d{1,2}))?(?:\.[a-z]|$)", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex ProductShape();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// What an RPG Maker title's own files say about the maker that built it (beta.19), read from the files on disk.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>MV and MZ</b> ship their engine as JavaScript, and its core script opens with its own name and version — line 2 of
|
||||
/// <c>js/rmmz_core.js</c> reads <c>// rmmz_core.js v1.10.0</c> (A Doll's Locket - Remake), of <c>www/js/rpg_core.js</c>
|
||||
/// <c>// rpg_core.js v1.6.2</c> (Flower in Us, 996IR) or <c>v1.6.1</c> (HELLO, HELLO WORLD!) — measured 2026-10-12.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>XP, VX and VX Ace</b> run on the Ruby Game Scripting System, whose library <c>Game.ini</c> names
|
||||
/// (<c>Library=System\RGSS301.dll</c>): RGSS1 is XP, RGSS2 VX, RGSS3 VX Ace, and the name carries the library's version
|
||||
/// (<c>RGSS301</c> is 3.0.1; its version resource reads <c>3, 0, 1, 1</c> on City of Bones and Träumerei Chapter 2).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed record RpgMakerBuildFacts
|
||||
{
|
||||
/// <summary>The core script whose header was read — <c>rmmz_core.js</c> or <c>rpg_core.js</c> — or null.</summary>
|
||||
public string? CoreScript { get; init; }
|
||||
|
||||
/// <summary>The version that script's header names (<c>1.10.0</c>), or null.</summary>
|
||||
public string? CoreScriptVersion { get; init; }
|
||||
|
||||
/// <summary>The RGSS library's file name (<c>RGSS301.dll</c>), as <c>Game.ini</c> names it or as found, or null.</summary>
|
||||
public string? RgssLibrary { get; init; }
|
||||
|
||||
/// <summary>That library's numeric file version (four parts), or null when it carries none or was not read.</summary>
|
||||
public IReadOnlyList<int>? RgssFileVersion { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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.RegularExpressions;
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// Which RPG Maker built a title, and at which version (beta.19), decided from <see cref="RpgMakerBuildFacts"/> — or nothing.
|
||||
/// The witness names the maker: the App shows <c>rpgmaker_mv</c> as "RPG Maker MZ" when the version came from MZ's core
|
||||
/// script, and <c>rpgmaker_rgss</c> as "RPG Maker VX Ace" when it came from an RGSS3 library.
|
||||
/// </summary>
|
||||
public static partial class RpgMakerVersion
|
||||
{
|
||||
/// <summary>MZ's core script.</summary>
|
||||
public const string MzCoreScript = "rmmz_core.js";
|
||||
|
||||
/// <summary>MV's core script.</summary>
|
||||
public const string MvCoreScript = "rpg_core.js";
|
||||
|
||||
/// <summary>The version these facts establish, and the witness it rests on.</summary>
|
||||
public static EngineVersionReading Decide(RpgMakerBuildFacts facts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
|
||||
if (ScriptVersion(facts.CoreScriptVersion) is { } script)
|
||||
{
|
||||
if (string.Equals(facts.CoreScript, MzCoreScript, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new EngineVersionReading(script, EngineVersionSource.RpgMakerMzCore);
|
||||
}
|
||||
|
||||
if (string.Equals(facts.CoreScript, MvCoreScript, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new EngineVersionReading(script, EngineVersionSource.RpgMakerMvCore);
|
||||
}
|
||||
}
|
||||
|
||||
if (facts.RgssLibrary is null || LibraryShape().Match(facts.RgssLibrary.Trim()) is not { Success: true } m)
|
||||
{
|
||||
return EngineVersionReading.None;
|
||||
}
|
||||
|
||||
int generation = m.Groups["generation"].Value[0] - '0';
|
||||
string source = generation switch
|
||||
{
|
||||
1 => EngineVersionSource.Rgss1Library,
|
||||
2 => EngineVersionSource.Rgss2Library,
|
||||
_ => EngineVersionSource.Rgss3Library,
|
||||
};
|
||||
|
||||
// The library's own numbers when they are its generation's; else the ones its name carries (RGSS301 → 3.0.1).
|
||||
string version = facts.RgssFileVersion is { Count: >= 3 } parts && parts[0] == generation && parts[1] is >= 0 and <= 9 && parts[2] is >= 0 and <= 9
|
||||
? string.Create(CultureInfo.InvariantCulture, $"{parts[0]}.{parts[1]}.{parts[2]}")
|
||||
: string.Create(CultureInfo.InvariantCulture, $"{generation}.{m.Groups["minor"].Value}.{m.Groups["patch"].Value}");
|
||||
return new EngineVersionReading(version, source);
|
||||
}
|
||||
|
||||
/// <summary>A core script's version as its header writes it (<c>1.10.0</c>), or null when it does not read as one.</summary>
|
||||
public static string? ScriptVersion(string? text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Match m = ScriptShape().Match(text.Trim());
|
||||
return m.Success ? m.Value : null;
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"^\d{1,2}\.\d{1,3}\.\d{1,3}$", RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex ScriptShape();
|
||||
|
||||
[GeneratedRegex(@"^RGSS(?<generation>[123])(?<minor>\d)(?<patch>\d)[A-Z]?\.dll$", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex LibraryShape();
|
||||
}
|
||||
@@ -232,8 +232,10 @@ public sealed class RuleEvaluator
|
||||
? v
|
||||
: null,
|
||||
// Not answerable from the snapshot: StaticGameDetector reads the engine's build facts for the one engine
|
||||
// that matched (beta.10) — a scan the probe must not make for every game in the library.
|
||||
VersionExtractorType.UnrealBuild => null,
|
||||
// that matched (beta.10; Unity, Godot and RPG Maker since beta.19) — reads the probe must not make for every
|
||||
// game in the library.
|
||||
VersionExtractorType.UnrealBuild or VersionExtractorType.UnityBuild or VersionExtractorType.GodotBuild
|
||||
or VersionExtractorType.RpgMakerBuild => null,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// What a Unity title's own files say about the engine it was built with (beta.19): read from the files on disk, never from
|
||||
/// the game's process (CLAUDE.md rule 4 is about game memory).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Measured read-only on the owner's fifteen Unity installs, 2026-10-12 (<c>05_DETECTION</c> §Engine version — Unity, Godot,
|
||||
/// RPG Maker): the player library's <c>ProductVersion</c> names the editor version in thirteen
|
||||
/// (<c>2022.3.39f1 (4e1b0f82c39a)</c>); a 2019.4 player carries only numbers there, and its data file's header names it
|
||||
/// (<c>2019.4.1f1</c>); GIRLS' FRONTLINE 2's data file is encrypted, and its player's numeric file version
|
||||
/// (<c>2019.4.40.16762411</c>) is all there is.
|
||||
/// </remarks>
|
||||
public sealed record UnityBuildFacts
|
||||
{
|
||||
/// <summary><c>UnityPlayer.dll</c>'s <c>ProductVersion</c> string, or null.</summary>
|
||||
public string? PlayerProductVersion { get; init; }
|
||||
|
||||
/// <summary><c>UnityPlayer.dll</c>'s numeric file version (four parts), or null when it carries none or was not read.</summary>
|
||||
public IReadOnlyList<int>? PlayerFileVersion { get; init; }
|
||||
|
||||
/// <summary>The editor version the header of <c><Game>_Data\globalgamemanagers</c> names, as read, or null.</summary>
|
||||
public string? DataHeaderVersion { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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.RegularExpressions;
|
||||
|
||||
namespace FrameLedger.Domain.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// The Unity version a title was built with (beta.19, owner request: "detect the version of Unity, Godot and RPG Maker
|
||||
/// games"), decided from <see cref="UnityBuildFacts"/> — or nothing.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The ladder, strongest first</b> (measured on fifteen installs 2026-10-12):
|
||||
/// </para>
|
||||
/// <list type="number">
|
||||
/// <item>The player library's <c>ProductVersion</c> is an editor version — <c>2022.3.39f1</c>, the release letter and its
|
||||
/// number included (thirteen of fifteen).</item>
|
||||
/// <item>The data file's header names one (A Space for the Unbound: <c>2019.4.1f1</c>, beside a player that carries only
|
||||
/// numbers).</item>
|
||||
/// <item>The player's numeric file version: MAJOR.MINOR.PATCH and no release letter (GIRLS' FRONTLINE 2: <c>2019.4.40</c>,
|
||||
/// whose data file is encrypted). The player library is Unity's own binary — a studio does not number it — so this rung
|
||||
/// is the engine's, only shorter.</item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// Until beta.19 the rules read the player's <c>FileVersion</c> string as it is (<c>2022.3.39.5118735</c>, the build
|
||||
/// number where the release letter belongs).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static partial class UnityVersion
|
||||
{
|
||||
/// <summary>The version these facts establish, and the rung it stands on.</summary>
|
||||
public static EngineVersionReading Decide(UnityBuildFacts facts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
|
||||
if (EditorVersion(facts.PlayerProductVersion) is { } product)
|
||||
{
|
||||
return new EngineVersionReading(product, EngineVersionSource.UnityPlayer);
|
||||
}
|
||||
|
||||
if (EditorVersion(facts.DataHeaderVersion) is { } header)
|
||||
{
|
||||
return new EngineVersionReading(header, EngineVersionSource.UnityData);
|
||||
}
|
||||
|
||||
return facts.PlayerFileVersion is { Count: >= 3 } parts && IsUnityMajor(parts[0]) && parts[1] is >= 0 and <= 99 && parts[2] is >= 0 and <= 999
|
||||
? new EngineVersionReading(string.Create(CultureInfo.InvariantCulture, $"{parts[0]}.{parts[1]}.{parts[2]}"), EngineVersionSource.UnityPlayerFile)
|
||||
: EngineVersionReading.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The editor version a text starts with — <c>2022.3.39f1</c> of <c>2022.3.39f1 (4e1b0f82c39a)</c>, <c>6000.0.58f2</c> —
|
||||
/// or null when it is not one: a major Unity never used, or no release letter (<c>2019.4.1.15122501</c>).
|
||||
/// </summary>
|
||||
public static string? EditorVersion(string? text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Match m = EditorShape().Match(text.Trim());
|
||||
return m.Success && int.TryParse(m.Groups["major"].Value, NumberStyles.None, CultureInfo.InvariantCulture, out int major) && IsUnityMajor(major)
|
||||
? m.Groups["version"].Value
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The majors Unity has shipped: 3 to 5, the years 2017 to 2023, and Unity 6's <c>6000</c> line (6000.0 is Unity 6,
|
||||
/// 6000.3 is 6.3).
|
||||
/// </summary>
|
||||
private static bool IsUnityMajor(int major) => major is >= 3 and <= 5 or >= 2017 and <= 2023 or >= 6000 and <= 6999;
|
||||
|
||||
[GeneratedRegex(@"^(?<version>(?<major>\d{1,4})\.\d{1,2}\.\d{1,3}[abfpx]\d{1,3})(?![\d.])", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex EditorShape();
|
||||
}
|
||||
@@ -25,4 +25,19 @@ public enum VersionExtractorType
|
||||
/// matched — so <see cref="RuleEvaluator"/> returns null for it.
|
||||
/// </summary>
|
||||
UnrealBuild,
|
||||
|
||||
/// <summary>
|
||||
/// Unity's (beta.19): the player library's version resource and the data file's header, weighed by
|
||||
/// <see cref="UnityVersion.Decide"/>. A second read, like <see cref="UnrealBuild"/>.
|
||||
/// </summary>
|
||||
UnityBuild,
|
||||
|
||||
/// <summary>Godot's (beta.19): a data pack's header and the executable's version resource (<see cref="GodotVersion.Decide"/>).</summary>
|
||||
GodotBuild,
|
||||
|
||||
/// <summary>
|
||||
/// RPG Maker's (beta.19): MV/MZ's core-script header, or the RGSS library <c>Game.ini</c> names
|
||||
/// (<see cref="RpgMakerVersion.Decide"/>).
|
||||
/// </summary>
|
||||
RpgMakerBuild,
|
||||
}
|
||||
@@ -225,6 +225,9 @@ public sealed class DetectionRulesFile : IDetectionRulesSource
|
||||
"strings_regex" => VersionExtractorType.StringsRegex,
|
||||
"manifest_field" => VersionExtractorType.ManifestField,
|
||||
"unreal_build" => VersionExtractorType.UnrealBuild,
|
||||
"unity_build" => VersionExtractorType.UnityBuild,
|
||||
"godot_build" => VersionExtractorType.GodotBuild,
|
||||
"rpgmaker_build" => VersionExtractorType.RpgMakerBuild,
|
||||
_ => throw new InvalidOperationException($"'{owner}' has unknown version extractor '{d.Type}'"),
|
||||
},
|
||||
Value = d.Value,
|
||||
|
||||
@@ -124,6 +124,122 @@ public sealed class GameFileProbe : IGameFileProbe
|
||||
return ValueTask.FromResult(ShippingExecutable(snapshot) is { } exe ? UnrealBuildReader.Read(exe.FullPath, exe.RelativePath, ct) : null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// <c>UnityPlayer.dll</c> beside the row's executable, else the shallowest one the walk listed; the data file is
|
||||
/// <c><exe>_Data\globalgamemanagers</c>, else the one in a <c>*_Data</c> folder beside that player.
|
||||
/// </remarks>
|
||||
public ValueTask<UnityBuildFacts?> ReadUnityBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(snapshot);
|
||||
ct.ThrowIfCancellationRequested();
|
||||
string exe = Native(snapshot.ExePath);
|
||||
string? exeDirectory = Path.GetDirectoryName(exe);
|
||||
string? beside = exeDirectory is null ? null : Path.Combine(exeDirectory, "UnityPlayer.dll");
|
||||
string? player = beside is not null && File.Exists(beside) ? beside : Shallowest(snapshot, static name => string.Equals(name, "UnityPlayer.dll", StringComparison.OrdinalIgnoreCase));
|
||||
return ValueTask.FromResult(UnityBuildReader.Read(player, UnityDataFile(snapshot, exe, player)));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>The pack is <c><exe>.pck</c> beside the executable, else the only <c>.pck</c> there; else the executable's own end.</remarks>
|
||||
public ValueTask<GodotBuildFacts?> ReadGodotBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(snapshot);
|
||||
ct.ThrowIfCancellationRequested();
|
||||
string exe = Native(snapshot.ExePath);
|
||||
return ValueTask.FromResult(GodotBuildReader.Read(exe, GodotPack(exe)));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>The core script or <c>Game.ini</c> beside the executable or up to two folders above; else an RGSS library the walk listed.</remarks>
|
||||
public ValueTask<RpgMakerBuildFacts?> ReadRpgMakerBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(snapshot);
|
||||
ct.ThrowIfCancellationRequested();
|
||||
string? library = Shallowest(snapshot, static name => name.StartsWith("RGSS", StringComparison.OrdinalIgnoreCase) && name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase));
|
||||
return ValueTask.FromResult(RpgMakerBuildReader.Read(Native(snapshot.ExePath), library));
|
||||
}
|
||||
|
||||
private static string Native(string path) => path.Replace('/', Path.DirectorySeparatorChar);
|
||||
|
||||
/// <summary>The full path of the shallowest file the walk listed whose name <paramref name="named"/> accepts, or null.</summary>
|
||||
private static string? Shallowest(GameFileSnapshot snapshot, Func<string, bool> named)
|
||||
{
|
||||
string? best = null;
|
||||
int bestDepth = int.MaxValue;
|
||||
foreach (string relative in snapshot.RelativeFiles)
|
||||
{
|
||||
int slash = relative.LastIndexOf('/');
|
||||
if (!named(relative[(slash + 1)..]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int depth = relative.Count(static c => c == '/');
|
||||
if (depth < bestDepth)
|
||||
{
|
||||
(best, bestDepth) = (relative, depth);
|
||||
}
|
||||
}
|
||||
|
||||
return best is null ? null : Native(snapshot.GameDirectory.TrimEnd('/') + "/" + best);
|
||||
}
|
||||
|
||||
private static string? UnityDataFile(GameFileSnapshot snapshot, string exe, string? player)
|
||||
{
|
||||
string? exeDirectory = Path.GetDirectoryName(exe);
|
||||
if (exeDirectory is not null)
|
||||
{
|
||||
string own = Path.Combine(exeDirectory, Path.GetFileNameWithoutExtension(exe) + "_Data", "globalgamemanagers");
|
||||
if (File.Exists(own))
|
||||
{
|
||||
return own;
|
||||
}
|
||||
}
|
||||
|
||||
string? playerDirectory = player is null ? null : Path.GetDirectoryName(player);
|
||||
if (playerDirectory is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return Directory.EnumerateDirectories(playerDirectory, "*_Data")
|
||||
.Select(static d => Path.Combine(d, "globalgamemanagers"))
|
||||
.FirstOrDefault(File.Exists);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string? GodotPack(string exe)
|
||||
{
|
||||
string? directory = Path.GetDirectoryName(exe);
|
||||
if (directory is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string own = Path.Combine(directory, Path.GetFileNameWithoutExtension(exe) + ".pck");
|
||||
if (File.Exists(own))
|
||||
{
|
||||
return own;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string[] packs = [.. Directory.EnumerateFiles(directory, "*.pck").Take(2)];
|
||||
return packs.Length == 1 ? packs[0] : null;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The executable an Unreal title's engine version is read from (beta.10): the row's own when it is the shipping build
|
||||
/// (<c>*-Win64-Shipping.exe</c>, <c>*-WinGDK-Shipping.exe</c> — what <c>ExecutableLocator</c> prefers), else the largest
|
||||
@@ -303,9 +419,9 @@ public sealed class GameFileProbe : IGameFileProbe
|
||||
/// name, keyed by the <c>from</c> value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Unity's rule reads <c>UnityPlayer.dll</c>. Answering that from the game
|
||||
/// executable would report a version that is <em>wrong</em> rather than
|
||||
/// merely missing, which is the worse of the two failures.
|
||||
/// CryEngine's rule reads <c>CrySystem.dll</c> (Unity's read <c>UnityPlayer.dll</c> until beta.19, when its version
|
||||
/// became <see cref="ReadUnityBuildAsync"/>'s). Answering that from the game executable would report a version that is
|
||||
/// <em>wrong</em> rather than merely missing, which is the worse of the two failures.
|
||||
/// </remarks>
|
||||
private static Dictionary<string, string> ReadSiblingVersions(string dir, DetectionRuleSet rules)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Diagnostics;
|
||||
using FrameLedger.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// Godot's build facts from the files on disk (beta.19, <c>05_DETECTION</c> §Engine version — Unity, Godot, RPG Maker): the
|
||||
/// 20-byte header of the data pack — <c>GDPC</c>, the pack format, the engine's MAJOR, MINOR and PATCH, little-endian — from
|
||||
/// a <c>.pck</c> beside the executable, or from a pack appended to the executable, which ends with the pack's size and the
|
||||
/// magic again; and the executable's version resource. Nothing else of either file is read.
|
||||
/// </summary>
|
||||
public static class GodotBuildReader
|
||||
{
|
||||
/// <summary><c>GDPC</c> as the little-endian <c>uint</c> a pack starts (and an appended pack ends) with.</summary>
|
||||
public const uint PackMagic = 0x43504447;
|
||||
|
||||
/// <summary>The header: magic, format, major, minor, patch.</summary>
|
||||
public const int HeaderBytes = 20;
|
||||
|
||||
/// <summary>What an appended pack leaves at the end of the executable: its size (a 64-bit integer), then the magic.</summary>
|
||||
public const int TrailerBytes = 12;
|
||||
|
||||
/// <summary>The facts for <paramref name="exePath"/>, or null when nothing could be read.</summary>
|
||||
/// <param name="exePath">The game's executable.</param>
|
||||
/// <param name="packPath">The <c>.pck</c> beside it, or null when there is none.</param>
|
||||
public static GodotBuildFacts? Read(string exePath, string? packPath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
IReadOnlyList<int>? pack = packPath is null ? null : ReadFile(packPath, static s => ReadHeader(s, 0));
|
||||
bool embedded = false;
|
||||
if (pack is null)
|
||||
{
|
||||
pack = ReadFile(exePath, ReadAppended);
|
||||
embedded = pack is not null;
|
||||
}
|
||||
|
||||
string? productName = null;
|
||||
string? productVersion = null;
|
||||
try
|
||||
{
|
||||
FileVersionInfo info = FileVersionInfo.GetVersionInfo(exePath);
|
||||
productName = string.IsNullOrWhiteSpace(info.ProductName) ? null : info.ProductName.Trim();
|
||||
productVersion = string.IsNullOrWhiteSpace(info.ProductVersion) ? null : info.ProductVersion.Trim();
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException)
|
||||
{
|
||||
// The pack, if read, is the stronger witness anyway.
|
||||
}
|
||||
|
||||
return pack is null && productName is null && productVersion is null
|
||||
? null
|
||||
: new GodotBuildFacts { PackVersion = pack, PackEmbedded = embedded, ExeProductName = productName, ExeProductVersion = productVersion };
|
||||
}
|
||||
|
||||
/// <summary>MAJOR, MINOR, PATCH from a header at <paramref name="offset"/>, or null when there is none. Public for the tests.</summary>
|
||||
public static IReadOnlyList<int>? ReadHeader(Stream stream, long offset)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
if (offset < 0 || offset + HeaderBytes > stream.Length)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Span<byte> header = stackalloc byte[HeaderBytes];
|
||||
stream.Position = offset;
|
||||
if (stream.ReadAtLeast(header, HeaderBytes, throwOnEndOfStream: false) < HeaderBytes
|
||||
|| BinaryPrimitives.ReadUInt32LittleEndian(header) != PackMagic)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
uint major = BinaryPrimitives.ReadUInt32LittleEndian(header[8..]);
|
||||
uint minor = BinaryPrimitives.ReadUInt32LittleEndian(header[12..]);
|
||||
uint patch = BinaryPrimitives.ReadUInt32LittleEndian(header[16..]);
|
||||
return major > 99 || minor > 99 || patch > 99 ? null : [(int)major, (int)minor, (int)patch];
|
||||
}
|
||||
|
||||
/// <summary>The header of a pack appended to an executable, found through the trailer it ends with. Public for the tests.</summary>
|
||||
public static IReadOnlyList<int>? ReadAppended(Stream stream)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
long length = stream.Length;
|
||||
if (length < TrailerBytes + HeaderBytes)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Span<byte> trailer = stackalloc byte[TrailerBytes];
|
||||
stream.Position = length - TrailerBytes;
|
||||
if (stream.ReadAtLeast(trailer, TrailerBytes, throwOnEndOfStream: false) < TrailerBytes
|
||||
|| BinaryPrimitives.ReadUInt32LittleEndian(trailer[8..]) != PackMagic)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
long size = BinaryPrimitives.ReadInt64LittleEndian(trailer);
|
||||
return size < HeaderBytes || size > length - TrailerBytes ? null : ReadHeader(stream, length - TrailerBytes - size);
|
||||
}
|
||||
|
||||
private static IReadOnlyList<int>? ReadFile(string path, Func<Stream, IReadOnlyList<int>?> read)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete, bufferSize: 1);
|
||||
return read(file);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using FrameLedger.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// RPG Maker's build facts from the files on disk (beta.19, <c>05_DETECTION</c> §Engine version — Unity, Godot, RPG Maker):
|
||||
/// the first <see cref="ScriptHeaderBytes"/> of MV/MZ's core script (<c>js/rmmz_core.js</c>, <c>www/js/rpg_core.js</c>,
|
||||
/// <c>js/rpg_core.js</c>), or <c>Game.ini</c>'s <c>Library=</c> line and that RGSS library's version resource — beside the
|
||||
/// executable or up to two folders above it, as <c>RpgMakerTitle</c> looks (a launcher-fronted game keeps its runtime in a
|
||||
/// subfolder: HELLO, HELLO WORLD!'s is <c>swiftshader\</c>, A Doll's Locket's <c>css\</c>). Nothing else is read.
|
||||
/// </summary>
|
||||
public static partial class RpgMakerBuildReader
|
||||
{
|
||||
/// <summary>How much of a core script is read: its opening comment block, with room to spare (the version is on line 2).</summary>
|
||||
public const int ScriptHeaderBytes = 4096;
|
||||
|
||||
/// <summary>A <c>Game.ini</c> larger than this is not RPG Maker's (it holds four short lines).</summary>
|
||||
public const long MaxIniBytes = 64 * 1024;
|
||||
|
||||
/// <summary>How many folders above the executable's own are looked in.</summary>
|
||||
public const int FoldersUp = 2;
|
||||
|
||||
private static readonly (string Relative, string Script)[] _scripts =
|
||||
[
|
||||
(Path.Combine("js", RpgMakerVersion.MzCoreScript), RpgMakerVersion.MzCoreScript),
|
||||
(Path.Combine("www", "js", RpgMakerVersion.MvCoreScript), RpgMakerVersion.MvCoreScript),
|
||||
(Path.Combine("js", RpgMakerVersion.MvCoreScript), RpgMakerVersion.MvCoreScript),
|
||||
];
|
||||
|
||||
/// <summary>The facts for an entry at <paramref name="exePath"/>, or null when none of the files is there.</summary>
|
||||
/// <param name="exePath">The entry's executable.</param>
|
||||
/// <param name="rgssLibrary">An RGSS library the install listing holds, for an install with no readable <c>Game.ini</c>; or null.</param>
|
||||
public static RpgMakerBuildFacts? Read(string exePath, string? rgssLibrary = null)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
string? folder = Path.GetDirectoryName(exePath);
|
||||
for (int up = 0; up <= FoldersUp && !string.IsNullOrEmpty(folder); up++, folder = Path.GetDirectoryName(folder))
|
||||
{
|
||||
foreach ((string relative, string script) in _scripts)
|
||||
{
|
||||
if (ScriptVersion(Path.Combine(folder, relative), script) is { } version)
|
||||
{
|
||||
return new RpgMakerBuildFacts { CoreScript = script, CoreScriptVersion = version };
|
||||
}
|
||||
}
|
||||
|
||||
if (LibraryOf(Path.Combine(folder, "Game.ini")) is { } library)
|
||||
{
|
||||
return Rgss(library);
|
||||
}
|
||||
}
|
||||
|
||||
return rgssLibrary is null ? null : Rgss(rgssLibrary);
|
||||
}
|
||||
|
||||
/// <summary>The version a core script's header names for <paramref name="script"/>, or null. Public for the tests.</summary>
|
||||
public static string? ScriptVersion(string path, string script)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(path);
|
||||
try
|
||||
{
|
||||
using var file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete, bufferSize: 1);
|
||||
byte[] head = new byte[ScriptHeaderBytes];
|
||||
int read = file.ReadAtLeast(head, head.Length, throwOnEndOfStream: false);
|
||||
foreach (Match m in HeaderLine().Matches(Encoding.UTF8.GetString(head, 0, read)))
|
||||
{
|
||||
if (string.Equals(m.Groups["script"].Value, script, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return RpgMakerVersion.ScriptVersion(m.Groups["version"].Value);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The library a <c>Game.ini</c> names (<c>Library=System\RGSS301.dll</c>), as a full path under the ini's folder — or
|
||||
/// its bare file name when the value points outside that folder, which is then not read. Null without the line.
|
||||
/// </summary>
|
||||
public static string? LibraryOf(string iniPath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(iniPath);
|
||||
try
|
||||
{
|
||||
var ini = new FileInfo(iniPath);
|
||||
if (!ini.Exists || ini.Length > MaxIniBytes || ini.DirectoryName is not { } folder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (string line in File.ReadLines(iniPath, Encoding.Latin1))
|
||||
{
|
||||
Match m = LibraryLine().Match(line);
|
||||
if (!m.Success)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string value = m.Groups["value"].Value.Trim();
|
||||
string full = Path.GetFullPath(Path.Combine(folder, value));
|
||||
return full.StartsWith(Path.TrimEndingDirectorySeparator(folder) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)
|
||||
? full
|
||||
: Path.GetFileName(value);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or NotSupportedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static RpgMakerBuildFacts Rgss(string library)
|
||||
{
|
||||
IReadOnlyList<int>? version = null;
|
||||
if (Path.IsPathFullyQualified(library))
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo info = FileVersionInfo.GetVersionInfo(library);
|
||||
version = info.FileMajorPart == 0 && info.FileMinorPart == 0 && info.FileBuildPart == 0 && info.FilePrivatePart == 0
|
||||
? null
|
||||
: [info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart];
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException)
|
||||
{
|
||||
// The name still carries the version (RGSS301 is 3.0.1).
|
||||
}
|
||||
}
|
||||
|
||||
return new RpgMakerBuildFacts { RgssLibrary = Path.GetFileName(library), RgssFileVersion = version };
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"^//\s*(?<script>rmmz_core\.js|rpg_core\.js)\s+v(?<version>\d{1,2}\.\d{1,3}\.\d{1,3})\b", RegexOptions.ExplicitCapture | RegexOptions.Multiline | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex HeaderLine();
|
||||
|
||||
[GeneratedRegex(@"^\s*Library\s*=\s*(?<value>\S.*)$", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex LibraryLine();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using FrameLedger.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// Unity's build facts from the files on disk (beta.19, <c>05_DETECTION</c> §Engine version — Unity, Godot, RPG Maker): the
|
||||
/// player library's version resource and the first <see cref="DataHeaderBytes"/> bytes of the data file
|
||||
/// <c>globalgamemanagers</c>, whose serialized-file header names the editor version (at byte 20 in a 2019.4 build, 48 in
|
||||
/// later ones). Nothing else of either file is read; the game's process is never opened.
|
||||
/// </summary>
|
||||
public static partial class UnityBuildReader
|
||||
{
|
||||
/// <summary>How much of the data file is read: its header, with room to spare (the version sat at 48 at the latest).</summary>
|
||||
public const int DataHeaderBytes = 256;
|
||||
|
||||
/// <summary>The facts in the two files, or null when neither gave any.</summary>
|
||||
/// <param name="playerPath"><c>UnityPlayer.dll</c>, or null when the install has none.</param>
|
||||
/// <param name="dataFilePath"><c><Game>_Data\globalgamemanagers</c>, or null.</param>
|
||||
public static UnityBuildFacts? Read(string? playerPath, string? dataFilePath)
|
||||
{
|
||||
string? product = null;
|
||||
IReadOnlyList<int>? numeric = null;
|
||||
if (playerPath is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo info = FileVersionInfo.GetVersionInfo(playerPath);
|
||||
product = string.IsNullOrWhiteSpace(info.ProductVersion) ? null : info.ProductVersion.Trim();
|
||||
numeric = info.FileMajorPart == 0 && info.FileMinorPart == 0 && info.FileBuildPart == 0 && info.FilePrivatePart == 0
|
||||
? null
|
||||
: [info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart];
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException)
|
||||
{
|
||||
// No version resource read: the data file may still say it.
|
||||
}
|
||||
}
|
||||
|
||||
string? header = dataFilePath is null ? null : DataHeaderVersion(dataFilePath);
|
||||
return product is null && numeric is null && header is null
|
||||
? null
|
||||
: new UnityBuildFacts { PlayerProductVersion = product, PlayerFileVersion = numeric, DataHeaderVersion = header };
|
||||
}
|
||||
|
||||
/// <summary>The editor version in the first <see cref="DataHeaderBytes"/> of a data file, or null. Public for the tests.</summary>
|
||||
public static string? DataHeaderVersion(string dataFilePath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(dataFilePath);
|
||||
try
|
||||
{
|
||||
using var file = new FileStream(dataFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete, bufferSize: 1);
|
||||
byte[] head = new byte[DataHeaderBytes];
|
||||
int read = file.ReadAtLeast(head, head.Length, throwOnEndOfStream: false);
|
||||
Match m = HeaderVersion().Match(Encoding.Latin1.GetString(head, 0, read));
|
||||
return m.Success ? UnityVersion.EditorVersion(m.Value) : null;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"\d{1,4}\.\d{1,2}\.\d{1,3}[abfpx]\d{1,3}", RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 250)]
|
||||
private static partial Regex HeaderVersion();
|
||||
}
|
||||
@@ -24,9 +24,14 @@ namespace FrameLedger.Infrastructure.Import;
|
||||
/// bootstrapper and as <c>Game-Win64-Shipping.exe</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The two layout rules are the engines' own conventions, not guesses about names: a Unity player is <c>X.exe</c>
|
||||
/// beside a directory <c>X_Data</c>, and an Unreal packaged build's game process is <c>*-Win64-Shipping.exe</c> (the
|
||||
/// root executable of the same name is a bootstrapper that starts it and exits).
|
||||
/// The layout rules are the engines' own conventions, not guesses about names: a Unity player is <c>X.exe</c> beside a
|
||||
/// directory <c>X_Data</c>, an Unreal packaged build's game process is <c>*-Win64-Shipping.exe</c> (the root executable
|
||||
/// of the same name is a bootstrapper that starts it and exits), and — since beta.19 (owner decision D56) — an NW.js
|
||||
/// runtime is the executable beside its <c>nw.dll</c> and <c>package.json</c>, which is how an RPG Maker MV/MZ game
|
||||
/// ships. The last one ranks below the first two and above a name: an NW.js folder can be a tool shipped beside a Unity
|
||||
/// or Unreal game, and a launcher named after the install is exactly what fronts the runtime on A Doll's Locket - Remake
|
||||
/// (itch), whose 213 MB <c>DollsLocket.exe</c> starts <c>css\Game.exe</c> — the process that draws, the one D28 pointed
|
||||
/// HELLO, HELLO WORLD!'s entry at by hand.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class ExecutableLocator : IExecutableLocator
|
||||
@@ -37,7 +42,8 @@ public sealed class ExecutableLocator : IExecutableLocator
|
||||
/// </summary>
|
||||
public const int MaxDepth = 4;
|
||||
|
||||
private const int _rankEngineLayout = 2;
|
||||
private const int _rankEngineLayout = 3;
|
||||
private const int _rankNwjsRuntime = 2;
|
||||
private const int _rankNamedAfterTheInstall = 1;
|
||||
private const int _minimumNameLength = 4;
|
||||
|
||||
@@ -50,8 +56,30 @@ public sealed class ExecutableLocator : IExecutableLocator
|
||||
// beta.14: BugSplat's sender (BsSndRpt64.exe, Kingdom Come: Deliverance II) matches none of the above — its name says
|
||||
// "report" without the letters; KCD2 picked its game by rank alone.
|
||||
"bssndrpt", "bugsplat",
|
||||
// beta.19: what an NW.js runtime keeps beside itself — Chromium's toast helper (NW.js 0.48.4 on A Doll's Locket - Remake,
|
||||
// 0.82.0 on Flower in Us), and the SDK flavour's compiler and driver, which the NW.js rank would otherwise weigh as the game.
|
||||
"notification_helper", "nwjc", "chromedriver",
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Whole names (no extension) of helpers a runtime ships beside a game, which no store's choice makes the game (beta.19).
|
||||
/// itch's butler keeps the shallowest candidates and drops those that ask for elevation, so its verdict for A Doll's
|
||||
/// Locket - Remake named <c>notification_helper.exe</c> and nothing else. Whole names rather than
|
||||
/// <see cref="HelperFragments"/>: a store names its own pick, and a fragment such as <c>node</c> is inside a real game's
|
||||
/// name (<c>Nodebuster</c>) — the locator's guess can afford that, overruling a store's verdict cannot.
|
||||
/// </summary>
|
||||
public static readonly IReadOnlySet<string> RuntimeHelperNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"notification_helper", "crashpad_handler", "UnityCrashHandler64", "UnityCrashHandler32", "CrashReportClient", "nwjc", "chromedriver",
|
||||
};
|
||||
|
||||
/// <summary>True for a name in <see cref="RuntimeHelperNames"/>.</summary>
|
||||
public static bool IsRuntimeHelper(string fileNameWithoutExtension)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(fileNameWithoutExtension);
|
||||
return RuntimeHelperNames.Contains(fileNameWithoutExtension);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Folder-name fragments of what a store install carries beside the game: a folder whose name holds one is not walked.
|
||||
/// Red Dead Redemption 2's <c>Redistributables\Rockstar-Games-Launcher.exe</c> is 140 MB to <c>RDR2.exe</c>'s 90.
|
||||
@@ -164,6 +192,11 @@ public sealed class ExecutableLocator : IExecutableLocator
|
||||
return _rankEngineLayout; // Unreal: the packaged game process, not the root bootstrapper
|
||||
}
|
||||
|
||||
if (dir is not null && File.Exists(Path.Combine(dir, "nw.dll")) && File.Exists(Path.Combine(dir, "package.json")))
|
||||
{
|
||||
return _rankNwjsRuntime; // NW.js (RPG Maker MV/MZ): the runtime, not the launcher in front of it (D56)
|
||||
}
|
||||
|
||||
string squashed = Squash(name);
|
||||
bool named = squashed.Length >= _minimumNameLength && installName.Length >= _minimumNameLength
|
||||
&& (installName.Contains(squashed, StringComparison.Ordinal) || squashed.Contains(installName, StringComparison.Ordinal));
|
||||
|
||||
@@ -99,16 +99,7 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
""", cancellationToken: ct)).ConfigureAwait(false)).Select(static r => new CaveRow(r.GameId, r.LocationPath, r.FolderName, r.CustomFolder, r.Verdict, r.Title))];
|
||||
}
|
||||
|
||||
int added = 0;
|
||||
foreach (CaveRow cave in caves)
|
||||
{
|
||||
if (ToGame(cave) is { } game && byInstall.TryAdd(game.InstallDirectory, game))
|
||||
{
|
||||
added++;
|
||||
}
|
||||
}
|
||||
|
||||
return $"butler.db read: {locations} location(s), {caves.Count} cave(s), {added} title(s)";
|
||||
return AddCaves(locations, caves, byInstall);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or SqliteException or InvalidOperationException)
|
||||
{
|
||||
@@ -126,7 +117,26 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
}
|
||||
}
|
||||
|
||||
private static StoreGame? ToGame(CaveRow cave)
|
||||
/// <summary>One row per cave the database lists; returns the log fragment — with the titles whose verdict named only a helper.</summary>
|
||||
private static string AddCaves(int locations, List<CaveRow> caves, Dictionary<string, StoreGame> byInstall)
|
||||
{
|
||||
int added = 0;
|
||||
List<string> helperVerdicts = [];
|
||||
foreach (CaveRow cave in caves)
|
||||
{
|
||||
if (ToGame(cave, helperVerdicts) is { } game && byInstall.TryAdd(game.InstallDirectory, game))
|
||||
{
|
||||
added++;
|
||||
}
|
||||
}
|
||||
|
||||
string note = $"butler.db read: {locations} location(s), {caves.Count} cave(s), {added} title(s)";
|
||||
return helperVerdicts.Count == 0
|
||||
? note
|
||||
: note + $"; butler's verdict named only a helper for {string.Join(", ", helperVerdicts)} — the executable is guessed instead";
|
||||
}
|
||||
|
||||
private static StoreGame? ToGame(CaveRow cave, List<string> helperVerdicts)
|
||||
{
|
||||
string? install = !string.IsNullOrWhiteSpace(cave.CustomFolder) ? cave.CustomFolder
|
||||
: cave.LocationPath is { Length: > 0 } && cave.FolderName is { Length: > 0 } ? Path.Combine(cave.LocationPath, cave.FolderName)
|
||||
@@ -138,7 +148,13 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
|
||||
install = Path.GetFullPath(install);
|
||||
string name = cave.Title is { Length: > 0 } ? cave.Title : ReadReceipt(Path.Combine(install, ".itch", "receipt.json.gz"))?.Title ?? Path.GetFileName(install);
|
||||
return new StoreGame(_platform, cave.GameId.ToString(System.Globalization.CultureInfo.InvariantCulture), name, install, VerdictExecutable(cave.Verdict, install), Version: null);
|
||||
string? exe = VerdictExecutable(cave.Verdict, install, out bool onlyHelpers);
|
||||
if (onlyHelpers)
|
||||
{
|
||||
helperVerdicts.Add(name);
|
||||
}
|
||||
|
||||
return new StoreGame(_platform, cave.GameId.ToString(System.Globalization.CultureInfo.InvariantCulture), name, install, exe, Version: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -146,8 +162,17 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
/// Windows candidate is the executable butler itself launches; anything else (an HTML5 or Love2D game, a
|
||||
/// verdict that will not parse) leaves the guess to the locator.
|
||||
/// </summary>
|
||||
private static string? VerdictExecutable(string? verdict, string install)
|
||||
/// <remarks>
|
||||
/// <b>Not a candidate a runtime ships as a helper (beta.19).</b> butler saves a FILTERED verdict — the shallowest
|
||||
/// candidates, minus those whose manifest asks for elevation — and does not rank what is left, so on A Doll's Locket -
|
||||
/// Remake (game 5085165) the one candidate was <c>Dolls Locket/notification_helper.exe</c>: the 213 MB launcher asks for
|
||||
/// administrator and the NW.js runtime sits a level deeper. The import took it as the game, unmarked as a guess. A
|
||||
/// candidate <see cref="ExecutableLocator.IsRuntimeHelper"/> names, or one inside a Unity plugin folder, is skipped;
|
||||
/// when nothing else is left, <paramref name="onlyHelpers"/> is true and the locator guesses — the review says so.
|
||||
/// </remarks>
|
||||
private static string? VerdictExecutable(string? verdict, string install, out bool onlyHelpers)
|
||||
{
|
||||
onlyHelpers = false;
|
||||
if (string.IsNullOrWhiteSpace(verdict))
|
||||
{
|
||||
return null;
|
||||
@@ -167,7 +192,15 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
&& string.Equals(flavor.GetString(), "windows", StringComparison.Ordinal);
|
||||
if (windows && candidate.TryGetProperty("path", out JsonElement path) && path.ValueKind == JsonValueKind.String && path.GetString() is { Length: > 0 } relative)
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(install, relative.Replace('/', Path.DirectorySeparatorChar)));
|
||||
string full = Path.GetFullPath(Path.Combine(install, relative.Replace('/', Path.DirectorySeparatorChar)));
|
||||
if (ExecutableLocator.IsRuntimeHelper(Path.GetFileNameWithoutExtension(full)) || ExecutableLocator.IsUnderPluginFolder(install, full))
|
||||
{
|
||||
onlyHelpers = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
onlyHelpers = false;
|
||||
return full;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +208,7 @@ public sealed class ItchLibrarySource(string? itchDirectory = null, Action<strin
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
onlyHelpers = false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,40 +22,60 @@ target_compile_features(FrameLedger.Shm INTERFACE cxx_std_20)
|
||||
#
|
||||
# KNOWN LIMIT, stated rather than discovered: this runs at CONFIGURE time, so the
|
||||
# `-dirty` suffix reflects the tree when CMake last ran, not when the DLL was
|
||||
# last compiled. For a released build that is exact — CI configures and builds
|
||||
# once from a clean checkout. For a developer editing between configures it is
|
||||
# approximate, and the field is a version-skew signal rather than a provenance
|
||||
# guarantee. Making it exact means re-running git on every build, which is a cost
|
||||
# on every incremental compile for a value only the attach handshake reads.
|
||||
execute_process(
|
||||
COMMAND git describe --always --dirty --abbrev=12
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE FL_BUILD_ID_RAW
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT FL_BUILD_ID_RAW)
|
||||
set(FL_BUILD_ID_RAW "unknown")
|
||||
endif()
|
||||
# buildId is char[32] and the guard side compares the whole array, so a value
|
||||
# that would be truncated must be caught here rather than becoming a permanent
|
||||
# mismatch nobody can explain.
|
||||
string(LENGTH "${FL_BUILD_ID_RAW}" FL_BUILD_ID_LEN)
|
||||
# AFTER THE FIRST TAG the long form stopped fitting on a developer's machine: `v0.1.0-beta.2-2-gd3e74988a7bc-dirty`
|
||||
# is 35 characters, so every local configure with an uncommitted change failed here and the documented workaround
|
||||
# was "commit before you build" (measured 2026-09-17, again 2026-09-21). The id is a version-skew signal, not a
|
||||
# provenance guarantee (above), so the fallback spends fewer characters on the same facts: an 8-digit abbreviation
|
||||
# and `+` for dirty. A released build is a clean checkout AT a tag and never reaches this branch. Still too long
|
||||
# after that is still fatal, for the reason the check exists.
|
||||
if(FL_BUILD_ID_LEN GREATER 31)
|
||||
# last compiled. This comment said that for a released build it was exact, "CI
|
||||
# configures and builds once from a clean checkout", and it was not (corrected
|
||||
# 2026-10-07, beta.18): release.yml writes the release date into the tracked
|
||||
# legal/*.md before the gate configures, and every release until beta.18 shipped
|
||||
# "<tag>-dirty" — the owner's Dashboard read "Overlay build v0.1.0-beta.17-dirty",
|
||||
# and the run's log "FL_BUILD_ID = v0.1.0-beta.17-dirty" two lines after
|
||||
# "RELEASE_DATE = 2026-10-07 in 3 file(s)". A release now hands the id in (below). For a
|
||||
# developer editing between configures it is approximate, and the field is a
|
||||
# version-skew signal rather than a provenance guarantee. Making it exact means
|
||||
# re-running git on every build, which is a cost on every incremental compile for a
|
||||
# value only the attach handshake reads.
|
||||
#
|
||||
# A RELEASE HANDS THE ID IN: release.yml reads describe from the clean checkout, before
|
||||
# anything edits a tracked file, and passes it as the environment's FL_BUILD_ID; it is
|
||||
# taken as given here, and tools/buildid-check.ps1 then reads it back out of the
|
||||
# published binaries. It goes into a C string literal, so it must be what describe can
|
||||
# print and nothing a literal would have to escape.
|
||||
if(DEFINED ENV{FL_BUILD_ID} AND NOT "$ENV{FL_BUILD_ID}" STREQUAL "")
|
||||
set(FL_BUILD_ID_RAW "$ENV{FL_BUILD_ID}")
|
||||
if(NOT FL_BUILD_ID_RAW MATCHES "^[0-9A-Za-z._+-]+$")
|
||||
message(FATAL_ERROR "FL_BUILD_ID '${FL_BUILD_ID_RAW}' from the environment holds a character no build id has (0-9 A-Z a-z . _ + -).")
|
||||
endif()
|
||||
string(LENGTH "${FL_BUILD_ID_RAW}" FL_BUILD_ID_LEN)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND git describe --always --dirty=+ --abbrev=8
|
||||
COMMAND git describe --always --dirty --abbrev=12
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE FL_BUILD_ID_RAW
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT FL_BUILD_ID_RAW)
|
||||
set(FL_BUILD_ID_RAW "unknown")
|
||||
endif()
|
||||
# buildId is char[32] and the guard side compares the whole array, so a value
|
||||
# that would be truncated must be caught here rather than becoming a permanent
|
||||
# mismatch nobody can explain.
|
||||
string(LENGTH "${FL_BUILD_ID_RAW}" FL_BUILD_ID_LEN)
|
||||
# AFTER THE FIRST TAG the long form stopped fitting on a developer's machine: `v0.1.0-beta.2-2-gd3e74988a7bc-dirty`
|
||||
# is 35 characters, so every local configure with an uncommitted change failed here and the documented workaround
|
||||
# was "commit before you build" (measured 2026-09-17, again 2026-09-21). The id is a version-skew signal, not a
|
||||
# provenance guarantee (above), so the fallback spends fewer characters on the same facts: an 8-digit abbreviation
|
||||
# and `+` for dirty. A released build hands its id in (above) and never reaches this branch. Still too long
|
||||
# after that is still fatal, for the reason the check exists.
|
||||
if(FL_BUILD_ID_LEN GREATER 31)
|
||||
execute_process(
|
||||
COMMAND git describe --always --dirty=+ --abbrev=8
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE FL_BUILD_ID_RAW
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
string(LENGTH "${FL_BUILD_ID_RAW}" FL_BUILD_ID_LEN)
|
||||
endif()
|
||||
endif()
|
||||
if(FL_BUILD_ID_LEN GREATER 31)
|
||||
message(FATAL_ERROR
|
||||
|
||||
@@ -171,6 +171,31 @@ public sealed class FormatsTests
|
||||
Formats.Engine(null).Should().BeEmpty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.19: each RPG Maker rule covers several makers, and the file the version was read from names which; the RGSS
|
||||
/// number is the runtime library's, and says so.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TheVersionsWitnessNamesTheMakerAndRgssSaysWhoseNumberItIs()
|
||||
{
|
||||
Formats.Engine("rpgmaker_mv", EngineVersionSource.RpgMakerMzCore).Should().Be("RPG Maker MZ");
|
||||
Formats.Engine("rpgmaker_mv", EngineVersionSource.RpgMakerMvCore).Should().Be("RPG Maker MV");
|
||||
Formats.Engine("rpgmaker_rgss", EngineVersionSource.Rgss1Library).Should().Be("RPG Maker XP");
|
||||
Formats.Engine("rpgmaker_rgss", EngineVersionSource.Rgss2Library).Should().Be("RPG Maker VX");
|
||||
Formats.Engine("rpgmaker_rgss", EngineVersionSource.Rgss3Library).Should().Be("RPG Maker VX Ace");
|
||||
Formats.Engine("rpgmaker_mv", null).Should().Be("RPG Maker MV/MZ", "no witness, no maker");
|
||||
Formats.Engine("unity", EngineVersionSource.RpgMakerMzCore).Should().Be("Unity", "a witness names a maker only for its own rule");
|
||||
|
||||
Formats.EngineWithVersion("rpgmaker_mv", "1.10.0", EngineVersionSource.RpgMakerMzCore).Should().Be("RPG Maker MZ 1.10.0");
|
||||
Formats.EngineWithVersion("rpgmaker_rgss", "3.0.1", EngineVersionSource.Rgss3Library).Should().Be("RPG Maker VX Ace (RGSS 3.0.1)");
|
||||
Formats.EngineWithVersion("unity", "2022.3.39f1", EngineVersionSource.UnityPlayer).Should().Be("Unity 2022.3.39f1");
|
||||
Formats.EngineWithVersion("godot", "4.4.1", EngineVersionSource.GodotPack).Should().Be("Godot 4.4.1");
|
||||
Formats.EngineWithVersion("unreal", "5.4.4", EngineVersionSource.UnrealFileVersion).Should().Be("Unreal Engine 5.4.4");
|
||||
Formats.EngineWithVersion("unity", "6000.0", null).Should().Be("Unity 6000.0", "a version the user typed has no witness");
|
||||
Formats.EngineWithVersion("godot", null, null).Should().Be("Godot");
|
||||
Formats.EngineWithVersion(null, "1.0", null).Should().BeEmpty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Every engine the shipped rules can detect has a name here, and it is the rule's own <c>name</c> (2026-09-23): a rule
|
||||
/// added without one would show its raw id on every card that engine lands on — which is what every engine did until
|
||||
|
||||
@@ -107,12 +107,19 @@ public sealed class GameDetailViewModelTests
|
||||
|
||||
private sealed class FakePicker(string? path) : IGamePicker
|
||||
{
|
||||
public string? PickExecutable() => path;
|
||||
/// <summary>The folder each pick was asked to open in.</summary>
|
||||
public List<string?> Folders { get; } = [];
|
||||
|
||||
public string? PickExecutable(string? initialDirectory = null)
|
||||
{
|
||||
Folders.Add(initialDirectory);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<(GameDetailViewModel Vm, FakeAgent Agent, FakePrompt Prompt, FakeNavigator Nav, FakeStrip Strip)> BuildAsync(
|
||||
ScratchLedger s, long gameId, RemoveGameChoice remove = RemoveGameChoice.Cancel, GameMetadata? edit = null, string? pick = null,
|
||||
FakeAgent? withAgent = null, RegisteredSettings? settings = null, UiMode? mode = null)
|
||||
FakeAgent? withAgent = null, RegisteredSettings? settings = null, UiMode? mode = null, FakePicker? picker = null)
|
||||
{
|
||||
FakeAgent agent = withAgent ?? new FakeAgent();
|
||||
var prompt = new FakePrompt();
|
||||
@@ -121,7 +128,7 @@ public sealed class GameDetailViewModelTests
|
||||
var vm = new GameDetailViewModel(s.Library, new GameSelection { GameId = gameId }, new HookingConsent(agent, prompt), nav,
|
||||
new FakeConfirmations(remove), new FakeEdit(edit), strip, new NoSummaries(),
|
||||
new Charts.SessionSeriesLoader(s.Sessions), new Infrastructure.Persistence.SqliteHardwareSnapshotRepository(s.Db), new SessionSelection(),
|
||||
new FakePicker(pick), settings, mode: mode);
|
||||
picker ?? new FakePicker(pick), settings, mode: mode);
|
||||
Task pending = vm.Pending;
|
||||
await pending.ConfigureAwait(false);
|
||||
return (vm, agent, prompt, nav, strip);
|
||||
@@ -613,7 +620,47 @@ public sealed class GameDetailViewModelTests
|
||||
.And.Contain(new GameDetailRow("Engine version", Strings.GameDetail_EngineVersion_NotFound), "an Unreal title says its version was not found rather than nothing");
|
||||
|
||||
(GameDetailViewModel gf2, _, _, _, _) = await BuildAsync(s, unity.Id);
|
||||
gf2.Details.Should().NotContain(r => r.Label == "Engine version", "other engines add no line");
|
||||
gf2.Details.Should().NotContain(r => r.Label == "Engine version", "a version an older rules file's extractor wrote names no witness");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Strings.Culture = previous;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.19: a Unity, Godot or RPG Maker version says what it was read from, RPG Maker's witness names the maker in the
|
||||
/// header, and such a title whose files named no version says so once the sweep has read it.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheDetailsCardSaysWhatAUnityGodotOrRpgMakerVersionWasReadFrom()
|
||||
{
|
||||
CultureInfo? previous = Strings.Culture;
|
||||
Strings.Culture = CultureInfo.GetCultureInfo("en");
|
||||
try
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
ValueTask<int> SetAsync(long id, string engine, string? version, string? source) => s.Db.WriteAsync((c, tx, ct) => Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(
|
||||
"UPDATE games SET engine = @engine, engine_version = @version, engine_version_source = @source, exe_machine = 'x64' WHERE id = @id",
|
||||
new { id, engine, version, source }, tx, cancellationToken: ct)), Ct);
|
||||
(string Name, string Engine, string? Version, string? Source, string Subtitle, string Witness)[] cases =
|
||||
[
|
||||
("A Doll's Locket - Remake", "rpgmaker_mv", "1.10.0", EngineVersionSource.RpgMakerMzCore, "RPG Maker MZ 1.10.0", "From the first lines of the game's js/rmmz_core.js."),
|
||||
("City of Bones", "rpgmaker_rgss", "3.0.1", EngineVersionSource.Rgss3Library, "RPG Maker VX Ace (RGSS 3.0.1)", Strings.GameDetail_EngineVersion_Rgss),
|
||||
("xiandie", "godot", "4.4.1", EngineVersionSource.GodotPack, "Godot 4.4.1", Strings.GameDetail_EngineVersion_GodotPack),
|
||||
("GF2", "unity", "2019.4.40", EngineVersionSource.UnityPlayerFile, "Unity 2019.4.40", Strings.GameDetail_EngineVersion_UnityPlayerFile),
|
||||
("Unread", "unity", null, null, "Unity", Strings.GameDetail_EngineVersion_NotFoundInFiles),
|
||||
];
|
||||
foreach ((string name, string engine, string? version, string? source, string subtitle, string witness) in cases)
|
||||
{
|
||||
GameRow row = await s.GameAsync(name);
|
||||
await SetAsync(row.Id, engine, version, source);
|
||||
|
||||
(GameDetailViewModel vm, _, _, _, _) = await BuildAsync(s, row.Id);
|
||||
|
||||
vm.Subtitle.Should().EndWith(subtitle, name);
|
||||
vm.Details.Should().Contain(new GameDetailRow("Engine version", witness), name);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -815,6 +862,36 @@ public sealed class GameDetailViewModelTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.19 (owner request 2026-10-12): the pick opens in the game's own root folder — a Steam install's folder under
|
||||
/// <c>steamapps\common</c>, not the <c>bin\x64</c> the executable sits in, and not wherever the dialog was last.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ChangingTheExecutableOpensThePickInTheGamesOwnFolder()
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
string library = Path.Combine(Path.GetTempPath(), "fl-pick-" + Guid.NewGuid().ToString("N"));
|
||||
string install = Path.Combine(library, "steamapps", "common", "Title");
|
||||
Directory.CreateDirectory(Path.Combine(install, "bin", "x64"));
|
||||
try
|
||||
{
|
||||
GameRow game = await s.GameAsync("Title", Infrastructure.Io.ExecutableIdentity.Normalise(Path.Combine(install, "bin", "x64", "Title.exe")));
|
||||
var picker = new FakePicker(null);
|
||||
(GameDetailViewModel vm, _, _, _, FakeStrip strip) = await BuildAsync(s, game.Id, picker: picker);
|
||||
|
||||
vm.ChangeExecutableCommand.Execute(null);
|
||||
Task pending = vm.Pending;
|
||||
await pending;
|
||||
|
||||
picker.Folders.Should().Equal([install], "the install root under steamapps\\common, not bin\\x64");
|
||||
strip.Lines.Should().BeEmpty("a cancelled pick changes nothing");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Directory.Delete(library, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ChangingTheExecutableToAnUnreadableFileOrCancellingChangesNothing()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
// 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;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Where Change executable… opens (beta.19, owner request 2026-10-12): the game's root folder for each layout the library
|
||||
/// holds — a store's install folder, an Unreal package outside a store, a loose folder — the nearest folder still there for
|
||||
/// an entry whose folder is gone, and nothing for a drive that is not connected.
|
||||
/// </summary>
|
||||
public sealed class GameFolderTests : IDisposable
|
||||
{
|
||||
private readonly string _dir = Path.Combine(Path.GetTempPath(), "fl-gamefolder-" + Guid.NewGuid().ToString("N"));
|
||||
|
||||
public GameFolderTests() => Directory.CreateDirectory(_dir);
|
||||
|
||||
public void Dispose() => Directory.Delete(_dir, recursive: true);
|
||||
|
||||
private string Sub(params string[] parts)
|
||||
{
|
||||
string p = Path.Combine([_dir, .. parts]);
|
||||
Directory.CreateDirectory(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AStoreInstallOpensAtItsFolderUnderTheStoresBoundary()
|
||||
{
|
||||
string install = Sub("SteamLibrary", "steamapps", "common", "Lies of P");
|
||||
string bin = Sub("SteamLibrary", "steamapps", "common", "Lies of P", "LiesofP", "Binaries", "Win64");
|
||||
|
||||
GameFolder.StartFolder(Path.Combine(bin, "LiesofP-Win64-Shipping.exe")).Should().Be(install);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnUnrealPackageOutsideAStoreOpensAboveItsProjectFolder()
|
||||
{
|
||||
string root = Sub("Games", "Hell Is Us");
|
||||
string bin = Sub("Games", "Hell Is Us", "HellIsUs", "Binaries", "Win64");
|
||||
|
||||
GameFolder.StartFolder(Path.Combine(bin, "HellIsUs-Win64-Shipping.exe")).Should().Be(root, "<root>\\<Project>\\Binaries\\Win64 is Unreal's own layout");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ALooseFolderOpensWhereTheExecutableIs()
|
||||
{
|
||||
string game = Sub("it", "a-dolls-locket-remake", "Dolls Locket");
|
||||
|
||||
GameFolder.StartFolder(Path.Combine(game, "notification_helper.exe")).Should().Be(game);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFolderThatIsGoneOpensAtTheNearestOneStillThere()
|
||||
{
|
||||
string library = Sub("it");
|
||||
|
||||
GameFolder.StartFolder(Path.Combine(library, "uninstalled", "Sub", "Game.exe")).Should().Be(library, "the entry reads Not installed; its library folder is still there");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ADriveThatIsNotConnectedOpensNowhereInParticular()
|
||||
{
|
||||
char? absent = null;
|
||||
for (char letter = 'Z'; letter >= 'D'; letter--)
|
||||
{
|
||||
if (!Directory.Exists(letter + @":\"))
|
||||
{
|
||||
absent = letter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.SkipWhen(absent is null, "every drive letter from D to Z is in use on this machine");
|
||||
GameFolder.StartFolder(absent + @":\Games\Title\Title.exe").Should().BeNull("Windows then opens where the last pick was");
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public sealed class GamesViewModelTests
|
||||
|
||||
private sealed class NoPicker : IGamePicker
|
||||
{
|
||||
public string? PickExecutable() => null;
|
||||
public string? PickExecutable(string? initialDirectory = null) => null;
|
||||
}
|
||||
|
||||
private sealed class NoStrip : IMessageStrip
|
||||
|
||||
@@ -129,7 +129,7 @@ public sealed partial class PagesLoadTests
|
||||
|
||||
private sealed class NoPicker : IGamePicker
|
||||
{
|
||||
public string? PickExecutable() => null;
|
||||
public string? PickExecutable(string? initialDirectory = null) => null;
|
||||
}
|
||||
|
||||
private sealed class NoTheme : IThemeApplier
|
||||
|
||||
@@ -92,7 +92,7 @@ public sealed class SessionDeletionAndOverviewTests
|
||||
|
||||
private sealed class NoPicker : IGamePicker
|
||||
{
|
||||
public string? PickExecutable() => null;
|
||||
public string? PickExecutable(string? initialDirectory = null) => null;
|
||||
}
|
||||
|
||||
/// <summary>The summary windows, counting how often they were asked to close the deleted sessions' ones.</summary>
|
||||
|
||||
@@ -78,6 +78,15 @@ public sealed class DetectionSweepTests
|
||||
// Unity rules only here: the sweep's second read is StaticGameDetector's, pinned in StaticGameDetectorTests.
|
||||
public ValueTask<UnrealBuildFacts?> ReadUnrealBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default) =>
|
||||
ValueTask.FromResult<UnrealBuildFacts?>(null);
|
||||
|
||||
public ValueTask<UnityBuildFacts?> ReadUnityBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default) =>
|
||||
ValueTask.FromResult<UnityBuildFacts?>(null);
|
||||
|
||||
public ValueTask<GodotBuildFacts?> ReadGodotBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default) =>
|
||||
ValueTask.FromResult<GodotBuildFacts?>(null);
|
||||
|
||||
public ValueTask<RpgMakerBuildFacts?> ReadRpgMakerBuildAsync(GameFileSnapshot snapshot, CancellationToken ct = default) =>
|
||||
ValueTask.FromResult<RpgMakerBuildFacts?>(null);
|
||||
}
|
||||
|
||||
private sealed class FakeIdentity : IExecutableIdentitySource
|
||||
|
||||
@@ -129,6 +129,72 @@ public sealed class LibraryImporterTests
|
||||
log.Should().Contain(static l => l.Contains("added Cyberpunk 2077", StringComparison.Ordinal) && l.Contains("hooking off", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.19: the owner's library holds A Doll's Locket - Remake at the helper an earlier import took from butler's
|
||||
/// verdict. This build guesses the NW.js runtime instead — and without matching the store's own id it would offer the
|
||||
/// same game a second time beside the entry the owner already has (and re-points with Change executable…).
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AStoreTitleAlreadyInTheLibraryAtAnotherExecutableIsNotOfferedAgain()
|
||||
{
|
||||
var games = new FakeGameRepository();
|
||||
var identity = new FakeIdentity();
|
||||
var locator = new FakeLocator();
|
||||
List<string> log = [];
|
||||
const string install = @"D:\another\it\a-dolls-locket-remake";
|
||||
const string helper = @"D:\ANOTHER\IT\A-DOLLS-LOCKET-REMAKE\DOLLS LOCKET\NOTIFICATION_HELPER.EXE";
|
||||
GameRow old = await games.EnsureAsync(new ExecutableFingerprint { ExePath = helper, SizeBytes = 7, MtimeUnixMs = 7 }, "A Doll's Locket - Remake", Ct);
|
||||
await games.ApplyStoreMetadataAsync(old.Id, new StoreMetadata { Platform = "itch", StoreId = "5085165" }, Ct);
|
||||
identity.Existing.Add(helper);
|
||||
identity.Existing.Add(@"D:\ANOTHER\IT\A-DOLLS-LOCKET-REMAKE\DOLLS LOCKET\CSS\GAME.EXE");
|
||||
locator.Guesses[install] = install + @"\Dolls Locket\css\Game.exe";
|
||||
var itch = new ScriptedStore("itch",
|
||||
new StoreGame("itch", "5085165", "A Doll's Locket - Remake", install, null, null),
|
||||
new StoreGame("itch", "1659887", "Plethora of Bullets 2", @"D:\another\it\plethora-of-bullets-2", @"D:\another\it\plethora-of-bullets-2\POB2.exe", null));
|
||||
identity.Existing.Add(@"D:\ANOTHER\IT\PLETHORA-OF-BULLETS-2\POB2.EXE");
|
||||
var importer = new LibraryImporter([itch], games, identity, locator, log.Add);
|
||||
|
||||
IReadOnlyList<ImportCandidate> found = await importer.DiscoverAsync(Ct);
|
||||
|
||||
ImportCandidate dolls = found.Single(static c => string.Equals(c.Game.StoreId, "5085165", StringComparison.Ordinal));
|
||||
dolls.AlreadyInLibrary.Should().BeTrue("the same itch title is an entry already, at the executable an earlier import chose");
|
||||
dolls.CanImport.Should().BeFalse();
|
||||
found.Single(static c => string.Equals(c.Game.StoreId, "1659887", StringComparison.Ordinal)).CanImport.Should().BeTrue("another title of the same store is not matched");
|
||||
log.Should().Contain(l => l.Contains("already in the library as " + helper, StringComparison.Ordinal));
|
||||
|
||||
(await importer.ImportAsync([.. found.Where(static c => c.CanImport)], Ct)).Added.Should().Be(1);
|
||||
games.Rows.Should().HaveCount(2, "Plethora was added and A Doll's Locket stayed one entry");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entry's platform is the detection sweep's to refresh — an itch build that ships Steam's API reads as Steam — so the
|
||||
/// same store id with the entry's executable inside the title's install folder is the same title too; outside it, an id
|
||||
/// under another platform is another store's numbering, not this game.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheSameStoreIdInsideTheTitlesFolderIsTheSameTitleWhateverThePlatformReadsAs()
|
||||
{
|
||||
var games = new FakeGameRepository();
|
||||
var identity = new FakeIdentity();
|
||||
var locator = new FakeLocator();
|
||||
const string install = @"D:\another\it\some-game";
|
||||
const string old = @"D:\ANOTHER\IT\SOME-GAME\NOTIFICATION_HELPER.EXE";
|
||||
GameRow entry = await games.EnsureAsync(new ExecutableFingerprint { ExePath = old, SizeBytes = 7, MtimeUnixMs = 7 }, "Some Game", Ct);
|
||||
await games.ApplyStoreMetadataAsync(entry.Id, new StoreMetadata { Platform = "steam", StoreId = "42" }, Ct);
|
||||
identity.Existing.Add(@"D:\ANOTHER\IT\SOME-GAME\GAME.EXE");
|
||||
locator.Guesses[install] = install + @"\Game.exe";
|
||||
identity.Existing.Add(@"D:\ANOTHER\IT\OTHER\OTHER.EXE");
|
||||
locator.Guesses[@"D:\another\it\other"] = @"D:\another\it\other\Other.exe";
|
||||
var itch = new ScriptedStore("itch",
|
||||
new StoreGame("itch", "42", "Some Game", install, null, null),
|
||||
new StoreGame("itch", "42", "Another store's 42", @"D:\another\it\other", null, null));
|
||||
|
||||
IReadOnlyList<ImportCandidate> found = await new LibraryImporter([itch], games, identity, locator, static _ => { }).DiscoverAsync(Ct);
|
||||
|
||||
found.Single(static c => string.Equals(c.Game.Name, "Some Game", StringComparison.Ordinal)).AlreadyInLibrary.Should().BeTrue("its entry's executable is inside the title's folder");
|
||||
found.Single(static c => string.Equals(c.Game.Name, "Another store's 42", StringComparison.Ordinal)).CanImport.Should().BeTrue("the same number under another platform, elsewhere, is not this title");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AStoreThatThrowsCostsItsOwnTitlesAndTheSameExecutableUnderTwoStoresIsOneRow()
|
||||
{
|
||||
|
||||
@@ -41,6 +41,33 @@ public sealed class StaticGameDetectorTests
|
||||
UnrealReads++;
|
||||
return ValueTask.FromResult(unreal);
|
||||
}
|
||||
|
||||
public UnityBuildFacts? Unity { get; init; }
|
||||
|
||||
public GodotBuildFacts? Godot { get; init; }
|
||||
|
||||
public RpgMakerBuildFacts? RpgMaker { get; init; }
|
||||
|
||||
/// <summary>Which of the beta.19 second reads was made, in order.</summary>
|
||||
public List<string> BuildReads { get; } = [];
|
||||
|
||||
public ValueTask<UnityBuildFacts?> ReadUnityBuildAsync(GameFileSnapshot s, CancellationToken ct = default)
|
||||
{
|
||||
BuildReads.Add("unity");
|
||||
return ValueTask.FromResult(Unity);
|
||||
}
|
||||
|
||||
public ValueTask<GodotBuildFacts?> ReadGodotBuildAsync(GameFileSnapshot s, CancellationToken ct = default)
|
||||
{
|
||||
BuildReads.Add("godot");
|
||||
return ValueTask.FromResult(Godot);
|
||||
}
|
||||
|
||||
public ValueTask<RpgMakerBuildFacts?> ReadRpgMakerBuildAsync(GameFileSnapshot s, CancellationToken ct = default)
|
||||
{
|
||||
BuildReads.Add("rpgmaker");
|
||||
return ValueTask.FromResult(RpgMaker);
|
||||
}
|
||||
}
|
||||
|
||||
private static SignalGroup Any(params string[] globs) => new()
|
||||
@@ -249,6 +276,55 @@ public sealed class StaticGameDetectorTests
|
||||
probe.UnrealReads.Should().Be(0);
|
||||
}
|
||||
|
||||
private static DetectionRuleSet BuildRules() => Rules() with
|
||||
{
|
||||
Engines =
|
||||
[
|
||||
new EngineRule { Id = "unity", Name = "Unity", Signals = Any("UnityPlayer.dll"), Version = new VersionExtractor { Type = VersionExtractorType.UnityBuild } },
|
||||
new EngineRule { Id = "rpgmaker_mv", Name = "RPG Maker MV/MZ", Signals = Any("nw.dll"), Version = new VersionExtractor { Type = VersionExtractorType.RpgMakerBuild } },
|
||||
new EngineRule { Id = "godot", Name = "Godot", Signals = Any("*.pck"), Version = new VersionExtractor { Type = VersionExtractorType.GodotBuild } },
|
||||
],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// beta.19: Unity, Godot and RPG Maker decide their versions in code as Unreal does — one second read, for the engine that
|
||||
/// matched only, and the decider's witness reported (the owner's Dialoop, 衔蝶 and A Doll's Locket - Remake as measured).
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData("UnityPlayer.dll", "unity", "6000.3.3f1", EngineVersionSource.UnityPlayer)]
|
||||
[InlineData("xiandie.pck", "godot", "4.4.1", EngineVersionSource.GodotPack)]
|
||||
[InlineData("css/nw.dll", "rpgmaker", "1.10.0", EngineVersionSource.RpgMakerMzCore)]
|
||||
public async Task UnityGodotAndRpgMakerReadTheirBuildFactsOnceForTheEngineThatMatched(string marker, string read, string version, string source)
|
||||
{
|
||||
var probe = new ScriptedProbe(Snapshot(marker))
|
||||
{
|
||||
Unity = new UnityBuildFacts { PlayerProductVersion = "6000.3.3f1 (ef04196de0d6)", PlayerFileVersion = [6000, 3, 3, 15664153] },
|
||||
Godot = new GodotBuildFacts { PackVersion = [4, 4, 1], ExeProductName = "xiandie", ExeProductVersion = "0.1.0.3" },
|
||||
RpgMaker = new RpgMakerBuildFacts { CoreScript = "rmmz_core.js", CoreScriptVersion = "1.10.0" },
|
||||
};
|
||||
var detector = new StaticGameDetector(new ScriptedRules(BuildRules()), probe);
|
||||
|
||||
StaticDetectionResult r = await detector.DetectAsync(@"C:\Games\Example\Game.exe", TestContext.Current.CancellationToken);
|
||||
|
||||
r.EngineVersion.Should().Be(version);
|
||||
r.EngineVersionSource.Should().Be(source);
|
||||
probe.BuildReads.Should().Equal([read], "one read, for the matched engine only");
|
||||
probe.UnrealReads.Should().Be(0);
|
||||
}
|
||||
|
||||
/// <summary>A build read that found nothing is no version and no witness — never the old rules' raw file version.</summary>
|
||||
[Fact]
|
||||
public async Task ABuildReadWithNoFactsHasNoVersion()
|
||||
{
|
||||
var detector = new StaticGameDetector(new ScriptedRules(BuildRules()), new ScriptedProbe(Snapshot("UnityPlayer.dll")));
|
||||
|
||||
StaticDetectionResult r = await detector.DetectAsync(@"C:\Games\Example\Game.exe", TestContext.Current.CancellationToken);
|
||||
|
||||
r.EngineId.Should().Be("unity");
|
||||
r.EngineVersion.Should().BeNull();
|
||||
r.EngineVersionSource.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ItRejectsAnEmptyExePathRatherThanProbingNothing()
|
||||
{
|
||||
|
||||
@@ -39,11 +39,10 @@ namespace FrameLedger.CaptureHost.Tests;
|
||||
/// machine, so the record's path is pinned too.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Category=Integration, and CI will not run it.</b> §S19(b): the guard refuses a
|
||||
/// .NET test host that has loaded a <c>protect</c>-matching module, measured on CI.
|
||||
/// On this dev box the guard allows it, so these are dev-box-reproducible and
|
||||
/// merge-gate-absent — the same split <c>ShmDrainIntegrationTests</c> lives with, and
|
||||
/// stated rather than implied.
|
||||
/// <b>Category=Integration — and CI runs it.</b> This paragraph said CI would not (corrected 2026-10-07): §S19(b), the
|
||||
/// guard refusing a .NET test host that had loaded a <c>protect</c>-matching module, was answered on 2026-09-06 by the
|
||||
/// signer check, and <c>./build.ps1 check</c> runs the Integration category on CI since (<c>13_CI_CD</c> §ci.yml). A green
|
||||
/// CI is evidence for this suite, and a race in it fails a merge: two did on 2026-10-07 (the two cases below that say so).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[Trait("Category", "Integration")]
|
||||
@@ -454,13 +453,26 @@ public sealed class CaptureHostEndToEndTests : IDisposable
|
||||
// P1 item 3, from OUTSIDE the process: the host launches the harness in its Vulkan mode with the
|
||||
// layer's environment, the guard passes and injects nothing (TargetIsVulkanLayered), and the
|
||||
// records come from the layer's ring. Skipped honestly where there is no Vulkan loader or no
|
||||
// presentable device -- the harness says so with exit 77, which the session reports as
|
||||
// LaunchTargetExited before any ring existed.
|
||||
// presentable device -- the harness says so itself, with exit 77 and a "[SKIP]" line.
|
||||
if (!File.Exists(Path.Combine(Environment.SystemDirectory, "vulkan-1.dll")))
|
||||
{
|
||||
Assert.Skip("no Vulkan loader on this machine");
|
||||
}
|
||||
|
||||
// ASKED BEFORE THE HOST RUNS, of the harness itself (beta.18). This used to be read off the host's run: its output
|
||||
// for the harness's "[SKIP]" line, or the session's LaunchTargetExited. Neither holds on a hosted runner, which has
|
||||
// the loader and no device. The runner is elevated, so the host starts the harness through CreateProcessWithTokenW
|
||||
// (UnelevatedProcess), which hands the child no stdout -- the line never reached the host's output -- and the
|
||||
// harness's exit races the guard's poll: #288's CI run scanned it while it died and ended RefusedByGuard
|
||||
// (ModuleScanFailed, "a module list came back incomplete"), failing where it should have skipped. Run directly, the
|
||||
// harness's own output and exit code are this test's; and once it HAS presented here, every failure below is real.
|
||||
(int probeExit, string probeOutput) = await ProbeVulkanAsync();
|
||||
if (probeExit == 77)
|
||||
{
|
||||
Assert.Skip("the harness found no presentable Vulkan device on this machine: " + probeOutput);
|
||||
}
|
||||
|
||||
probeExit.Should().Be(0, "the harness presents through Vulkan on this machine, or says why it cannot: " + probeOutput);
|
||||
(await GrantConsentAsync()).Should().Be(ConsentWriteOutcome.Written);
|
||||
|
||||
using Process host = StartHost("launch", "--exe", ConsentedExecutable, "--args", "--vulkan --hold-presenting 8",
|
||||
@@ -470,16 +482,6 @@ public sealed class CaptureHostEndToEndTests : IDisposable
|
||||
await host.WaitForExitAsync(TestContext.Current.CancellationToken);
|
||||
stdout += "\n---- stderr ----\n" + await stderrTask + $"\n---- exit {host.ExitCode} ----\n";
|
||||
|
||||
// The harness says so itself (exit 77, a "[SKIP]" line on the shared console) when this
|
||||
// machine has a loader but no device -- a hosted runner's shape. Its exit races the guard's
|
||||
// poll, so the session may read LaunchTargetExited or, if it died under the scan, whatever
|
||||
// the scan could not read; the harness's own line is the signal that does not race.
|
||||
if (stdout.Contains("[SKIP]", StringComparison.Ordinal)
|
||||
|| stdout.Contains(nameof(SessionEndReason.LaunchTargetExited), StringComparison.Ordinal))
|
||||
{
|
||||
Assert.Skip("the harness found no presentable Vulkan device on this machine: " + stdout);
|
||||
}
|
||||
|
||||
stdout.Should().Contain("vulkan layer: ", "the launch names the manifest it wrote and the enable-list entry");
|
||||
stdout.Should().Contain("capture side: the Vulkan implicit layer", stdout);
|
||||
stdout.Should().Contain("apiMask=0x8", "FL_API_VULKAN is bit 3; the ring is the layer's, not an Overlay's");
|
||||
@@ -487,6 +489,34 @@ public sealed class CaptureHostEndToEndTests : IDisposable
|
||||
host.ExitCode.Should().Be(0, stdout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The plain harness asked to present through Vulkan for a second, under its own name — never the consented copy, whose
|
||||
/// name the host resolves its target by — with its output and exit code read here: 77 and a "[SKIP]" line where this
|
||||
/// machine cannot, 0 where it can. Bounded: a driver that hangs is a failure to report, not a test that never ends.
|
||||
/// </summary>
|
||||
private static async Task<(int ExitCode, string Output)> ProbeVulkanAsync()
|
||||
{
|
||||
using var probe = Process.Start(new ProcessStartInfo(Harness, "--vulkan --hold-presenting 1")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardOutput = true,
|
||||
})!;
|
||||
using var bound = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken);
|
||||
bound.CancelAfter(TimeSpan.FromSeconds(60));
|
||||
try
|
||||
{
|
||||
string output = await probe.StandardOutput.ReadToEndAsync(bound.Token).ConfigureAwait(false);
|
||||
await probe.WaitForExitAsync(bound.Token).ConfigureAwait(false);
|
||||
return (probe.ExitCode, output);
|
||||
}
|
||||
catch (OperationCanceledException e) when (!TestContext.Current.CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
probe.Kill(entireProcessTree: true);
|
||||
throw new TimeoutException("hook-harness --vulkan --hold-presenting 1 did not end within 60 s", e);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WhenTheTargetExitsTheHostStopsAndSaysWhy()
|
||||
{
|
||||
@@ -494,7 +524,11 @@ public sealed class CaptureHostEndToEndTests : IDisposable
|
||||
// DLL_PROCESS_DETACH teardown — so this can only come from the held process handle.
|
||||
(await GrantConsentAsync()).Should().Be(ConsentWriteOutcome.Written);
|
||||
|
||||
Process harness = StartHarness("--real --hold-presenting 6");
|
||||
// 15 s, not 6 (beta.18): the host resolves its target once, as it starts, and on a loaded runner a host that took
|
||||
// longer than the hold found the harness gone and ended TargetNotRunning — #286's first CI run, as on 2026-09-21
|
||||
// and before. The host prints nothing until its session ends, so there is no "attached" to wait for; the hold is
|
||||
// the margin, and the case's run time with it.
|
||||
Process harness = StartHarness("--real --hold-presenting 15");
|
||||
Process? host = null;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Domain.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The Godot version (beta.19): the owner's two Godot installs as measured on 2026-10-12, and the executable's version
|
||||
/// resource taken only while it is still the engine's.
|
||||
/// </summary>
|
||||
public sealed class GodotVersionTests
|
||||
{
|
||||
[Fact]
|
||||
public void TheTwoMeasuredInstallsReadFromTheirPacks()
|
||||
{
|
||||
GodotVersion.Decide(new GodotBuildFacts { PackVersion = [4, 2, 2], ExeProductName = "Godot Engine", ExeProductVersion = "4.2.2.stable.official" })
|
||||
.Should().Be(new EngineVersionReading("4.2.2", EngineVersionSource.GodotPack), "Plethora of Bullets 2");
|
||||
GodotVersion.Decide(new GodotBuildFacts { PackVersion = [4, 4, 1], ExeProductName = "xiandie", ExeProductVersion = "0.1.0.3" })
|
||||
.Should().Be(new EngineVersionReading("4.4.1", EngineVersionSource.GodotPack), "衔蝶");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnAppendedPackIsSaidAsSuchAndAZeroPatchIsNotWritten() =>
|
||||
GodotVersion.Decide(new GodotBuildFacts { PackVersion = [4, 3, 0], PackEmbedded = true })
|
||||
.Should().Be(new EngineVersionReading("4.3", EngineVersionSource.GodotPackEmbedded), "Godot names 4.3.0 as 4.3");
|
||||
|
||||
[Theory]
|
||||
[InlineData("Godot Engine", "4.2.2.stable.official", "4.2.2")]
|
||||
[InlineData("Godot Engine", "4.2.2.stable.mono.official", "4.2.2")]
|
||||
[InlineData("Godot Engine", "4.3.stable", "4.3")]
|
||||
[InlineData("Godot Engine", "3.5.3", "3.5.3")]
|
||||
[InlineData("xiandie", "0.1.0.3", null)]
|
||||
[InlineData("Godot Engine", "not a version", null)]
|
||||
[InlineData(null, "4.2.2.stable.official", null)]
|
||||
public void WithoutAPackTheExecutableSpeaksOnlyWhileItIsStillTheEngines(string? productName, string? productVersion, string? expected)
|
||||
{
|
||||
EngineVersionReading r = GodotVersion.Decide(new GodotBuildFacts { ExeProductName = productName, ExeProductVersion = productVersion });
|
||||
|
||||
r.Version.Should().Be(expected);
|
||||
r.Source.Should().Be(expected is null ? null : EngineVersionSource.GodotExe);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APackHeaderNoGodotReleaseCarriesIsNoVersion() =>
|
||||
GodotVersion.Decide(new GodotBuildFacts { PackVersion = [0, 0, 0] }).Should().Be(EngineVersionReading.None);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Domain.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// RPG Maker's maker and version (beta.19): the owner's six RPG Maker installs as measured on 2026-10-12 — MZ and MV by their
|
||||
/// core script's header, VX Ace by its RGSS3 library — and the RGSS generations by name.
|
||||
/// </summary>
|
||||
public sealed class RpgMakerVersionTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("A Doll's Locket - Remake", "rmmz_core.js", "1.10.0", "1.10.0", EngineVersionSource.RpgMakerMzCore)]
|
||||
[InlineData("Flower in Us", "rpg_core.js", "1.6.2", "1.6.2", EngineVersionSource.RpgMakerMvCore)]
|
||||
[InlineData("996IR", "rpg_core.js", "1.6.2", "1.6.2", EngineVersionSource.RpgMakerMvCore)]
|
||||
[InlineData("HELLO, HELLO WORLD!", "rpg_core.js", "1.6.1", "1.6.1", EngineVersionSource.RpgMakerMvCore)]
|
||||
public void MzAndMvReadFromTheirCoreScript(string title, string script, string header, string version, string source) =>
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { CoreScript = script, CoreScriptVersion = header })
|
||||
.Should().Be(new EngineVersionReading(version, source), title);
|
||||
|
||||
[Fact]
|
||||
public void VxAceReadsFromItsRgss3Library() =>
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "RGSS301.dll", RgssFileVersion = [3, 0, 1, 1] })
|
||||
.Should().Be(new EngineVersionReading("3.0.1", EngineVersionSource.Rgss3Library), "City of Bones and Träumerei Chapter 2");
|
||||
|
||||
[Theory]
|
||||
[InlineData("RGSS104E.dll", "1.0.4", EngineVersionSource.Rgss1Library)]
|
||||
[InlineData("RGSS102J.dll", "1.0.2", EngineVersionSource.Rgss1Library)]
|
||||
[InlineData("RGSS202E.dll", "2.0.2", EngineVersionSource.Rgss2Library)]
|
||||
[InlineData("rgss300.dll", "3.0.0", EngineVersionSource.Rgss3Library)]
|
||||
public void WithoutAVersionResourceTheLibrarysNameCarriesIt(string library, string version, string source) =>
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = library })
|
||||
.Should().Be(new EngineVersionReading(version, source));
|
||||
|
||||
[Fact]
|
||||
public void ALibraryWhoseNumbersAreNotItsGenerationsKeepsTheNameAndNothingElseIsAVersion()
|
||||
{
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "RGSS301.dll", RgssFileVersion = [1, 0, 0, 1] })
|
||||
.Should().Be(new EngineVersionReading("3.0.1", EngineVersionSource.Rgss3Library));
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { RgssLibrary = "Game.dll" }).Should().Be(EngineVersionReading.None);
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts { CoreScript = "rmmz_core.js", CoreScriptVersion = "v1" }).Should().Be(EngineVersionReading.None);
|
||||
RpgMakerVersion.Decide(new RpgMakerBuildFacts()).Should().Be(EngineVersionReading.None);
|
||||
}
|
||||
}
|
||||
@@ -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.Domain.Detection;
|
||||
|
||||
namespace FrameLedger.Domain.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The Unity version ladder (beta.19). The cases are the owner's fifteen Unity installs, measured read-only on 2026-10-12
|
||||
/// (<c>05_DETECTION</c> §Engine version — Unity, Godot, RPG Maker) — their numbers only, never their files.
|
||||
/// </summary>
|
||||
public sealed class UnityVersionTests
|
||||
{
|
||||
public static TheoryData<string, string?, int[]?, string?, string?, string?> Measured => new()
|
||||
{
|
||||
// title, UnityPlayer.dll ProductVersion, its numeric file version, data header version, → version, source
|
||||
{ "A Space for the Unbound - Prologue", "2019.4.1.15122501", [2019, 4, 1, 15122501], "2019.4.1f1", "2019.4.1f1", EngineVersionSource.UnityData },
|
||||
{ "DONT GO", "2022.3.39f1 (4e1b0f82c39a)", [2022, 3, 39, 5118735], "2022.3.39f1", "2022.3.39f1", EngineVersionSource.UnityPlayer },
|
||||
{ "Dialoop", "6000.3.3f1 (ef04196de0d6)", [6000, 3, 3, 15664153], "6000.3.3f1", "6000.3.3f1", EngineVersionSource.UnityPlayer },
|
||||
{ "Broken Shell Demo", "6000.0.58f2 (92dee566b325)", [6000, 0, 58, 9625317], "6000.0.58f2", "6000.0.58f2", EngineVersionSource.UnityPlayer },
|
||||
{ "Deadly Heart Gambit", "2022.3.32f1 (c8300dc0a3fa)", [2022, 3, 32, 13119501], "2022.3.32f1", "2022.3.32f1", EngineVersionSource.UnityPlayer },
|
||||
{ "DreadFields", "6000.3.17f1 (cf0352b38e81)", [6000, 3, 17, 13566802], "6000.3.17f1", "6000.3.17f1", EngineVersionSource.UnityPlayer },
|
||||
{ "GIRLS' FRONTLINE 2: EXILIUM", "2019.4.40.16762411", [2019, 4, 40, 16762411], null, "2019.4.40", EngineVersionSource.UnityPlayerFile },
|
||||
{ "Kemono Teatime", "2022.3.51f1 (9f9d16c45e54)", [2022, 3, 51, 10460438], "2022.3.51f1", "2022.3.51f1", EngineVersionSource.UnityPlayer },
|
||||
{ "March Out! Playtest", "2022.3.62f3 (96770f904ca7)", [2022, 3, 62, 9860879], "2022.3.62f3", "2022.3.62f3", EngineVersionSource.UnityPlayer },
|
||||
{ "Umamusume: Pretty Derby", "2022.3.62f2 (7670c08855a9)", [2022, 3, 62, 7762112], "2022.3.62f2", "2022.3.62f2", EngineVersionSource.UnityPlayer },
|
||||
{ "Walto", "6000.3.2f1 (a9779f353c9b)", [6000, 3, 2, 11106207], "6000.3.2f1", "6000.3.2f1", EngineVersionSource.UnityPlayer },
|
||||
{ "Yasha: Legends of the Demon Blade", "2022.3.54f1 (129125d4e700)", [2022, 3, 54, 1216805], "2022.3.54f1", "2022.3.54f1", EngineVersionSource.UnityPlayer },
|
||||
{ "Yu-Gi-Oh! Master Duel", "6000.0.61f1 (74a0adb02c31)", [6000, 0, 61, 7643309], null, "6000.0.61f1", EngineVersionSource.UnityPlayer },
|
||||
{ "帰路", "6000.0.58f2 (92dee566b325)", [6000, 0, 58, 9625317], "6000.0.58f2", "6000.0.58f2", EngineVersionSource.UnityPlayer },
|
||||
{ "Legends of Runeterra", "2022.3.62f2 (ac7faeb0984d)", [2022, 3, 62, 11304878], "2022.3.62f2", "2022.3.62f2", EngineVersionSource.UnityPlayer },
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Measured))]
|
||||
public void TheFifteenMeasuredInstallsReadAsMeasured(string title, string? product, int[]? fileVersion, string? header, string? version, string? source)
|
||||
{
|
||||
EngineVersionReading r = UnityVersion.Decide(new UnityBuildFacts { PlayerProductVersion = product, PlayerFileVersion = fileVersion, DataHeaderVersion = header });
|
||||
|
||||
r.Version.Should().Be(version, title);
|
||||
r.Source.Should().Be(source, title);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("2022.3.39f1 (4e1b0f82c39a)", "2022.3.39f1")]
|
||||
[InlineData("6000.0.58f2", "6000.0.58f2")]
|
||||
[InlineData("5.6.4p2", "5.6.4p2")]
|
||||
[InlineData("2019.4.1.15122501", null)]
|
||||
[InlineData("10.0.29648.1000", null)]
|
||||
[InlineData("1.2.3f1", null)]
|
||||
[InlineData("", null)]
|
||||
[InlineData(null, null)]
|
||||
public void OnlyAnEditorVersionOfAMajorUnityShippedIsOne(string? text, string? expected) =>
|
||||
UnityVersion.EditorVersion(text).Should().Be(expected);
|
||||
|
||||
/// <summary>A library's numbers that no Unity release carries — a system DLL's — are nothing, not a Unity version.</summary>
|
||||
[Fact]
|
||||
public void NumbersNoUnityReleaseCarriesAreNoVersion() =>
|
||||
UnityVersion.Decide(new UnityBuildFacts { PlayerProductVersion = "10.0.29648.1000", PlayerFileVersion = [10, 0, 29648, 1000] })
|
||||
.Should().Be(EngineVersionReading.None);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Domain.Detection;
|
||||
using FrameLedger.Infrastructure.Detection;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Tests.Detection;
|
||||
|
||||
/// <summary>
|
||||
/// beta.19's three readers over files the test writes in the shapes measured on the owner's installs (2026-10-12): a Unity
|
||||
/// data file's header, a Godot pack beside the executable and one appended to it, RPG Maker MZ/MV core scripts and a VX Ace
|
||||
/// <c>Game.ini</c>. Each reads a bounded head of one file and says nothing when the file is not what it expects.
|
||||
/// </summary>
|
||||
public sealed class EngineBuildReadersTests : IDisposable
|
||||
{
|
||||
private readonly string _dir = Path.Combine(Path.GetTempPath(), "fl-enginebuild-" + Guid.NewGuid().ToString("N"));
|
||||
|
||||
public EngineBuildReadersTests() => Directory.CreateDirectory(_dir);
|
||||
|
||||
public void Dispose() => Directory.Delete(_dir, recursive: true);
|
||||
|
||||
private static CancellationToken Ct => TestContext.Current.CancellationToken;
|
||||
|
||||
private string Sub(params string[] parts)
|
||||
{
|
||||
string p = Path.Combine([_dir, .. parts]);
|
||||
Directory.CreateDirectory(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
private static byte[] PackHeader(uint format, uint major, uint minor, uint patch)
|
||||
{
|
||||
byte[] header = new byte[GodotBuildReader.HeaderBytes];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(header, GodotBuildReader.PackMagic);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(header.AsSpan(4), format);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(header.AsSpan(8), major);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(header.AsSpan(12), minor);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(header.AsSpan(16), patch);
|
||||
return header;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(20, "2019.4.1f1")]
|
||||
[InlineData(48, "2022.3.39f1")]
|
||||
public async Task AUnityDataFilesHeaderNamesItsEditorVersion(int offset, string version)
|
||||
{
|
||||
// The serialized-file header: numbers, then the version as a NUL-terminated string (at 20 in a 2019.4 build, 48 later).
|
||||
byte[] bytes = new byte[4096];
|
||||
Encoding.ASCII.GetBytes(version + "\0").CopyTo(bytes, offset);
|
||||
string file = Path.Combine(Sub("Game_Data"), "globalgamemanagers");
|
||||
await File.WriteAllBytesAsync(file, bytes, Ct);
|
||||
|
||||
UnityBuildReader.DataHeaderVersion(file).Should().Be(version);
|
||||
UnityBuildFacts? facts = UnityBuildReader.Read(playerPath: null, file);
|
||||
facts.Should().NotBeNull();
|
||||
UnityVersion.Decide(facts!).Should().Be(new EngineVersionReading(version, EngineVersionSource.UnityData));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AnEncryptedOrAbsentUnityDataFileSaysNothing()
|
||||
{
|
||||
string file = Path.Combine(Sub("GF2_Data"), "globalgamemanagers");
|
||||
await File.WriteAllBytesAsync(file, [.. Enumerable.Range(0, 4096).Select(static i => (byte)((i * 37) + 11))], Ct);
|
||||
|
||||
UnityBuildReader.DataHeaderVersion(file).Should().BeNull("GIRLS' FRONTLINE 2's data file carries no readable header");
|
||||
UnityBuildReader.DataHeaderVersion(Path.Combine(_dir, "missing")).Should().BeNull();
|
||||
UnityBuildReader.Read(null, null).Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AGodotPackHeaderIsReadAndAnythingElseIsNot()
|
||||
{
|
||||
GodotBuildReader.ReadHeader(new MemoryStream(PackHeader(2, 4, 2, 2)), 0).Should().Equal([4, 2, 2]);
|
||||
byte[] wrong = PackHeader(2, 4, 2, 2);
|
||||
wrong[0] = (byte)'X';
|
||||
GodotBuildReader.ReadHeader(new MemoryStream(wrong), 0).Should().BeNull("not GDPC");
|
||||
GodotBuildReader.ReadHeader(new MemoryStream(new byte[10]), 0).Should().BeNull("shorter than a header");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APackAppendedToTheExecutableIsFoundThroughItsTrailer()
|
||||
{
|
||||
using var exe = new MemoryStream();
|
||||
exe.Write(new byte[5000]);
|
||||
byte[] pack = [.. PackHeader(2, 4, 4, 1), .. new byte[300]];
|
||||
exe.Write(pack);
|
||||
Span<byte> trailer = stackalloc byte[GodotBuildReader.TrailerBytes];
|
||||
BinaryPrimitives.WriteInt64LittleEndian(trailer, pack.Length);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(trailer[8..], GodotBuildReader.PackMagic);
|
||||
exe.Write(trailer);
|
||||
|
||||
GodotBuildReader.ReadAppended(exe).Should().Equal([4, 4, 1]);
|
||||
|
||||
BinaryPrimitives.WriteInt64LittleEndian(trailer, exe.Length * 2);
|
||||
exe.Position = exe.Length - GodotBuildReader.TrailerBytes;
|
||||
exe.Write(trailer);
|
||||
GodotBuildReader.ReadAppended(exe).Should().BeNull("a size larger than the file points at nothing");
|
||||
GodotBuildReader.ReadAppended(new MemoryStream(new byte[100])).Should().BeNull("no trailer");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AGodotPackBesideTheExecutableIsPreferredToTheExecutablesEnd()
|
||||
{
|
||||
string game = Sub("plethora-of-bullets-2");
|
||||
string exe = Path.Combine(game, "POB2v020beta5.exe");
|
||||
await File.WriteAllBytesAsync(exe, new byte[64], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(game, "POB2v020beta5.pck"), [.. PackHeader(2, 4, 2, 2), .. new byte[64]], Ct);
|
||||
|
||||
GodotBuildFacts? facts = GodotBuildReader.Read(exe, Path.Combine(game, "POB2v020beta5.pck"));
|
||||
|
||||
facts.Should().NotBeNull();
|
||||
facts!.PackVersion.Should().Equal([4, 2, 2]);
|
||||
facts.PackEmbedded.Should().BeFalse();
|
||||
GodotBuildReader.Read(exe, packPath: null).Should().BeNull("a zero-filled executable has no appended pack and no version resource");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MzAndMvAreReadFromTheirCoreScriptsBesideOrAboveTheExecutable()
|
||||
{
|
||||
// A Doll's Locket - Remake: the MZ runtime and its own copy of the scripts in css\.
|
||||
string css = Sub("Dolls Locket", "css");
|
||||
string js = Sub("Dolls Locket", "css", "js");
|
||||
await File.WriteAllBytesAsync(Path.Combine(css, "Game.exe"), new byte[8], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(js, "rmmz_core.js"),
|
||||
"//=============================================================================\r\n// rmmz_core.js v1.10.0\r\n//=============================================================================\r\n", Ct);
|
||||
RpgMakerBuildReader.Read(Path.Combine(css, "Game.exe")).Should().Be(new RpgMakerBuildFacts { CoreScript = "rmmz_core.js", CoreScriptVersion = "1.10.0" });
|
||||
|
||||
// HELLO, HELLO WORLD!: the runtime in swiftshader\, the MV scripts one folder up, under www\.
|
||||
string runtime = Sub("HELLO, HELLO WORLD!", "swiftshader");
|
||||
string www = Sub("HELLO, HELLO WORLD!", "www", "js");
|
||||
await File.WriteAllBytesAsync(Path.Combine(runtime, "Game.exe"), new byte[8], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(www, "rpg_core.js"), "//====\n// rpg_core.js v1.6.1\n//====\n", Ct);
|
||||
RpgMakerBuildFacts? mv = RpgMakerBuildReader.Read(Path.Combine(runtime, "Game.exe"));
|
||||
mv.Should().Be(new RpgMakerBuildFacts { CoreScript = "rpg_core.js", CoreScriptVersion = "1.6.1" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task VxAceIsReadFromTheLibraryItsGameIniNames()
|
||||
{
|
||||
string game = Sub("City of Bones 1.0");
|
||||
string system = Sub("City of Bones 1.0", "System");
|
||||
await File.WriteAllBytesAsync(Path.Combine(game, "CityofBones.exe"), new byte[8], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(game, "Game.ini"), "[Game]\r\nRTP=RPGVXAce\r\nLibrary=System\\RGSS301.dll\r\nScripts=Data\\Scripts.rvdata2\r\nTitle=City of Bones\r\n", Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(system, "RGSS301.dll"), new byte[8], Ct);
|
||||
|
||||
RpgMakerBuildReader.LibraryOf(Path.Combine(game, "Game.ini")).Should().Be(Path.Combine(system, "RGSS301.dll"));
|
||||
RpgMakerBuildFacts? facts = RpgMakerBuildReader.Read(Path.Combine(game, "CityofBones.exe"));
|
||||
facts.Should().Be(new RpgMakerBuildFacts { RgssLibrary = "RGSS301.dll" }, "a library with no version resource is named, and its name carries 3.0.1");
|
||||
RpgMakerVersion.Decide(facts!).Should().Be(new EngineVersionReading("3.0.1", EngineVersionSource.Rgss3Library));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ALibraryOutsideTheGamesFolderIsNamedNotReadAndNoMarkerIsNoFacts()
|
||||
{
|
||||
string game = Sub("Elsewhere");
|
||||
await File.WriteAllTextAsync(Path.Combine(game, "Game.ini"), "[Game]\nLibrary=..\\..\\Windows\\RGSS103J.dll\n", Ct);
|
||||
|
||||
RpgMakerBuildReader.LibraryOf(Path.Combine(game, "Game.ini")).Should().Be("RGSS103J.dll");
|
||||
|
||||
string plain = Sub("a", "b", "c", "Plain");
|
||||
await File.WriteAllBytesAsync(Path.Combine(plain, "Plain.exe"), new byte[8], Ct);
|
||||
RpgMakerBuildReader.Read(Path.Combine(plain, "Plain.exe")).Should().BeNull();
|
||||
RpgMakerBuildReader.Read(Path.Combine(plain, "Plain.exe"), rgssLibrary: Path.Combine(plain, "RGSS202E.dll"))
|
||||
.Should().Be(new RpgMakerBuildFacts { RgssLibrary = "RGSS202E.dll" }, "the walk's own find when no Game.ini names one");
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,51 @@ public sealed class ExecutableLocatorTests : IDisposable
|
||||
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(game, "b.exe"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Doll's Locket - Remake (itch, 2026-10-12), with its real names: a .NET launcher named after the install at the top
|
||||
/// (213,745,664 bytes on disk — scaled down here, it only has to be the largest), NW.js's toast helper beside it, and the
|
||||
/// RPG Maker MZ runtime one folder down beside its <c>nw.dll</c> and <c>package.json</c>. The runtime is the process
|
||||
/// that draws (D56); the launcher only starts it.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AnNwjsRuntimeBeatsTheLauncherNamedAfterTheInstallAndItsHelpersAreDropped()
|
||||
{
|
||||
string cave = Sub("a-dolls-locket-remake");
|
||||
string game = Sub("a-dolls-locket-remake", "Dolls Locket");
|
||||
string css = Sub("a-dolls-locket-remake", "Dolls Locket", "css");
|
||||
await File.WriteAllBytesAsync(Path.Combine(game, "DollsLocket.exe"), new byte[3_000_000], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(game, "notification_helper.exe"), new byte[919_552], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(css, "Game.exe"), new byte[2_139_648], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(css, "notification_helper.exe"), new byte[919_552], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(css, "nw.dll"), new byte[10], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(css, "package.json"), "{\"name\":\"rmmz-game\",\"main\":\"index.html\"}", Ct);
|
||||
|
||||
new ExecutableLocator().PickPrimary(cave).Should().Be(Path.Combine(css, "Game.exe"),
|
||||
"an executable beside nw.dll and package.json is the NW.js runtime; the larger launcher named after the install only starts it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AnNwjsRuntimeAtTheRootIsTheGameAndAUnityPlayerOutranksAnNwjsToolBesideIt()
|
||||
{
|
||||
// Flower in Us (Steam): the runtime at the root, NW.js 0.82.0's helper beside it.
|
||||
string flower = Sub("Flower in Us");
|
||||
await File.WriteAllBytesAsync(Path.Combine(flower, "Game.exe"), new byte[2_191_360], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(flower, "notification_helper.exe"), new byte[1_157_632], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(flower, "nw.dll"), new byte[10], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(flower, "package.json"), "{}", Ct);
|
||||
new ExecutableLocator().PickPrimary(flower).Should().Be(Path.Combine(flower, "Game.exe"));
|
||||
|
||||
// A Unity game shipping an NW.js tool: the NW.js rank sits below the engines' own layouts.
|
||||
string unity = Sub("Some Unity Title");
|
||||
string tool = Sub("Some Unity Title", "tools", "config");
|
||||
Sub("Some Unity Title", "Title_Data");
|
||||
await File.WriteAllBytesAsync(Path.Combine(unity, "Title.exe"), new byte[650_000], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(tool, "Config.exe"), new byte[2_000_000], Ct);
|
||||
await File.WriteAllBytesAsync(Path.Combine(tool, "nw.dll"), new byte[10], Ct);
|
||||
await File.WriteAllTextAsync(Path.Combine(tool, "package.json"), "{}", Ct);
|
||||
new ExecutableLocator().PickPrimary(unity).Should().Be(Path.Combine(unity, "Title.exe"), "X.exe beside X_Data outranks an NW.js folder");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("ZFGameBrowser")]
|
||||
[InlineData("KernelDumpAnalyzer")]
|
||||
@@ -116,6 +161,22 @@ public sealed class ExecutableLocatorTests : IDisposable
|
||||
[InlineData("CrashReportClient")]
|
||||
[InlineData("UnityCrashHandler64")]
|
||||
[InlineData("crashpad_handler")]
|
||||
[InlineData("notification_helper")]
|
||||
public void TheHelpersThisWasMeasuredOnAreHelpers(string name) =>
|
||||
ExecutableLocator.IsHelper(name).Should().BeTrue();
|
||||
|
||||
/// <summary>
|
||||
/// What may overrule a store's own pick is a whole name, never a fragment: <c>node</c> is a helper fragment and inside
|
||||
/// a real game's name.
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData("notification_helper", true)]
|
||||
[InlineData("NOTIFICATION_HELPER", true)]
|
||||
[InlineData("crashpad_handler", true)]
|
||||
[InlineData("UnityCrashHandler64", true)]
|
||||
[InlineData("Nodebuster", false)]
|
||||
[InlineData("Game", false)]
|
||||
[InlineData("DollsLocket", false)]
|
||||
public void OnlyWholeRuntimeHelperNamesOverruleAStore(string name, bool helper) =>
|
||||
ExecutableLocator.IsRuntimeHelper(name).Should().Be(helper);
|
||||
}
|
||||
@@ -190,6 +190,35 @@ public sealed class StoreLibrarySourcesTests : IDisposable
|
||||
log.Should().ContainSingle().Which.Should().Contain("butler.db read: 1 location(s), 4 cave(s), 4 title(s)").And.Contain("1 receipt(s), 1 new", "only the apps folder is scanned for receipts; the one beside a cave elsewhere is read for its title, not counted here");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.19: butler's verdict for A Doll's Locket - Remake (game 5085165), as it is stored on the owner's machine — one
|
||||
/// candidate, NW.js's toast helper, because butler keeps the shallowest candidates and drops the launcher that asks
|
||||
/// for elevation. A helper is no game whoever names it: the row leaves the guess to the locator, and a verdict with a
|
||||
/// real candidate after a helper still names that one.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task ItchSkipsAVerdictCandidateThatIsARuntimeHelper()
|
||||
{
|
||||
string itch = Sub("itch");
|
||||
string location = Sub("it");
|
||||
string dolls = Sub("it", "a-dolls-locket-remake", "Dolls Locket");
|
||||
await File.WriteAllBytesAsync(Path.Combine(dolls, "notification_helper.exe"), new byte[10], Ct);
|
||||
string other = Sub("it", "other-game");
|
||||
await WriteButlerAsync(Path.Combine(itch, "db", "butler.db"), location, [
|
||||
(5085165, "a-dolls-locket-remake", "", "A Doll's Locket - Remake",
|
||||
"{\"basePath\":\"x\",\"candidates\":[{\"path\":\"Dolls Locket/notification_helper.exe\",\"depth\":2,\"flavor\":\"windows\",\"arch\":\"amd64\",\"size\":919552,\"windowsInfo\":{\"gui\":true}}]}"),
|
||||
(42, "other-game", "", "Other Game",
|
||||
"{\"candidates\":[{\"path\":\"crashpad_handler.exe\",\"flavor\":\"windows\"},{\"path\":\"Other.exe\",\"flavor\":\"windows\"}]}"),
|
||||
]);
|
||||
List<string> log = [];
|
||||
|
||||
IReadOnlyList<StoreGame> games = await new ItchLibrarySource(itch, log.Add).ListAsync(Ct);
|
||||
|
||||
games.Single(g => string.Equals(g.StoreId, "5085165", StringComparison.Ordinal)).ExePath.Should().BeNull("the only candidate is a helper, so the locator guesses");
|
||||
games.Single(g => string.Equals(g.StoreId, "42", StringComparison.Ordinal)).ExePath.Should().Be(Path.Combine(other, "Other.exe"), "the first candidate that is not a helper");
|
||||
log.Should().ContainSingle().Which.Should().Contain("named only a helper for A Doll's Locket - Remake").And.NotContain("Other Game");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ItchWithoutADatabaseOrWithAnUnreadableOneStillReadsReceipts()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
# Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
#Requires -Version 7.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Fails when a shipped native binary does not carry the release's build id, exactly.
|
||||
|
||||
.DESCRIPTION
|
||||
FL_BUILD_ID is `git describe` at CMake's configure (src/native/FrameLedger.Shm/CMakeLists.txt), compiled into the
|
||||
Overlay, the guard, the NVAPI bridge and the process-stats reader; the ring's handshake compares the Overlay's with the
|
||||
guard's, and the App shows the Overlay's as "Overlay build". release.yml wrote the release date into the tracked
|
||||
legal/*.md before the gate configured, so describe read the tree as dirty and every release until beta.18 shipped
|
||||
"<tag>-dirty" (the owner's Dashboard, 0.1.0-beta.16 and beta.17). The workflow now reads the id from the clean
|
||||
checkout, hands it to CMake as the environment's FL_BUILD_ID, and runs this over the published tree.
|
||||
|
||||
The id is looked for as the C string it is compiled as — its characters and the NUL after them — in each binary's
|
||||
bytes. Nothing is loaded: loading the Overlay would run its DllMain in this process.
|
||||
|
||||
.PARAMETER BuildDir
|
||||
The directory holding the native binaries (release.yml: out/app).
|
||||
|
||||
.PARAMETER Expected
|
||||
The id they must carry: describe of the clean checkout. One that marks a dirty tree is refused too.
|
||||
|
||||
.PARAMETER SelfTest
|
||||
Runs the fixture cases below, in a scratch directory, and exits 0 only if every one behaves.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$BuildDir,
|
||||
[string]$Expected,
|
||||
[switch]$SelfTest
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# The four that compile FL_BUILD_ID in (FrameLedger.Shm's INTERFACE define): FlGetBuildId, FlGuardBuildId, FlNvBuildId, FlPsBuildId.
|
||||
$binaries = 'FrameLedger.Overlay.dll', 'FrameLedger.Guard.dll', 'FrameLedger.NvapiBridge.dll', 'FrameLedger.ProcessStats.dll'
|
||||
|
||||
function Get-BuildIdProblem {
|
||||
param([string]$Directory, [string]$Id)
|
||||
|
||||
$problems = [System.Collections.Generic.List[string]]::new()
|
||||
# What describe can print, and what a C string literal carries without escaping (CMakeLists.txt checks the same).
|
||||
if ([string]::IsNullOrEmpty($Id) -or $Id -notmatch '^[0-9A-Za-z._+-]{1,31}$') {
|
||||
$problems.Add("the expected id '$Id' is not a build id (1 to 31 of [0-9A-Za-z._+-])")
|
||||
return , $problems.ToArray()
|
||||
}
|
||||
if ($Id.EndsWith('-dirty', [StringComparison]::Ordinal) -or $Id.EndsWith('+', [StringComparison]::Ordinal)) {
|
||||
$problems.Add("the expected id '$Id' marks a dirty tree; a release is built from a clean checkout")
|
||||
}
|
||||
# Latin-1 maps every byte to one char, so a byte search is an ordinal string search.
|
||||
$needle = $Id + [char]0
|
||||
foreach ($name in $binaries) {
|
||||
$path = Join-Path $Directory $name
|
||||
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
|
||||
$problems.Add("$name is missing")
|
||||
continue
|
||||
}
|
||||
$text = [Text.Encoding]::Latin1.GetString([IO.File]::ReadAllBytes($path))
|
||||
if ($text.IndexOf($needle, [StringComparison]::Ordinal) -lt 0) {
|
||||
$problems.Add("$name does not carry '$Id'")
|
||||
}
|
||||
}
|
||||
return , $problems.ToArray()
|
||||
}
|
||||
|
||||
if ($SelfTest) {
|
||||
$root = Join-Path ([IO.Path]::GetTempPath()) ('fl-buildid-selftest-' + [guid]::NewGuid().ToString('N'))
|
||||
$id = 'v0.1.0-beta.18'
|
||||
$cases = @(
|
||||
@{ Name = 'every binary carries the id passes'; Expected = $id; Ids = @($id, $id, $id, $id); Bad = 0 },
|
||||
@{ Name = 'a commit id with no tag passes'; Expected = '15b4c6b1a2c3'; Ids = @('15b4c6b1a2c3', '15b4c6b1a2c3', '15b4c6b1a2c3', '15b4c6b1a2c3'); Bad = 0 },
|
||||
@{ Name = "the Overlay built from a dirty tree FAILS"; Expected = $id; Ids = @("$id-dirty", $id, $id, $id); Bad = 1 },
|
||||
@{ Name = "the short fallback's dirty mark FAILS"; Expected = $id; Ids = @($id, "$id+", $id, $id); Bad = 1 },
|
||||
@{ Name = 'a binary with no id at all FAILS'; Expected = $id; Ids = @($id, $id, 'unknown', $id); Bad = 1 },
|
||||
@{ Name = 'a missing binary FAILS'; Expected = $id; Ids = @($id, $id, $id, $null); Bad = 1 },
|
||||
@{ Name = 'an expected id that marks a dirty tree FAILS'; Expected = "$id-dirty"; Ids = @("$id-dirty", "$id-dirty", "$id-dirty", "$id-dirty"); Bad = 1 },
|
||||
@{ Name = 'an expected id no build has FAILS'; Expected = 'v0.1.0 "beta"'; Ids = @($id, $id, $id, $id); Bad = 1 }
|
||||
)
|
||||
$failed = 0
|
||||
try {
|
||||
$i = 0
|
||||
foreach ($c in $cases) {
|
||||
$i++
|
||||
$dir = Join-Path $root "case$i"
|
||||
New-Item -ItemType Directory -Path $dir -Force | Out-Null
|
||||
for ($b = 0; $b -lt $binaries.Count; $b++) {
|
||||
if ($null -eq $c.Ids[$b]) { continue }
|
||||
# A string among other bytes, as the linker leaves it in .rdata.
|
||||
$body = [Text.Encoding]::Latin1.GetBytes("MZ`0`0padding`0" + $c.Ids[$b] + "`0more`0")
|
||||
[IO.File]::WriteAllBytes((Join-Path $dir $binaries[$b]), $body)
|
||||
}
|
||||
$got = Get-BuildIdProblem -Directory $dir -Id $c.Expected
|
||||
$ok = ($got.Count -gt 0) -eq ($c.Bad -gt 0)
|
||||
Write-Host (" {0,-4} {1}" -f ($(if ($ok) { 'ok' } else { 'FAIL' })), $c.Name) -ForegroundColor ($(if ($ok) { 'DarkGray' } else { 'Red' }))
|
||||
if (-not $ok) { $failed++ }
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (Test-Path -LiteralPath $root) { Remove-Item -LiteralPath $root -Recurse -Force }
|
||||
}
|
||||
if ($failed -gt 0) { Write-Host "buildid-check self-test FAILED ($failed)" -ForegroundColor Red; exit 1 }
|
||||
Write-Host "buildid-check self-test: $($cases.Count) cases, both directions" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
|
||||
if (-not $BuildDir) { throw 'buildid-check: -BuildDir is required (or -SelfTest)' }
|
||||
$problems = Get-BuildIdProblem -Directory $BuildDir -Id $Expected
|
||||
if ($problems.Count -gt 0) {
|
||||
$problems | ForEach-Object { Write-Host " $_" -ForegroundColor Red }
|
||||
Write-Host "buildid-check: the native binaries in $BuildDir do not all carry '$Expected' (src/native/FrameLedger.Shm/CMakeLists.txt, 12_BUILD)." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "buildid-check: ok - $($binaries.Count) native binaries carry '$Expected'" -ForegroundColor Green
|
||||
exit 0
|
||||
+3
-1
@@ -19,9 +19,11 @@ The full documents are [`docs/13_CI_CD.md`](../docs/13_CI_CD.md) and [`docs/11_U
|
||||
statement (`legal/ACCURACY.md` and its copies) and `LIMITATIONS.md`. `VERSION` changes only with the numeric core.
|
||||
2. After it merges, a signed tag `vx.y.z` (or `vx.y.z-beta.N`) on the merge commit starts `release.yml`:
|
||||
- it checks the tag against `VERSION` and that the changelog has the section;
|
||||
- reads the build id from the clean checkout, before anything is edited;
|
||||
- writes the release date into the legal documents;
|
||||
- runs the whole gate;
|
||||
- publishes the App and the agent (self-contained, ReadyToRun) and checks the published tree;
|
||||
- publishes the App and the agent (self-contained, ReadyToRun) and checks the published tree, the build id in the
|
||||
native binaries included;
|
||||
- packs them with Velopack, with a delta from the previous release;
|
||||
- writes `SHA256SUMS.txt`;
|
||||
- creates the GitHub release from the changelog section, marked pre-release for a beta.
|
||||
|
||||
Reference in new issue
Block a user