diff options
| author | CLHelper <359823989+CLHelper@users.noreply.github.com> | 2026-11-22 19:37:45 +0000 |
|---|---|---|
| committer | CLHelper <359823989+CLHelper@users.noreply.github.com> | 2026-11-22 19:37:55 +0000 |
| commit | ca438076bc73ac960e2743d7b0e092a457052fca (patch) | |
| tree | 745906a24eb322874adf90fef1d192b5a51c8604 /docs | |
| parent | 162821017ea3c286c8bec860f3ff94f037912061 (diff) | |
feat(tools): inline_scan finds inline command-list writes and whether each checks the cursor limit
The package's DLLs check before every inline write (BVH builder 196/196, FSR 9/9), so a layer that keeps
the cursor at the limit sees every command. Whether the game's executable does the same was open until it is
available; inline_scan answers it in one pass over a dumpbin listing. Baseline in d3d12_command_objects.md,
day-one step in design.md.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/d3d12_command_objects.md | 21 | ||||
| -rw-r--r-- | docs/design.md | 6 |
2 files changed, 27 insertions, 0 deletions
diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md index 56e1fd5cd..b72bf3696 100644 --- a/docs/d3d12_command_objects.md +++ b/docs/d3d12_command_objects.md | |||
| @@ -453,6 +453,27 @@ them, and it is the simplest contract for a layer that does not want to decode t | |||
| 453 | executable makes the same check before writing is unknown until it is available; it is compiled against the same | 453 | executable makes the same check before writing is unknown until it is available; it is compiled against the same |
| 454 | console headers. | 454 | console headers. |
| 455 | 455 | ||
| 456 | **Every inline write in the package's DLLs checks first.** `tools/inline_scan.py` finds each cursor store-back | ||
| 457 | (`mov [list+18h],reg` after stores through the cursor) and looks for the compare in front of it. On the 1.0.2.1 | ||
| 458 | DLLs (dumpbin 14.44 listings): | ||
| 459 | |||
| 460 | | Image | Inline writes | Checked | Not checked | Limit compared | Fallback slot (sites) | | ||
| 461 | |---|---:|---:|---:|---|---| | ||
| 462 | | `XboxBvhBuilder.dll` | 196 | 196 | 0 | `+0x30` ×165, `+0x28` ×30, a register loaded in another block ×1 | 45 ×71, 37 ×35, 25 ×34, 14 ×24, 39 ×16, 43 ×9, 80 ×4; 3 reach theirs through a shared jump the tool does not follow | | ||
| 463 | | `amd_fidelityfx_upscaler_xbox.dll` | 9 | 9 | 0 | `+0x30` ×8, `+0x28` ×1 | 35 ×6, 25, 41, 14 | | ||
| 464 | |||
| 465 | **Measured.** The packet headers it reads back are the two dispatch forms above: `0x4002c400` (26 four-word | ||
| 466 | dispatches in the builder, one in FSR) and `0x4003cc00` (the builder's four five-word ones). The other 14 DLLs have | ||
| 467 | no inline write, except one checked site in `libHttpClient.GDK.dll`, which imports nothing from D3D12: read a | ||
| 468 | result as an upper bound of about one site per image. Removing the compare and branch in front of the builder's | ||
| 469 | `0x14972` write turns exactly that site into "not checked", so a missing check is visible. | ||
| 470 | |||
| 471 | On the executable, `python -I tools/inline_scan.py <exe> --sites` answers the question in one pass (see the day-one | ||
| 472 | list in `docs/design.md`): no unchecked site means a cursor-at-limit layer sees every command the game records; each | ||
| 473 | unchecked site is listed by RVA and is a write that layer never sees. Its fallback-slot line is the set of console | ||
| 474 | list methods the game reaches through the vtable. Limit offsets other than `+0x28`/`+0x30` would be command kinds | ||
| 475 | the DLLs never write (draws, input-assembler and output-merger state); read a few of those sites by hand. | ||
| 476 | |||
| 456 | **The five-word dispatch.** The BVH builder also writes `0x4003cc00, x, 1, 1, W`: | 477 | **The five-word dispatch.** The BVH builder also writes `0x4003cc00, x, 1, 1, W`: |
| 457 | 478 | ||
| 458 | - **Sites:** `0x14972`, `0x15215`, `0x1536a` and `0x1d002`, each checked against the dispatch limit `+0x28`. The | 479 | - **Sites:** `0x14972`, `0x15215`, `0x1536a` and `0x1d002`, each checked against the dispatch limit `+0x28`. The |
diff --git a/docs/design.md b/docs/design.md index 6ee0e6f4e..c8312491a 100644 --- a/docs/design.md +++ b/docs/design.md | |||
| @@ -29,6 +29,7 @@ tools/ Python analysis tools (no game data inside) | |||
| 29 | pe_inspect.py PE headers, sections, entropy, imports sorted by where they resolve, .pdata, TLS | 29 | pe_inspect.py PE headers, sections, entropy, imports sorted by where they resolve, .pdata, TLS |
| 30 | rpf_probe.py RPF header survey of a game folder | 30 | rpf_probe.py RPF header survey of a game folder |
| 31 | manifest.py SHA-256 manifest of a game folder, plus a --verify mode | 31 | manifest.py SHA-256 manifest of a game folder, plus a --verify mode |
| 32 | inline_scan.py inline command-list writes in an image, and whether each checks the cursor limit first | ||
| 32 | scripts/ | 33 | scripts/ |
| 33 | first_look.ps1 run once the exe arrives: the full report set for it | 34 | first_look.ps1 run once the exe arrives: the full report set for it |
| 34 | runtime/ C++ native loader (CMake + Ninja, MSVC) | 35 | runtime/ C++ native loader (CMake + Ninja, MSVC) |
| @@ -51,6 +52,11 @@ This writes `reports/exe/` (JSON plus a readable summary). Check it in this orde | |||
| 51 | 2. **Import table.** Each DLL is marked `bundled` (in the game folder), `system` (present on this Windows), or | 52 | 2. **Import table.** Each DLL is marked `bundled` (in the game folder), `system` (present on this Windows), or |
| 52 | `shim` (needs a reimplementation). The `shim` list is the real to-do list. | 53 | `shim` (needs a reimplementation). The `shim` list is the real to-do list. |
| 53 | 3. **.pdata function count.** This gives function boundaries for patching and later analysis. | 54 | 3. **.pdata function count.** This gives function boundaries for patching and later analysis. |
| 55 | 4. **Inline command-list writes.** `python -I tools/inline_scan.py <game>\game_scarlett_master.exe --sites` (a few | ||
| 56 | minutes; it streams `dumpbin /disasm`). "UNCHECKED 0" means every inline write checks the cursor limit, so a | ||
| 57 | layer that keeps the cursor at the limit receives every command through the vtable; any unchecked site is a | ||
| 58 | write that layer never sees. The package's DLLs check at every site | ||
| 59 | ([d3d12_command_objects.md](d3d12_command_objects.md), "Every inline write in the package's DLLs checks first"). | ||
| 54 | 60 | ||
| 55 | Then `runtime\build\gta6rt.exe --dry-run <exe>` maps the image and binds every import to the shim table without | 61 | Then `runtime\build\gta6rt.exe --dry-run <exe>` maps the image and binds every import to the shim table without |
| 56 | running any game code. It reports what it couldn't bind. | 62 | running any game code. It reports what it couldn't bind. |