Compare commits

...
Author SHA1 Message Date
poli0981andClaude Fable 5.2 8259fba7ef feat(overlay): hook slSetConstants - what a game tells Streamline about each frame, read only while the Agent asks and patched only once it has; never the matrices or the camera's position and axes (beta.43 PR-2)
A new inventory row, sl.interposer.dll!slSetConstants, family FL_HOOK_SL_CONSTANTS (bit 13). InstallByFamily returns before resolving the symbol in a process never asked for Advanced metrics (D111), so nothing is patched with the option off. The detour checks the request, MayObserve, the struct's GUID and version and the viewport handle's on every call; fl_adv_fields.h reads jitterOffset, mvecScale, cameraNear, cameraFar, cameraFOV, cameraAspectRatio and the seven Booleans into region 5's sl group, summarised for the first viewport seen. tools/overlay-fields-check.ps1 gains the parameter k and thirteen list entries; the camera's names are still refused everywhere.

Measured on the headers with the Overlay's flags: +0.6 ns not asked, +19.6 ns asked on the summarised viewport, +5.8 ns on another.

ctest fl_adv_fields and fl_guard [advanced]: never asked - the export's first 16 bytes in the target are the file's; asked - the first viewport's numbers and none of the second's; no longer asked - the region unchanged; stopped - the bytes restored.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 11:28:35 +07:00
poli0981andClaude Fable 5.2 31d79184eb fix(overlay): an FSR UPSCALE is counted at the first source that saw one - a loader that hands a dispatch on to the leaf's export brought it to two hooked modules, and the frame count would have doubled with frame generation off (beta.43 PR-1, D125; decisions D124-D125) (#414)
g_ffxUpscaleOwner gates the count and the source word through fl::adv::Owns; the FSR 3.0 host is a source like the four leaves; the render size and the quality byte are not gated. Measured on Cyberpunk 2077's loader 2.3.0 for frame-generation dispatches; no title run so far upscales through such a loader, so it is a precaution, held by the stub loader bound through the leaves' exports (hook-harness --ffx-topology 2x-export): 60 presents read as 120 frames before, 60 after.

Measured on the header's Owns with the Overlay's flags: +0.02 to +0.03 ns on the counted module.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 04:22:06 +00:00
poli0981andClaude Fable 5.2 ab8b4ac158 fix(guard): a module list that changed while it was read is read again before the guard refuses (D123) (#413)
* fix(guard): a module list that changed while it was read is read again, at most three times, before the guard refuses - launches were being lost as a safety unhook with no frame recorded (owner decision D123)

Collected::kUnsettled for a module that was in the list and could not be named (until now kIncomplete, an immediate refusal). CheckModules re-reads the whole scan set from a fresh snapshot after kScanRetryPauseMs, up to kMaxUnsettledRereads (3) times; a list still unsettled on the last read refuses kModuleScanFailed with its own signal. A finding - also among the modules that were read from a half-read list - a protected process and a list too long for the buffer still refuse at once; D48's re-read stays one. The launch poll's runtime probe asks again on an unsettled list.

ctest fl_guard [D123]: ten sections against fakes, and the real source against a process that loads and frees a module in a loop (hook-harness --churn-module): about one read in four unsettled, none anything else.

HANDOFF: D123; the Cyberpunk FSR 3 session cannot be run (the game's only FSR upscaler is 2.1), D121 closed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the live D123 case counts its answers with an if-chain - Qodana's switch-enum on a switch that named two of five values

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 04:05:20 +00:00
poli0981andClaude Fable 5.2 6d4e799f68 docs(handoff): what the first four sessions on beta.42 showed - Cyberpunk's upscale was FSR 2.1, built into the game (D121) (#412)
* docs(handoff): what the owner's first four sessions on 0.1.0-beta.42 showed - Cyberpunk's upscale was FSR 2.1, built into the game (D121 answered); the 2.3 loader re-enters the leaf's export; the plane at infinity measured on two titles

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): three more starts of Cyberpunk on beta.42 - the game was still on FSR 2 (the settings file says so), and the first start was lost to a module list read while the game was loading: five such ends in the Agent's logs since 2026-11-05, and a decision for the owner

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): the owner's screenshot of Cyberpunk's Graphics menu confirms it - Resolution Scaling is FSR 2.1

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 03:29:32 +00:00
poli0981andClaude Fable 5.2 e2de7cfbc0 docs(handoff): 0.1.0-beta.42's release facts - the tag's run, the digests, the delta, the wiki run; SonarCloud's one finding fixed (a strlen in a test helper); two transient failures recorded (#411)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 03:05:42 +00:00
22 changed files with 1180 additions and 77 deletions

No files matched your search

+35
View File
@@ -35,6 +35,41 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Added
- **Advanced metrics, inside the game: what the game tells NVIDIA Streamline about each frame** (the part inside the
game; what a session shows of it comes with the same release). With **Advanced metrics** on, FrameLedger now also
reads, from a call a Streamline game makes every frame, the size of the jitter, the motion-vector scale, the depth
range, the range of the field of view, the aspect ratio and seven on/off settings (inverted depth, how motion
vectors are stored, whether the upscaler's history was reset). It never reads where the game's camera is, which
way it looks, or its matrices, which sit in the same data — a check in the build refuses any code that names
them. This is the first reading that needs a hook of its own, and that hook is put into a game only once
Advanced metrics has been asked for: with the option off, nothing in the game is touched for it. Measured cost:
about 20 billionths of a second per frame while the option is on, under one billionth while it is off.
### Fixed
- **FSR upscaling is counted once per frame whichever way the game's FidelityFX loader passes it on.** Newer
FidelityFX loaders hand a call on to the library behind them in a way that brought the same upscale to
FrameLedger twice; with frame generation off, the count of frames the game rendered would have doubled — Native
FPS twice too high. Seen in how Cyberpunk 2077's loader passes on its frame-generation calls; no game tested so
far upscales through such a loader, so this is a precaution. The upscale is now counted where the game calls it,
and nowhere else. (Owner decision D125. Measured cost: none that can be told from noise.)
- **A game is no longer left unrecorded because it was still loading when FrameLedger looked at it.** Before it
hooks a game, and again right after, FrameLedger lists the modules the game has loaded and checks them against
the anti-cheat list. A game that is starting loads and unloads modules for several seconds, and when the list
changed in the middle of being read FrameLedger treated it as unreadable and stopped: the session ended as a
safety stop with nothing recorded, and the game ran on unmeasured until it was restarted. It now reads the list
again — up to three more times, a quarter of a second apart — and only stops if the list never holds still. What
stops a session has not changed: an anti-cheat module found in any read stops it at once, a protected process
still stops it at once, and a list that cannot be read in the end is still a stop, never a pass. (Owner decision
D123; seen five times in one PC's logs in a week.)
- **A test of the Overlay's log reads its lines without `strlen`.** The helper that looks for a line in the log
took its text as C strings and measured one with `strlen`; it takes strings now. Test code only: nothing in the
installed software changes. (Found by SonarCloud after 0.1.0-beta.42 was merged.)
## Releases
Newest first. Each file holds that release's section exactly as it stood here.
+3 -1
View File
@@ -90,7 +90,9 @@ shown is recorded too, from outside the game. ([Capture](docs/04_CAPTURE.md))
same games as *Render → output resolution* in the accuracy statement; elsewhere it says it was not measured.
- The upscaler is read from the game's calls: DLSS and NIS through NVIDIA Streamline, and FSR through AMD's
FidelityFX libraries. **Intel XeSS is not read** (its licence forbids it), FSR 2 and upscalers built into the
game are not identified, and Vulkan and OpenGL games read N/A. Where no hook saw DLSS but the NVIDIA driver
game are not identified — Cyberpunk 2077's FSR 2.1 is one: its sessions say "unknown" beside a measured render
size — and Vulkan and OpenGL games read N/A. A game that sends FSR upscaling through two unrelated libraries in
one run is counted from the first alone (none is known). Where no hook saw DLSS but the NVIDIA driver
reports it, the page says it is the driver's report.
- **The quality mode** (Quality, Balanced, DLAA, …) is shown only when it is known: the NVIDIA App's override
where the NVIDIA driver reports it applied (marked *· NVIDIA App*, since 0.1.0-beta.24), or the mode the game
+6 -1
View File
@@ -133,7 +133,12 @@ What the region is, as a contract between the two sides:
beta.43~~ 0.1.0-beta.43 and beta.44 fill *(renumbered twice on 2026-11-12 — D118: a fix release took beta.41;
D122: the second step became two releases, and beta.42 fills none of them. The comments in `fl_shm.h` and
`ShmLayout.cs` carry the new numbers since beta.42)* (`ffxFg*`,
`sl*`, `features`) are declared now and stay zero until then, so those releases bump no layout.
`sl*`, `features`) are declared now and stay zero until then, so those releases bump no layout. **The `sl*` group
is filled since 0.1.0-beta.43** by the `slSetConstants` hook (`17_HOOK_ENGINE` §Hook inventory), under
`FL_ADV_VALID_SL_CONSTANTS`: the call count of every viewport, and for the first viewport seen the resets, the
jitter's largest magnitude, the motion-vector scale, the two depth planes, the field of view's range, the aspect
ratio, and one bit per `Boolean` in each of two words — seen true, seen false. `FlHookFamily` gains
`FL_HOOK_SL_CONSTANTS` (bit 13): the hook is in, which it is only in a process that was asked at least once.
- The Vulkan layer never writes it. `ShmLayoutMirrorTests.TheAdvancedStateMirrorMatches` checks every member's
offset against `fl-layout-dump`; `ShmRingReaderTests` the three reads and that the request is stored either way.
+7 -3
View File
@@ -194,10 +194,11 @@ Every hook must be listed here with a purpose. Anything not on this list is not
|---|---|
| NGX: `NVSDK_NGX_D3D11/D3D12/VULKAN_CreateFeature`, `EvaluateFeature`, `ReleaseFeature` | Which NGX feature is *actually created and evaluated per frame*: SuperSampling (DLSS), RayReconstruction (DLSS-D), FrameGeneration (DLSS-G) |
| NGX parameter accessors (`NVSDK_NGX_Parameter_SetI/GetI/SetUI`) — **exported by `sl.common.dll` only; see below** | `Width`/`Height` (render) vs `OutWidth`/`OutHeight` (output), `PerfQualityValue` (quality preset), sharpness |
| ✅ Streamline: `slEvaluateFeature` · ⏳ `slInit`, `slSetFeatureLoaded`, `slSetConstants`, `slGetFeatureRequirements` | Feature set actually active when the game goes through SL rather than NGX directly (`kFeatureDLSS`, `DLSS_G`, `DLSS_RR`, `Reflex`, `NIS`; since beta.34 `kFeatureDLSS_NR` — DLSS 5's neural rendering, its own fact bit and family `FL_HOOK_SL_NEURAL_RENDERING`, D84; rule 4: the `feature` argument of the API hooked, nothing else). **Built 2026-08-09**, identity only: one MinHook detour on `sl.interposer.dll!slEvaluateFeature`, resolved **module-scoped** and installed lazily by the watchdog. Sets `FL_MEASURED_UPSCALER` + `FL_HOOK_UPSCALER_IDENTITY`; decodes `kFeatureDLSS`/`kFeatureNIS` and reports `FL_UPSCALER_UNKNOWN` for anything else. **Never `FL_UPSCALER_NONE`** — a Streamline-only writer cannot see FFX, XeSS or NGX-direct, and `NONE` is the only one of the three states that may be aggregated as a negative. **Since 0.1.0-beta.40 (Advanced metrics train B, D111), and only while the Agent asks** (`FlControlBlock.advancedRequested`): the `sl::DLSSOptions` a title chains into `inputs` — the struct the quality mode is read from — is read further: `outputWidth`/`outputHeight`, `preExposure`, `exposureScale`, `colorBuffersHDR`, the five presets of version 1, and where the struct's own `structVersion` proves them present `ultraQualityPreset` and `useAutoExposure` (≥ 2) and `alphaUpscalingEnabled` (≥ 3) — §Which struct version carries which field. Rule 4: more members of the same argument of the same call; `fl_adv_fields.h` is the one place, `tools/overlay-fields-check.ps1` holds it. No new patch site. **Measured** (the header's own functions, `/O2 /guard:cf /Qspectre /MT`, 20 M calls × 3): +9.5–11.7 ns per evaluation that chains the options while asked; with the word at 0, one relaxed load and a branch not taken — below what the bench resolves. Most titles set these through `slDLSSSetOptions`, which is not an export, and read N/A (train D) |
| ✅ Streamline: `slEvaluateFeature` · ⏳ `slInit`, `slSetFeatureLoaded`, ~~`slSetConstants`~~ *(its own row below since beta.43)*, `slGetFeatureRequirements` | Feature set actually active when the game goes through SL rather than NGX directly (`kFeatureDLSS`, `DLSS_G`, `DLSS_RR`, `Reflex`, `NIS`; since beta.34 `kFeatureDLSS_NR` — DLSS 5's neural rendering, its own fact bit and family `FL_HOOK_SL_NEURAL_RENDERING`, D84; rule 4: the `feature` argument of the API hooked, nothing else). **Built 2026-08-09**, identity only: one MinHook detour on `sl.interposer.dll!slEvaluateFeature`, resolved **module-scoped** and installed lazily by the watchdog. Sets `FL_MEASURED_UPSCALER` + `FL_HOOK_UPSCALER_IDENTITY`; decodes `kFeatureDLSS`/`kFeatureNIS` and reports `FL_UPSCALER_UNKNOWN` for anything else. **Never `FL_UPSCALER_NONE`** — a Streamline-only writer cannot see FFX, XeSS or NGX-direct, and `NONE` is the only one of the three states that may be aggregated as a negative. **Since 0.1.0-beta.40 (Advanced metrics train B, D111), and only while the Agent asks** (`FlControlBlock.advancedRequested`): the `sl::DLSSOptions` a title chains into `inputs` — the struct the quality mode is read from — is read further: `outputWidth`/`outputHeight`, `preExposure`, `exposureScale`, `colorBuffersHDR`, the five presets of version 1, and where the struct's own `structVersion` proves them present `ultraQualityPreset` and `useAutoExposure` (≥ 2) and `alphaUpscalingEnabled` (≥ 3) — §Which struct version carries which field. Rule 4: more members of the same argument of the same call; `fl_adv_fields.h` is the one place, `tools/overlay-fields-check.ps1` holds it. No new patch site. **Measured** (the header's own functions, `/O2 /guard:cf /Qspectre /MT`, 20 M calls × 3): +9.5–11.7 ns per evaluation that chains the options while asked; with the word at 0, one relaxed load and a branch not taken — below what the bench resolves. Most titles set these through `slDLSSSetOptions`, which is not an export, and read N/A (train D) |
| ✅ Streamline: `slSetConstants` (0.1.0-beta.43, Advanced metrics train B; owner decisions D111–D116, D122) | **What the game tells Streamline about a frame**, once per frame and viewport, read from the `sl::Constants` it passes — rule 4: an argument of the call hooked, and of it only the members named here. **Read:** `jitterOffset`, `mvecScale`, `cameraNear`, `cameraFar`, `cameraFOV`, `cameraAspectRatio` and the seven `Boolean`s (`depthInverted`, `cameraMotionIncluded`, `motionVectors3D`, `reset`, `orthographicProjection`, `motionVectorsDilated`, `motionVectorsJittered`). **Never read:** the five matrices (bytes 32..351 of the struct), `cameraPinholeOffset`, and the camera's position and three axes (bytes 368..423) — `tools/overlay-fields-check.ps1` refuses their names anywhere in code loaded into a game, and ctest `fl_adv_fields` publishes two structs that differ in every one of those bytes and gets the same bytes out. **The one row that is not installed unless asked for** (D111): `InstallByFamily` returns before it resolves the symbol in a process the Agent has never asked for Advanced metrics — resolving takes a reference on the module — so with the option off the export's first bytes are the file's (`fl_guard` `[advanced]` reads them from the target). Once asked, the patch goes in on that watchdog tick and stays for the life of the process; the detour forwards without looking while the request is off, and after a stop (`MayObserve`). **Every call** checks the struct's GUID and a `structVersion` of at least 1 before any member is read, and the viewport handle's the same way; every member read is one version 1 carries, so a version-1 struct laid against unreadable memory is read whole without a fault (the same ctest). **Summaries are the first viewport's**: a title with two viewports sets constants for each every frame, and "the last value" across them would flip twice a frame; the call count is of every viewport. `FLT_MAX` is Streamline's "not set" here and is kept nowhere (D119's plane at infinity is FidelityFX's). Family `FL_HOOK_SL_CONSTANTS` (bit 13), published with the patch: it entitles no field of a frame record, and tells "hooked, never called" from "not hooked". **Measured overhead** (the detour's body on the headers, the Overlay's flags, 20 million calls a run, three runs): not asked **+0.57 / +0.60 / +0.58 ns**; asked, the summarised viewport **+19.61 / +19.54 / +19.79 ns**; asked, another viewport +5.83 / +6.01 / +5.62 ns. |
| ✅ Streamline: `slSetTag` — **and, since 2026-09-05, every tag's TYPE** (`slTagCensus`; a HUD-less / UI tag marks the present `FL_FG_DLSS_G`, rule 4: the same argument) | The **global** resource tags, where a title states the size of the buffer it is upscaling *from*: `kBufferTypeScalingInputColor`'s extent → `renderW/H` — **or, since 2026-09-05, the size the tagged `sl::Resource` declares when the extent is zero** (`TagSize` in `fl_sl_inputs.h`, shared by all three tag routes; GUID-checked; a Resource declaring no size is still the honest unknown). **Built 2026-08-15** (`FL_HOOK_UPSCALER_PARAMS`), and it is an ALTERNATIVE to the local tags in `slEvaluateFeature`'s `inputs`, not a layer over them — `sl_core_api.h:258` says global and local tags "do NOT interact", so a title using one yields nothing from the other and both are read. Published only on a frame where an evaluation was also seen, because a tag is viewport state that outlives any one frame. This row was MISSING from this table while the hook shipped, which is the gap the banner above now names |
| ✅ Streamline: `slSetTagForFrame` — **and every tag's TYPE, as above** | The same global tags through **Streamline 2.8's frame-based entry point**, which deprecates `slSetTag`: `(const FrameToken&, const ViewportHandle&, const ResourceTag*, uint32_t, CommandBuffer*)` — the token first, then exactly `slSetTag`'s list, handed to the same tag walk. **Built 2026-09-04** (`FL_HOOK_UPSCALER_PARAMS`, its own trampoline; the family is now **published when whole** — once every tag export the loaded interposer has is patched — because publishing on the first row entitled records the second was not yet producing, 38 of 41 on the fixture: the ffx leaves' #110 defect again, fixed the same way). Measured need: Dying Light: The Beast (SL 2.8.0) published `Dlss` identity on every batch and the params bit on none across three captures, because a 2.8 title that tags per frame never calls the deprecated export. The token is not read; the frame count stays with `slGetNewFrameToken`. The installer picks this detour by SYMBOL (`kSymbolSlSetTagForFrame`, bound to the row by `static_assert`), not by family, since the two rows share a family bit and differ in signature |
| ✅ **FidelityFX ffx-api: `ffxDispatch` on the FOUR modules a game calls** — `amd_fidelityfx_dx12.dll` (SDK 1.1.x monolith), `amd_fidelityfx_upscaler_dx12.dll`, `amd_fidelityfx_framegeneration_dx12.dll`, **and `amd_fidelityfx_loader_dx12.dll`** (added the evening of 2026-09-04: three loader-shipping titles at FSR produced zero dispatches at any leaf export, so the loader is where their calls arrive) · ⏳ FSR 3.0 host route `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` / `ffxFsr3DispatchFrameGeneration` · ~~`ffxFsr2ContextCreate`~~ · ~~`ffxCreateContext`~~ | **Built 2026-09-04** (`HANDOFF` item 7c). One observer behind three trampolines reads the DESCRIPTOR the title passed — head type first, body only after the type matched a constant from the vendored MIT headers (`third_party/fidelityfx/`, tag v2.3.0): **UPSCALE** → identity (`FSR3` from the monolith, `FSR_UNVERSIONED` from the 2.x upscaler DLL, which hosts FSR 3.1 and FSR 4 behind one type) + `renderSize` → `renderW/H` (quality and sharpness `0xFF`: the dispatch carries neither — *since beta.25 the quality byte is the mode the `ffxQuery` row below names for the dispatched size, `0xFF` when none does*) + one COUNT; **PREPARE / PREPARE_V2** → `frameID` counted on a *new* index only — this vendor's `slGetNewFrameToken`, the `fgEvaluations` producer once a title has ever prepared, with the UPSCALE count as the fallback for a title that never does; **FRAMEGENERATION** → `fgMode = FSR_FG` on that present. Rule 4: the argument of the API we hooked, never `context`, `pNext`, a command list or a resource. **Why all four:** a UE5 title ships the two leaves with no loader and calls their exports; a loader-shipping title calls the loader's export and the signed loader reaches its providers through an object, not the leaves' exports (measured: Dying Light: The Beast, KCD2, Wukong). The morning's "never the loader" rested on the export tables alone and was reversed by the run. What guards against a loader that DID re-enter a leaf's export is the K = 1 control with all four hooked and the consumer's `frames/upscale-drained`, both of which read 2× in that case. `ffxCreateContext` is deliberately NOT a row — nothing it carries fills a field the dispatch does not, and its honest family would collide with `slEvaluateFeature`'s under the installer's equality binding. The family is compound (`IDENTITY \| PARAMS \| FG_EVALUATIONS`), pinned by `static_assert`s that also bind the leaf table to the rows both ways and refuse the loader as a row. Streamline keeps precedence for the count once it has ever issued a token, so every §S31-validated title is byte-identical. Second count: the consumer prints `frames/upscale-drained`, the AMD `tokens/batch`. **FSR 3.0 — BUILT 2026-09-05 as a fifth AMD target:** `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` (Cyberpunk's copy; named export, its own descriptor, vendored from tag **`fsr3-v3.0.4`** — the tag whose twelve `ffxFsr3*` declarations match the shipped module, not the `v1.1.4` first named). Rule 4: the detour reads `renderSize` of the descriptor the title passed and nothing else — never the context, a resource or the command list; the offset is pinned to a literal (1256) so a re-vendoring that moved it fails to compile. Same family and publish point as the four rows (`PublishFfxFamilyIfWhole` waits for a loaded host too), keyed by module in the installer; identity `FSR3` as a fact. `ffxFsr3DispatchFrameGeneration` is deliberately not a row (§H11 carries the reversal condition); the `ffx_fsr3upscaler_x64.dll` leaf is the pre-committed alternative if the facade reads silent (row B2) — never both, or `frames/upscale-drained` reads 2.00. **Since 0.1.0-beta.40 (Advanced metrics train B, D111), and only while the Agent asks:** the UPSCALE arm reads the rest of `ffxDispatchDescUpscale` — `enableSharpening`, `sharpness`, `jitterOffset`, `preExposure`, `cameraNear`, `cameraFar`, `cameraFovAngleVertical`, `flags`, `reset`, `frameTimeDelta` — into process-local summaries (an "ever seen" mask, a largest magnitude, a lowest and highest, a count and a sum; one module's dispatches are counted, so a dispatch that reaches the loader and a leaf is one). Never on the FSR 3.0 host's legacy descriptor, which is vouched for through `renderSize` and no further; never a PREPARE descriptor's camera arrays (`tools/overlay-fields-check.ps1` refuses their names anywhere in the Overlay). `cameraNear`/`cameraFar`/`cameraFovAngleVertical` are the depth range and the field of view, not where the camera is; the field of view is kept as a session's range, never a series (D114). **Measured** (as the row above): +22–23 ns per UPSCALE dispatch, i.e. per application frame, while asked; ≤ 0.7 ns, inside the bench's noise, with the word at 0 |
| ✅ **FidelityFX ffx-api: `ffxDispatch` on the FOUR modules a game calls** — `amd_fidelityfx_dx12.dll` (SDK 1.1.x monolith), `amd_fidelityfx_upscaler_dx12.dll`, `amd_fidelityfx_framegeneration_dx12.dll`, **and `amd_fidelityfx_loader_dx12.dll`** (added the evening of 2026-09-04: three loader-shipping titles at FSR produced zero dispatches at any leaf export, so the loader is where their calls arrive) · ⏳ FSR 3.0 host route `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` / `ffxFsr3DispatchFrameGeneration` · ~~`ffxFsr2ContextCreate`~~ · ~~`ffxCreateContext`~~ | **Built 2026-09-04** (`HANDOFF` item 7c). One observer behind three trampolines reads the DESCRIPTOR the title passed — head type first, body only after the type matched a constant from the vendored MIT headers (`third_party/fidelityfx/`, tag v2.3.0): **UPSCALE** → identity (`FSR3` from the monolith, `FSR_UNVERSIONED` from the 2.x upscaler DLL, which hosts FSR 3.1 and FSR 4 behind one type) + `renderSize` → `renderW/H` (quality and sharpness `0xFF`: the dispatch carries neither — *since beta.25 the quality byte is the mode the `ffxQuery` row below names for the dispatched size, `0xFF` when none does*) + one COUNT *(since 0.1.0-beta.43, owner decision D125: **counted at the first source that saw an UPSCALE and at no other** — `g_ffxUpscaleOwner`, `fl::adv::Owns`. Cyberpunk 2077's loader 2.3.0 hands a dispatch on to the leaf's export — its frame-generation dispatch types are logged on the loader and on the leaf — so an UPSCALE through such a loader reaches two hooked modules, and one count per module read K = 1 as 2.0 on the fixture bound that way (`--ffx-topology 2x-export`: 60 presents, 120 counted). No title run so far upscales through one; it is a precaution. Measured on the header with the Overlay's flags: +0.02 to +0.03 ns on the module that is counted, about 4 ns less on the forwarded copy)*; **PREPARE / PREPARE_V2** → `frameID` counted on a *new* index only — this vendor's `slGetNewFrameToken`, the `fgEvaluations` producer once a title has ever prepared, with the UPSCALE count as the fallback for a title that never does; **FRAMEGENERATION** → `fgMode = FSR_FG` on that present. Rule 4: the argument of the API we hooked, never `context`, `pNext`, a command list or a resource. **Why all four:** a UE5 title ships the two leaves with no loader and calls their exports; a loader-shipping title calls the loader's export and the signed loader reaches its providers through an object, not the leaves' exports (measured: Dying Light: The Beast, KCD2, Wukong). The morning's "never the loader" rested on the export tables alone and was reversed by the run. What guards against a loader that DID re-enter a leaf's export is the K = 1 control with all four hooked and the consumer's `frames/upscale-drained`, both of which read 2× in that case. `ffxCreateContext` is deliberately NOT a row — nothing it carries fills a field the dispatch does not, and its honest family would collide with `slEvaluateFeature`'s under the installer's equality binding. The family is compound (`IDENTITY \| PARAMS \| FG_EVALUATIONS`), pinned by `static_assert`s that also bind the leaf table to the rows both ways and refuse the loader as a row. Streamline keeps precedence for the count once it has ever issued a token, so every §S31-validated title is byte-identical. Second count: the consumer prints `frames/upscale-drained`, the AMD `tokens/batch`. **FSR 3.0 — BUILT 2026-09-05 as a fifth AMD target:** `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` (Cyberpunk's copy; named export, its own descriptor, vendored from tag **`fsr3-v3.0.4`** — the tag whose twelve `ffxFsr3*` declarations match the shipped module, not the `v1.1.4` first named). Rule 4: the detour reads `renderSize` of the descriptor the title passed and nothing else — never the context, a resource or the command list; the offset is pinned to a literal (1256) so a re-vendoring that moved it fails to compile. Same family and publish point as the four rows (`PublishFfxFamilyIfWhole` waits for a loaded host too), keyed by module in the installer; identity `FSR3` as a fact. `ffxFsr3DispatchFrameGeneration` is deliberately not a row (§H11 carries the reversal condition); the `ffx_fsr3upscaler_x64.dll` leaf is the pre-committed alternative if the facade reads silent (row B2) — never both, or `frames/upscale-drained` reads 2.00. **Since 0.1.0-beta.40 (Advanced metrics train B, D111), and only while the Agent asks:** the UPSCALE arm reads the rest of `ffxDispatchDescUpscale` — `enableSharpening`, `sharpness`, `jitterOffset`, `preExposure`, `cameraNear`, `cameraFar`, `cameraFovAngleVertical`, `flags`, `reset`, `frameTimeDelta` — into process-local summaries (an "ever seen" mask, a largest magnitude, a lowest and highest, a count and a sum; one module's dispatches are counted, so a dispatch that reaches the loader and a leaf is one). Never on the FSR 3.0 host's legacy descriptor, which is vouched Line truncated
| ✅ **FidelityFX ffx-api: `ffxQuery` on the same four modules** (beta.25, owner decision D65) — `amd_fidelityfx_dx12.dll`, `amd_fidelityfx_upscaler_dx12.dll`, `amd_fidelityfx_framegeneration_dx12.dll`, `amd_fidelityfx_loader_dx12.dll` | **Built 2026-10-19.** The mode an FSR title runs at reaches the vendor only as an argument of `ffxQuery` — "what render size (`…GETRENDERRESOLUTIONFROMQUALITYMODE`, `0x00010003`) or ratio (`…GETUPSCALERATIOFROMQUALITYMODE`, `0x00010002`) does this mode give at this display size?" — asked before the title sizes its targets; the per-frame dispatch carries the size alone. The detour calls the original FIRST, exactly once, and only when it returned `FFX_API_RETURN_OK` reads the descriptor's type, display size and mode and the values the vendor wrote through the title's own out pointers, into a five-slot table (one per `FfxApiUpscaleQualityMode`); the `ffxDispatch` UPSCALE arm names the ONE mode whose kept answer fits the dispatched `renderSize` (and `upscaleSize`, where stated) as `0x10 + mode` in `upscalerQuality`, else `0xFF` (`03_METRICS` §Upscaling). **Rule 4:** the arguments of the API we hooked — the descriptor the title passed and the out values of that same call — never `context`, a resource or anything the title did not hand the hooked export; nothing of the title's is written, and every read is under the hook's SEH guard. Both query layouts and type ids are pinned to literals by `static_assert`s, identical at SDK v1.1.4 and v2.3.0. **Its own family**, `FL_HOOK_UPSCALER_QUALITY` (bit 11 of `hooksInstalledMask`, mirrored in `FlHookFamily` and `HookFamilies`): `InstallByFamily` binds a row by equality, and the query entitles no measured field by itself — the byte rides under `FL_MEASURED_UPSCALER_PARAMS` from the dispatch arm — so the bit says only that the query was hooked, which tells "never asked" from "could not have seen it ask". Published like the dispatch family, once every loaded leaf is patched (`PublishFfxQueryFamilyIfWhole`); the FSR 3.0 host has no `ffxQuery` and no row (`static_assert`). A loader that passes a query on to a leaf's export refreshes one kept answer twice; nothing is counted, so nothing is counted twice. **Measured overhead** (a copy of the two bodies, `/O2 /guard:cf /Qspectre /MT`, 20 M calls × 3 runs, every slot holding both a size and a ratio — the worst case): 7.6–8.2 ns added per UPSCALE dispatch, i.e. per application frame, and 1.6 ns per query beside the trampoline; the per-present path gains one load. Harness: `--ffx-query sizes|ratios`; `fl_guard` "FSR's quality mode". **Since 0.1.0-beta.40 (Advanced metrics train B, D111), and only while the Agent asks:** when the query the vendor answered OK is the upscaler's memory — `FFX_API_QUERY_DESC_TYPE_UPSCALE_GPU_MEMORY_USAGE` (`0x00010008`, ffx-api 1.1.2) or `…_V2` (`0x00010009`, 2.0) — the `FfxApiEffectMemoryUsage` it wrote through the title's own out-pointer is kept (total and aliasable bytes), one module's queries counted. Only a title that asks is answered: FrameLedger never calls `ffxQuery` itself. The frame-generation memory queries (`0x00020007`, `0x0002000b`) are not read. +4.3–6.1 ns per such query while asked. Harness: `--ffx-memory-query v1|v2`; `fl_guard` "region 5 stays empty until the Agent asks". |
| ~~XeSS: `xessD3D12CreateContext`, `xessD3D12Init`, `xessD3D12Execute`~~ **Closed at the census by licence, 2026-09-04** (`20_OPEN_QUESTIONS` §Scope decisions, `18_GPU_VENDOR_APIS` §Intel XeSS SDK): no hook on any `libxess*.dll` export *(corrected 2026-10-04)* | ~~`outputResolution`, `qualitySetting`, XeSS version; `xess_fg` variants for XeFG~~ |
| ✅ **Application frames per present** (`fgEvaluations`) — **`sl.interposer.dll!slGetNewFrameToken` since 2026-09-03** | Native vs Displayed frame counts at Tier 1 — see `03_METRICS` §Frame Generation. **The producer is the frame-token export**: Streamline hands a title one token per application frame and the title must ask; the detour counts distinct tokens between two presents (pointer changes, nothing dereferenced), `FL_HOOK_FG_EVALUATIONS` is its family, and it installs on every Streamline 2 title including the ones that evaluate nothing through `slEvaluateFeature`. Rule 4: the out-parameter of an API we hooked. Premise and its gate in `03_METRICS`; pre-committed table in `20_OPEN_QUESTIONS` §S31. *The row as it stood before:* ~~NGX/SL/FFX/XeSS FG feature evaluations per present. **Built 2026-08-15 for Streamline, and MEASURED TO YIELD NOTHING ON THAT ROUTE**~~ — `slEvaluateFeature(kFeatureDLSS_G)` is never called by Cyberpunk 2077 (0 across ~14,000 batches, four FG settings), so this row installs, is honest, and counts zero; see `docs/HANDOFF.md` item 3. Built on the detour that was already there: `kFeatureDLSS_G` contributes to a saturating COUNT in the same word the feature bits live in (`fl_sl_seen.h`) rather than to a bit, because a bit collapses several evaluations between two presents into one — and under multi-frame generation that is the common case, not the edge. The row's family is therefore compound (`FL_HOOK_UPSCALER_IDENTITY \| FL_HOOK_FG_EVALUATIONS`), pinned by a `static_assert` because `hookinventory-check` reads that column as an opaque identifier. **Counts EVALUATIONS, not generated frames** — the 2026-08-14 owner ruling; the multiplier lives in `sl::DLSSGOptions`, which is only reachable by the route §2b refused. ~~Non-NVIDIA FG vendors are **deferred with a written rationale**: `amd_fidelityfx_framegeneration_dx12.dll` 3.1.5 exports only the five generic `ffx*` entry points, identical to five sibling modules, so identity is in the arguments and we have no headers~~ — **AMD has a producer since 2026-09-04** (the FidelityFX row above: the PREPARE dispatch's `frameID`, or the UPSCALE count on a title that never prepares, feeds `fgEvaluations` when Streamline has never issued a token); Intel stays at the census (`20_OPEN_QUESTIONS` §Scope decisions, by licence); the FSR 3.0 host DLL's UPSCALE (`ffxFsr3ContextDispatchUpscale`, since 2026-09-05) counts like an ffx-api UPSCALE when neither Streamline nor a PREPARE has spoken |
@@ -326,7 +327,10 @@ v2.8.0, v2.9.0, v2.10.0, v2.10.3, v2.11.1, v2.12.0, v2.14.1, v2.14.16):
`sl::DLSSOptions` keeps those seventeen declarations, same types and order, through v2.14.16 (`9a875bd4f843`); v2.8.0
only re-spelled the deprecated `sharpness`. `sl::Constants` is unchanged from v2.4.0 through v2.14.16
(`15589e577df9`). Streamline 1.x is refused before any read (`SpeaksStreamline2`).
(`15589e577df9`). Streamline 1.x is refused before any read (`SpeaksStreamline2`). **Since 0.1.0-beta.43 the
Overlay reads `sl::Constants`, and only members of version 1** — nothing of version 2 — so no version test beyond
"at least 1" is needed, and the read ends before `minRelativeLinearDepthObjectSeparation`, the member version 2
added.
**FidelityFX** (`GPUOpen-LibrariesAndSDKs/FidelityFX-SDK`; tags v1.1.0 — FSR 3.1.0, the first ffx-api — v1.1.1,
v1.1.2, v1.1.3, v1.1.4, v2.0.0, v2.1.0, v2.2.0, v2.3.0, v2.4.0). The descriptor header carries a `type` and no size
+21 -1
View File
@@ -60,10 +60,30 @@ Implemented in `FrameLedger.Injector` and reached from managed code through a th
> at once), waits `kScanRetryPauseMs` (250 ms), takes a **fresh** scan set and scans it whole. A member still unreadable
> then refuses `kProcessUnreadable`, as before; one that has gone is not in the new set; a target that has gone leaves
> no set, which refuses `kProcessTreeUnavailable`. **`ERROR_ACCESS_DENIED` — a protected process — is never retried**,
> and no other answer of any source is. The sentence above stands: every failure still means REFUSE; what changed is
> and no other answer of any source is *(one more since D123, below)*. The sentence above stands: every failure still means REFUSE; what changed is
> how many times "still loading" is asked before it counts as one. ctest `fl_guard` `[D48]` holds both directions,
> against fakes and against the real source (a process created suspended, a pid with no process).
>
> **Amended 2026-11-12 (owner decision D123): a module list that changed while it was read is read again, at most
> three times — never a pass.** The module check lists a process's modules and then asks each one's name. A game at
> its launch loads and unloads modules for seconds, and a module that was in the list and could not be named a
> moment later made the whole answer "incomplete": a refusal before injection, or — 0.5 s after it, at the first
> supervision scan — a safety unhook with no frame recorded, the game then running on unrecorded. **Five such ends
> in one PC's Agent logs in a week** (Phantom Blade Zero three times on 2026-11-05, Crown & Coin on 11-10,
> Cyberpunk 2077 on 11-12), and twice in this repository's own gate. Asked with that, the owner chose: read it
> again. Such a list is now `Collected::kUnsettled`; the pass finishes — **a blocklisted module among those that
> were read still refuses at once** — waits `kScanRetryPauseMs`, takes a fresh scan set and reads it whole, up to
> `kMaxUnsettledRereads` (3) times: four reads and 750 ms of pauses at most. A list still unsettled on the last
> read refuses `kModuleScanFailed` ("a module list kept changing while it was read"). **What did not change:** a
> list too long for the guard's buffer is still `kIncomplete` and refuses at once (a second read would be as
> long); a protected process still refuses at once; D48's re-read is still one for the whole check; every read is
> of the whole scan set, and the read that allows is one in which every member was read whole and none held a
> finding. A failure to read is still never a pass — what changed is how many times a list that is moving is
> asked before it counts as unreadable. The launch poll's presentation-runtime probe treats an unsettled list as
> "ask again" rather than deciding on half of one. ctest `fl_guard` `[D123]`: against fakes, every direction
> above; against the real source, a process that loads and frees a module in a loop — read some 3,600 times in
> three seconds, about one read in four is unsettled and none is anything else.
>
> **Launch mode (2026-09-06, P1 item 2) does not weaken this.** `FlGuardedInjectWhenReady` polls
> the same enumeration to learn *when* the launched target has mapped a presentation runtime, and a
> failing enumeration there means "not yet" — the poll continues. That is not a pass: the poll
+140 -10
View File
@@ -116,11 +116,115 @@ is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Unhooking and §Native logging, [`
turning the template into function pointers: the header is loaded into a game, and D100 changes such code only
for a defect.
### What the owner's first four sessions on beta.42 showed (2026-11-12, 09:40–09:53)
Dying Light: The Beast, Kingdom Come: Deliverance II, Cyberpunk 2077 and Lies of P, each quit from its own menu;
read from the four `overlay-<pid>-….log` files, a copy of the ledger, and — for Cyberpunk — the game's own settings
file and executable on disk. All four hooked, no fault, no `PATCH_FAILED`, the Agent's log without an `advanced:`
line.
- **D121 is answered, and it is not a detection gap: in that session Cyberpunk 2077 upscaled with FSR 2.1, which is
compiled into the game.** Its `UserSettings.json`, written when the session ended, has `ResolutionScaling = FSR2`,
`FSR2 = Quality`, `FrameGeneration = FSR3`, `FSR3_FrameGeneration = true` — FSR **2** for the upscale, FSR **3**
for frame generation only. Quality is a ratio of 1.5, and the session's render size is 1707×960 at 2560×1440.
`Cyberpunk2077.exe` carries FSR 2's own function names (`ffxFsr2GetJitterPhaseCount`,
`ffxFsr2GetUpscaleRatioFromQualityMode`) and names one FidelityFX module, the loader; its folder has no FSR 2
DLL. **The log says the same from the other side**: the loader (2.3.0), the upscaler leaf (4.1.1) and the
frame-generation leaf (4.0.1) were all patched; the loader and the frame-generation leaf were handed `0x20004`
(PREPARE) and `0x20003` (FRAMEGENERATION); the loader and the upscaler leaf were asked `0x10002` (the ratio of a
quality mode) once at start; **no module was ever handed `0x10001`**, and there is no `UPSCALE_ROUTE` line. The
NVIDIA driver's words for the session say DLSS was not running. So the upscale goes through no export at all —
the case `LIMITATIONS.md` already names ("FSR 2 and upscalers built into the game are not identified"), and
"unknown" beside a measured render size is the true reading. ~~**The owner had said FSR 3 or 4; that the setting is
FSR 2.1 is read from the file, and is the owner's to confirm.**~~ **Confirmed by the owner the same morning with
a screenshot of the game's Graphics menu: Resolution Scaling reads "AMD FidelityFX Super Resolution 2.1"** (the
file's `FSR2`), with its own quality and sharpening rows under it. Nothing to fix for it in beta.43.
- **The loader of SDK 2.3 passes a dispatch on to the leaf's export — the older loader does not — and that is a
double count waiting for the first title that upscales through it.** In Cyberpunk each frame-generation dispatch
type is logged on the loader AND on the frame-generation leaf: the game calls the loader, the loader calls the
leaf's exported `ffxDispatch`. In Kingdom Come and Dying Light (loader 1.0.2) the UPSCALE is logged on the loader
alone, which is what `fl_hook_inventory.h` measured in September and what the fixture's loader stub copies.
Frame generation is unharmed — PREPARE is counted by its frame number, FRAMEGENERATION is a bit, and the
session's factor is ×2.0001. **An UPSCALE is counted once per hooked module that sees it**
(`g_ffxSeen`'s count): through a 2.3 loader that would be two a frame, and with frame generation off — no
PREPARE, so the count falls back to UPSCALE dispatches — the application-frame count would double. Not
observed: no UPSCALE was dispatched. **One session answers it: Cyberpunk with Resolution Scaling set to FSR 3
and frame generation off** — the log shows whether `0x10001` is on both modules, and the session's frame
counts show whether it was counted twice. If so, the fix is beta.43's: count at the first module seen, as
`fl::adv::Owns` already does for the Advanced reads.
- **The plane at infinity is measured, not a hypothesis any more (D119).** Lies of P: `cameraNear = ∞`,
`cameraFar = 10`. Dying Light: `cameraNear = ∞`, `cameraFar = 0.1`. Both gave one plane on beta.41. Kingdom
Come still gives both as numbers (0.05 and 8000). Clair Obscur was not run.
- **The logs are whole.** Each has its installs by module and symbol, the census as it grew, and lines long after
the first second — Dying Light's first UPSCALE at 71.6 s, Kingdom Come's at 37.5 s, when play began. One line
looks odd and was not looked into: Cyberpunk's frame-generation leaf's `ffxDispatch` is at `0x241cde7ba10`, far
from where the other modules sit (`0x7ff…`); the patch went in and was called.
- **Dying Light was named FSR, Quality, with DLSS frame generation ×3.99** — its settings as the owner gave them.
No session changed upscaler part-way, so D120's case was not exercised.
### And three more starts of Cyberpunk 2077, 10:05–10:15 the same morning
Asked for as "Resolution Scaling = FSR 3, frame generation off". Read the same way.
- **The game was still on FSR 2.** After the last of them `UserSettings.json` has `ResolutionScaling = FSR2`,
`FSR2 = Performance` (it was `Quality` at 09:50), `FSR3 = Auto` untouched, `FrameGeneration = Off`. So the quality
and the frame generation were changed and the upscaler was not: **the owner's screenshot of the menu, taken after
them, shows Resolution Scaling = "AMD FidelityFX Super Resolution 2.1", Performance, Frame Generation Off** —
the file's `FSR2` is the menu's FSR 2.1. Both
stored sessions (215 s and 158 s, attached to a game already running) agree with FSR 2.1 built in and frame
generation off: every hook in, **not one ffx dispatch or query of any type**, no Streamline evaluation, no render
size, upscaler "unknown", factor 1.0 from Streamline's frame tokens, ~290 FPS. **So the 2.3 loader's double count
is still unobserved either way**: what answers it is a session in which `UserSettings.json` says
`ResolutionScaling = FSR3` afterwards.
- **The first start was lost to the transient this file recorded an hour earlier — in a real session this time.**
10:05:20 the game appeared; the Overlay went in at 10:05:23; 0.47 s later it was told to stop, and the Agent's
log says why: `SafetyUnhook; Discarded (tier 1, exit=UnhookedSafety, frames=0); guard=ModuleScanFailed/a module
list came back incomplete`. The Overlay's log shows the four patches restored within 0.75 s. The game ran on
unrecorded for two minutes until the owner restarted it. **It is not new and not rare**: the Agent's logs kept on
this PC (2026-11-05 onwards) hold five such ends — Phantom Blade Zero three times on 2026-11-05 (two safety
unhooks and one refusal before injection), Crown & Coin on 2026-11-10, Cyberpunk today — beside the two test
runs. Each is a module list read while the target was still loading modules, at a launch. **The question for the
owner is no longer hypothetical**: a list that cannot be read is not a finding, and rule 2 treats it as a refusal
so that an unreadable game is never hooked; reading it again a bounded number of times before refusing would
keep that — a list that stays unreadable still refuses — and stop losing sessions to a moment of loading. It
changes what the guard does on a check, so it is the owner's decision, and it is not made here. *(Made the same
day: D123, §NEXT item 1b.)*
### NEXT
1. **The owner runs item 40** — above all **one session of Cyberpunk 2077 with FSR upscaling** on beta.42, then
quits the game the ordinary way. Its `logs\overlay-<pid>-….log` is what beta.43 waits for.
2. **Read that log, then plan 0.1.0-beta.43** — `slSetConstants` and `ffxConfigure`, and the fix for D121 if the
1. ~~**The owner runs item 40** — above all **one session of Cyberpunk 2077 with FSR upscaling** on beta.42, then
quits the game the ordinary way. Its `logs\overlay-<pid>-….log` is what beta.43 waits for.~~ **Run 2026-11-12;
the section above is what it showed.** What is left of item 40 is (d), a session that changes upscaler, and
the owner's word on the rest.
1a. ~~**Before beta.43's plan: one session of Cyberpunk 2077 with Resolution Scaling = FSR 3, frame generation
off** (the second bullet above), and a second with it on. It says whether FrameLedger names FSR 3 there —
the route through the loader that D121 was first taken to be about — and whether the 2.3 loader counts an
UPSCALE twice. *(Tried 2026-11-12 10:08 and 10:12: the game was still on FSR 2 — the section above. The check
that the right thing ran is the file: `ResolutionScaling = FSR3`.)*~~
**It cannot be run, the owner said the same day: Cyberpunk 2077 has FSR 2.1 as its only FSR upscaler and
FSR 3.1 as frame generation only — two separate settings, not a pair; there is no FSR 3 under Resolution
Scaling.** So D121 is closed for good — every Cyberpunk session upscaling with FSR reads "unknown", by the
limit `LIMITATIONS.md` states — and **no title run so far upscales through a 2.3 loader**. The double
count stays unobserved. What IS measured is that this loader hands a frame-generation dispatch to the leaf's
export; an UPSCALE through the same `ffxDispatch` would take the same path. beta.43's plan therefore counts
an UPSCALE at the first hooked module that sees it (as `fl::adv::Owns` does) as a precaution, with a fixture
whose loader forwards to the leaf's export — rather than wait for a session that cannot be had.
1b. ~~**The owner's decision on the guard's module-list read** (the section above): refuse at the first incomplete
list, as now, or read again a bounded number of times first. If the second, it is a pull request of its own
in the guard (`FrameLedger.Injector`), with `19_SAFETY` amended in it, before or with beta.43.~~ **Decided
2026-11-12 — read again (D123) — and built the same day**: `Collected::kUnsettled`, up to three re-reads,
`19_SAFETY` amended. Not released: it ships with the next pre-release, and until then a launch can still be
lost this way on beta.42. What the owner then checks is the Agent's log: no `guard=ModuleScanFailed` end at a
game's launch, and if one comes its signal now says which kind — *kept changing while it was read* (four reads
were not enough) or *came back incomplete* (more modules than the guard's buffer holds).
2. **0.1.0-beta.43 — planned and approved 2026-11-12 (D123–D125), and under way.** The guard's re-read (D123,
#413) ships with it and not on its own (D124). Five pull requests after it: (1) an UPSCALE is counted at the
first source that saw one (D125) — the fixture's loader bound through the leaves' exports read K = 1 as 2.0
before it; (2) `slSetConstants`; (3) `ffxConfigure` on the four ffx modules; (4) the Agent, the App and the
Privacy Policy 2.17, whose wording the plan carried and the owner approved with it; (5) the release, owner-only
item 41. The design is the one below, as the review of 2026-11-12's first plan left it; nothing in the logs
changed it except D125.
~~**Read that log, then plan 0.1.0-beta.43**~~ — `slSetConstants` and `ffxConfigure`, and the fix for D121 if the
log shows the route. What to look for: which `HOOK_INSTALLED` lines there are (which of the four ffx modules and
the FSR 3.0 host were patched); the `FFX_DISPATCH` lines — is `b=0x10001` (UPSCALE) on any module, or only
`0x20004` / `0x2000c` / `0x20003`; an `UPSCALE_ROUTE` line; `PATCH_FAILED`; the last `RUNTIME_CENSUS` word.
@@ -143,8 +247,14 @@ is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Unhooking and §Native logging, [`
### Left open by this session
- **This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request.
- ~~**This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request.~~ **Recorded 2026-11-12: 0.1.0-beta.42 was released
2026-11-12T02:31:07Z** (09:31 in the owner's time zone) from the signed tag on `a708ae8` (#410), by run
43139775713 — green at the first attempt, one run for the one tag push. Eight assets; the seven digests of
`SHA256SUMS.txt` equal the ones GitHub computed; the four shipped natives carry `FL_BUILD_ID v0.1.0-beta.42`. The
delta from beta.41 is 710,943 bytes beside a full package of 110,716,228 — "Delta processed 0452 files. 0023
patched, 0429 unchanged". The wiki was published by run 43142009098. The rehearsal on the release branch (run
43137520796) had made a delta of 735,485 bytes with the same file counts.
- **No real game was run on this build.** The four changes were tested with the harness and the cost measured on
the headers. Item 40 is the first real session.
- **Whether the missing plane of Lies of P, Clair Obscur and Dying Light is `FLT_MAX`** is still the reading their
@@ -157,12 +267,24 @@ is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Unhooking and §Native logging, [`
it is a re-run. **In a real session the same answer is a safety unhook**: a re-scan that cannot read the module
list of a game that is still running stops the session (`19_SAFETY` §During a session; D48 covers only a game
that has exited). Whether the guard should read the list a second time before refusing is a change to rule 2's
checks and is the owner's to decide; nothing was changed.
- **SonarCloud has not answered for #406–#409**: `main`'s `sonarcloud` job was cancelled by the next merge each
time. It runs to its end on this release's commit; read it then.
checks and is the owner's to decide; nothing was changed. **A second one within the hour, in the gate of the pull
request that records the release's facts:**
`ToolhelpProcessSnapshotSourceTests.ThisProcessIsInTheSnapshotWithItsNormalisedImagePathAndACreationTime` got an
empty snapshot — `ToolhelpProcessSnapshotSource.Take` returns an empty list when the snapshot cannot be taken or
walked, and says nothing. Green on the run after. Both are Windows refusing, for a moment, to enumerate something
on a PC that was building, testing and running FrameLedger itself at once; what an empty snapshot does to the
watcher's tick in a real session was not looked into.
- ~~**SonarCloud has not answered for #406–#409**: `main`'s `sonarcloud` job was cancelled by the next merge each
time. It runs to its end on this release's commit; read it then.~~ **It answered on `a708ae8`: the quality gate
passed, and one issue was open on `main`** — `cpp:S5813`, a `strlen` in the helper the new log case of
`guard_test.cpp` reads lines with (#408). Fixed in the pull request that records these facts: the helper takes
strings. **`csharpsquid:S3869` on `ParentDump.cs` is no longer open** — SonarCloud shows it accepted at
2026-11-11T21:13Z (04:13 on the 12th, the owner's time), which is before the texts that still called it open
were written; they were not checked against SonarCloud then. **Qodana's two reports are green on the release's
commit**; the native one was red from #407 to #408 on seven problems in test code, answered in #409.
- **`LIMITATIONS.md` and the accuracy statement still say the processor's, the memory's and the motherboard's
sensors "have never been read on real hardware"** — the owner's to reword. **SonarCloud's `csharpsquid:S3869` on
`ParentDump.cs`** is the owner's to accept. **Items 36 (d) and 37 are still open.** The alpha line still rests
sensors "have never been read on real hardware"** — the owner's to reword. ~~**SonarCloud's `csharpsquid:S3869` on
`ParentDump.cs`** is the owner's to accept.~~ *(Done — the line above.)* **Items 36 (d) and 37 are still open.** The alpha line still rests
(D98).
**Owner-only:** item 40.
@@ -482,6 +604,11 @@ is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Unhooking and §Native logging, [`
and says *settings changed during session*. (e) **Any hooked game, ended by quitting it**: its overlay log has
lines after the first second — `HOOK_INSTALLED` with a module and a function, `RUNTIME_CENSUS` — and no
`PATCH_FAILED`; if there is one, its `a=` number is the reason.
**Four sessions were run on 2026-11-12 and read the same morning** (START HERE §What the owner's first four
sessions on beta.42 showed): (a) happened — the sessions carry the beta.42 build; (b) read, and D121 answered:
the session upscaled with FSR 2.1, built into the game; (c) Lies of P and Dying Light show `cameraNear = ∞`;
(e) all four logs are whole and none has a `PATCH_FAILED`. **(d) was not exercised**, and the owner has not
said the item passed.
**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
@@ -618,6 +745,9 @@ Where each owner decision is recorded — the file and its section, and a label
| D120 | [`03_METRICS.md`](03_METRICS.md) §Upscaling | a session's upscaler is the technology named on the most samples, and its quality and render size are read from that technology's samples — not the first one named, with the others' values beside it |
| D121 | [`HANDOFF.md`](HANDOFF.md) §NEXT | Cyberpunk 2077 was set to FSR upscaling and FrameLedger named none: a detection gap, to be investigated — which first needs a native log that survives the game's exit |
| D122 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | train B's second step is split: **beta.42** has no new patch site (D119–D121 and the patch registry's hardening); **beta.43** is the two new hooks, begun only after the owner has run Cyberpunk on beta.42 and its log was read. The third release is beta.44, train C beta.45, train D beta.46 |
| D123 | [`19_SAFETY_AND_ANTICHEAT.md`](19_SAFETY_AND_ANTICHEAT.md) §Pre-injection checks, check 1 | a module list that changed while the guard read it is read again, at most three times, before it refuses — five real sessions on one PC in a week had ended as a safety unhook with no frame recorded; a list that never settles still refuses, and nothing else about what refuses changed |
| D124 | [`HANDOFF.md`](HANDOFF.md) §NEXT | the guard's re-read (D123) ships with 0.1.0-beta.43 and not as a release of its own — the train's numbers do not move a third time; until then a launch can still be lost that way on beta.42 |
| D125 | [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Hook inventory | an FSR UPSCALE is counted at the first source that saw one and at no other — a precaution for a loader that hands a dispatch on to the leaf's export (Cyberpunk 2077's 2.3.0 does, for frame generation); no title run so far upscales through one |
| D109 | [`../legal/DISCLAIMER.md`](../legal/DISCLAIMER.md) §5, §5A | asked on 2026-11-11 with both sentences quoted: the Disclaimer goes to 2.15 with the Privacy Policy — PawnIO and the admin mode are no longer "for the CPU temperature" alone; with Advanced metrics on they also read the processor's, the memory's and the motherboard's sensors. The admin mode's disclosure follows (`agent-admin-dialog/2`) |
---
@@ -29,4 +29,7 @@ public enum HookFamilies
/// <summary>The Streamline detour decodes DLSS 5's neural rendering (beta.34, D84).</summary>
SlNeuralRendering = 1 << 12,
/// <summary><c>slSetConstants</c> is hooked (0.1.0-beta.43) - only where Advanced metrics was ever asked for.</summary>
SlConstants = 1 << 13,
}
+6
View File
@@ -280,6 +280,12 @@ public enum FlHookFamily : uint
/// writer that looked for neural rendering is told from one built before it could (<see cref="FlFeatureFlags.SlNeuralRendering"/>).
/// </summary>
SlNeuralRendering = 1u << 12,
/// <summary>
/// <c>slSetConstants</c> is hooked (0.1.0-beta.43, Advanced metrics train B). Only in a process that was asked for
/// Advanced metrics at least once; it tells "hooked, never called" from "not hooked", and entitles no frame field.
/// </summary>
SlConstants = 1u << 13,
}
/// <summary>
@@ -277,12 +277,26 @@ enum class Collected : std::uint8_t {
// kProcessUnreadable -- so it is never a pass. ACCESS_DENIED (a protected process) is kFailed and is never retried.
// Every other consumer of Collected treats anything but kOk as a failure.
kRetry,
// EnumerateModules ONLY (owner decision D123, 2026-11-12): the module list CHANGED WHILE IT WAS READ -- a module
// that was in the list could not be named a moment later, because the process unloaded it, or was still loading
// it, between the two calls. Not a finding and not a protected process: a game at its launch loads and unloads
// modules for seconds. Until D123 this was kIncomplete and refused at once, which ended real sessions as a safety
// unhook with no frame recorded (five in the Agent's logs of one PC in a week: Phantom Blade Zero, Crown & Coin,
// Cyberpunk 2077). The module check reads the whole scan set again, up to kMaxUnsettledRereads times, each
// after kScanRetryPauseMs; a list that is still unsettled on the last read refuses as kModuleScanFailed -- so it
// is never a pass, and nothing that was not read whole is ever allowed. A list too long for the buffer stays
// kIncomplete and is not read again: a second read would be as long.
kUnsettled,
};
// How long the module check waits before its one re-read (D48). A process that was still loading has its modules
// How long the module check waits before a re-read (D48, D123). A process that was still loading has its modules
// well within it; one that has exited is out of the fresh snapshot.
inline constexpr std::uint32_t kScanRetryPauseMs = 250;
// How many times the module check reads the scan set again for a list that changed under the read (D123): three, so
// four reads in all and at most 750 ms of pauses. D48's re-read for a process still being created stays ONE.
inline constexpr std::uint32_t kMaxUnsettledRereads = 3;
// Callbacks receive (context, name) for each item found. Returning false stops
// enumeration early — used when a match has already been found.
using NameSink = bool (*)(void* ctx, const char* name);
@@ -391,9 +391,12 @@ Verdict LoadRules(const Sources& s, Rules& rules) noexcept {
// One pass of check 1 over a fresh scan set. `allowRetry` (D48): on the first pass a member that is still being
// created or already gone (Collected::kRetry) is noted in `retryWanted` and the pass goes on -- a finding in any other
// member still refuses at once; on the second pass the same answer refuses as kProcessUnreadable, exactly as an
// unreadable member always has. Anything but the four answers refuses too: no answer is a pass by omission.
// unreadable member always has. `allowUnsettled` (D123): the same for a member whose module list changed while it
// was read (Collected::kUnsettled), noted in `unsettledWanted`; when it is not allowed -- the last read -- the same
// answer refuses as kModuleScanFailed. Anything but the answers named refuses too: no answer is a pass by omission.
Verdict ScanModulesOnce(const Sources& s, const Rules& rules, std::uint32_t targetPid, const Tolerance* tolerance,
ToleratedFinding& finding, bool allowRetry, bool& retryWanted) noexcept {
ToleratedFinding& finding, bool allowRetry, bool& retryWanted, bool allowUnsettled,
bool& unsettledWanted) noexcept {
ScanSet set;
if (s.EnumerateScanSet(targetPid, &ScanSetSink, &set) != Collected::kOk || set.overflowed || set.count == 0) {
// An empty scan set is not "nothing to scan" — it is "we do not know
@@ -427,6 +430,16 @@ Verdict ScanModulesOnce(const Sources& s, const Rules& rules, std::uint32_t targ
if (c == Collected::kFailed || c == Collected::kRetry) {
return Refuse(Reason::kProcessUnreadable, nullptr, "a process in the scan set could not be read");
}
// D123: a list that changed under the read is read again from a fresh scan set -- AFTER the finding check
// above, so a blocklisted module among those that were read still refuses at once. The members read whole
// in this pass are read again too: the pass that allows is one in which every member was read whole.
if (c == Collected::kUnsettled) {
if (allowUnsettled) {
unsettledWanted = true;
continue;
}
return Refuse(Reason::kModuleScanFailed, nullptr, "a module list kept changing while it was read");
}
if (c != Collected::kOk) {
return Refuse(Reason::kModuleScanFailed, nullptr, "a module list came back incomplete");
}
@@ -464,24 +477,40 @@ Verdict ScanModulesOnce(const Sources& s, const Rules& rules, std::uint32_t targ
// whole. A member still unreadable then refuses as before; one that is gone is not in the new set; a target that is
// gone makes the new set unavailable, which refuses. The re-read can only turn a refusal of "could not read" into a
// full read -- never into a pass that skipped anything.
//
// D123 (owner decision, 2026-11-12): a member whose module list CHANGED WHILE IT WAS READ -- a game at its launch,
// loading and unloading -- refused the session the same way, and five real sessions on one PC ended as a safety
// unhook with no frame recorded. Such a list is read again the same way, up to kMaxUnsettledRereads times; one that
// has not settled by the last read refuses as kModuleScanFailed. D48's re-read stays ONE for the whole check: a
// member still being created on a second read refuses, whichever read first saw it. Every read is of the whole
// scan set, and the read that allows is one in which every member was read whole and none held a finding.
Verdict CheckModules(const Sources& s, const Rules& rules, std::uint32_t targetPid, const Tolerance* tolerance,
ToleratedFinding& finding) noexcept {
if (s.EnumerateScanSet == nullptr || s.EnumerateModules == nullptr) {
return Refuse(Reason::kProcessTreeUnavailable, nullptr, "no process source");
}
bool retryWanted = false;
const Verdict first = ScanModulesOnce(s, rules, targetPid, tolerance, finding, true, retryWanted);
if (!first.Allowed() || !retryWanted) {
return first;
bool retryUsed = false; // D48's one re-read, for the whole check
std::uint32_t unsettledRereads = 0; // D123's, up to kMaxUnsettledRereads
for (;;) {
bool retryWanted = false;
bool unsettledWanted = false;
const Verdict pass = ScanModulesOnce(s, rules, targetPid, tolerance, finding, !retryUsed, retryWanted,
unsettledRereads < kMaxUnsettledRereads, unsettledWanted);
// A refusal is final, and so is a pass in which every member was read whole. A `wanted` flag is only ever
// set where the pass was allowed to ask, so this cannot loop past either bound.
if (!pass.Allowed() || (!retryWanted && !unsettledWanted)) {
return pass;
}
retryUsed = retryUsed || retryWanted;
if (unsettledWanted) {
++unsettledRereads;
}
if (s.Pause != nullptr) {
s.Pause(kScanRetryPauseMs);
}
finding = ToleratedFinding{}; // collected again from the pass that decides
}
if (s.Pause != nullptr) {
s.Pause(kScanRetryPauseMs);
}
finding = ToleratedFinding{}; // collected again from the pass that decides
bool again = false;
return ScanModulesOnce(s, rules, targetPid, tolerance, finding, false, again);
}
// Check 2 — machine-wide drivers. Independent of process identity, which is
@@ -893,8 +922,10 @@ PresentationRuntime FindPresentationRuntime(const Sources& s, std::uint32_t pid)
}
RuntimeProbe p;
const Collected c = s.EnumerateModules(pid, &RuntimeSinkFn, &p);
if (c == Collected::kFailed || c == Collected::kRetry) {
return PresentationRuntime::kNone; // still in its loader, or unreadable -- the full scan refuses the latter
if (c == Collected::kFailed || c == Collected::kRetry || c == Collected::kUnsettled) {
// Still in its loader, a list that moved under the read (D123: half a list could miss vulkan-1.dll and send
// the Overlay into a Vulkan title), or unreadable -- the full scan refuses the last. The poll asks again.
return PresentationRuntime::kNone;
}
if (p.vk) {
return PresentationRuntime::kVulkan;
@@ -119,7 +119,11 @@ Collected EnumerateModulesImpl(std::uint32_t pid, ModuleSink sink, void* ctx) no
char name[MAX_PATH]{};
if (GetModuleBaseNameA(h, mods[i], name, MAX_PATH) == 0) {
CloseHandle(h);
return Collected::kIncomplete; // a module we could not name is one we could not check
// A module we could not name is one we could not check -- and it WAS in the list a moment ago, so the
// list moved under the read (unloaded, or its loader entry not yet whole). The module check reads the
// scan set again a bounded number of times and refuses if it never settles (D123); until then this was
// kIncomplete, an immediate refusal.
return Collected::kUnsettled;
}
// The load path, for §S22(b)'s ownership question. Failing to get it is
@@ -162,6 +162,22 @@ struct Accumulators {
std::atomic<uint64_t> ffxMemoryAliasableBytes{0u};
std::atomic<uint32_t> ffxMemoryQueries{0u};
std::atomic<uint32_t> ffxMemoryOwner{0u}; // leaf + 1 of the module whose answered queries are counted
// sl::Constants (0.1.0-beta.43), summarised - from the first viewport seen; the calls count every viewport
std::atomic<uint64_t> slViewport{0u}; // that viewport's id + 1; 0 = none yet
std::atomic<uint32_t> slConstantsCalls{0u};
std::atomic<uint32_t> slResets{0u};
std::atomic<uint32_t> slJitterMaxXBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slJitterMaxYBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slMvecScaleXBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slMvecScaleYBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slNearBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slFarBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slFovMinBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slFovMaxBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slAspectBits{FL_ADV_FLOAT_NONE};
std::atomic<uint32_t> slFlagsSeenTrue{0u};
std::atomic<uint32_t> slFlagsSeenFalse{0u};
};
// Whether `leaf` is the module whose calls a summary counts: the first one seen, and
@@ -307,6 +323,86 @@ inline void ObserveFfxMemoryQuery(uint32_t leaf, const ffxQueryDescHeader* desc,
}
}
// One sl::Boolean of sl::Constants into the two "seen" words: true sets its bit in `seenTrue`, false in `seenFalse`,
// the third state ("invalid": the game set nothing) in neither.
inline void NoteSlBoolean(sl::Boolean value, uint32_t bit, uint32_t& seenTrue, uint32_t& seenFalse) noexcept {
if (value == sl::Boolean::eTrue) {
seenTrue |= bit;
} else if (value == sl::Boolean::eFalse) {
seenFalse |= bit;
}
}
// What the game told Streamline about a frame (slSetConstants, 0.1.0-beta.43). The caller has matched the struct's
// GUID and found its version at least 1, on THIS call (fl_sl_inputs.h IsReadable): every member read below is one
// version 1 carries (17_HOOK_ENGINE "Which struct version carries which field").
//
// WHAT IS READ: the jitter, the motion-vector scale, the two depth planes, the field of view, the aspect ratio and
// the seven Booleans. WHAT IS NOT, EVER: the five matrices that precede them and the pinhole offset, the camera's
// position and its three axes that sit between the scale and the planes (rule 4). Nothing here names them, and
// tools/overlay-fields-check.ps1 fails the build if anything in the code loaded into a game does.
//
// THE SUMMARIES ARE THE FIRST VIEWPORT'S. A title with two viewports -- a scene and a picture-in-picture, a
// split screen -- sets constants for each every frame; "the last value seen" across them would flip twice a frame
// and a range would span two cameras. The first viewport that calls is the one summarised, for the life of the
// process. The call count is of every viewport: it says how often the game called.
//
// FLT_MAX IS "NOT SET" HERE (Streamline's INVALID_FLOAT) and is kept nowhere: the plane at infinity of D119 is
// FidelityFX's convention and stays on that route.
inline void ObserveSlConstants(const sl::Constants& k, uint32_t viewport, Accumulators& a) noexcept {
a.slConstantsCalls.fetch_add(1u, std::memory_order_relaxed);
const uint64_t me = static_cast<uint64_t>(viewport) + 1u;
uint64_t owner = a.slViewport.load(std::memory_order_relaxed);
if (owner == 0u && a.slViewport.compare_exchange_strong(owner, me, std::memory_order_relaxed)) {
owner = me;
}
if (owner != me) {
return;
}
if (Usable(k.jitterOffset.x) && Usable(k.jitterOffset.y)) {
KeepMax(a.slJitterMaxXBits, Magnitude(k.jitterOffset.x));
KeepMax(a.slJitterMaxYBits, Magnitude(k.jitterOffset.y));
}
if (Usable(k.mvecScale.x) && Usable(k.mvecScale.y)) {
a.slMvecScaleXBits.store(std::bit_cast<uint32_t>(k.mvecScale.x), std::memory_order_relaxed);
a.slMvecScaleYBits.store(std::bit_cast<uint32_t>(k.mvecScale.y), std::memory_order_relaxed);
}
if (Usable(k.cameraNear)) {
a.slNearBits.store(std::bit_cast<uint32_t>(k.cameraNear), std::memory_order_relaxed);
}
if (Usable(k.cameraFar)) {
a.slFarBits.store(std::bit_cast<uint32_t>(k.cameraFar), std::memory_order_relaxed);
}
// A range, lowest to highest, never a series (D114).
if (Usable(k.cameraFOV) && k.cameraFOV > 0.0f) {
KeepMin(a.slFovMinBits, k.cameraFOV);
KeepMax(a.slFovMaxBits, k.cameraFOV);
}
if (Usable(k.cameraAspectRatio) && k.cameraAspectRatio > 0.0f) {
a.slAspectBits.store(std::bit_cast<uint32_t>(k.cameraAspectRatio), std::memory_order_relaxed);
}
// One bit per Boolean, in the header's order (FlAdvancedState::slFlagsSeenTrue).
uint32_t seenTrue = 0u;
uint32_t seenFalse = 0u;
NoteSlBoolean(k.depthInverted, 1u << 0, seenTrue, seenFalse);
NoteSlBoolean(k.cameraMotionIncluded, 1u << 1, seenTrue, seenFalse);
NoteSlBoolean(k.motionVectors3D, 1u << 2, seenTrue, seenFalse);
NoteSlBoolean(k.reset, 1u << 3, seenTrue, seenFalse);
NoteSlBoolean(k.orthographicProjection, 1u << 4, seenTrue, seenFalse);
NoteSlBoolean(k.motionVectorsDilated, 1u << 5, seenTrue, seenFalse);
NoteSlBoolean(k.motionVectorsJittered, 1u << 6, seenTrue, seenFalse);
NoteBits(a.slFlagsSeenTrue, seenTrue);
NoteBits(a.slFlagsSeenFalse, seenFalse);
if ((seenTrue & (1u << 3)) != 0u) {
a.slResets.fetch_add(1u, std::memory_order_relaxed);
}
NoteBits(a.validMask, FL_ADV_VALID_SL_CONSTANTS);
}
// A NEW REQUEST: the summaries start afresh, so a session's ranges, masks and
// counts are its own and not those of the session before it in the same game.
// THE WATCHDOG'S. A detour running beside it loses nothing that matters: what it
@@ -343,6 +439,20 @@ inline void Reset(Accumulators& a) noexcept {
a.ffxMemoryTotalBytes.store(0u, relaxed);
a.ffxMemoryAliasableBytes.store(0u, relaxed);
a.ffxMemoryQueries.store(0u, relaxed);
// Which viewport is summarised stays, as the two owners do: a fact about the process.
a.slConstantsCalls.store(0u, relaxed);
a.slResets.store(0u, relaxed);
a.slJitterMaxXBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slJitterMaxYBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slMvecScaleXBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slMvecScaleYBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slNearBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slFarBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slFovMinBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slFovMaxBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slAspectBits.store(FL_ADV_FLOAT_NONE, relaxed);
a.slFlagsSeenTrue.store(0u, relaxed);
a.slFlagsSeenFalse.store(0u, relaxed);
}
// Copies the accumulators into region 5, under the request they answer. THE
@@ -410,6 +520,20 @@ inline void Publish(Accumulators& a, FlAdvancedState* region, uint32_t request,
put64(region->ffxMemoryAliasableBytes, a.ffxMemoryAliasableBytes.load(relaxed));
put32(region->ffxMemoryQueries, a.ffxMemoryQueries.load(relaxed));
put32(region->slConstantsCalls, a.slConstantsCalls.load(relaxed));
put32(region->slResets, a.slResets.load(relaxed));
put32(region->slJitterMaxXBits, a.slJitterMaxXBits.load(relaxed));
put32(region->slJitterMaxYBits, a.slJitterMaxYBits.load(relaxed));
put32(region->slMvecScaleXBits, a.slMvecScaleXBits.load(relaxed));
put32(region->slMvecScaleYBits, a.slMvecScaleYBits.load(relaxed));
put32(region->slNearBits, a.slNearBits.load(relaxed));
put32(region->slFarBits, a.slFarBits.load(relaxed));
put32(region->slFovMinBits, a.slFovMinBits.load(relaxed));
put32(region->slFovMaxBits, a.slFovMaxBits.load(relaxed));
put32(region->slAspectBits, a.slAspectBits.load(relaxed));
put32(region->slFlagsSeenTrue, a.slFlagsSeenTrue.load(relaxed));
put32(region->slFlagsSeenFalse, a.slFlagsSeenFalse.load(relaxed));
std::atomic_ref<uint32_t> samples{region->samples};
samples.store(samples.load(relaxed) + 1u, relaxed);
seq.store(odd + 1u, std::memory_order_release);
@@ -124,7 +124,7 @@ inline constexpr uint32_t kFamiliesEvaluateFeatureDoesNotImplement =
static_cast<uint32_t>(fl::FL_HOOK_RT_AS_BUILD) | static_cast<uint32_t>(fl::FL_HOOK_RT_PSO) |
static_cast<uint32_t>(fl::FL_HOOK_PSO) | static_cast<uint32_t>(fl::FL_HOOK_COLOR_SPACE) |
static_cast<uint32_t>(fl::FL_HOOK_REFLEX) | static_cast<uint32_t>(fl::FL_HOOK_VRAM) |
static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_QUALITY);
static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_QUALITY) | static_cast<uint32_t>(fl::FL_HOOK_SL_CONSTANTS);
static_assert((kFamilyEvaluateFeature & kFamiliesEvaluateFeatureDoesNotImplement) == 0u,
"the slEvaluateFeature row claims a family its detour does not implement -- hookinventory-check "
@@ -183,6 +183,13 @@ static_assert((kFamilyEvaluateFeature & static_cast<uint32_t>(fl::FL_HOOK_FG_EVA
// prints against each other (frames/upscale-drained) and the K = 1 control in the
// fixtures are what would show a loader that re-entered a leaf's export: 2x on both.
//
// AND MEASURED A THIRD TIME, 2026-11-12, WITH A THIRD ANSWER: Cyberpunk 2077's loader 2.3.0 DOES hand a dispatch
// on to the leaf's export -- its frame-generation dispatch types are logged on the loader and on the
// frame-generation leaf. So "the leaves stay silent behind the loader" is a fact about the loader of September's
// three titles (1.0.2), not about loaders. The rows stand as they are -- whatever module the game calls -- and
// what a dispatch seen twice may count is decided where it is counted: PREPARE by its frame number, an UPSCALE at
// the first source that saw one (dllmain.cpp g_ffxUpscaleOwner, owner decision D125).
//
// The effect-DLL split is NOT a guess about the vendor's internals: the FidelityFX
// SDK's own getting-started text says the loader "only manages the loading of
// effect type DLLs" and is "interface- and behavior-compatible with
@@ -200,7 +207,8 @@ inline constexpr uint32_t kFamiliesFfxDispatchDoesNotImplement =
static_cast<uint32_t>(fl::FL_HOOK_RT_AS_BUILD) | static_cast<uint32_t>(fl::FL_HOOK_RT_PSO) |
static_cast<uint32_t>(fl::FL_HOOK_PSO) | static_cast<uint32_t>(fl::FL_HOOK_COLOR_SPACE) |
static_cast<uint32_t>(fl::FL_HOOK_REFLEX) | static_cast<uint32_t>(fl::FL_HOOK_VRAM) |
static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_QUALITY) | static_cast<uint32_t>(fl::FL_HOOK_SL_NEURAL_RENDERING);
static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_QUALITY) | static_cast<uint32_t>(fl::FL_HOOK_SL_NEURAL_RENDERING) |
static_cast<uint32_t>(fl::FL_HOOK_SL_CONSTANTS);
static_assert((kFamilyFfxDispatch & kFamiliesFfxDispatchDoesNotImplement) == 0u,
"the ffxDispatch rows claim a family their detour does not implement -- hookinventory-check reads "
@@ -271,6 +279,29 @@ static_assert(kFamilyFfxQuery != kFamilyFfxDispatch && kFamilyFfxQuery != kFamil
static_assert((kFamilyFfxDispatch & kFamilyFfxQuery) == 0u,
"the dispatch rows must not claim the query's bit: they do not hook ffxQuery");
// --- Streamline: slSetConstants (0.1.0-beta.43, Advanced metrics train B, owner decisions D111-D116) ---
//
// WHAT THE GAME TELLS STREAMLINE ABOUT A FRAME, once per frame and viewport: the jitter, the motion-vector scale,
// the depth range, the field of view, the aspect ratio and seven Booleans -- beside five matrices and the camera's
// position and axes, WHICH ARE NEVER READ (rule 4; tools/overlay-fields-check.ps1 refuses their names anywhere in
// the code loaded into a game). One exporter, sl.interposer.dll, like the other Streamline rows.
//
// THE ONE ROW THAT IS NOT INSTALLED UNLESS ASKED FOR. Every other row is patched when its module appears; this one
// only in a process the Agent has asked for Advanced metrics at least once (D111: with the option off, nothing more
// is read -- and nothing more is patched). dllmain's installer checks that BEFORE it resolves the symbol, because
// resolving takes a reference on the module. Once in, the patch stays for the life of the process and the detour
// forwards without looking while the request is off.
//
// ITS OWN BIT. It entitles no measured field of a frame record; the bit says the hook is in, so that a session can
// tell "hooked, and the game never called it" from "not hooked".
inline constexpr uint32_t kFamilySlConstants = static_cast<uint32_t>(fl::FL_HOOK_SL_CONSTANTS);
static_assert(kFamilySlConstants != kFamilyEvaluateFeature && kFamilySlConstants != kFamilyFfxDispatch &&
kFamilySlConstants != kFamilyFfxQuery &&
kFamilySlConstants != static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_PARAMS) &&
kFamilySlConstants != static_cast<uint32_t>(fl::FL_HOOK_FG_EVALUATIONS),
"InstallByFamily binds a row by EQUALITY on this value -- a collision would hand slSetConstants' "
"detour to another export, or another's to it");
// The leaves, in the order dllmain's per-leaf trampoline and latch arrays are indexed.
enum FfxLeaf : uint32_t {
kFfxLeafMonolith = 0, // amd_fidelityfx_dx12.dll -- SDK 1.1.x, FSR 3.1 only
@@ -366,6 +397,7 @@ inline int FfxLeafOf(const wchar_t* moduleName) noexcept {
X(L"sl.interposer.dll", "slSetTag", fl::FL_HOOK_UPSCALER_PARAMS) \
X(L"sl.interposer.dll", "slSetTagForFrame", fl::FL_HOOK_UPSCALER_PARAMS) \
X(L"sl.interposer.dll", "slGetNewFrameToken", fl::FL_HOOK_FG_EVALUATIONS) \
X(L"sl.interposer.dll", "slSetConstants", fl::inventory::kFamilySlConstants) \
X(L"amd_fidelityfx_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
X(L"amd_fidelityfx_upscaler_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
X(L"amd_fidelityfx_framegeneration_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
@@ -381,7 +413,7 @@ inline int FfxLeafOf(const wchar_t* moduleName) noexcept {
#define FL_COUNT_ROW(mod, sym, family) +1u
inline constexpr uint32_t kRowCount = 0u FL_HOOK_INVENTORY(FL_COUNT_ROW);
#undef FL_COUNT_ROW
static_assert(kRowCount == 13u, "a row was added or removed: say so here, and in 17_HOOK_ENGINE §Hook inventory");
static_assert(kRowCount == 14u, "a row was added or removed: say so here, and in 17_HOOK_ENGINE §Hook inventory");
// A row's "module!symbol", for the native log, built at compile time from the row's own two spellings -- so an
// install line names the module it patched, and no second list of names exists to drift from the table
+68 -5
View File
@@ -1166,7 +1166,13 @@ std::atomic<uint32_t> g_slSetTagForFramePatched{0};
using PFN_SlGetNewFrameToken = ::PFun_slGetNewFrameToken*;
PFN_SlGetNewFrameToken g_origSlGetNewFrameToken = nullptr;
std::atomic<uint32_t> g_frameTokensLive{0};
std::atomic<uint32_t> g_frameTokens{0};
// slSetConstants (0.1.0-beta.43, Advanced metrics): patched only in a process that was asked for Advanced metrics at
// least once (InstallByFamily), and its detour forwards without looking while the request is off.
using PFN_SlSetConstants = ::PFun_slSetConstants*;
PFN_SlSetConstants g_origSlSetConstants = nullptr;
std::atomic<uint32_t> g_slConstantsLive{0};
std::atomic<uint32_t> g_frameTokens{0};
// The HIGHEST frame index seen so far, tagged in bit 32 so that index 0 is
// distinct from "no frame yet". Measured 2026-09-03 on Cyberpunk 2077
// (20_OPEN_QUESTIONS §S31, row P4): the title asks for a token 3 to 4.6 times per
@@ -1256,6 +1262,23 @@ std::atomic<uint64_t> g_ffxExtent{0};
// not say which -- so the same UPSCALE type decodes to FL_UPSCALER_FSR3 from one leaf
// and to FL_UPSCALER_FSR_UNVERSIONED from the other (fl_shm.h says why).
std::atomic<uint32_t> g_ffxUpscaleLeaf{0};
// WHICH SOURCE'S UPSCALES ARE COUNTED (owner decision D125, 2026-11-12): the first one that saw an UPSCALE, and from
// then on only it -- leaf + 1 for an ffx-api module, kFfxUpscaleSourceFsr3Host for the 3.0 host; fl::adv::Owns' slot.
//
// WHY. A loader that hands a dispatch on to the leaf's EXPORT delivers one UPSCALE to two hooked modules, and the
// count below was one per module that saw it. Measured on Cyberpunk 2077's loader 2.3.0 for the frame-generation
// dispatches (logged on the loader AND the leaf); the loader of the three titles of 2026-09-04 leaves the leaf
// exports silent, which is why the rows were written without this. With frame generation off no PREPARE arrives, the
// application-frame count falls back to this one, and K = 1 would read 2.0: Native FPS doubled and the factor halved,
// which rule 6 forbids in either direction. No title run so far upscales through such a loader -- this is a
// precaution, held by the fixture's loader bound through the exports.
//
// THE FIRST SOURCE, AND NOT THE OUTERMOST CALL ON THE STACK: knowing that a detour runs inside another's original
// would take state carried across the call to the original, which every detour here makes exactly once and outside
// its guard. The game's entry is the first to see a dispatch, so the first source IS the entry. What it gives up is
// said in LIMITATIONS: a process whose UPSCALEs come from two unrelated sources is counted from the first alone.
// The render size and the quality byte are NOT gated -- the same call writes the same values twice.
std::atomic<uint32_t> g_ffxUpscaleOwner{0};
using PFN_FfxDispatch = ::PfnFfxDispatch;
PFN_FfxDispatch g_origFfxDispatch[fl::inventory::kFfxLeafCount] = {};
@@ -1707,6 +1730,26 @@ sl::Result STDMETHODCALLTYPE Hook_SlSetTag(const sl::ViewportHandle& viewport, c
return g_origSlSetTag(viewport, tags, numTags, cmdBuffer);
}
// What the game tells Streamline about a frame (0.1.0-beta.43). THREE CONDITIONS BEFORE ANYTHING IS READ, in the
// order that costs least: the Agent is asking for Advanced metrics; observing has not stopped (after a stop nobody
// clears the request word, so the first test alone would keep reading); and the struct is the one these headers
// describe -- its GUID and a version of at least 1, checked on THIS call, because the game owns the struct and a
// Streamline generation that lays it out differently keeps the export's name. The struct is read in
// fl_adv_fields.h, which never touches its matrices or the camera's position and axes (rule 4). The viewport's id
// is the handle's own conversion to an integer, taken only from a handle that is one (the same GUID check).
sl::Result STDMETHODCALLTYPE Hook_SlSetConstants(const sl::Constants& values, const sl::FrameToken& frame,
const sl::ViewportHandle& viewport) {
FL_HOOK_GUARD({
if (g_advancedRequested.load(std::memory_order_relaxed) != 0u && MayObserve() &&
fl::slinputs::IsReadable<sl::Constants>(&values) &&
fl::slinputs::IsReadable<sl::ViewportHandle>(&viewport)) {
fl::adv::ObserveSlConstants(values, static_cast<uint32_t>(viewport), g_adv);
}
})
// ALWAYS exactly once, on every path including the fault path, with every argument forwarded untouched.
return g_origSlSetConstants(values, frame, viewport);
}
// slSetTagForFrame: the FrameToken first, then the same list slSetTag takes. The
// token is not read -- the frame count comes from slGetNewFrameToken -- and the tag
// list is handed to the same NoteTags, because a per-frame tag and a viewport tag
@@ -2014,8 +2057,12 @@ void ObserveFfxDispatch(uint32_t leaf, const ffxDispatchDescHeader* desc) noexce
g_ffxQuality.store(
FfxQualityOf(up->renderSize.width, up->renderSize.height, up->upscaleSize.width, up->upscaleSize.height),
std::memory_order_release);
g_ffxUpscaleLeaf.store(leaf + 1u, std::memory_order_relaxed);
g_ffxSeen.fetch_add(fl::slseen::kCountOne, std::memory_order_relaxed);
// Counted once, at the first source that saw an UPSCALE (D125): a loader that forwards to the leaf's export
// brings the same dispatch here twice.
if (fl::adv::Owns(g_ffxUpscaleOwner, leaf)) {
g_ffxUpscaleLeaf.store(leaf + 1u, std::memory_order_relaxed);
g_ffxSeen.fetch_add(fl::slseen::kCountOne, std::memory_order_relaxed);
}
// The rest of the same descriptor (sharpening, jitter, exposure, the depth range, the field of view, flags,
// the frame time) - Advanced metrics, only while the Agent asked (D111). Not on the FSR 3.0 host's route:
// its legacy descriptor is vouched for through renderSize and no further (17_HOOK_ENGINE §Which struct
@@ -2080,8 +2127,11 @@ fsr3host::FfxErrorCode Hook_FfxFsr3ContextDispatchUpscale(fsr3host::FfxFsr3Conte
FL_HOOK_GUARD({
if (MayObserve() && desc != nullptr) {
NoteFfxExtent(desc->renderSize.width, desc->renderSize.height);
g_ffxUpscaleLeaf.store(kFfxUpscaleSourceFsr3Host, std::memory_order_relaxed);
g_ffxSeen.fetch_add(fl::slseen::kCountOne, std::memory_order_relaxed);
// The host is a source like the four leaves (D125): Owns' slot value for it is its leaf index + 1.
if (fl::adv::Owns(g_ffxUpscaleOwner, kFfxUpscaleSourceFsr3Host - 1u)) {
g_ffxUpscaleLeaf.store(kFfxUpscaleSourceFsr3Host, std::memory_order_relaxed);
g_ffxSeen.fetch_add(fl::slseen::kCountOne, std::memory_order_relaxed);
}
}
})
return g_origFfxFsr3DispatchUpscale(context, desc);
@@ -2402,6 +2452,19 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
// bit test would bind any future row that happens to include identity to THIS
// detour -- which is the neighbour's-body defect this function exists to stop,
// and it would arrive silently because the row would still install.
//
// THE ROWS THAT ARE INSTALLED ONLY WHERE ADVANCED METRICS WAS EVER ASKED FOR (owner decision D111), FIRST -- before
// anything is resolved, because ResolveScoped takes a reference on the module at every call: in a process never
// asked, these rows must change nothing, not even a reference count. g_advancedSeen is the watchdog's, and this
// runs on the watchdog, after the block that sets it. Once the patch is in it stays; the detour forwards without
// looking while the request is off.
if (family == fl::inventory::kFamilySlConstants) {
if (g_advancedSeen == 0u) {
return false;
}
return InstallRow(moduleName, symbol, family, reinterpret_cast<void*>(&Hook_SlSetConstants),
reinterpret_cast<void**>(&g_origSlSetConstants), g_slConstantsLive, name);
}
if (family == fl::inventory::kFamilyEvaluateFeature) {
return InstallRow(moduleName, symbol, family, reinterpret_cast<void*>(&Hook_SlEvaluateFeature),
reinterpret_cast<void**>(&g_origSlEvaluateFeature), g_upscalerIdentityLive, name);
@@ -405,6 +405,11 @@ enum FlHookFamily : uint32_t {
// FL_FEAT_RAY_RECONSTRUCTION_OBSERVED and never bit 7, and without this family its silence would read as a
// measured "not running" -- a fabricated negative of the kind 03_METRICS §RT/PT/RR forbids for ray reconstruction.
FL_HOOK_SL_NEURAL_RENDERING = 1u << 12,
// Advanced metrics, train B's second step (0.1.0-beta.43): slSetConstants is hooked. Published only in a process
// that was asked for Advanced metrics at least once -- the patch is not made otherwise (owner decision D111) --
// so its absence beside FL_ADV_VALID_* bits says "the hook was not installed", and its presence beside a zero
// slConstantsCalls says "hooked, and the game never called it". It entitles no measured field of a frame record.
FL_HOOK_SL_CONSTANTS = 1u << 13,
};
// FlWriterState::runtimeCensus -- which vendor RUNTIME MODULES the loader reported
+340 -17
View File
@@ -1025,6 +1025,134 @@ TEST_CASE("D48 — a scan-set member still loading, or gone, is read again once"
}
}
// ===========================================================================
// D123 (owner decision, 2026-11-12) — a module list that CHANGED WHILE IT WAS READ
// is read again, a bounded number of times, and a list that never settles refuses.
//
// What it is for: a game at its launch loads and unloads modules for seconds. A
// module that was in the list and could not be named a moment later made the
// whole check "incomplete", and the session ended as a safety unhook with no
// frame recorded -- five times in a week in one PC's Agent logs (Phantom Blade
// Zero, Crown & Coin, Cyberpunk 2077). What it must never do is the same as
// D48: pass anything that was not read whole.
// ===========================================================================
TEST_CASE("D123 — a module list that changed under the read is read again, at most three times",
"[guard][failclosed][D123]") {
ResetFake();
g.scanSet = {1234, 1000, 4000}; // the target, its launcher, a child
SECTION("the target's list settles on the second read: one pause, two snapshots, allowed") {
g.moduleResultsInTurn[1234] = {Collected::kUnsettled, Collected::kOk};
CHECK(EvaluateWithSources(1234, FakeSources()).Allowed());
CHECK(g.pauses == 1);
CHECK(g.lastPauseMs == kScanRetryPauseMs);
CHECK(g.scanSetCalls == 2);
CHECK(g.moduleCallsByPid[1000] == 2); // the members that read whole are read again too
}
SECTION("it settles on the fourth read: three pauses, four snapshots, allowed") {
g.moduleResultsInTurn[1234] = {Collected::kUnsettled, Collected::kUnsettled, Collected::kUnsettled,
Collected::kOk};
CHECK(EvaluateWithSources(1234, FakeSources()).Allowed());
CHECK(g.pauses == 3);
CHECK(g.scanSetCalls == 4);
}
SECTION("a list that never settles refuses -- after four reads and not one more") {
g.moduleResultsInTurn[1234] = {Collected::kUnsettled}; // the last answer repeats
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kModuleScanFailed);
CHECK(std::string(v.signal) == "a module list kept changing while it was read");
CHECK(g.pauses == static_cast<int>(kMaxUnsettledRereads));
CHECK(g.scanSetCalls == static_cast<int>(kMaxUnsettledRereads) + 1);
CHECK(g.moduleCallsByPid[1234] == static_cast<int>(kMaxUnsettledRereads) + 1);
}
SECTION("a list too long for the buffer is not read again: it would be as long") {
g.moduleResultByPid[4000] = Collected::kIncomplete;
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kModuleScanFailed);
CHECK(std::string(v.signal) == "a module list came back incomplete");
CHECK(g.pauses == 0);
CHECK(g.scanSetCalls == 1);
}
SECTION("a finding among the modules that WERE read refuses at once, with no pause") {
// The half-read list held a blocklisted module: the re-read is for what could not be read, never a second
// chance for what was.
g.moduleResultsInTurn[4000] = {Collected::kUnsettled, Collected::kOk};
g.modulesByPid[4000] = {"kernel32.dll", "EasyAntiCheat_EOS.dll"};
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kBlockedModule);
CHECK(g.pauses == 0);
CHECK(g.scanSetCalls == 1);
}
SECTION("a finding in another member refuses at once, with no pause") {
g.moduleResultsInTurn[4000] = {Collected::kUnsettled, Collected::kOk};
g.modulesByPid[1000] = {"EasyAntiCheat_EOS.dll"};
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kBlockedModule);
CHECK(g.pauses == 0);
}
SECTION("a finding the re-read sees refuses") {
g.moduleResultsInTurn[4000] = {Collected::kUnsettled, Collected::kOk};
g.modulesByPid[1234] = {"kernel32.dll"};
g.modulesByPid[1000] = {"kernel32.dll"};
g.modulesLate = {"EasyAntiCheat_EOS.dll"};
g.moduleCallsBeforeLate = 3; // the first read's three; the module is there on the re-read
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kBlockedModule);
CHECK(g.pauses == 1);
}
SECTION("a protected process met on a re-read refuses as unreadable: the re-read excuses nothing else") {
g.moduleResultsInTurn[1234] = {Collected::kUnsettled, Collected::kOk};
g.moduleResultsInTurn[4000] = {Collected::kOk, Collected::kFailed};
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kProcessUnreadable);
CHECK(g.pauses == 1);
}
SECTION("D48's re-read stays ONE, whichever read first met the member still being created") {
// The target's list is unsettled on reads 1 and 2; a child is still being created on reads 2 and 3. Its first
// kRetry is excused -- D48 -- and its second refuses, though the unsettled list would have allowed a fourth
// read.
g.moduleResultsInTurn[1234] = {Collected::kUnsettled, Collected::kUnsettled, Collected::kOk};
g.moduleResultsInTurn[4000] = {Collected::kOk, Collected::kRetry, Collected::kRetry};
const Verdict v = EvaluateWithSources(1234, FakeSources());
REQUIRE_FALSE(v.Allowed());
CHECK(v.reason == Reason::kProcessUnreadable);
CHECK(g.pauses == 2);
CHECK(g.scanSetCalls == 3);
}
SECTION("...and the two together still end in a read of everything, whole") {
g.moduleResultsInTurn[1234] = {Collected::kUnsettled, Collected::kOk};
g.moduleResultsInTurn[4000] = {Collected::kRetry, Collected::kOk};
CHECK(EvaluateWithSources(1234, FakeSources()).Allowed());
CHECK(g.pauses == 1);
CHECK(g.scanSetCalls == 2);
}
}
TEST_CASE("D48 — the real module source answers kRetry for a process still loading and for one that is gone",
"[guard][D48][live]") {
const Sources s = SystemSources();
@@ -2921,6 +3049,40 @@ TEST_CASE("region 4 describes a swap chain on a real window: its window, its bac
CHECK(r.st->faultCount == 0u);
}
TEST_CASE("D123 — the real module source says a churning list is unsettled, never too long and never unreadable",
"[guard][D123][live]") {
// A process that loads and frees one module as fast as it can: a list that changes under every read. The real
// source may read it whole (kOk) or meet a module it can no longer name (kUnsettled); what it must not say is
// kIncomplete -- which is not read again -- or kFailed. How often it is unsettled is the machine's to decide, so
// the count is reported and not asserted: on the PC this was written on, about one read in four.
Child child;
REQUIRE(StartHarness(child, std::wstring(L"--churn-module \"") + FL_STUB_SL_COMMON + L"\" --hold 30"));
const Sources s = SystemSources();
REQUIRE(s.EnumerateModules != nullptr);
auto none = [](void*, const char*, const wchar_t*) noexcept -> bool { return true; };
int ok = 0;
int unsettled = 0;
int other = 0;
const ULONGLONG until = GetTickCount64() + 3000;
while (GetTickCount64() < until) {
// An if-chain, not a switch: the two answers are named and every other one is "other" on purpose.
const Collected c = s.EnumerateModules(child.pi.dwProcessId, none, nullptr);
if (c == Collected::kOk) {
++ok;
} else if (c == Collected::kUnsettled) {
++unsettled;
} else {
++other;
}
}
WARN("a churning module list, read " << (ok + unsettled + other) << " times in 3 s: " << ok << " whole, "
<< unsettled << " unsettled, " << other << " other");
CHECK(ok > 0);
CHECK(other == 0);
}
TEST_CASE("the native log: written at init, on the Agent's request, and on the stop -- and the stop restores each "
"patch by compare-and-restore",
"[guard][inject][shm][log]") {
@@ -3816,7 +3978,7 @@ TEST_CASE("an isolation seam that cannot answer refuses, and so does a guard wir
REQUIRE(StartHarness(child));
// Every fact clear beside a failed result: the result is what is honoured, never the facts next to it.
for (const Collected bad : {Collected::kFailed, Collected::kIncomplete, Collected::kRetry}) {
for (const Collected bad : {Collected::kFailed, Collected::kIncomplete, Collected::kRetry, Collected::kUnsettled}) {
ResetFake();
g.modules = {"kernel32.dll"};
g.scanSet = {child.pi.dwProcessId};
@@ -5926,6 +6088,26 @@ TEST_CASE("FSR through the SDK 2.x loader: identified, extent exact, the count t
}
}
TEST_CASE("a loader that hands a dispatch on to the leaf's export (D125): an UPSCALE is counted once, at the module "
"the game called",
"[guard][inject][shm][ffx]") {
// MEASURED ON CYBERPUNK 2077, 2026-11-12: its loader 2.3.0 forwards a dispatch to the leaf's EXPORT -- each
// frame-generation dispatch type was logged on the loader and on the frame-generation leaf -- where the loader of
// September's three titles left the leaf exports silent. With all four modules hooked an UPSCALE through such a
// loader arrives twice, and the count that stands in for application frames when no PREPARE is issued (frame
// generation off) was one per hooked module that saw it: K = 1 read 2.0. No title run so far upscales this way;
// the stub loader bound through the exports is how the rule is held. Frame generation ON is the second half:
// PREPARE is counted by its frame number and must read the same through either loader.
for (const int k : {1, 4}) {
CAPTURE(k);
FfxObservation obs;
REQUIRE(ObserveFfx(k, L"2x-export", /*prepare=*/k > 1, fl::FL_UPSCALER_FSR_UNVERSIONED, obs));
AssertFfxWindow(obs, k);
CHECK((obs.census & fl::FL_CENSUS_AMD_FFX_UPSCALER) != 0u);
CHECK((obs.census & fl::FL_CENSUS_AMD_FFX_FRAMEGENERATION) != 0u);
}
}
TEST_CASE("the SDK 1.1.x monolith is FSR3; with no PREPARE the count falls back to UPSCALE dispatches",
"[guard][inject][shm][ffx]") {
// TWO SHAPES A 1.1.x TITLE ACTUALLY HAS. Frame generation OFF: no PREPARE is ever
@@ -5988,7 +6170,7 @@ TEST_CASE("the FSR 3.0 host facade: Fsr3 identity and the count from its upscale
namespace {
// Whether the log has a line of this code whose text starts with `name` and which ends in `tail`.
bool LogHasLine(const std::string& text, const char* code, const char* name, const char* tail) {
bool LogHasLine(const std::string& text, const char* code, const std::string& name, const std::string& tail) {
const std::string head = std::string("s ") + code + " ";
std::size_t at = 0;
while (at < text.size()) {
@@ -6003,9 +6185,9 @@ bool LogHasLine(const std::string& text, const char* code, const char* name, con
while (n < line.size() && line[n] == ' ') {
++n;
}
const std::string tailText = tail;
if (line.compare(n, std::strlen(name), name) == 0 && line.size() >= tailText.size() &&
line.compare(line.size() - tailText.size(), tailText.size(), tailText) == 0) {
// The lengths are the strings' own (SonarCloud's cpp:S5813 was a strlen here).
if (line.compare(n, name.size(), name) == 0 && line.size() >= tail.size() &&
line.compare(line.size() - tail.size(), tail.size(), tail) == 0) {
return true;
}
}
@@ -6777,6 +6959,16 @@ constexpr float kAdvFfxFar = 1000.0f;
constexpr float kAdvFfxFovLow = 0.9f;
constexpr float kAdvFfxFovHigh = 1.1f;
constexpr uint32_t kAdvFfxFrameTimeUs = 16000u;
// ...and hands slSetConstants for viewport 0 (0.1.0-beta.43); a second viewport gets other numbers every frame.
constexpr float kAdvSlJitterX = 0.3125f;
constexpr float kAdvSlJitterY = 0.4375f;
constexpr float kAdvSlMvecScaleX = 0.5f;
constexpr float kAdvSlMvecScaleY = 0.25f;
constexpr float kAdvSlNear = 0.25f;
constexpr float kAdvSlFar = 4000.0f;
constexpr float kAdvSlFovLow = 0.8f;
constexpr float kAdvSlFovHigh = 1.2f;
constexpr float kAdvSlAspect = 1.75f;
constexpr uint64_t kAdvMemoryTotal = 123456789ull;
constexpr uint64_t kAdvMemoryAliasable = 23456789ull;
@@ -6835,16 +7027,63 @@ uint32_t BitsOf(float v) {
return std::bit_cast<uint32_t>(v);
}
// What 0.1.0-beta.43 and beta.44 fill (beta.41 and beta.42 until D118 and D122): declared, written by nothing yet.
// What later releases fill: declared, written by nothing yet. (The sl::Constants group left this list with
// 0.1.0-beta.43, which fills it; SlConstantsAreUnread below is for a target that never calls slSetConstants.)
bool LaterGroupsAreZero(const fl::FlAdvancedState& a) {
bool zero = a.ffxFgConfigures == 0u && a.ffxFgEnabledSeen == 0u && a.ffxFgFlagsSeen == 0u &&
a.slConstantsCalls == 0u && a.slResets == 0u && a.slFlagsSeenTrue == 0u && a.slFlagsSeenFalse == 0u;
bool zero = a.ffxFgConfigures == 0u && a.ffxFgEnabledSeen == 0u && a.ffxFgFlagsSeen == 0u;
for (uint32_t i = 0; i < FL_ADV_FEATURE_SLOTS * FL_ADV_FEATURE_WORDS; ++i) {
zero = zero && a.features[i] == 0u;
}
return zero;
}
bool SlConstantsAreUnread(const fl::FlAdvancedState& a) {
return a.slConstantsCalls == 0u && a.slResets == 0u && a.slFlagsSeenTrue == 0u && a.slFlagsSeenFalse == 0u &&
(a.validMask & fl::FL_ADV_VALID_SL_CONSTANTS) == 0u;
}
// The first 16 bytes of one export of a module AS THEY ARE IN ANOTHER PROCESS: the export's offset from this
// process's own mapping of the same file (mapped as an image, nothing run), the module's base from the target's
// module list. What a patch changes, and what a restore puts back.
bool ReadTargetExportBytes(DWORD pid, const wchar_t* dllPath, const char* symbol, unsigned char out[16]) {
const HMODULE mine = LoadLibraryExW(dllPath, nullptr, DONT_RESOLVE_DLL_REFERENCES);
if (mine == nullptr) {
return false;
}
const auto* entry = reinterpret_cast<const unsigned char*>(GetProcAddress(mine, symbol));
const size_t rva =
entry != nullptr ? static_cast<size_t>(entry - reinterpret_cast<const unsigned char*>(mine)) : 0u;
FreeLibrary(mine);
const wchar_t* slash = wcsrchr(dllPath, L'\\');
const wchar_t* slash2 = wcsrchr(dllPath, L'/');
const wchar_t* leaf = slash != nullptr && (slash2 == nullptr || slash > slash2) ? slash + 1
: slash2 != nullptr ? slash2 + 1
: dllPath;
if (rva == 0u) {
return false;
}
HANDLE h = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ, FALSE, pid);
if (h == nullptr) {
return false;
}
HMODULE mods[1024]{};
DWORD needed = 0;
bool read = false;
if (EnumProcessModulesEx(h, mods, sizeof(mods), &needed, LIST_MODULES_ALL)) {
const size_t n = (needed > sizeof(mods) ? sizeof(mods) : needed) / sizeof(HMODULE);
for (size_t i = 0; i < n && !read; ++i) {
wchar_t name[MAX_PATH]{};
if (GetModuleBaseNameW(h, mods[i], name, MAX_PATH) != 0 && _wcsicmp(name, leaf) == 0) {
SIZE_T got = 0;
read = ReadProcessMemory(h, reinterpret_cast<const unsigned char*>(mods[i]) + rva, out, 16, &got) &&
got == 16;
}
}
}
CloseHandle(h);
return read;
}
} // namespace
TEST_CASE("region 5 stays empty until the Agent asks, then carries what an FSR title told its upscaler, per request",
@@ -6912,6 +7151,7 @@ TEST_CASE("region 5 stays empty until the Agent asks, then carries what an FSR t
// hands the same query on to the leaf and both are hooked.
CHECK(a.ffxMemoryTotalBytes == kAdvMemoryTotal);
CHECK(a.ffxMemoryAliasableBytes == kAdvMemoryAliasable);
CHECK(SlConstantsAreUnread(a)); // an FSR title with no Streamline: nothing calls slSetConstants
CHECK(a.ffxMemoryQueries != 0u);
CHECK(a.ffxMemoryQueries <= a.ffxDispatches + 2u);
CHECK(LaterGroupsAreZero(a));
@@ -6978,10 +7218,14 @@ TEST_CASE("FSR's plane at infinity (beta.42, D119): a far plane of FLT_MAX reach
CHECK(r.st->status == fl::FL_STATUS_READY);
}
TEST_CASE("region 5 carries the DLSS options a title chains into its evaluation, and only while asked",
TEST_CASE("region 5 carries what a Streamline title chains into its evaluation and tells slSetConstants, and "
"slSetConstants is patched only once the Agent has asked",
"[guard][inject][shm][advanced]") {
// ONE TARGET, FOUR STRETCHES: never asked -> asked -> no longer asked -> stopped. The target does the same thing
// throughout: it chains an sl::DLSSOptions into every evaluation and calls slSetConstants for two viewports every
// frame, with the matrices and the camera's position and axes set to loud, changing values.
Child child;
REQUIRE(StartHarness(child, L"--real --advanced --hold-presenting-upscaled 30"));
REQUIRE(StartHarness(child, L"--real --advanced --hold-presenting-upscaled 60"));
ResetFake();
g.modules = {"kernel32.dll"};
@@ -6994,19 +7238,40 @@ TEST_CASE("region 5 carries the DLSS options a title chains into its evaluation,
return; // not reached after the REQUIRE; said in the form a static analyser follows (cpp:S2259)
}
REQUIRE(WaitForIdentityHook(r.st));
const auto slConstants = static_cast<uint32_t>(fl::FL_HOOK_SL_CONSTANTS);
// Not asked: the evaluation is hooked, the options are chained into every one, and none of it is kept.
// ---- 1. NEVER ASKED (owner decision D111): the evaluation is hooked, the game calls slSetConstants every frame,
// and that export is not patched -- its first bytes in the target are the file's -- nor is anything kept.
unsigned char pristine[16]{};
unsigned char now[16]{};
REQUIRE(ReadTargetExportBytes(child.pi.dwProcessId, FL_STUB_SL_INTERPOSER, "slSetConstants", pristine));
const std::uint64_t atHooks = r.st->writeIndex;
TickFor(r, 2500);
TickFor(r, 2500); // two watchdog ticks and more: every row that installs unasked has had its chance
REQUIRE(r.st->writeIndex > atHooks + 30u);
CHECK(RegionFiveIsZero(r));
CHECK((r.st->hooksInstalledMask & slConstants) == 0u);
REQUIRE(ReadTargetExportBytes(child.pi.dwProcessId, FL_STUB_SL_INTERPOSER, "slSetConstants", now));
CHECK(std::memcmp(pristine, now, sizeof(now)) == 0);
// ---- 2. ASKED: the patch goes in on the tick that sees the request, and the next publications carry both groups.
SetAdvancedRequest(r, 1u);
REQUIRE(WaitForHookFamily(r.st, slConstants));
REQUIRE(ReadTargetExportBytes(child.pi.dwProcessId, FL_STUB_SL_INTERPOSER, "slSetConstants", now));
CHECK(std::memcmp(pristine, now, sizeof(now)) != 0); // patched now
fl::FlAdvancedState a{};
REQUIRE(ReadAdvanced(r, 1u, a, 0u, fl::FL_ADV_VALID_DLSS_OPTIONS));
INFO("mask 0x" << std::hex << a.validMask << std::dec << " version " << a.dlssStructVersion << " seen "
<< a.dlssOptionsSeen << " output " << a.dlssOutputWidth << "x" << a.dlssOutputHeight);
CHECK(a.validMask == static_cast<uint32_t>(fl::FL_ADV_VALID_DLSS_OPTIONS)); // no ffx call in this target
REQUIRE(ReadAdvanced(r, 1u, a, 0u, fl::FL_ADV_VALID_DLSS_OPTIONS | fl::FL_ADV_VALID_SL_CONSTANTS));
// A reset arrives on one frame in sixty-four and both halves of each alternation within two: read on until the
// summaries hold all of them (bounded by ReadAdvanced's own wait, a few publications).
for (int i = 0; i < 8 && (a.slResets == 0u || a.slFovMinBits == a.slFovMaxBits); ++i) {
REQUIRE(ReadAdvanced(r, 1u, a, a.samples, fl::FL_ADV_VALID_DLSS_OPTIONS | fl::FL_ADV_VALID_SL_CONSTANTS));
}
INFO("mask 0x" << std::hex << a.validMask << " true 0x" << a.slFlagsSeenTrue << " false 0x" << a.slFlagsSeenFalse
<< std::dec << " calls " << a.slConstantsCalls << " resets " << a.slResets << " version "
<< a.dlssStructVersion << " output " << a.dlssOutputWidth << "x" << a.dlssOutputHeight);
CHECK(a.validMask == static_cast<uint32_t>(fl::FL_ADV_VALID_DLSS_OPTIONS | fl::FL_ADV_VALID_SL_CONSTANTS));
// The options chained into the evaluation, as before.
CHECK(a.dlssStructVersion == 3u); // the version these headers declare, which is what entitles the tail
CHECK(a.dlssOptionsSeen != 0u);
CHECK(a.dlssOutputWidth == kAdvDlssOutputW);
@@ -7025,11 +7290,69 @@ TEST_CASE("region 5 carries the DLSS options a title chains into its evaluation,
CHECK(a.dlssColorBuffersHdr == 1u);
CHECK(a.dlssAutoExposure == 2u);
CHECK(a.dlssAlphaUpscaling == 2u);
CHECK(a.ffxDispatches == 0u);
// What the game told slSetConstants for the FIRST viewport: exactly the harness's numbers, and not one of the
// second viewport's (near 9, far 99, a field of view of 2, depth not inverted, an orthographic projection).
CHECK(a.slConstantsCalls > 60u); // both viewports' calls are counted
CHECK(a.slJitterMaxXBits == BitsOf(kAdvSlJitterX));
CHECK(a.slJitterMaxYBits == BitsOf(kAdvSlJitterY));
CHECK(a.slMvecScaleXBits == BitsOf(kAdvSlMvecScaleX));
CHECK(a.slMvecScaleYBits == BitsOf(kAdvSlMvecScaleY));
CHECK(a.slNearBits == BitsOf(kAdvSlNear));
CHECK(a.slFarBits == BitsOf(kAdvSlFar));
CHECK(a.slFovMinBits == BitsOf(kAdvSlFovLow)); // a range, never a series (D114)
CHECK(a.slFovMaxBits == BitsOf(kAdvSlFovHigh));
CHECK(a.slAspectBits == BitsOf(kAdvSlAspect));
// Bits in the header's order: depthInverted 0, cameraMotionIncluded 1, motionVectors3D 2, reset 3,
// orthographicProjection 4, motionVectorsDilated 5, motionVectorsJittered 6.
CHECK(a.slFlagsSeenTrue == ((1u << 0) | (1u << 1) | (1u << 3) | (1u << 6)));
CHECK(a.slFlagsSeenFalse == ((1u << 2) | (1u << 3) | (1u << 4) | (1u << 5)));
CHECK(a.slResets >= 1u);
CHECK(a.slResets * 32u < a.slConstantsCalls); // one frame in sixty-four of ONE viewport, not of both
CHECK(a.ffxDispatches == 0u); // no ffx call in this target
CHECK(a.ffxSharpnessMinBits == FL_ADV_FLOAT_NONE); // a float nobody saw is "none", never 0.0
CHECK(a.ffxMemoryQueries == 0u);
CHECK(LaterGroupsAreZero(a));
// ---- 3. NO LONGER ASKED: the detour forwards without looking, the region is as it was left, and the patch stays
// (it is never taken out mid-session).
SetAdvancedRequest(r, 0u);
TickFor(r, 1500);
fl::FlAdvancedState held{};
std::memcpy(&held, RegionFive(r), sizeof(held));
TickFor(r, 2500);
CHECK(std::memcmp(&held, RegionFive(r), sizeof(held)) == 0);
CHECK((r.st->hooksInstalledMask & slConstants) != 0u);
REQUIRE(ReadTargetExportBytes(child.pi.dwProcessId, FL_STUB_SL_INTERPOSER, "slSetConstants", now));
CHECK(std::memcmp(pristine, now, sizeof(now)) != 0);
CHECK(r.st->faultCount == 0u);
CHECK(r.st->status == fl::FL_STATUS_READY);
// ---- 4. STOPPED: the export's first bytes are the file's again, and the log says which patch was restored.
r.ctl->unhookRequested = 1;
for (int i = 0; i < 60 && r.st->status != fl::FL_STATUS_UNHOOKED; ++i) {
++r.ctl->guardTicks;
Sleep(50);
}
REQUIRE(r.st->status == fl::FL_STATUS_UNHOOKED);
std::wstring log;
std::string text;
for (int i = 0; i < 100; ++i) {
if ((!log.empty() || FindOverlayLog(child.pi.dwProcessId, child.pi.hProcess, log))) {
text = ReadWholeFile(log);
if (text.find("STOP_FLUSHED") != std::string::npos) {
break;
}
}
Sleep(100);
}
INFO("after the stop:\n" << text);
REQUIRE(ReadTargetExportBytes(child.pi.dwProcessId, FL_STUB_SL_INTERPOSER, "slSetConstants", now));
CHECK(std::memcmp(pristine, now, sizeof(now)) == 0);
CHECK(text.find("HOOK_INSTALLED sl.interposer.dll!slSetConstants") != std::string::npos);
CHECK(text.find("UNHOOK_RESTORED sl.interposer.dll!slSetConstants") != std::string::npos);
CHECK(text.find("UNHOOK_DECLINED") == std::string::npos);
CHECK(text.find("PATCH_FAILED") == std::string::npos);
}
@@ -225,6 +225,8 @@ const char* CollectedName(fl::guard::Collected c) {
return "INCOMPLETE";
case fl::guard::Collected::kRetry:
return "RETRY (still loading, or gone)";
case fl::guard::Collected::kUnsettled:
return "UNSETTLED (the list changed while it was read)";
}
return "?";
}
+259 -12
View File
@@ -97,7 +97,7 @@
// an FSR title does: one UPSCALE and one PREPARE (issued twice,
// same frameID) per application frame, one FRAMEGENERATION per
// frame at K > 1, then K presents (--presents-per-eval K)
// --ffx-topology 1x|2x|ue|fsr3host|fsr3host+mono
// --ffx-topology 1x|2x|2x-export|ue|fsr3host|fsr3host+mono
// which vendor shape --hold-presenting-ffx stands in: 2x (default)
// is the SDK 2.x pair of effect DLLs behind the LOADER (the game
// calls the loader; the loader forwards NOT through the leaves'
@@ -115,7 +115,13 @@
// --advanced send what Advanced metrics reads (train B, 0.1.0-beta.40): --hold-presenting-upscaled chains an
// sl::DLSSOptions into slEvaluateFeature's inputs, --hold-presenting-ffx fills the rest of the
// UPSCALE descriptor (sharpening, jitter, exposure, depth range, field of view, flags, frame time).
// The values are the kAdv* constants below; the injected fl_guard cases assert them
// The values are the kAdv* constants below; the injected fl_guard cases assert them.
// Since 0.1.0-beta.43 the upscaled hold also calls slSetConstants every frame, for viewport 0
// (kAdvSl*) and for a second viewport whose numbers must never be shown, with the matrices and
// the camera's position and axes - which the Overlay never reads - set to loud, changing values
// --churn-module <dll>
// load and free the module in a loop on a thread of its own, for the life of the process: a
// module list that keeps changing under whoever reads it (the guard's D123, 2026-11-12)
// --ffx-infinite-far
// with --advanced: the UPSCALE descriptor's cameraFar is FLT_MAX, as an engine with an infinite
// depth states the plane at infinity (0.1.0-beta.42, D119), instead of kAdvFfxFar
@@ -1999,6 +2005,17 @@ bool ProbeSlInputs() {
// send. A UNIT PROBE, as --probe-sl-inputs is: what matters here is a struct of an OLDER VERSION than these headers
// declare, whose tail must not be read (owner decision D115), and the vendors' own sentinels and zeros, which must
// never leave the header as values. No fixture title can be made to send a version-1 DLSSOptions; this can.
// A read of sl::Constants at an address chosen by the caller, in a function of its own so that the SEH frame holds no
// object with a destructor. True when the read faulted.
bool ObserveSlConstantsFaults(const void* constants, fl::adv::Accumulators& a) {
__try {
fl::adv::ObserveSlConstants(*static_cast<const sl::Constants*>(constants), 0u, a);
return false;
} __except (EXCEPTION_EXECUTE_HANDLER) {
return true;
}
}
bool ProbeAdvFields() {
g_failures = 0;
const auto bitsOf = [](float v) { return std::bit_cast<uint32_t>(v); };
@@ -2308,6 +2325,140 @@ bool ProbeAdvFields() {
"and nothing of the session before: no mask, no count, no range, no size");
delete region;
}
// --- sl::Constants, what the game tells Streamline about a frame (0.1.0-beta.43) ------------------------------
{
fl::adv::Accumulators a;
sl::Constants c;
c.jitterOffset = {-0.375f, 0.25f};
c.mvecScale = {0.5f, 0.25f};
c.cameraNear = 0.1f;
c.cameraFar = 5000.0f;
c.cameraFOV = 1.0f;
c.cameraAspectRatio = 1.6f;
c.depthInverted = sl::Boolean::eTrue;
c.cameraMotionIncluded = sl::Boolean::eFalse;
c.reset = sl::Boolean::eFalse;
c.motionVectorsJittered = sl::Boolean::eTrue; // motionVectors3D is left in its third state
fl::adv::ObserveSlConstants(c, 3u, a);
c.jitterOffset = {0.125f, -0.4375f};
c.cameraFOV = 0.6f;
c.reset = sl::Boolean::eTrue;
fl::adv::ObserveSlConstants(c, 3u, a);
Check(a.validMask.load() == fl::FL_ADV_VALID_SL_CONSTANTS && a.slConstantsCalls.load() == 2u,
"two calls, counted, and the group marked read");
Check(a.slJitterMaxXBits.load() == bitsOf(0.375f) && a.slJitterMaxYBits.load() == bitsOf(0.4375f),
"the jitter is the largest magnitude on each axis");
Check(a.slMvecScaleXBits.load() == bitsOf(0.5f) && a.slMvecScaleYBits.load() == bitsOf(0.25f),
"the motion-vector scale is kept");
Check(a.slNearBits.load() == bitsOf(0.1f) && a.slFarBits.load() == bitsOf(5000.0f), "the depth range is kept");
Check(a.slFovMinBits.load() == bitsOf(0.6f) && a.slFovMaxBits.load() == bitsOf(1.0f),
"the field of view is a range, lowest and highest (D114)");
Check(a.slAspectBits.load() == bitsOf(1.6f), "the aspect ratio is kept");
// Bits in the header's order: depthInverted 0, cameraMotionIncluded 1, motionVectors3D 2, reset 3,
// orthographicProjection 4, motionVectorsDilated 5, motionVectorsJittered 6.
Check(a.slFlagsSeenTrue.load() == ((1u << 0) | (1u << 3) | (1u << 6)),
"a Boolean seen true sets its bit: depth inverted, reset, jittered");
Check(a.slFlagsSeenFalse.load() == ((1u << 1) | (1u << 3) | (1u << 4) | (1u << 5)),
"a Boolean seen false sets its bit in the other word; one in its third state sets neither");
Check(a.slResets.load() == 1u, "a reset is counted");
// A SECOND VIEWPORT is counted as a call and summarised nowhere.
sl::Constants other;
other.jitterOffset = {0.9f, 0.9f};
other.cameraNear = 9.0f;
other.cameraFar = 99.0f;
other.cameraFOV = 2.0f;
other.depthInverted = sl::Boolean::eFalse;
other.reset = sl::Boolean::eTrue;
fl::adv::ObserveSlConstants(other, 4u, a);
Check(a.slConstantsCalls.load() == 3u, "a call for another viewport is a call");
Check(a.slNearBits.load() == bitsOf(0.1f) && a.slFovMaxBits.load() == bitsOf(1.0f) &&
a.slJitterMaxXBits.load() == bitsOf(0.375f) && a.slResets.load() == 1u &&
(a.slFlagsSeenFalse.load() & 1u) == 0u,
"and the summaries stay the first viewport's: no value, range, flag or reset of the second");
// The handle's own "no viewport" value is a viewport like another.
fl::adv::Accumulators last;
fl::adv::ObserveSlConstants(c, 0xFFFFFFFFu, last);
fl::adv::ObserveSlConstants(other, 0u, last);
Check(last.slNearBits.load() == bitsOf(0.1f) && last.slConstantsCalls.load() == 2u,
"a first viewport of 0xFFFFFFFF owns the summaries; viewport 0 after it does not");
// SENTINELS: a struct the game set nothing in. FLT_MAX is Streamline's INVALID_FLOAT - on THIS route it is
// "not set", never the plane at infinity (D119 is the ffx route's).
fl::adv::Accumulators unset;
sl::Constants blank;
fl::adv::ObserveSlConstants(blank, 0u, unset);
Check(unset.slNearBits.load() == FL_ADV_FLOAT_NONE && unset.slFarBits.load() == FL_ADV_FLOAT_NONE &&
unset.slFovMinBits.load() == FL_ADV_FLOAT_NONE && unset.slAspectBits.load() == FL_ADV_FLOAT_NONE &&
unset.slJitterMaxXBits.load() == FL_ADV_FLOAT_NONE &&
unset.slMvecScaleXBits.load() == FL_ADV_FLOAT_NONE,
"INVALID_FLOAT - FLT_MAX - is 'no value' in every member, a depth plane included");
Check(unset.slFlagsSeenTrue.load() == 0u &&
unset.slFlagsSeenFalse.load() == ((1u << 4) | (1u << 5) | (1u << 6)),
"the four Booleans in their third state are neither; the three the vendor defaults to false are false");
blank.cameraFOV = -1.0f;
blank.cameraAspectRatio = 0.0f;
blank.jitterOffset = {0.5f, std::bit_cast<float>(0x7FC00000u)};
fl::adv::ObserveSlConstants(blank, 0u, unset);
Check(unset.slFovMinBits.load() == FL_ADV_FLOAT_NONE && unset.slAspectBits.load() == FL_ADV_FLOAT_NONE &&
unset.slJitterMaxXBits.load() == FL_ADV_FLOAT_NONE,
"a field of view or an aspect ratio that is not positive is not one; half a jitter is no jitter");
// WHERE THE MEMBERS ARE, by the addresses of this build's own struct: the two ranges never read are bytes
// 32..351 (five matrices) and 368..423 (the pinhole offset, the camera's position and its three axes).
const auto at = [&c](const void* member) {
return static_cast<size_t>(static_cast<const unsigned char*>(member) -
reinterpret_cast<const unsigned char*>(&c));
};
Check(at(&c.cameraViewToClip) == 32u && at(&c.jitterOffset) == 352u && at(&c.mvecScale) == 360u,
"the five matrices are bytes 32..351; the jitter and the scale follow at 352 and 360");
Check(at(&c.cameraPinholeOffset) == 368u && at(&c.cameraNear) == 424u,
"the pinhole offset, the camera's position and its axes are bytes 368..423; the near plane is at 424");
// NOTHING OF THOSE TWO RANGES REACHES WHAT IS PUBLISHED. Two structs alike in every member that is read and
// different in every byte that is not: the accumulators come out byte for byte the same.
sl::Constants p = c;
sl::Constants q = c;
std::memset(reinterpret_cast<unsigned char*>(&p) + 32u, 0x11, 352u - 32u);
std::memset(reinterpret_cast<unsigned char*>(&p) + 368u, 0x11, 424u - 368u);
std::memset(reinterpret_cast<unsigned char*>(&q) + 32u, 0xEE, 352u - 32u);
std::memset(reinterpret_cast<unsigned char*>(&q) + 368u, 0xEE, 424u - 368u);
auto* regionP = new fl::FlAdvancedState{};
auto* regionQ = new fl::FlAdvancedState{};
fl::adv::Accumulators ap;
fl::adv::Accumulators aq;
fl::adv::ObserveSlConstants(p, 0u, ap);
fl::adv::ObserveSlConstants(q, 0u, aq);
fl::adv::Publish(ap, regionP, 5u, 1u);
fl::adv::Publish(aq, regionQ, 5u, 1u);
Check(std::memcmp(regionP, regionQ, sizeof(fl::FlAdvancedState)) == 0 && regionP->slNearBits == bitsOf(0.1f) &&
regionP->slConstantsCalls == 1u,
"two structs that differ only in the matrices and the camera publish the same bytes");
delete regionP;
delete regionQ;
// A VERSION-1 STRUCT ENDS WHERE VERSION 2's MEMBER BEGINS, and is read no further: laid against a page that
// cannot be read, it is read whole and nothing faults.
const size_t v1Size = at(&c.minRelativeLinearDepthObjectSeparation);
auto* pages =
static_cast<unsigned char*>(VirtualAlloc(nullptr, 8192, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
DWORD old = 0;
if (pages == nullptr || !VirtualProtect(pages + 4096, 4096, PAGE_NOACCESS, &old)) {
Check(false, "two pages, the second unreadable, for the version-1 struct");
} else {
unsigned char* v1 = pages + 4096 - v1Size;
std::memcpy(v1, &c, v1Size);
fl::adv::Accumulators edge;
Check(!ObserveSlConstantsFaults(v1, edge),
"a version-1 struct at the end of readable memory is read without a fault");
Check(edge.slNearBits.load() == bitsOf(0.1f) && edge.slFlagsSeenTrue.load() != 0u,
"and what it carries is read: the last member version 1 has is the last one read");
VirtualFree(pages, 0, MEM_RELEASE);
}
}
return g_failures == 0;
}
@@ -2760,6 +2911,19 @@ constexpr float kAdvFfxFar = 1000.0f;
constexpr float kAdvFfxFovLow = 0.9f; // radians; the two alternate, frame by frame
constexpr float kAdvFfxFovHigh = 1.1f;
constexpr float kAdvFfxFrameTimeMs = 16.0f;
// What --advanced hands slSetConstants (0.1.0-beta.43), for viewport 0. The jitter and the field of view alternate
// frame by frame; `reset` is true on one frame in sixty-four. A SECOND viewport (7) is set every frame with
// different numbers, which must never be the ones a session shows.
constexpr float kAdvSlJitterX = 0.3125f; // the larger magnitude of the two that alternate
constexpr float kAdvSlJitterY = 0.4375f;
constexpr float kAdvSlMvecScaleX = 0.5f;
constexpr float kAdvSlMvecScaleY = 0.25f;
constexpr float kAdvSlNear = 0.25f;
constexpr float kAdvSlFar = 4000.0f;
constexpr float kAdvSlFovLow = 0.8f;
constexpr float kAdvSlFovHigh = 1.2f;
constexpr float kAdvSlAspect = 1.75f;
constexpr uint32_t kAdvSlOtherViewport = 7u;
using StubTokenFn = sl::Result(STDMETHODCALLTYPE*)(sl::FrameToken*&, const uint32_t*);
alignas(16) unsigned char g_dummyFrameToken[64]{};
@@ -2860,6 +3024,41 @@ int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature,
options.performancePreset = sl::DLSSPreset::ePresetM;
options.ultraPerformancePreset = sl::DLSSPreset::ePresetL;
const sl::BaseStructure* advancedInputs[] = {&options};
// --advanced, 0.1.0-beta.43: the per-frame constants, through the stub's slSetConstants. Everything the Overlay may
// read is a known value; EVERYTHING IT MAY NOT -- the five matrices, the pinhole offset, the camera's position and
// axes -- is filled with loud numbers that change every frame, so a read of them would show in what is published.
// The frame token by address, as the other stub entry points take it: a reference parameter is a pointer in
// the ABI, and the harness has no token object, only storage of the right size.
using StubSetConstantsFn =
sl::Result(STDMETHODCALLTYPE*)(const sl::Constants&, const void*, const sl::ViewportHandle&);
auto setConstants =
reinterpret_cast<StubSetConstantsFn>(reinterpret_cast<void*>(GetProcAddress(stub, "slSetConstants")));
if (advanced && setConstants == nullptr) {
Check(false, "the stub exports slSetConstants");
return 1;
}
sl::Constants constants;
sl::Constants otherConstants;
sl::ViewportHandle otherViewport{kAdvSlOtherViewport};
constants.mvecScale = {kAdvSlMvecScaleX, kAdvSlMvecScaleY};
constants.cameraNear = kAdvSlNear;
constants.cameraFar = kAdvSlFar;
constants.cameraAspectRatio = kAdvSlAspect;
constants.depthInverted = sl::Boolean::eTrue;
constants.cameraMotionIncluded = sl::Boolean::eTrue;
constants.motionVectors3D = sl::Boolean::eFalse;
constants.orthographicProjection = sl::Boolean::eFalse;
constants.motionVectorsDilated = sl::Boolean::eFalse;
constants.motionVectorsJittered = sl::Boolean::eTrue;
otherConstants.jitterOffset = {0.9f, 0.9f};
otherConstants.mvecScale = {9.0f, 9.0f};
otherConstants.cameraNear = 9.0f;
otherConstants.cameraFar = 99.0f;
otherConstants.cameraFOV = 2.0f;
otherConstants.cameraAspectRatio = 9.0f;
otherConstants.depthInverted = sl::Boolean::eFalse;
otherConstants.orthographicProjection = sl::Boolean::eTrue;
if (advanced) {
std::printf(" --advanced: an sl::DLSSOptions (version %zu, output %ux%u) chained into every evaluation\n",
options.structVersion, kAdvDlssOutputW, kAdvDlssOutputH);
@@ -2878,6 +3077,23 @@ int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature,
} else {
setTag(viewport, tags, numTags, nullptr);
}
if (advanced) {
const bool odd = (evaluated & 1) != 0;
const float loud = static_cast<float>(evaluated % 977) + 1000.0f;
constants.jitterOffset = {odd ? -kAdvSlJitterX : 0.125f, odd ? 0.0625f : -kAdvSlJitterY};
constants.cameraFOV = odd ? kAdvSlFovLow : kAdvSlFovHigh;
constants.reset = (evaluated % 64) == 5 ? sl::Boolean::eTrue : sl::Boolean::eFalse;
// What must never be read: a different loud value in each, every frame.
constants.cameraViewToClip.row[0] = {loud, loud + 1.0f, loud + 2.0f, loud + 3.0f};
constants.clipToPrevClip.row[3] = {loud + 4.0f, loud + 5.0f, loud + 6.0f, loud + 7.0f};
constants.cameraPinholeOffset = {loud + 8.0f, loud + 9.0f};
constants.cameraPos = {loud + 10.0f, loud + 11.0f, loud + 12.0f};
constants.cameraUp = {loud + 13.0f, loud + 14.0f, loud + 15.0f};
constants.cameraRight = {loud + 16.0f, loud + 17.0f, loud + 18.0f};
constants.cameraFwd = {loud + 19.0f, loud + 20.0f, loud + 21.0f};
setConstants(constants, g_dummyFrameToken, viewport);
setConstants(otherConstants, g_dummyFrameToken, otherViewport);
}
// ONE EVALUATION PER PRESENT, which is what a real upscaled title does
// and what makes the drained record's identity checkable frame by frame.
eval(feature, g_dummyFrameToken, advanced ? advancedInputs : nullptr, advanced ? 1u : 0u, nullptr);
@@ -3019,7 +3235,9 @@ int HoldPresentingFg(Gfx& g, int seconds, bool real, int presentsPerEval) {
// DLL alone (its named UPSCALE export, no PREPARE, no frame generation -- the K = 1
// double-count control for that row), fsr3host+mono = Cyberpunk 2077's measured shape:
// the host upscales while the 1.1.x monolith prepares and generates.
enum class FfxTopology { Monolith, Loader, Ue, Fsr3Host, Fsr3HostMonolith };
// LoaderExport (2026-11-12, D125): the two leaves behind a loader that forwards a dispatch to their EXPORTS, as
// Cyberpunk 2077's loader 2.3.0 was measured to -- every dispatch then reaches two hooked modules.
enum class FfxTopology { Monolith, Loader, LoaderExport, Ue, Fsr3Host, Fsr3HostMonolith };
using PfnFsr3DispatchUpscale = decltype(&fsr3host::ffxFsr3ContextDispatchUpscale);
@@ -3078,6 +3296,19 @@ void AskQuality(PfnFfxQuery query, FfxQuery what) {
}
}
// --churn-module <dll>: one thread that loads and frees the module for as long as the process lives (D123's fixture).
wchar_t g_churnPath[MAX_PATH * 2]{};
DWORD WINAPI ChurnModuleThread(LPVOID) {
for (;;) {
if (HMODULE h = LoadLibraryW(g_churnPath); h != nullptr) {
FreeLibrary(h);
} else {
Sleep(1);
}
}
}
// --ffx-infinite-far (with --advanced): cameraFar is FLT_MAX rather than kAdvFfxFar.
bool g_ffxInfiniteFar = false;
@@ -3120,16 +3351,17 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
Check(false, "the SDK 2.x leaf stubs loaded for the ffx hold");
return 1;
}
if (topology == FfxTopology::Loader) {
if (topology == FfxTopology::Loader || topology == FfxTopology::LoaderExport) {
const HMODULE loader = LoadStubExactly(FL_STUB_FFX_LOADER);
if (loader == nullptr) {
Check(false, "the loader stub loaded for the ffx hold");
return 1;
}
auto bind =
reinterpret_cast<StubLoaderBindFn>(reinterpret_cast<void*>(GetProcAddress(loader, "FlStubLoaderBind")));
auto bind = reinterpret_cast<StubLoaderBindFn>(reinterpret_cast<void*>(
GetProcAddress(loader, topology == FfxTopology::LoaderExport ? "FlStubLoaderBindThroughExports"
: "FlStubLoaderBind")));
if (bind == nullptr) {
Check(false, "the loader stub exports FlStubLoaderBind");
Check(false, "the loader stub exports its bind entry");
return 1;
}
bind(upscaler, fg);
@@ -3166,9 +3398,12 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
return 1;
}
// The pre-V2 PREPARE is the 1.1.x monolith's, on both topologies that use it.
const bool topology2x = topology == FfxTopology::Loader || topology == FfxTopology::Ue;
const char* topologyName = topology == FfxTopology::Monolith ? "SDK 1.1.x (monolith)"
: topology == FfxTopology::Loader ? "SDK 2.x (two leaves behind the loader)"
const bool topology2x =
topology == FfxTopology::Loader || topology == FfxTopology::LoaderExport || topology == FfxTopology::Ue;
const char* topologyName = topology == FfxTopology::Monolith ? "SDK 1.1.x (monolith)"
: topology == FfxTopology::Loader ? "SDK 2.x (two leaves behind the loader)"
: topology == FfxTopology::LoaderExport
? "SDK 2.x (two leaves behind a loader that forwards to their exports)"
: topology == FfxTopology::Ue ? "UE5 (two leaves, no loader)"
: topology == FfxTopology::Fsr3Host ? "FSR 3.0 host DLL alone"
: "FSR 3.0 host DLL + SDK 1.1.x monolith";
@@ -3468,6 +3703,7 @@ int main(int argc, char** argv) {
} else if (std::strcmp(argv[i], "--ffx-topology") == 0 && i + 1 < argc) {
const char* t = argv[++i];
ffxTopology = std::strcmp(t, "1x") == 0 ? FfxTopology::Monolith
: std::strcmp(t, "2x-export") == 0 ? FfxTopology::LoaderExport
: std::strcmp(t, "ue") == 0 ? FfxTopology::Ue
: std::strcmp(t, "fsr3host") == 0 ? FfxTopology::Fsr3Host
: std::strcmp(t, "fsr3host+mono") == 0 ? FfxTopology::Fsr3HostMonolith
@@ -3505,6 +3741,17 @@ int main(int argc, char** argv) {
} else {
i += 2;
}
} else if (std::strcmp(argv[i], "--churn-module") == 0 && i + 1 < argc) {
// The fixture for D123: a process whose module list keeps changing, as a game's does at its launch. One
// thread loads and frees the named module for the life of the process.
const char* path = argv[++i];
MultiByteToWideChar(CP_ACP, 0, path, -1, g_churnPath, static_cast<int>(std::size(g_churnPath)));
HANDLE t = CreateThread(nullptr, 0, &ChurnModuleThread, nullptr, 0, nullptr);
std::printf(" --churn-module %s -> %s\n", path, t != nullptr ? "started" : "FAILED");
if (t == nullptr) {
return 3;
}
CloseHandle(t);
} else if (std::strcmp(argv[i], "--load") == 0 && i + 1 < argc) {
// The fixture for the guard's signer half: put a named module into
// THIS process before the guard looks. Loaded, not injected, and it
@@ -3529,11 +3776,11 @@ int main(int argc, char** argv) {
std::strcmp(argv[i], "--advanced") == 0 || std::strcmp(argv[i], "--ffx-memory-query") == 0 ||
std::strcmp(argv[i], "--ffx-infinite-far") == 0 || std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0 || std::strcmp(argv[i], "--load") == 0 ||
std::strcmp(argv[i], "--load-after-ms") == 0) {
std::strcmp(argv[i], "--churn-module") == 0 || std::strcmp(argv[i], "--load-after-ms") == 0) {
if (std::strcmp(argv[i], "--plus-ui") == 0 || std::strcmp(argv[i], "--present-interval-ms") == 0 ||
std::strcmp(argv[i], "--presents-per-eval") == 0 || std::strcmp(argv[i], "--ffx-topology") == 0 ||
std::strcmp(argv[i], "--ffx-query") == 0 || std::strcmp(argv[i], "--ffx-memory-query") == 0 ||
std::strcmp(argv[i], "--load") == 0) {
std::strcmp(argv[i], "--load") == 0 || std::strcmp(argv[i], "--churn-module") == 0) {
++i;
}
if (std::strcmp(argv[i], "--load-after-ms") == 0) {
@@ -26,6 +26,16 @@
//
// IT IS A FIXTURE, NOT A CLAIM ABOUT THE REAL LOADER'S INTERNALS beyond the one
// measured fact: the leaf exports stay silent behind it.
//
// AND A SECOND MEASURED FACT, 2026-11-12, FOR A LATER LOADER. Cyberpunk 2077's
// loader 2.3.0 hands a dispatch on to the leaf's EXPORT: each frame-generation
// dispatch type was logged on the loader and on the frame-generation leaf. So the
// stub has a second way to be bound -- FlStubLoaderBindThroughExports -- that
// forwards through the leaves' exported ffxDispatch, and with all four modules
// hooked the Overlay then sees every dispatch at two of them. What it does with
// that is owner decision D125: an UPSCALE is counted at the first module that
// sees it. No title run so far upscales through such a loader; the fixture is how
// the rule is held.
#include <ffx_api.h>
@@ -51,7 +61,7 @@ Bound g_upscaler;
Bound g_frameGeneration;
volatile LONG g_forwarded = 0;
void Bind(Bound& b, HMODULE h) {
void Bind(Bound& b, HMODULE h, bool dispatchThroughExport = false) {
if (h == nullptr) {
b = Bound{};
return;
@@ -60,9 +70,10 @@ void Bind(Bound& b, HMODULE h) {
b.destroy = reinterpret_cast<PfnFfxDestroyContext>(reinterpret_cast<void*>(GetProcAddress(h, "ffxDestroyContext")));
b.configure = reinterpret_cast<PfnFfxConfigure>(reinterpret_cast<void*>(GetProcAddress(h, "ffxConfigure")));
b.query = reinterpret_cast<PfnFfxQuery>(reinterpret_cast<void*>(GetProcAddress(h, "ffxQuery")));
// DISPATCH GOES THROUGH THE DIRECT ENTRY, NOT THE EXPORT -- see the header comment.
b.dispatch =
reinterpret_cast<PfnFfxDispatch>(reinterpret_cast<void*>(GetProcAddress(h, "FlStubFfxDispatchDirect")));
// DISPATCH GOES THROUGH THE DIRECT ENTRY, NOT THE EXPORT -- see the header comment -- unless this is the later
// loader's shape (FlStubLoaderBindThroughExports).
b.dispatch = reinterpret_cast<PfnFfxDispatch>(
reinterpret_cast<void*>(GetProcAddress(h, dispatchThroughExport ? "ffxDispatch" : "FlStubFfxDispatchDirect")));
}
// Route by EFFECT ID, which is what the real loader's provider lookup keys on
@@ -90,6 +101,12 @@ __declspec(dllexport) void FlStubLoaderBind(HMODULE upscaler, HMODULE frameGener
Bind(g_frameGeneration, frameGeneration);
}
// The loader 2.3 shape (measured on Cyberpunk 2077, 2026-11-12): dispatches are handed to the leaves' exports.
__declspec(dllexport) void FlStubLoaderBindThroughExports(HMODULE upscaler, HMODULE frameGeneration) {
Bind(g_upscaler, upscaler, true);
Bind(g_frameGeneration, frameGeneration, true);
}
__declspec(dllexport) unsigned int FlStubLoaderForwarded() {
return static_cast<unsigned int>(InterlockedCompareExchange(&g_forwarded, 0, 0));
}
@@ -62,6 +62,9 @@ StubFrameToken g_tokenPool[8];
static_assert(fl::stub::InventoryHas("slGetNewFrameToken"),
"fl_hook_inventory.h no longer contains \"slGetNewFrameToken\", so the frame-token fixture would "
"exercise a row the Overlay does not install.");
static_assert(fl::stub::InventoryHas("slSetConstants"),
"fl_hook_inventory.h no longer contains \"slSetConstants\", so the constants fixture would exercise a "
"row the Overlay does not install.");
static_assert(fl::stub::InventoryHas("slSetTagForFrame"),
"fl_hook_inventory.h no longer contains \"slSetTagForFrame\", so the frame-based tag fixture would "
"exercise a row the Overlay does not install.");
@@ -144,6 +147,16 @@ SL_API sl::Result slIsFeatureLoaded(sl::Feature feature, bool& loaded) {
return sl::Result::eOk;
}
// The per-frame constants (0.1.0-beta.43). Signature from the vendored header, like the others. The stub keeps
// nothing: the harness hands it known values and the injected cases assert what the Overlay read of them.
SL_API sl::Result slSetConstants(const sl::Constants& values, const sl::FrameToken& frame,
const sl::ViewportHandle& viewport) {
(void)values;
(void)frame;
(void)viewport;
return sl::Result::eOk;
}
SL_API sl::Result slGetNewFrameToken(sl::FrameToken*& token, const uint32_t* frameIndex) {
// The vendor's contract in miniature: an explicit index returns THAT frame's
// token (the same object on a re-request), no index advances to a new one.
+18
View File
@@ -43,6 +43,24 @@ ffxDispatchDescUpscale::flags
ffxDispatchDescUpscale::reset
ffxDispatchDescUpscale::frameTimeDelta
# sl::Constants, what the game tells slSetConstants about a frame (parameter `k`; 0.1.0-beta.43). The jitter, the
# motion-vector scale, the depth range, the field of view, the aspect ratio and the seven Booleans - numbers and
# switches of the kind a settings menu or a debug overlay shows. The five matrices, the pinhole offset, the camera's
# position and its three axes sit in the same struct and are refused by name wherever they appear (rule 4).
sl::Constants::jitterOffset
sl::Constants::mvecScale
sl::Constants::cameraNear
sl::Constants::cameraFar
sl::Constants::cameraFOV
sl::Constants::cameraAspectRatio
sl::Constants::depthInverted
sl::Constants::cameraMotionIncluded
sl::Constants::motionVectors3D
sl::Constants::reset
sl::Constants::orthographicProjection
sl::Constants::motionVectorsDilated
sl::Constants::motionVectorsJittered
# The upscaler's memory query: the header's type, the game's out-pointer in either version of the descriptor
# (parameter `q`), and what ffxQuery wrote through it after answering OK (parameter `m`)
ffxQueryDescHeader::type
+8 -3
View File
@@ -17,9 +17,9 @@
1. The reads are in ONE header, src/native/FrameLedger.Overlay/include/fl_adv_fields.h, through parameters with
fixed names - `o` (sl::DLSSOptions), `d` (ffxDispatchDescUpscale), `m` (FfxApiEffectMemoryUsage), `q` (the
memory query's descriptor) and `desc` (a query's header). Every member read through them is on
memory query's descriptor), `k` (sl::Constants, since 0.1.0-beta.43) and `desc` (a query's header). Every member read through them is on
tools/overlay-allowed-fields.txt, and every name on that list is read.
2. Those parameters are not aliased: each of the four letters appears only as `x.member` or where it is
2. Those parameters are not aliased: each of the five letters appears only as `x.member` or where it is
declared, and `->` is applied to nothing but `desc` and the Overlay's own `region`. So a member cannot be
read under a name this check does not look at.
3. No other source of the Overlay or the Vulkan layer reads a member the list names (the names every struct
@@ -55,6 +55,7 @@ $script:Parameter = [ordered]@{
d = 'ffxDispatchDescUpscale'
m = 'FfxApiEffectMemoryUsage'
q = 'ffxQueryDescUpscaleGetGPUMemoryUsage'
k = 'sl::Constants'
desc = 'ffxQueryDescHeader'
}
@@ -103,7 +104,7 @@ function Get-HeaderRead([string]$Code) {
$reads = [System.Collections.Generic.SortedSet[string]]::new([StringComparer]::Ordinal)
$problems = [System.Collections.Generic.List[string]]::new()
foreach ($m in [regex]::Matches($Code, '(?<![\w.>:])(o|d|m|q)\b(\s*\.\s*([A-Za-z_]\w*))?')) {
foreach ($m in [regex]::Matches($Code, '(?<![\w.>:])(o|d|m|q|k)\b(\s*\.\s*([A-Za-z_]\w*))?')) {
$name = $m.Groups[1].Value
if ($m.Groups[3].Success) {
[void]$reads.Add("$($script:Parameter[$name])::$($m.Groups[3].Value)")
@@ -210,6 +211,10 @@ inline void Publish(Accumulators& a, FlAdvancedState* region) noexcept { region-
@{ Name = 'a pointer to it, and offsetof into it, pass'; Header = $goodHeader; List = $goodList; Other = $goodOther; Expect = 0 },
@{ Name = 'a name listed twice FAILS'; Header = $goodHeader; List = $goodList + "sl::DLSSOptions::outputWidth`n"; Other = $goodOther; Expect = 1 },
@{ Name = 'a line that is not one Struct::member FAILS'; Header = $goodHeader; List = $goodList + "sl::DLSSOptions::outputWidth # the size`n"; Other = $goodOther; Expect = 1 },
@{ Name = 'sl::Constants read through its parameter, each member on the list, passes'; Header = $goodHeader + "`ninline void ObserveK(const sl::Constants& k, uint32_t viewport, Accumulators& a) noexcept { a.n.store(k.cameraNear + k.jitterOffset.x); }"; List = $goodList + "sl::Constants::cameraNear`nsl::Constants::jitterOffset`n"; Other = $goodOther; Expect = 0 },
@{ Name = 'a member of sl::Constants the list does not allow FAILS'; Header = $goodHeader + "`ninline void ObserveK(const sl::Constants& k, Accumulators& a) noexcept { a.n.store(k.cameraNear + k.cameraFOV); }"; List = $goodList + "sl::Constants::cameraNear`n"; Other = $goodOther; Expect = 1 },
@{ Name = 'the camera read through the sl::Constants parameter FAILS, listed or not'; Header = $goodHeader + "`ninline void ObserveK(const sl::Constants& k, Accumulators& a) noexcept { a.n.store(k.cameraPos.x); }"; List = $goodList + "sl::Constants::cameraPos`n"; Other = $goodOther; Expect = 2 },
@{ Name = 'the sl::Constants parameter handed on whole FAILS'; Header = $goodHeader + "`ninline void ObserveK(const sl::Constants& k, Accumulators& a) noexcept { a.n.store(k.cameraNear); Other(k); }"; List = $goodList + "sl::Constants::cameraNear`n"; Other = $goodOther; Expect = 1 },
@{ Name = 'a header with no read at all FAILS'; Header = '// o.outputWidth is somewhere else'; List = "# nothing`n"; Other = $goodOther; Expect = 1 }
)
foreach ($c in $cases) {