Skip to content

Latest commit

 

History

History
1442 lines (1216 loc) · 93.1 KB

DEVELOPMENT_LOG.md

File metadata and controls

1442 lines (1216 loc) · 93.1 KB

Development Log

All times UTC. This log is append-only and records what was actually done, run, and observed.


2026-11-16 — Session 1: Reconnaissance + toolkit bootstrap

Environment (observed)

  • OS: Windows 11 Home 10.0.22631 (x64)
  • CPU: AMD Ryzen 7 5700G (8C/16T)
  • RAM: 47.6 GB
  • GPU: NVIDIA GeForce RTX 5060 Ti (primary); a "Meta Virtual Monitor" virtual adapter also present
  • Disk: D: has 321.7 GB free (project lives on D:); C: 127 GB free
  • Toolchains found:
    • Rust rustc 1.99.1, host x86_64-pc-windows-msvc, via rustup. Build+link+run smoke test PASSED.
    • MSVC VC tools: VS 2026 Community (18.9.12105.275), toolset 14.16.27023 at C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.16.27023 (also VS 2017 present).
    • .NET 10.0.400 (dotnet)
    • git, node
    • No usable Python — the python.exe on PATH is the Microsoft Store App Execution Alias stub, not a real interpreter.
    • cmake, ninja, standalone clang, dumpbin not on PATH.
  • MCP reverse-engineering servers available: rea and ida. These are the primary binary-analysis tools once the real executable is extracted.

Actions

  1. Inspected working directory: contained only CLAUDE.md (not a git repo).
  2. Created input/analysis/docs/src layout.
  3. Probed the supplied archive URL via HTTP HEAD:
    • Status 200, Content-Length = 27,385,950,541 bytes (25.51 GB), Content-Type: application/zip, Accept-Ranges: bytes (resumable).
  4. Wrote input/original/download_metadata.json.
  5. Started a resumable background download with curl.exe -L -C - --retry 5. (in progress)
  6. Chose Rust for the binary toolkit (see ADR-0001).

Status of milestones (CLAUDE.md §12)

  • [~] 1. Archive downloaded and checksum recorded — download IN PROGRESS (25.5 GB).
  • 2. Dump extracted and inventoried.
  • Remaining milestones blocked on the download completing.

Next priorities

  • While download runs: build + test the PE/COFF parser against known Windows PEs (does not need the real binary).
  • On completion: verify SHA-256, extract safely, inventory, identify main executable + modules, parse it, enumerate imports to find Xbox/GDK dependencies.

Progress during the download (same session)

  • Built tombox-pe + pe-inspect (zero-dep PE32+ parser). 8 tests pass incl. real kernel32.dll (1671 exports, CreateFileW present, AMD64/PE32+), a no-panic sweep over random / PE-shaped / truncated inputs, and a DIR64-relocation assertion. Verified pe-inspect on a real binary: full header/section/import/dir/TLS/reloc report + valid JSON.
  • Studied AnyPS5 (delegated Explore agent; docs/ANYPS5_STUDY.md). Confirmed a static-relink + reimplemented-syslib design. Drove ADR-0002: native x64 execution with import redirection, not emulation. Noted AnyPS5 avoids MSVC only due to SysV-ABI catch handlers — not a constraint for Xbox, so Rust/MSVC is the right fit.
  • Verified public Xbox facts (web): GDK D3D12.x, MicrosoftGame.config/MSIXVC flat-file layout, DXIL+offline-precompiled shaders — specifics NDA-gated → will come from binary evidence. Wrote docs/XBOX_RESEARCH.md with confidence tags.
  • Built tombox-archive + zip-inspect (zero-dep, ZIP64-aware central-directory reader + extraction safety validator). 9 tests pass: ZIP64 64-bit size resolution, path-traversal / absolute / drive-letter / UNC / symlink blocking, bomb-ratio warning. Verified on a real Compress-Archive zip. This gates the 25 GB extraction.
  • Wrote docs: README, ARCHITECTURE, COMPATIBILITY, TECHNICAL_DEBT, FORTNITE_ANALYSIS, DECISIONS (ADR-0001/0002), ANYPS5_STUDY. Initialized local git (game data/refs/target excluded).
  • 17 tests total, all passing. Toolchain: full Rust build/link/run confirmed; MSVC toolset located (VS 2026, 14.16).

2026-11-16 — Session 1 (cont.): download complete + real binary analysis

Download & verification

  • Archive downloaded in full: 27,385,950,541 bytes (size matches server exactly).
  • SHA-256 (archive): 433E7B3B65C0C51A4F20001721F7CC9FDA9AE97A0022A7F7B5AA94914BEFCA95
  • zip-inspect on the real archive: ZIP64, 834 entries, safe (0 blocking findings).

Extraction (selective, safe)

  • Vetted first, then extracted code only (Binaries + System32 DLLs/EXEs + manifests + symbols = ~390 MB) via .NET ZipFile with a path-traversal guard; skipped 24 GB of assets.
  • Structure: EmbeddedXvd/ (Xbox GameOS system image, 276 System32 DLLs) + Mount/ (game package). Loose decrypted files — not an encrypted XVC (premise confirmed).

Main executable (parsed with pe-inspect)

  • FortniteClient-XSX-Shipping.exe, 150 MiB, PE32+/AMD64, WINDOWS_GUI, MSVC linker 14.24, entry RVA 0x229a298, image base 0x140000000, ASLR/DEP, 2,045,522 DIR64 relocations, TLS present, 8 sections incl. Xbox-specific .xbld.
  • SHA-256 (EXE): 0B3D2E5968B0913EB01F52612793BFCC1984FF9764BD15D1C5AABF4830FCC3A0
  • 67 import modules / 670 functions. ~52 are standard Windows API-Sets/UCRT (BindOS candidates). Reimplementation list is short: d3d12_xs, xmem, xg_xs, GameInput, XAudio2_9, AcpHal, XCRDAPI(DirectStorage), dxcompiler_xs, + dynamic xgameruntime.
  • Analyzed each Xbox system DLL's exports/imports (analysis/syslib/*.json): d3d12_xs is a 33 KB thin shim exporting standard D3D12 COM + Xbox ext; xgameruntime exports only QueryApiImpl dispatch and is dynamically loaded (not a static import).

Shaders

  • DXBC/DXIL confirmed (not alien microcode): dxcompiler_x/xs.dll (DXC) + dxbc2dxil_xs.dll present; EXE imports DxcCreateInstance. Top graphics risk (R1) downgraded.

Symbols

  • FortniteClient-XSX-Shipping-Symbols.bin = UE console symbol DB, decompresses to 118 MB of demangled C++ names. Startup chain: GuardedMain→FEngineLoop→RHIInit→FD3D12DynamicRHI.

Milestones reached (CLAUDE.md §12)

  • 1 Archive downloaded + checksum. [x] 2 Extracted + inventoried. [x] 3 Main exe + modules identified. [x] 4 Executable parsed/validated. [x] 5 Dependencies/imports mapped.
  • [] 6 Xbox loader requirements: substantially understood (dynamic xgameruntime, .xbld, import redirection). [] 7 Architecture: ADR-0002 confirmed by evidence.

Next priorities

  1. Decode -Symbols.bin address↔name map; inspect .xbld.
  2. Enumerate GDK QueryApiImpl surface via symbol-labelled call sites (REA/IDA).
  3. Begin the loader PoC: map + DIR64 reloc + import table build with redirection + fail-loud unsupported-feature table (now evidence-justified).

2026-11-16 — Session 2: real binary + first compat DLLs

Archive (downloaded, exact size match 27,385,950,541 bytes)

  • zip-inspect: ZIP64, 834 entries, 0 symlinks/traversal → safe. SHA-256 in input/original/sha256.txt.
  • Structure: Mount/ (game) + EmbeddedXvd/ (Xbox GameOS System32 DLLs) + era.vbi. NOT an encrypted XVC — loose decrypted files (premise holds).
  • MicrosoftGame.config: main exe FortniteClient-XSX-Shipping.exe, TargetDeviceFamily="Scarlett", RequiresXboxLive=true.
  • Selectively extracted ~375 MB of code (Binaries + System32 + manifests); skipped 24 GB of .ucas/.pak/.mp4 assets.

Main EXE (FortniteClient-XSX-Shipping.exe, 157 MB)

  • PE32+ / AMD64, 8 sections, LARGE_ADDRESS_AWARE, ASLR/DEP/HIGH_ENTROPY_VA, subsystem WINDOWS_GUI, linker 14.24 (MSVC2019), entry 0x229a298, image base 0x140000000, 2,045,522 base relocs.
  • 67 import modules / 670 functions. ~52 are standard Windows API-Sets/UCRT (bind to real Windows). Delay import: GameChat2.dll.
  • Xbox-only modules (the reimplement list): d3d12_xs (6), xmem (10), xg_xs (1 XGCreateTextureComputer), GameInput (ord #1), XAudio2_9 (ords #1-6), AcpHal (6), XCRDAPI (DStorageGetFactory), dxcompiler_xs (DxcCreateInstance).
  • FD3D12DynamicRHI present, FScarlett/ScarlettRHI absent → D3D12.x handled inside the normal D3D12 RHI → D3D12.x is a dialect of PC D3D12.
  • Symbols: Mount/Symbols/*-Symbols.bin = UE console symbol DB, [magic 0x076b85ee][size][zlib] → 118 MB of demangled C++ names (GuardedMain/FEngineLoop/RHIInit present). Record layout [rva][size][?]×1,245,949 + length-prefixed string table (full decode deferred; names confirmed present).

VALIDATED ON REAL HARDWARE (user)

  • User launched the EXE natively on Windows: it loads to import resolution and only fails on missing Xbox-only DLLs → confirms ADR-0002 (native x64 + import redirection), no CPU emulation.
  • Build 1 DLLs (xmem, d3d12_xs, xg_xs, xcrdapi): exports verified == imports via our own pe-inspect; static CRT; only import kernel32/ntdll/apisets. xmem heap-backed (real), rest fail-loud stubs, all call-logged to %TEMP%\tombox_compat.log.
  • After build 1, loader advanced and requested dxcompiler_xs.dll + AcpHal.dll → Build 2 shipped (both verified).

Next

  • Await user's next-missing-DLL + the compat log (call order) → implement earliest-called Xbox API for real; D3D12 device creation is the expected wall (needs the graphics backend).

2026-11-16 — Session 2 cont.: boots to GDK runtime init (major milestone)

Milestone reached: the real game runs its own engine code

After the compat DLLs + two xmem fixes, FortniteClient-XSX-Shipping.exe loads natively and executes its own startup code. Verified via a purpose-built debug tracer (scratchpad mdbg.rs: DEBUG_ONLY_THIS_PROCESS loop capturing OutputDebugString, exceptions, exit-sink stack).

Two real bugs found + fixed from runtime evidence (not guesses)

  1. XMemVirtualAlloc passed Xbox allocation-type bits (0x20000000) to Windows VirtualAlloc → read as MEM_LARGE_PAGES → ERROR_INVALID_PARAMETER → null → UE memory init failed. Fix: mask to Windows-valid alloc-type bits.
  2. XMemVirtualAlloc committed pages as PAGE_NOACCESS (Xbox prot value 0x1 passed through) → game wrote to committed page → ACCESS_VIOLATION (confirmed via minidump + disasm: mov [rax],r15, rax = our returned pointer). Fix: committed pages get READWRITE (EXECUTE_READWRITE if execute requested); reserve stays NOACCESS.

Current wall: Xbox GDK runtime (XGameRuntime) init → clean exit(1)

OutputDebugString trace shows the GDK runtime bootstrapping its service objects (SErrorImpl, SUsersImpl, SGameImpl, SUserDeviceAssociationsImpl, SMultiplayerNetworkingImpl, SSystemImpl, SFeatureImpl, SAsyncImpl, SPersistentLocalStorageImpl — all "Created"), then all "Destroyed" and the process exits 1. XERROR: HR:80070006 ... TaskQueue during teardown. Graphics (d3d12_xs) is NEVER reached — this is platform/GDK init, before the RHI. Exit-sink stack walk: main/WinMain already returned (CRT teardown), i.e. a clean decision to quit, not a crash.

Why: the title needs the Xbox GameOS environment

  • MicrosoftGame.config TargetDeviceFamily="Scarlett"; appxmanifest.xml has <uap7:OSPackageDependency Name="Microsoft.GameOs" .../> and an Xbox proxy entry point. XGameRuntimeInitialize expects the console runtime/identity.
  • Package registration ruled out: Add-AppxPackage -Register → 0x80073CFF (no sideloading license); and the Microsoft.GameOs dependency can't be met on desktop Windows anyway.

Next phase (decided): XGameRuntime / GDK compat shim

Reimplement the Xbox GDK runtime surface (XGameRuntimeInitialize succeed, XTaskQueue, XAsync, XUser, XGame, PersistentLocalStorage, etc.) — the platform-services layer anticipated by CLAUDE.md §B. Same incremental method: shim → run → read the call log → implement the next required function. This is a substantial new subsystem.

Tooling added this session

  • mdbg debug tracer (OutputDebugString + exception + exit-stack capture) — to be formalized into the repo as tombox-trace.
  • mdparse minidump parser (exception code/address/faulting module).

2026-11-16 — Session 2 cont.: root cause pinned to the instruction (UE project load)

Milestone: the game boots into UE engine init; exit cause fully traced

Built a self-contained x64 disassembler (crates/tombox-disasm, iced-x86 + tombox-pe RVA mapping + symbol resolution) and a full symbol resolver from the shipped FortniteClient-XSX-Shipping-Symbols.bin (1,245,949 named functions; verified: EXE entry RVA 0x229a298 -> WinMainCRTStartup). Extended the debug tracer (mdbg) with EXE breakpoints + register/stack/FString capture + a continuing CreateFileW probe.

The exit path, traced end to end (all confirmed at runtime)

WinMainCRTStartup -> WinMain (0xb45c64): calls XGameRuntimeInitialize (succeeds), GuardedMainWrapper -> GuardedMain (0xb46088) -> EnginePreInit (0x2bcd12c) -> FEngineLoop::PreInitPreStartupScreen (0xe6d82c) returns 1 (captured eax=1 at EnginePreInit's test). Bisected PreInitPreStartupScreen by runtime breakpoints to: IProjectManager::Get -> virtual [+0x10] = FProjectManager::LoadProjectFile (RVA 0x15071cc) returns FALSE -> PreInit bails before RHI (no d3d12_xs ever called).

Root cause (exact)

LoadProjectFile -> FProjectDescriptor::Load (0x15072e4) -> FFileHelper::LoadFileToString("../../../FortniteGame/FortniteGame.uproject") returns FALSE (captured al=0). The game cannot read its project descriptor and aborts. Notes:

  • No .uproject exists anywhere in the package (archive, EmbeddedXvd, EXE strings).
  • Placing a valid .uproject at the resolved relative path (Mount/FortniteGame/) did NOT satisfy it; the read still fails.
  • A CreateFileW trace caught zero file opens -> the GDK/Xbox platform file layer uses a different API (almost certainly CreateFile2) and/or a package-mount namespace, not plain Win32 loose-file reads.

Interpretation

On real Xbox the project descriptor is served by the console package file system (FXboxPlatformFile) from the cooked package; our loose-file PC layout + the absent Xbox platform-file semantics mean the read fails. Next subsystem: Xbox platform file / content mounting (how the title resolves and reads packaged files), to make FFileHelper::LoadFileToString succeed for the descriptor (and later, pak/IoStore).

Tooling note

crates/tombox-disasm is committed. The diagnostic tracer (mdbg), minidump parser (mdparse), symbol resolver (symres) and export/IAT readers currently live in the session scratchpad and should be formalized into the repo (tombox-trace, tombox-sym).

2026-11-16 — Session 2 cont.: REAL D3D12 DEVICE CREATED; full engine init runs

The game now runs its entire Unreal Engine init on PC

With G:\ mapped to the package (subst) and the compat layer, FortniteClient-XSX boots through its real init, with full UE logging:

  • FEngineLoop PreInit (project descriptor now loads from G:\FortniteGame)
  • IoStore/DirectStorage (XCRDAPI DStorageGetFactory -> forwarded to real PC dstorage.dll with PC IID substitution; Xbox/PC IDStorageFactory compatible)
  • APU audio heap (AcpHal ApuCreateHeap/ApuAlloc/ApuHeapGetState -> real host memory)
  • Chaos physics, localization, LogOnline/MCP, GDKInput (5 controller devices), Slate (UI user)
  • D3D12RHI: XGCreateTextureComputer (REAL xg_xs.dll used as-is — pure RDNA2 tiling math, self-contained: imports only msvcrt + api-ms-win-core + our xmem)
  • D3D12XboxCreateDevice -> created a REAL PC D3D12 device (host d3d12.dll; Xbox device IID == PC ID3D12Device {189819f1-...}, hr=S_OK, live device handle)

Current wall: D3D12.x device interface divergence

RootDevice->QueryInterface(__uuidof(IDXGIDevice)) fails: Xbox D3D12.x merges the DXGI device into ID3D12Device; PC keeps them separate. First point where D3D12.x needs a wrapper/translation, not a plain forward. Next phase: a COM proxy for the device (handle QI for IDXGIDevice + Xbox-specific methods, forward the rest), then command queues, swapchain/present, resources, PSOs, shaders.

Key technique discovered

Some Xbox DLLs are pure computation and run on PC as-is (real xg_xs.dll). Others forward to PC equivalents with IID substitution (DStorage, D3D12 device). Only the hardware/semantics-divergent surface needs real translation.

Milestones (CLAUDE.md §12)

  • 12 Actual Fortnite reaches meaningful initialization — ACHIEVED (full UE init).
  • [~] 11 Graphics device initialized — device CREATED; post-device RHI setup pending the D3D12.x wrapper.

2026-11-16 — Session 2 cont.: real GPU driven; D3D12.x translation layer underway

The real binary drives our RTX 5060 Ti through D3D12 setup

FortniteClient-XSX runs its full engine and now performs real GPU work via a D3D12.x -> PC D3D12 translation layer (crates/compat/d3d12_xs):

  • Device wrapper (COM): QI returns self for ID3D12Device..Device8 and synthesizes the Xbox "DXGIDevice" (GetAdapter -> real PC IDXGIAdapter -> game reads RTX 5060 Ti, 7891MB VRAM). 160-slot vtable: 0-43 forward via naked thunks; 44+ are Xbox extensions -> fail-loud E_NOTIMPL stub unless intercepted.
  • Verified translations: CheckFeatureSupport (Xbox 64B vs PC 60B struct-size negotiation), CreateDescriptorHeap (wraps heap), CreateCommandQueueX slot 48 (Xbox desc -> PC CreateCommandQueue, created a real compute queue hr=S_OK).
  • Heap wrapper: fixes the Xbox(RAX)-vs-PC(sret fn(this,Handle* retval)) return convention for GetCPU/GPUDescriptorHandleForHeapStart.

Current frontier: Xbox D3D12.x method signatures

Next blocker is the Xbox command-list create (device vtable slot 73): standard PC CreateCommandList signature does NOT match (args mismapped -> E_INVALIDARG), so the Xbox vtable relocates/extends methods and some take Xbox-specific signatures. Resolving each needs the GDK d3d12_x headers or per-method RE. The remaining graphics path (command lists, resource creation, PSOs/shaders, swapchain/present) is a methodical per-method translation grind — the technique is proven; the volume is large.

Milestones

  • 12 meaningful initialization — done (full UE init + GPU device + queues).
  • [~] 11 graphics device + required features — device/caps/heaps/queues done; command lists onward pending D3D12.x ABI reversing.

2026-11-16 — Session 2 cont.: real GPU command infrastructure up

The game drives the real RTX 5060 Ti through D3D12 command setup

Continued the D3D12.x translation by reversing each Xbox method's ABI from its call site (no headers needed):

  • CreateCommandQueueX (slot 48): Xbox queue desc -> PC CreateCommandQueue. Real compute queue created (hr=S_OK).
  • Command-list create (slot 73): reversed the Xbox signature from the call site — takes a params struct {Type@0, NodeMask@8} by pointer, not inline args. Translated to PC CreateCommandList (nodeMask must be non-zero). Real DIRECT list created.
  • Close-on-create: PC CreateCommandList returns an OPEN list; the Xbox RHI expects it CLOSED then calls Reset() — closing it on create fixed an nvwgf2umx (driver) crash in FD3D12CommandListData::Reset.
  • Descriptor-heap handle ABI: switched from wrapping the heap (which leaked our wrapper into real SetDescriptorHeaps -> driver crash) to patching the shared ID3D12DescriptorHeap vtable slots 9/10 in place (VirtualProtect) — heaps stay real, handle getters bridged (Xbox RAX vs PC fn(this, Handle* retval)).
  • Robust 160-slot device vtable: standard methods forward, Xbox extensions default to fail-loud E_NOTIMPL stubs (no crashes), specific ones intercepted.

Current frontier: command-list recording method slots

The game now Reset()s and records on the real command list, then its own Close() fails -> the command-list recording methods (barriers, descriptor binds, draws — ~50) are at Xbox vtable slots that differ from PC, corrupting the recording. Fix is a command-list wrapper that remaps Xbox slots -> PC methods AND unwraps on ExecuteCommandLists. That object-graph wrapping (command lists, resources, PSOs)

  • swapchain/present + shader handling is the remaining rendering-pipeline work — proven approach, large volume.

Milestones

  • 12 meaningful initialization.
  • [~] 11 graphics device + features: device, caps, descriptor heaps, command queues AND command-list creation/reset all driving the real GPU; command recording -> present is the next phase.

2026-11-16 — Session 2 cont.: Xbox D3D12.x command-list vtable solved

Root cause of the descriptor-table crash: a +4 vtable slot shift

Enabled the D3D12 debug layer (TOMBOX_D3D12_DEBUG) in the shim — its validation messages flow through OutputDebugString into the tracer, turning opaque driver crashes into precise errors. It reported #646 INVALID_DESCRIPTOR_HANDLE in SetGraphicsRootDescriptorTable(root=2, handle=). Patched the shared command-list vtable to log binds + caller RVA: the caller was FD3D12DescriptorCache::SetDescriptorHeaps calling command-list slot 32 with (NumHeaps=2, ppHeaps=&{srvHeap,samplerHeap}) — i.e. it was SetDescriptorHeaps (PC slot 28), not SetGraphicsRootDescriptorTable (PC slot 32).

Reverse-engineered the Xbox command-list vtable from call sites in the Fortnite RHI: slots 0..=26 are identical to PC (verified: Close=9, Reset=10, DrawInstanced=12, DrawIndexedInstanced=13, Dispatch=14, SetPipelineState=25, ResourceBarrier=26), then 4 Xbox-specific methods are inserted after PC slot 27, shifting every method >=28 by +4 (SetDescriptorHeaps 28->32, OMSetRenderTargets 46->50, all verified).

Fix (cmdlist_wrap.rs): build an "Xbox-layout" vtable whose slot i holds the real PC method pointer for the mapped PC slot (identity 0..=26, stub 27..=31, i-4 for

=32), then repoint each real command-list object at it. No thunks needed — the object IS the real list, so the real method runs on the real this. Slots 0..=26 stay identical so the runtime's own QI/GetType/AddRef/Release still work at ExecuteCommandLists time.

Result: #646 gone, all D3D12 validation clean. The game now records and submits GPU work correctly. New blocker is unrelated: IoStore/.ucas content containers fail to open (DirectStorage path), fatal at pak mount.

Milestones

  • 11 graphics device + required features: device, caps, descriptor heaps, command queues, command lists, descriptor-table binding all correct on the real GPU with zero D3D12 validation errors.

2026-11-16 — DirectStorage container open + found incomplete extraction

Xbox DirectStorage OpenFile IID substitution

With the command-list vtable fixed, the next fatal was IoStore content: the Xbox IoStore backend (FXSXFileIoStoreImpl::OpenContainer) opens .ucas containers via DirectStorage factory->OpenFile (slot 4, PC-compatible slot). It passes the Xbox IDStorageFile IID, which PC OpenFile rejects (like the factory IID). xcrdapi now patches the real factory's vtable slot 4 to substitute PC IID_IDStorageFile {5de95e7b-...}. Result: OpenFile succeeds, containers open, pakChunkEarly-XSX mounts, plugins mount, device-profile CVars apply.

ROOT ISSUE found: the dump was only partially extracted

The remaining fatal (appError Line 644) is almost certainly missing content: the original ZIP is 834 entries / 26.9 GB, but only 905 MB (302 files) had been extracted — just the smallest paks (global, pakChunkEarly, pakchunk0). Missing: pakchunk10-XSX.ucas (21 GB — the bulk of the game), pakchunk12/7/8/2/5/11, all Movies, 468 files total. Verified the 302 present files are byte-complete (no truncation). Extracting the missing 468 now (disk has 294 GB free).

2026-11-16 — Full content + physical memory + resource/texture creation

After extracting the full 26.9GB dump (was partially extracted), cleared a chain of real blockers past engine init into GPU resource creation:

  1. XMemAllocatePhysicalPages / XMemMapPhysicalPages (xmem.dll): were stubs returning null -> fatal "AllocateTitlePhysicalPages failed" (Line 644). Implemented commit-on-map emulation of Xbox 64KB title physical pages (grant PFN tokens on allocate; VirtualAlloc-commit the reserved VA on map). The transient memory allocator now initializes (1792 DRAM pages).
  2. sret device thunks (device_wrap): GetResourceAllocationInfo (25) and GetCustomHeapProperties (26) return >8-byte structs by value, so this is in rdx (rcx = hidden return ptr). The generic rcx-forwarding thunk null-derefed. Added fwd_sret! thunks that redirect rdx.
  3. CreateCommittedResource (27): intercepted to substitute PC IID_ID3D12Resource (already matched, but robust) — real resources create (buffers hr=0).
  4. GetResourceAllocationInfo (25): the real D3D12Core method faults deep in its texture-tiling sub-function (vtbl+0x25829) for Xbox texture descs even after full desc sanitization (valid device, valid 1x1 BGRA desc). Compute the info ourselves from the D3D12 64KB standard-swizzle tile model, over-estimating so the pool never under-reserves. Texture allocation crash cleared.

Current frontier: GPU device removal

With CPU-side resource/texture creation working, a GPU operation during resource setup triggers DXGI device-removed ("GPU Crashed or D3D Device Removed", Line 656). Likely the unified-memory gap: Xbox places GPU resources on app physical pages (GPU-visible on console); our commit-on-map gives CPU VirtualAlloc memory the GPU can't access. Investigating.

2026-11-16 — ★ FIRST WINDOW: real Fortnite XSX binary opens on PC ★

MILESTONE 13 reached. After the presentation-init stubs (S_OK), the real FortniteClient-XSX-Shipping.exe created and presented its own window on the desktop (titled "Fortnite", blank first frame) before continuing init — the actual supplied Xbox Series console binary driving a live D3D12 swap chain on the RTX 5060 Ti. Confirmed visually by the user.

Async asset streaming (DirectStorage read path)

After the window, the IoStore I/O thread (FXSXFileIoStoreImpl::StartRequests) crashed: it enqueues DirectStorage reads on a queue that was null, because we had only substituted the PC IID on OpenFile. Added CreateQueue (factory slot 3) IID substitution (PC IID_IDStorageQueue {cfdbd83f-...}). The queue now creates and the game advances to FFortniteEarlyPreLoadScreen + FAssetRegistry startup + a WinHttp service call.

Current frontier: DSTORAGE_REQUEST translation

Real DStorageCore now fail-fasts in DStorageQueue.cpp:287 with E_INVALIDARG — the Xbox DSTORAGE_REQUEST layout passed to IDStorageQueue::EnqueueRequest differs from PC. Next: intercept EnqueueRequest on the queue vtable, translate the Xbox request (source file/offset/size + destination) to the PC DSTORAGE_REQUEST, or service the read directly. This is the asset-streaming subsystem that gates reaching the menu.

Milestones

  • 13 actual game renders a first frame (window created + presented).
  • [~] 14 main menu: blocked on DirectStorage request translation (asset streaming).

2026-11-16 — DirectStorage complete; content fully loads

Full Xbox DirectStorage -> PC translation now works end to end:

  • Factory IID substitution for OpenFile (slot 4), CreateQueue (slot 3), CreateStatusArray (slot 5).
  • DSTORAGE_REQUEST Xbox->PC field reorder (Dest before Source on Xbox).
  • Reads serviced directly via Win32 (CreateFileW in OpenFile -> OS handle map; positioned ReadFile in EnqueueRequest) because DStorageCore's own read path faults on the Xbox-origin requests; the game's Submit still fires status/fence.

Result: all 27GB content streams in, pakchunk10 (21GB) mounts, all 12 bundles install ("All Bundles Installs Complete!"), asset registry starts.

Current frontier: IoStore package-store build

An async task lambda crashes (AV read null) in the FPackageId->FPackageStoreEntry map build (TMapBase::FindOrAddImpl) — the entries buffer [rbp+0xA0] is null. Post-content-load engine init; needs tracing where that buffer is set up (likely a stubbed Xbox path returning null, or an IoStore package-store format detail).

2026-11-16 — Post-content crash: container header not decompressed

Traced the package-store build crash (async lambda in FPackageStore::LoadContainers, deserializing FContainerHeader). Root cause identified precisely via a crash-frame dump: the source buffer handed to the FMemoryReaderView contains ZLIB-COMPRESSED data (magic 0x78 0x9c), and the game deserializes it raw -> first bytes read as a package id/count -> null entries array -> AV read null. (The size field is fine at 0x10000; an earlier read of the 40-bit size looked wrong but the byte at +0x18 is 0.)

The buffer is memory-mapped (0x7ff4_xxxx_xxxx), NOT one of our 4 DirectStorage dest buffers, so it comes from a read path (FIoDispatcherImpl::ReadWithCallback) where the chunk's decompression isn't applied on PC. On Xbox this chunk is decompressed (hardware decompression via the Velocity Architecture / DirectStorage) before deserialization.

NEXT: trace the container-header read/decompress path; either the engine expects DirectStorage to decompress (CompressionFormat in the request) and our self-serviced reads must zlib-inflate, or the engine's own decompress step is being skipped. All DirectStorage self-service reads verified complete/non-zero (not the cause of bad data elsewhere).

2026-11-16 — ContainerHeader decompression/routing (precise localization)

Deepened the package-store crash analysis:

  • The source buffer handed to the FContainerHeader deserializer is zlib-compressed (78 9c) and memory-mapped (0x7ff4_xxxx_xxxx).
  • Our 4 DirectStorage reads are all uncompressed plaintext (verified: readable strings, CompressionFormat=0, src==dst size) -> NOT the cause.
  • FCompression::UncompressMemory IS called with zlib (78 9c) data during load, so the zlib path works. ScatterBlock's synchronous UncompressMemory (0x5c0789) is NOT hit before the crash; decompression goes via another caller (FDecompressAsyncTask).
  • Conclusion: the ContainerHeader's decompressed output is not routed to the deserializer — the lambda's captured buffer ([this+0x18]) still points at the compressed source. It's a read-callback buffer-plumbing difference, not a missing decompressor.

NEXT: add log-and-continue (single-step replant) support to mdbg (cfw_handle already does the trap-flag dance) so every UncompressMemory call + result + caller can be logged; then find where the ContainerHeader read hands the compressed source to the callback instead of the decompressed buffer. Chunk type = 0x0A (ContainerHeader), read via FIoDispatcherImpl::ReadWithCallback from FPackageStore::LoadContainers.

2026-11-16 — ROOT CAUSE: compressed container header read without decompression

Found the exact data behind the package-store crash:

  • The buffer deserialized as FContainerHeader is the raw contents of pakchunk9-XSX.ucas at file offset 0 (verified: the exact bytes the game deserialized, 789ced..., are at offset 0 of pakchunk9-XSX.ucas and NOWHERE else).
  • pakchunk9-XSX.utoc: 433 compressed blocks, 1 method = "Zlib", block size 64KB. block[0] (offset 0) = {compSize 2707, uncompSize 65536, methodIdx 1=Zlib}. It zlib-inflates cleanly to a valid 64KB container header (starts with an FIoContainerId).
  • So the container header IS correctly Zlib-compressed per the TOC, but the engine hands the deserializer the RAW compressed block — it is not decompressing it.
  • global/pakchunk0/pakChunkEarly have UNCOMPRESSED headers (no 78 9c at offset 0), which is why they loaded and pakchunk9 is the first container to crash.
  • FCompression::UncompressMemory is called during load but only from the .pak path (FPakUncompressTask); the IoStore ScatterBlock decompress (0x5c0789) is never hit before the crash. So the IoStore compressed-block decompression is not running for this container-header read.

This is the hardest blocker so far: it's not a shim-returns-wrong-value bug, it's the engine's IoStore read/decompress routing differing on PC. Fix options: (a) make the engine's IoStore decompression run for this read (trace why ScatterBlock/mmap path skips it), (b) intercept the container-header file read and return inflated data (needs file I/O hooking, scoped to not double-decompress content), (c) rewrite affected .ucas/.utoc to store uncompressed headers (offset-shift the whole container — deterministic but heavy).

2026-11-17 — Shader format cracked; RDNA2 translator foundation built

Reached the game's own "Gaming UI" window (black). Root-caused the black screen: every graphics PSO fails because the shaders ship as Xbox-native code, DXIL stripped. Reversed the full chain with evidence: DXBC → DXIL(NOBC) → XDAT v3 → zlib(78 9c) → FSSM(v0x101) → native RDNA2 ISA (confirmed by s_waitcnt/s_endpgm/s_code_end/s_cbranch markers). Not encrypted.

Decision (user): build the real translator. Architecture: runtime JIT at PSO-create (Xbox device slot 60/55), per-hash disk cache, backend RDNA2 → HLSL → dxc → DXIL. Rationale: RDNA2 VGPR ops are per-lane = per-thread, mapping cleanly to HLSL; dxc handles DXIL emit+signing.

Built crates/tombox-xshader (2 passing regression tests):

  • extract(): DXBC→XDAT→zlib→FSSM→ISA, bounds-checked, validated against RDNA2 markers.
  • rdna2::disassemble(): length-accurate decoder + full operand decode (SOP*/SMEM/VOP*/VINTRP/ EXP), self-validated by landing exactly on s_endpgm (VS 67 instrs/400B, PS 117/604B).

Next: VOP opcode-semantics table → RDNA2→HLSL emitter (straight-line first) → dxc compile → wire into create_gfx_pso_x with caching + fallback. See docs/FORTNITE_ANALYSIS.md.

2026-11-17 (later) — network guard, frame pacing, first visible frame

Network guard. Once pipeline creation worked the title's online subsystems started and issued real WinHTTP requests (analytics to datarouter.ol.epicgames.com, observed succeeding). compat-common::net_guard now fails DNS/connect/sendto/WinHTTP in-process (14 entry points); every run summary prints the guard status. Details and gaps in docs/TECHNICAL_DEBT.md.

Translator. Block dispatcher for CFGs that are not nested loops, 64-bit vector shifts, flat_load_dword* from embedded constant tables (only the table tail is emitted: FXC's 4096 indexable-literal limit). Global archive coverage 1410/1689 (83.5%).

Command-list shim. FD3D12StateCacheBase::ApplyState (EXE+0x4e0433) writes command packets inline through [list+18h]/[list+30h] and only calls the vtable when the buffer is full. The title now receives a zeroed shim object (write ptr == end ptr) whose thunks forward to the real list; ExecuteCommandLists unwraps shims. Only that one inline site is verified.

Frame pacing (d3d12_xs/src/frame.rs). The stall after engine frame 8 was the game thread waiting on a flip-synchronised render fence (UE watchdog FThreadHeartBeat then killed the process ~90 s later). Device slots 78/79/80/81 = SetFrameIntervalX / ScheduleFrameEventX / WaitFrameEventX / per-token frame statistics, reconstructed from XboxCommonGDKUpdateFrameEvents, FD3D12Viewport::PresentInternal, RHIWaitForFlip and GetFrameStatisticsForMostRecentFrame. Implemented: interval timer, flip-event signalling, tokens, statistics for tokens that reached PresentX.

Result (verified, repeatable twice undebugged): the title runs > 3 minutes without the watchdog firing, the game thread is in UGameEngine::Tick, 4000–5400 PresentX frames, and the host window shows drawn, animated content — a blue full-screen background with a yellow rotating quad (analysis/evidence/2026-11-17_first_visible_frame_{a,b}.png). This is output of the title's own draw calls through translated shaders.

Not yet true: no textures (device slot 44 CreatePlacedResourceX and slot 61 sampler are still stubs, cmdlist slots 67/68/83 are no-ops), so logos/text are missing; no audio; one debugger run showed a 14 s RHI-thread stall followed by a watchdog kill (not reproduced undebugged; cause unknown).

Tools: tools/dev/mdbg.rs gained MDBG_LIMIT and MDBG_HANGDUMP (all-thread stack scan); tools/dev/hang.sh symbolises the dump.

2026-11-17 (evening) — placed textures, title screen visible

Slot 44 CreatePlacedResourceX. Call site FXboxCommonD3D12Adapter::CreatePlacedResourceX (EXE+0x5c4610) passes (VirtualAddress, desc, InitialState, null clear, riid, ppv) — the public GDK signature. Caller CreateVirtualTexture reserves a 64 KiB-aligned block (streamed textures) or takes memory from a small-texture pool / XMemAlloc. Implemented as a committed PC texture plus a registry entry (d3d12_xs/src/placed.rs). ~5,100 textures are created on the way to the title screen, all with Xbox layout value 261.

Slot 61 extended sampler. FD3D12Device::CreateSamplerInternal uses it only for anisotropic filters, with a 0x6C-byte desc copied from the standard one; implemented as the standard anisotropic sampler (two extra clamp fields ignored, meaning unverified).

Texel mirroring (d3d12_xs/src/upload.rs). The texel memory is in the console's tiled layout and the title never announces writes. The real xg_xs.dll from the dump runs natively and provides the layout: tools/dev/xgprobe.rs verified vtable slot 6 (GetTexelElementOffsetBytes) against slot 8 (CopyIntoSubresource) for every element of five texture shapes. Slot 9 (CopyFromSubresource) returns E_INVALIDARG off-console (needs an exclusive-lock object), so de-tiling is done from slot-6 offsets. Each PresentX hashes title memory (new subresources first, uploaded ones round-robin, byte budgets) and re-uploads changes through a private command list.

XMemAlloc alignment. 469 texture allocations use attributes 0x30804000; decoding the XALLOC_ATTRIBUTES bit layout (alignment = bits 24..28, log2) gives 64 KiB. The shim ignored it and returned heap pointers; it now page-allocates aligned requests.

Result (one 170 s debugger run, 2,400 frames): the host window shows the title's own title screen — FORTNITE logo, yellow button with the X-button glyph, Unreal/Epic logos (analysis/evidence/2026-11-17_title_screen_logo.png). The log reaches UFortUIStateWidget_Login::HandleLoginRequestComplete ... Unable to complete login, which is the expected outcome with the network guard on.

Not yet true: no text (font glyph textures are not arriving — path not yet identified); no input, no audio; unmapped streamed mips are skipped (re-tried every frame); command-list slots 67/68/83 are still no-ops; device slot 74 still a logging stub.

2026-11-17 (night) — text, texture copies, network redirect

Command-list slots. Xbox 83 = CopyTextureRegion + one trailing argument (always 0 at FD3D12TextureBase::UpdateTexture and FD3D12RHICommandInitializeTexture), forwarded to PC slot 16; Xbox 68 = OMSetDepthBounds (PC slot 62, inferred from the state cache's two depth-bound floats); Xbox 67 = texture-cache flush, deliberate no-op. With the copies forwarded the font atlas fills in: the title screen now shows "UNABLE TO COMPLETE LOGIN. PLEASE TRY AGAIN LATER.", RETRY and "v14.50 (14617919)" (analysis/evidence/2026-11-17_title_screen_text.png).

Network policy change (project owner's instruction, 2026-11-17): network traffic is now allowed, but must go to the owner's own server horizon.halcy0n.net, never to Epic. compat-common::net_guard gained a redirect mode (TOMBOX_NET_REDIRECT=<host>, set by tools/dev/iter.sh): every requested host name is replaced by the redirect host in the resolver calls and WinHttpConnect; outbound sockets are allowed only to loopback or an address the redirect host resolves to; an entry point that cannot be trampolined fails closed. Without the variable the guard is deny-all as before. Offline test: cargo test -p compat-common --test net_redirect.

Verified in one run: guard logs REDIRECT mode ... 12/12 entry points hooked, 'horizon.halcy0n.net' -> 4 address(es), five WinHttpConnect 'datarouter.ol.epicgames.com' -> 'horizon.halcy0n.net' rewrites, no denied destinations, and the title logs one WinHTTP request State=[Succeeded].

Login still fails before any login request is sent: the GDK layer reports no signed-in user (LogGDKSaveGame: User -1 is not valid, no AuthToken stored for ControllerId -1). Next: find what answers the XUser calls today and what a sign-in needs.

2026-11-17 (late) — local Xbox user and store; login reaches the backend

Finding. The title runs on Microsoft's PC xgameruntime.dll (System32, 10.0.26100.9656). That runtime has no user for this unregistered title, so login aborted at ConsolePrivileges.

compat-common::gdk_user / gdk_store (Fortnite-build-specific, PE timestamp checked). The EXE's statically linked GDK wrappers (found by symbol table) are redirected: 28 XUser* functions to a single local offline user (gamertag/xuid/token from tombox.cfg, all privileges granted, placeholder token, no change events) and 22 XStore* functions to an empty store (no updates, no products, purchases cancelled — grants nothing). Async calls complete through the title's own XAsync wrappers.

Result (one run): login passes ConsolePrivileges, CheckCrossPlayPrivilege, LoginWaitingRoom (served by the owner's backend) and LoginConsole, then FOnlineIdentityMcp::Login Type=xbl_xtoken POSTs to /account on the backend, which answers 501 errors.com.epicgames.authentication.grantNotImplemented. That response is the backend's. Xbox Live hosts (rta.xboxlive.com, userstats.xboxlive.com) are also redirected to the backend.

Unverified / open: the GDK "user not found" HRESULT; other user-taking GDK families (XGameSave, XGameUi) still reach the real runtime with the local handle and will fail there.

2026-11-17 (end) — login completes, game-mode select reached

After the owner's backend accepted the xbl_xtoken grant, the login state machine ran to CreatingParty --> Completed (HandleLoginRequestComplete Result=2). The first attempt then died with "GPU Crashed or D3D Device Removed": really a pipeline-create failure, because one lobby pixel shader samples a texture with implicit derivatives inside a real loop and FXC (SM5) cannot compile that (X3570/X3511). The translator now emits such in-loop samples as LOD 0 (marked APPROX-LOOP-SAMPLE; exact only for single-mip textures) — fixture analysis/shaders/fortnite_loop_sample.dxbc, 25/25 fixtures compile.

Result (one run, driven with synthetic mouse input): safe-zone screen, then the game-mode select screen (Save the World / Battle Royale / Creative, "Signed in as: TomBoxPlayer") — analysis/evidence/2026-11-17_game_mode_select.png.

Input note: the title reads raw mouse deltas (real PC GameInput) and accumulates them in its 3840x2160 space, so the in-game cursor moves at 1/3 window scale and is unrelated to the OS cursor position; tools/dev/mouse.ps1 sends relative moves. Proper window-to-title input mapping is not implemented. No audio.

2026-11-17 (offline) — DXC, and every shader translating

Compiler switch. FXC needs minutes for some generated compute shaders (and an in-process D3DCompile cannot be cancelled), which is what tripped the engine watchdog. DXC compiles the same HLSL in about a second. tombox-xshader::dxc wraps dxcompiler.dll (+ dxil.dll for validation/signing); d3d12_xs uses it when available (TOMBOX_SHADER_COMPILER=fxc forces FXC). xpso creates a real compute pipeline state from translated DXIL plus the container's own RTS0 root signature: 3/3 compute fixtures accepted by D3D12 on this machine. Not yet verified: graphics pipelines, and the DXC path inside the running game.

Translation coverage (xscan, translate only): 105,506 of 105,506 unique shaders (was 105,429). Added: one-of-N buffer/cbuffer descriptors (guarded copies selected at run time); optimistic join for descriptors/table pointers known on one path only; structured buffer addressing with OFFEN and/or IDXEN (flat addressing over the declared element size); f16 K ops, f16 VOP3 abs/neg/clamp modifiers (previously dropped silently for VOP3-encoded f16 ops — a correctness bug, fixed); sub-word LDS; image atomics add/umax on <uint> UAV textures; wave reductions → WaveActiveMin/Max (SM6 only); code-table lookups whose address passes through a VGPR; LDS vertex records indexed by output register; GS table base s22; return from a GS-chained VS.

Inferred, not documented (see code comments): DPP operand codes 233/250, SOP1 0x29, MIMG 0x11/0x17 names, optimistic join rule.

Compile sweep (xscan --compile 1 --jobs 4, below-normal priority, fills the shared cache): in progress. Failures found so far and fixed: high half of a 64-bit scalar move not declared (3 shaders), position input needs centroid interpolation with conservative depth (3 shaders).

2026-11-17 — PC 14.40 shader archives as a reference

The owner supplied extracted PC shader archives (14.40, PCD3D_SM5; kept outside the repo). Format is the same FSerializedShaderArchive as the Xbox one: LZ4 entries, each = engine resource-table header + container + engine trailer. PC containers are plain SM5 DXBC (ISGN OSGN SHEX), i.e. fully documented bytecode; a few are DXIL (ray tracing).

xpair (exploratory) measures pairing keys that both platforms carry:

key Xbox entries with a PC candidate unique candidate
stage + uniform-buffer layout hashes (in order) 88,726 / 113,849 (77.9%) 1,416
+ input/output semantic names 53,668 (47.1%) 11,743
same, hashes sorted 59,608 (52.4%) 11,890

Observed: layout hashes are identical across platforms (e.g. View); the Xbox compiler writes centroid inputs as TEXCOORD10_centroid index 0. Versions differ (14.40 vs 14.50), so a key match is a candidate, not proof that two shaders come from the same source. Not done yet: disambiguation, and comparison by execution.

First reference check (by inspection, not yet automated). xpair --pairs wrote the 3 compute pairs whose key is unique on both sides (MaterialSetupCS, ComputeDistanceFieldNormalCS, LightGridCompactCS). For ComputeDistanceFieldNormalCS the PC disassembly (fxc /dumpbin, 17 instructions) and the translation of the Xbox shader agree instruction for instruction: same thread-ID math, same constant-buffer elements, same texture/sampler/UAV slots and component selections, same store. One shader, read by eye — evidence that pairing and register slots line up, not a general correctness claim.

2026-11-17 — Declarations compared against the PC reference; typed-buffer element types

New: decls module (resource declarations from a PC SM5 SHEX chunk, and from generated HLSL) and xpair --decls, which compares the two for every pair whose key is unique on both sides and non-trivial (4,553 pairs; the 11,7xx figure above counted Xbox entries with one PC candidate, not uniqueness on both sides).

First run (translator as committed in 07dae65):

  • 2,371 pairs agree register for register; 565 differ only in which slot a resource got (the two compilers assign registers independently — binding slots are not generally identical across platforms, correcting the impression from the three compute pairs).
  • ~1,400 differ in whole sampler+texture units or constant buffers present on one side only. Read as: the pairing key does not identify the same material/permutation, or the versions differ. These pairs are not usable as references without a stricter key.
  • Clear translator fault: ~250 pairs where the PC declares Buffer<int>/Buffer<uint> and the translation declared Buffer<float4> (mostly vertex shaders). A float-declared read of an integer-format view is undefined in D3D12.

Fix: infer_tbuf_types recovers the element type of each typed buffer from the first typed use of loaded registers (conversions, comparisons, integer/float arithmetic, use as a memory index; texture sampling coordinates count as float, fetches as integer), follows moves and bitwise logic, stops at unconditional branches, and propagates through direct buffer-to-buffer copies. Signedness is not reliably recoverable: integer buffers are declared uint4 unless a signed operation is seen; the comparison treats sint/uint as equal.

After the fix: 2,576 pairs agree; integer/float disagreements at the same register: 7 (6 + 1), all of them in pairs whose slots are permuted (both sides have the same set of kinds). Two intermediate versions over-inferred (233, then 139 float buffers marked integer) because the scan ran across unconditional branches and counted sampling coordinates as integer indices — both found through this comparison.

Checked: the 36 shaders among the first 70 pairs that now declare integer buffers compile with DXC (vs_6_0); xpso accepts the LightGridCompactCS pair (all five buffers now match the PC types). Not checked: behaviour in the game (new d3d12_xs.dll staged, not run). No fixture added: the evidence needs the game archives, which stay out of the repository.

2026-11-17 (night) — Lobby: empty scene depth traced to swapped MUBUF opcodes

Run with the typed-buffer inference: lobby looked unchanged. Render-target capture (TOMBOX_RTCAP=1) at the lobby:

  • G-buffer targets contain the character and floor, correctly shaded, in the top-left 1600x900 of the 3200x1800 targets (the title renders at 50% dynamic resolution).
  • Scene depth (D32S8 3200x1800): 1 non-zero sample of 639,600. Derived-PSO depth state shows the base pass tests GREATER_EQUAL with depth writes off and a separate depth-only pass (no colour target) writes depth — so an empty depth buffer means the depth pre-pass draws nothing visible, and everything after it (fog, lighting, post) treats each pixel as infinitely far.

Translating the dumped depth-only vertex shader (position-only stream + primitive id → StructuredBuffer of per-primitive transforms) showed impossible code: a 4-dword buffer load into v0..v3 immediately followed by a load indexed by v3, and the same pattern with v10..v13. The ISA only makes sense if those loads write three registers. The MUBUF opcode table had 0x0e/0x0f (and 0x1e/0x1f for stores) the wrong way round: on this hardware generation 0x0e is dwordx4 and 0x0f is dwordx3. Evidence: destination spacing in the same shader (0x0f loads into v13, v16, v19 — three apart; the one 0x0e load into v9 leaves four registers before v13). The store pair was swapped by analogy with the load pair and the public LLVM opcode order; no store has been examined.

Result (same procedure, driven to the lobby by script): depth has 160,200 non-zero samples of 639,600 — the whole rendered quarter. The lobby now shows the backdrop, stage, slot markers and particles (screenshot kept locally, not committed). Still wrong: the image is heavily over-exposed (white character and floor, blue cast).

Tooling fixes: mouse.ps1/capture.ps1/click.ps1 looked for a window titled exactly "Fortnite" (the title has trailing spaces) and could not take the foreground from a background shell; both fixed, drive_lobby.sh works unattended again.

2026-11-17 (night) — Over-exposure traced to a structured buffer read as a constant buffer

New diagnostics in d3d12_xs (all behind TOMBOX_RTCAP=1 / rtcap=1):

  • Draw trace. Hooks on SetPipelineState, OMSetRenderTargets, Draw*, Dispatch, ExecuteIndirect and on CreateRenderTargetView/CreateDepthStencilView attribute each draw of the captured frame to (pipeline, render targets, depth target). A capture writes draws.txt (targets by capture number, shader hashes, depth/blend state) and the original shader containers under shaders/. Recording order across command lists, not execution order.
  • Skip list. %TEMP%\tombox_skip_shaders.txt (hashes, re-read every present) drops draws whose pipeline uses a listed shader — live bisection without restarting.
  • Shader override. %TEMP%\tombox_shader_override\<hash>.hlsl replaces the generated HLSL of one shader (logged as OVERRIDE), to instrument a translation.

Procedure and result:

  1. Scene colour in the lobby had green ≤ 1.2 but red up to ~1,400 and blue up to ~33,800.
  2. Skipping each additive pass into scene colour in turn: only skipping pixel shader 815832c94bb46f01 (entry ReflectionEnvironmentSkyLighting) removed the excess.
  3. Three instrumented copies of that shader (intermediate values written out in screen strips) showed sane G-buffer decode, specular colour, reflection-capture and sky sums; the excess comes from the diffuse sky term, i.e. the spherical-harmonics evaluation.
  4. Its coefficients are read with s_buffer_load_dwordx16/x8/x4 through a descriptor that comes from the SRV table (PSV0 lists a structured SRV at t0), but the translator mapped every scalar buffer load to a constant buffer — here b0, unrelated data.

Fix: a scalar load whose (single) candidate descriptor is in the SRV or UAV table is translated as a read of a structured buffer by byte offset; the element stride is queried at run time (GetDimensions) because it belongs to the view, not the shader. When several descriptors are possible the old constant-buffer reading is kept (debt).

Result: scene colour max 0.66–0.69 on all three channels; the lobby shows the dark stage, blue backdrop and floor pads with plausible tones. Still wrong (screenshot kept locally): the character is not visible; white rectangles flicker in the upper part of the image (bloom-chain targets contain infinities); the floor centre is very bright.

2026-11-17 (night) — Character missing from depth: vertex inputs are packed by read registers

With lighting sane, the capture showed the G-buffer with the fully textured character but a scene depth without it, so later passes shaded those pixels as background.

The skinned depth-only vertex shader (d15c18830a4616f9) multiplies v8..v11 by 3 and uses them as bone-matrix row indices, v16..v19 as weights and v24..v26 as a float vector. Its input signature is ATTRIBUTE0,1,2,3,14,4,15,5,13 with read masks 0 for ATTRIBUTE1, 2 and 5. The translator placed input register r at v[4+4r], which put the bone indices at v16. The code only fits if the fetch shader hands over one group of four VGPRs per input register that the shader reads, in order, skipping unread ones (ATTRIBUTE3 → v8, ATTRIBUTE14 → v12, ATTRIBUTE4 → v16, ATTRIBUTE15 → v20, ATTRIBUTE13 → v24). A second shader with a different skip pattern (54ecf3051dfb9659: only ATTRIBUTE1 and 5 unread, bone indices used from v12) fits the same rule. Base-pass shaders read every input, which is why they worked.

Result: the character is in scene depth and appears in the lobby with correct occlusion (screenshot kept locally). Still wrong: it is almost unlit (dark silhouette), a white rectangle flickers in the upper part of the image (infinities in the bloom chain), and the floor centre is over-bright.

2026-11-18 — Lobby geometry: structured-buffer element size, legacy multiply, precise positions

State after the previous entry: character in depth but unlit; deferred light volumes cover the scene yet are rejected on the character; depth shows no floor.

Findings, each by experiment in the running title (overrides / skip list / draw trace):

  1. Structured-buffer element size is taken from the shader on PC. The depth-only vertex shaders read 3 dwords per row of the per-primitive data and were given a 12-byte element; the buffer has 16-byte elements. D3D12 addressed index * 12, so the depth pre-pass used scrambled transforms (the floor collapsed to a line; another object covered the screen at "infinite" distance). Overriding one shader to declare 16 bytes made the floor appear in depth. The PC reference (xpair --decls, new stride table) shows for 801 structured buffers at the same register: stride 16 where the Xbox code's extent is 8, 12, 16, 20, 24 or 28 bytes (175 of them were declared wrong), stride 64 for extent 64. Rule now: extent of one dword → 4-byte element; 2..7 dwords → 16 bytes, larger constant offsets address following elements; otherwise round up to 16. The one-dword case is needed: ScatterCopyCS reads a real 4-byte index buffer, and forcing 16 there scrambled the per-primitive data it uploads (three different wrong scenes before this was found). This is a heuristic fitted to one title — see TECHNICAL_DEBT.
  2. v_mul_legacy_f32 / v_mad_legacy_f32 now follow the ISA definition (product is 0 when either operand is 0). They were emitted as plain multiplies.
  3. precise on position outputs of non-pixel stages. The base pass tests depth without writing and relies on matching the pre-pass exactly; without precise the character showed holes once it was in the pre-pass.
  4. Vertex-buffer / draw-argument trace added to the capture tooling (%TEMP%\tombox_trace_shaders.txt): confirmed both passes bind the same streams.

Check: all 139 shaders of the lobby frame compile with DXC after these changes.

Result (screenshot kept locally): dark stage with floor pads, the character on its pad inside a translucent blue cylinder, coloured lights at the top; depth has 160,200 non-zero samples of 639,600 and includes floor and character; no white rectangles in this capture. Still wrong / unverified: the character is very dark (direct lighting not yet examined after these fixes); whether the scene matches the real console output is unknown — there is no reference image of this lobby.

Follow-up, same session: why the character is dark

Instrumenting the full-screen directional light (a06ce28faeb9dc00): pre-exposure ≈ 1.1, light colour ≈ (2.9, 2.6, 2.2) — both plausible — but the shader's result is ≈ 0 on every pixel. The light-attenuation (shadow mask) target has its blue channel at 0 on the floor and the character and 1 elsewhere; that channel is written with MIN blending by the per-object shadow projection shader d2397579fc2ea0fa (and red/green by 24915c8b11bee1f2). Both do percentage-closer filtering with image_gather4_lz_o against the D16 shadow atlas. So the lights are being shadowed out. Not yet determined: whether the shadow atlas content or the projection/compare is wrong. The capture tool decodes D16 targets as half floats, so the atlas cannot be read from the current reports (fix the decoder first).

2026-11-18/19 — Lights were skipped: integer textures and integer outputs; binding trace

Correction of the previous entry. The shadow mask was not the cause of the dark character. The binding trace (below) showed that mask belongs to a low-bias rim spotlight behind the character, and its partial value on the floor is what its own constants give.

Cause 1: integer textures declared as float. The deferred light shaders test LightingChannelsTexture.Load(..) & LightingChannelMask. The texture is R16_UINT; the translation declared every texture float4 and reinterpreted the float's bits, so the test failed and the light was skipped. Fix: texel type of textures read with texel fetches (and written with image stores) is inferred like typed buffers (img_ty): integer when the loaded value is used as an integer. Bitwise logic with a small constant now counts as integer evidence; the export tail counts as none.

Cause 2: integer outputs converted through float. (a) Every pixel-shader colour export ends in s_nop; s_nop; v_cvt_pkrtz_f16_f32 x2; exp even for uint4 outputs, where a float-to-half pack of an integer gives 0 (the lighting-channel copy wrote zeros). The tail is taken to be a default that the console replaces per render-target format — inferred from the shape, not observed. The unpacked operands are now exported directly (integers for integer elements, full floats otherwise). (b) Vertex-shader integer parameters (PRIMITIVE_ID) were exported as (uint)asfloat(bits), i.e. always 0, so every pixel shader read primitive 0's data. Integer elements now pass the register bits through. Opcode 0x2f was mislabelled v_pack_b32_f16; it is v_cvt_pkrtz_f16_f32.

Checks. cargo test -p tombox-xshader: 11 pass, including 5 new tests on hand-assembled programs (tests/synthetic.rs, no game data). All 139 shaders of the lobby frame translate and compile with DXC. xpair --decls: 2,607 of 4,553 paired shaders agree with the PC declarations (was 2,538); no pair is left where the PC declares an integer texture and the translation a float one (remaining integer differences: 3 pixel shaders with an integer UAV buffer, 1 vertex shader with an integer buffer).

In the game (one run, lobby). Scene colour maximum went from 0.16 to about 5; floor and character are lit. Not correct yet: the character is cyan with panel lines although the base-colour target holds the right skin colours; dropping all light passes and the sky pass leaves about half of that cyan, so part of it comes from the base pass (emissive) — possibly the game's own "cosmetics still loading" hologram (its log warns the cosmetic loadout is not initialised), possibly a consequence of pixel shaders now reading real primitive data. Undetermined. Bloom still shows bright blocks along the top edge (infinite values in the half-resolution chain).

New diagnostics (TOMBOX_RTCAP=1).

  • Binding trace (bindtrace.rs): descriptor writes and copies are recorded by hooks on the real device's method table (the title also reaches the real device directly, so hooks on the wrapper missed views). For shaders listed in %TEMP%\tombox_trace_shaders.txt each draw/dispatch logs every bound table: constant-buffer contents, and for each view the resource and the view's format/stride.
  • Capture: 16-bit depth is decoded as UNORM; raw <ids> in the trigger file also writes those targets at full resolution as float32.

Not done: SRVs created before a slot is rebound still show as "no descriptor recorded" in some tables (scene depth); R16_UINT targets are not decoded by the capture; whole-archive DXC sweep not rerun with these changes.

2026-11-20 — rpf-inspect: RAGE package files (structure only)

The owner supplied one package file from another title (appdata0.rpf, 8,880 bytes; not in the repo). Observed: magic RPF9; a plain 0x40-byte header; 0x40..0x550 high entropy (7.85 bits/byte); zeros to 0x1000; 0x1000..end high entropy (7.96). No plain table of contents, names or data anywhere. Header dword +0x04 = 0x360, +0x08 = 0x340, +0x0c = 0x40 (equals the header size), +0x1c = 0x150, +0x30 = 0x10; the meanings are not established (one file is not enough to tell sizes from counts).

New crate tombox-rpf (rpf-inspect <file>): bounds-checked header parse for RPF7 (community-documented 16-byte header) and RPF9 (fields reported by offset, unnamed), plus a region map (header / zero padding / high entropy / plain) with entropy. 3 unit tests on synthetic buffers, including truncation. It does not decrypt: package keys belong to the title, and recovering them is outside this project's scope. For shader inspection the route that stays in scope is capturing shaders as the running title hands them to the graphics API (the capture tool already saves them).

2026-11-20 — Second title, shaders only: shaders.rpf holds plain Xbox shader containers

Owner-supplied dump of a RAGE-engine title (no executable in the dump yet; nothing was run). The table of contents of shaders.rpf is high-entropy, but the data area is not encrypted:

  • a block tagged SGD5 (an index: 8-byte records of a 32-bit hash plus type/index bytes; not decoded further);
  • then records each carrying a NUL-terminated shader name (e.g. VS_BlitGenAmbCube_0cfdb358_Wrapped), one tag byte, u32 compressed size, u32 ?, u32 compressed size again, u32 inflated size, and a raw deflate stream that inflates to a standard DXBC container (SFI0 ISG1 OSG1 PSV0 HASH DXIL PRIV), shader model 6.6, bitcode stripped, RDNA2 code inside — the same container the first title uses.

Method: a throwaway scan (name + repeated size + inflate + DXBC check) over the 412 MB file, without the table of contents. It found 26,503 shaders (25,889 distinct by content, 223 MB of the file); what the remaining bytes hold was not examined, so this is a lower bound. By name: 11,092 pixel, 8,329 mesh (MS_VS_/MSNC_VS_), 2,581 compute, 2,183 vertex, 195 geometry, 47 domain, 1,462 unclassified.

Existing tools on the first 4,000 distinct shaders in file order (3,415 mesh, 585 vertex): every one disassembles to the end with a clean s_endpgm landing. Translation: mesh stage is not supported at all; of the vertex shaders about a third translate. The failures are the resource model, not instructions: these containers carry no root signature (rootSig=false), so descriptor tables have no known kind ("buffer in table of kind None"), plus s_load with a dynamic offset and s_buffer_load from a table pointer. Pixel and compute shaders come later in the file and were not sampled.

Not done: a proper extractor in the repo (the scan was a scratch script), pixel/compute sampling, the SGD5 index, mesh-shader translation, and a binding model for shaders without root signatures.

2026-11-20 — Second title: what is and is not encrypted in the data packages

Read-only survey with scratch scripts (samples of 17–34 MB per file at several offsets; not exhaustive).

  • Only the tables of contents are opaque. Every RPF9 archive (including archives nested inside levels.rpf, navmeshes.rpf, anim.rpf, …) has a plain 0x40-byte header followed by a high-entropy table. The first bytes of that table are identical across different archives. Not investigated further.
  • File contents are zlib streams, not encrypted. Sampled streams inflate cleanly: levels.rpf 132 streams (22.8 MB → 88.5 MB), navmeshes.rpf 362, anim.rpf 857, data.rpf 847, core_bvh4.rpf 730. Inflated payloads seen: resource objects carrying a 0DRP tag at +0x10 and pointers of the form 0x5000xxxx (relocatable resource memory), PSIN-tagged metadata blobs (most of data.rpf), raw float/index arrays (navigation meshes), and RSC8-tagged records stored plain in audio.rpf and story000.rpf next to readable asset names (pack:/….clip).
  • .ttpf (magic RDS5): plain header (entry count at +4) and a plain 8-byte-per-entry table, then zlib streams of 12–128 KiB that inflate to what look like block-compressed texture pages (repeating 8-byte colour-pair + index blocks). By directory names these are streamed texture databases (maps, terrain, peds, props, UI, …).

Consequence: contents can be listed by scanning for streams, but without the tables there are no file names, sizes or boundaries for anything that is not self-describing. Nothing here was decrypted and no keys were looked for.

2026-11-21 — Second title: 97% of shaders translate; descriptor-heap mode, mesh shaders; viewer

Corpus: the 25,889 distinct shader containers of the second title's shaders.rpf (rpf-shaders extracts them; no table of contents needed). Translation coverage, measured with xscan over all of them after each step:

step translated
start (Fortnite-only translator) 1,792 (6.9%)
heap mode, compares, MTBUF, f16 interpolation, wave ops 9,566 (37.0%)
mesh shaders 15,713 (60.7%)
DPP quad swaps, samplers as data, clip distances, SOP1 additions 20,654 (79.8%)
FSSM pixel-input table 21,787 (84.2%)
size/LOD queries, image atomics, MUBUF scalar offsets, 16-bit ops, 64-bit compares 25,214 (97.4%)

Fortnite's archive stays at 105,506 / 105,506 after every step. Translation is not compilation and not correctness: a DXC compile sweep of this corpus is running separately.

What was learned (evidence in the commits and the notes in hlsl.rs):

  • No root signature, SM 6.6. Descriptors are reached through pointers in entry SGPRs, at constant and run-time offsets. Translated as ResourceDescriptorHeap[address >> 5] (samplers >> 4) declared at each use, with entry SGPRs from a host constant buffer (TbUserData, b0 space100) and a binding report per shader (heap_bindings). Whether a read-only buffer/image is really an SRV, and whether a scalar-loaded buffer is a constant buffer, is chosen by use (debt).
  • Sampler descriptors as data (loaded from a constant buffer): mapped through a 512-entry host sampler table selected by address modes, filter, mip filter and compare function.
  • Opcode tables corrected from LLVM (GFX10): VOPC (v_cmpx, 16-/64-bit compares; the old table had 0xd0-0xd7 wrong), VOP3 (f16 interpolation, v_pack_b32_f16, v_cvt_pk_u8_f32, 16-bit integer ops), SOP1 (wrexec, 64-bit bit scans), MTBUF formats (UfmtGFX10). The decoder mis-sized VOP1/VOPC instructions with DPP sources (fixed).
  • Mesh shaders run as 64-wide waves; counts from GS_ALLOC_REQ, vertex/primitive exports per thread, outputs written after the body. Entry registers v5 / s3 are inferred from their use (debt).
  • PS inputs come from a table in the FSSM container (16-bit registers packed in pairs); the half offset of the second register of a pair is inferred.
  • Performance: the resource dataflow copied the instruction list per basic block; large shaders went from 11-20 s to under 0.1 s.

tombox-viewer runs a translated vertex+pixel (or compute) pair on the host GPU over procedural models with made-up inputs and writes the targets as PNG. 73 of 81 pixel shaders that link with the title's blit vertex shader ran without a device removal and produced finite output; the 8 others write depth only (not handled by the viewer). The images show execution, not what the game draws: the harness does not know the title's data.

Not done: the remaining 675 failures (mostly packed 16-bit attribute variants, d16 buffer loads, a few addressing forms), compile sweep results, runtime support for heap mode in d3d12_xs (needs the executable, which the dump does not contain).

2026-11-21 — Second title: asset carving without the package table of contents

  • rpf-carve (crates/tombox-rpf): finds zlib streams in an RPF9 data area, inflates them, joins consecutive 64 KiB streams into one file, classifies by leading bytes. Unit test with streams between noise. Observed: data areas are compressed, not encrypted; only the table of contents is encrypted, so file names are not recoverable except where a format embeds them.
  • Resource blocks: virtual data based at 0x50000000, GPU data at 0x60000000 in the block that follows. Texture dictionaries parsed (tools/rage/txd.py, field offsets inferred from 1,356 dictionaries: pointer array at +0x30, texture name/size/format/mips/GPU offset).
  • Untiling uses the title's own xg_xs.dll (XGCreateTextureComputer) through tools/rage/xgtry.py; layout value 0x105 decodes every format checked by eye (uncompressed gradient map, BC1/3/7 icons, normal maps). tools/rage/texexport.py exported 4,409 of the texture package's textures to PNG (Pillow BC decoding). Not exported: 195 whose GPU data falls outside the carved block, ~150 in formats Pillow does not decode (RGBA16F, R8, BC1 sRGB...). Only mip 0 / slice 0 is written.
  • Models: drawable resources found (bounding box, LOD distances, names). Their GPU buffers are not plain vertex/index buffers: each starts with a B@ header and the bounding box, followed by packed data, consistent with meshlet data for the mesh shaders. Not decoded yet.
  • Exported assets live under the git-ignored input/; nothing from the title is committed.

2026-11-21 — Second title: meshlet geometry decoded; translator fixes from a DXC sample

Geometry (tools/rage/meshlets.py, modelexport.py, objshot.py). Model GPU data is packed meshlets; the layout is read from the title's own mesh shaders (RDNA2 disassembly of MS_VS_Transform_PositionOnly and textured MS_VS_Transform variants), not guessed:

  • Meshlet buffer: header 0x80000000 | count, triangle-dword total, vertex-reference total; 16-byte records from byte 12 (vertex count-1 and triangle count-1 in 7 bits each, 17-bit vertex/triangle bases); triangles = three 7-bit local indices per dword; u16 vertex refs.
  • Position buffer (B@): header words = streams (offset (w>>7)&0x1fffffc, stride (w>>3)&60). Positions 24/24/16-bit quantized, scale/bias at +0x70/+0x60, axis-order code at +0x6c. Word 2 normals (octahedral), word 3 UVs (16_16_SNORM x float at +0x7c, or 2 x f32).
  • Checks: every meshlet's local indices in range; position buffers paired with meshlet buffers by exact vertex count (header stream offsets); normals: 10:10 encoding matched the sample terrain's face normals (mean dot 0.986), although the shader's branch reads as if that data were 8:8 — unresolved, so the encoding is picked per model by the face-normal fit; UVs: checker renders are continuous on terrain and a fan.
  • Minigame package: 13,437 geometries exported to OBJ (names from the resource); 1,718 not (492 buffers with the meshlet flag that fail the checks, the rest ambiguous pairings of tiny parts). Material -> texture linkage is not decoded (texture refs are joaat hashes in 32-byte records; generic blank_* maps confirmed by hash).

Packages. In the world package most of the 1.3 GB is neither zlib, raw deflate nor gzip, 4 KiB-aligned with no recognisable leading bytes. Possibly per-file encryption, possibly an unidentified compressor; not pursued further (no decryption). Models' own textures are likely there or in the story package, so textured previews use a checker for now.

Translator (400-shader random DXC sample of the second title: 359 compiled, 39 failed, 3 translate failures; 9 hit the 300 s per-shader timeout):

  • SMEM SOFFSET register was not counted as an entry read: 14 shaders had an undeclared sN. Fixed, regression test smem_soffset_register_is_entry_live.
  • PSV0 NumThreads offsets were wrong (40/44/48 instead of 36/40/44): mesh shaders declared numthreads(1, 1, name offset); 17 failed validation and the rest ran with one thread. Compute shaders now prefer PSV0 over the ISA preamble (the title's preambles say 1,1,1; one shader using derivatives failed validation). Fortnite's shaders carry no PSV0 thread counts: still 105,506 / 105,506.

2026-11-21 — Second title: texture packs (.ttpf) read; models linked to their textures; levels.rpf geometry

Texture packs (tools/rage/ttpf.py, ttpfexport.py). Not encrypted; layout read off the files and cross-checked against inflated sizes (details in the ttpf.py docstring):

  • RDS5 header: chunk count, virtual size, offset/256 of the ETPF texture table; then u64 chunk entries = file offset/256 (bits 0-25), codec (bits 26-29), virtual 4 KiB page (bits 30-51). Inflated chunk lengths equal the gaps between consecutive virtual pages (checked on every chunk read).
  • ETPF: count at +8, 16-byte records (width, height, mip count, DXGI format in d1 bits 3-9, array size, first page), then one sorted u64 hash per record. No names stored.
  • Tiling: the title's own layout library (xg_xs.dll). Record field d1 bits 24-26 select it: 0 -> layout 0x2, 1-3 -> 0x105. Chosen by rendering every layout value for sample textures and checking visually (UI pack logos, photos and car renders; a ped decal and a monitor screen that were tile-scrambled under 0x105 are correct under 0x2). A first rule keyed on mip count 0 fixed the UI cases but not the decals, which is how the field was found.
  • Cube maps (array size 6, selector 4 plus higher bits) do not untile with any 2D or 3D layout value tried (their 860,160-byte span is not any computed size); rejected explicitly. Under 1% of records. About 1.8% of a 3,600-record sample have a page span shorter than their mip chain; also rejected (the following pages may belong to another texture).
  • 357,067 textures in 57 packs. 306,222 (85.8%) are stored entirely in zlib chunks and decode. The rest touch chunks with codec values 1/3/4/5/6/7, and those values match the BC format of the texture (1 = BC1, 3 = BC3, 4 = BC4, 5 = BC5, 6 = BC6H, 7 = BC7): a BC-aware compressor, plausibly the console's hardware texture decompressor. No decoder for it is in the dump or in Fortnite's binaries; reported as unsupported, not guessed. Worst categories: terrain 67% and UI 65% decodable; vehicles 98%.
  • Some records' page span is smaller than the layout's size for their declared mip count (e.g. a 1024x1024 BC1 with a 36 KiB span); not understood, reported per texture.
  • Uncompressed R8G8B8A8 records (graphics pack, small) have not been confirmed visually.

Model -> texture link. A drawable's 32-byte texture records carry, after the joaat name hash and pointer, a u64 that is exactly a texture-pack hash: 6,615 of the 7,361 distinct keys in the minigame models resolve, and all 766 textures of the minigame's own map pack are referenced. tools/rage/modeltex.py resolves and decodes them (index of all packs in input/carved2/ttpf_index.json). The industrial fan resolves to painted-metal, rust and normal-map layers: these are tiling layer textures of a blended material, so which texture goes on which part (shader parameters -> geometry) is the next structure to decode; the earlier guess that model textures sat in the world/story packages is withdrawn.

levels.rpf (76 GB). Random 1 MiB samples are dense zlib streams with B@ position buffers. rpf-carve gained --start/--len; one 4 GiB slice (0x2c0000000..0x3c0000000) gave 20k+ resources named levels/americas/..., and modelexport.py exported level geometry from it (warehouse curtains, condo parts, car parks, a swing bridge, signs; spot-checked by render). Parts are in local coordinates; placement data not decoded.

2026-11-21 — Second title: map placement records found

tools/rage/placements.py. Placement ("entity") records are 0x90 bytes inside map resources in levels.rpf: quaternion at +0x0c, position at +0x34, joaat(model name) at +0x40 (equals a drawable's own name), flags at +0x44, scale XY/Z at +0x50/+0x54, index/parent at +0x58, draw distance at +0x5c. How it was found: object-type (archetype) records gave a name-hash pattern; an area file (sb_38) held the same name hashes inside 0x90-strided records with unit quaternions and world-sized positions. Not yet read through the resource's own header; found by a validated scan (unit quaternion, plausible scales, neighbouring record valid).

Evidence:

  • 4 GiB slice: 352,071 records with the 0x0018xxxx/0x001cxxxx flag form. Plotted from above they draw the city (~5.1 x 5.8 km: street grid, coastline, islands, a port). Only 8,317 name a model inside the same slice; the rest name models elsewhere in the 76 GB.
  • Balusters around a pool (172 records) form continuous balustrades with curved corners.
  • Rotation convention: the stored quaternion is the inverse rotation. Hotel facade glass panels form level bands with the conjugate and zigzag without it. Unknown: header/array pointers of the map resource, the per-file constant at +0x70, flags, the LOD-parent hierarchy (parent index != 0xffff on part of the records).

2026-11-21 — Second title: whole levels.rpf mount index; streaming map viewer

  • tombox_rpf::files::each_file: windowed stream carving with 64 KiB-continuation joining, shared by rpf-carve and the new rpf-index. Fixes a carver bug: the stream straddling each 64 MiB window was dropped (the overlap was read but never scanned). On the 4 GiB slice the new reader finds 56 files the old one missed, all starting just before a window edge. Tests: carve_range limit, joining across a range end (12 crate tests pass).
  • rpf-index <package> <out>: one pass, 4 threads at below-normal priority, writes files.tsv (offset, extent, size, tag, kind, name.#ext strings) and entities.bin (placement records, scanner ported from placements.py). Slice check against the Python scanner: 354,753 records in common; the 15,683 only Python reported are overlapping false positives (flags 0 / float-like); the 58 only Rust reported are flag-0x18 records from recovered files. Full package: 878,673 files, 235,788 named, 2,250,307 records (2,057,950 with the 0x18/0x1c flag form) in 219 s.
  • Names: in a 4,000-file sample, half of the model resources carry their name.#dr after the first 16 KiB, so names are searched in whole files. 97% of named files carry one name; the rest hold several _lod/_slod models. Using single-name .#dr and .#ft files, 1,544,464 of 1,656,073 world placements resolve to a model file.
  • meshnp.py: numpy decoder, identical to meshlets.py on 4,018 model parts (positions, triangles, normals, UVs compared).
  • tools/rage/mapview: server.py (127.0.0.1 only) loads the index and, per request, inflates a model's two files from levels.rpf by offset and decodes them; index.html (three.js) streams 250 m tiles around a fly camera and instances models by placement. Sampled 400 models near the densest tile: 394 decode; 1,387 of 1,697 parts in a 200-model sample. The first page version issued every model request at once and the browser dropped them (~33k "failed" in the user's run); requests are now queued (6 at a time, with retries), and decode failures and request errors are counted separately.

2026-11-21 — Second title: model materials decoded; textured map viewer

  • tools/rage/drawable.py: model resource structure by pointer-following (layout in its docstring). Shader group -> shaders -> parameter table (joaat name hash, slot code) -> texture slot -> texture record (pack key). Model -> geometries with a u16 shader index each. Each geometry points to its own position buffer (inline record +0x58) and meshlet buffer (+0x40 struct, which also states meshlet and triangle counts). Fragments (.#ft) hold their drawable at +0x18; multi-model files are dictionaries (name hashes + drawable pointers).
  • Checks: 4,000 sampled level files - every geometry's meshlet buffer has exactly the stated meshlet and triangle counts (15,866 parts), every shader index in range; all 776 dictionary member hashes equal names stored in their files; 200 of 200 sampled fragments decode via +0x18. Only two parameter hashes matched guessed names (DiffuseTex 0xc8e8c282, SpecularTex 0xc6f46e79); DiffuseTex slots hold only sRGB colour formats (BC1/BC7/BC3 sRGB). Shaders without DiffuseTex: the first sRGB-format slot is used (92% of them layer 1 of layered terrain shaders, 0x346394ea).
  • Second vertex format: header "c0" (low nibble 3, stride 12) = float32 x, y, z positions (and float normals); extents equal the drawable bounding box on the samples. 4% of parts.
  • ttpfexport.untile takes a mip level; the viewer decodes the largest mip <= 512 px (median 29 ms per texture). A8/R8 formats decoded as grey.
  • Short texture records (span < mip chain, ~3.6%): not explained by missing top mips (16 of 218 match a cut-down chain exactly); left unsupported.
  • Viewer: per-part colour textures; 400 sampled models near the densest tile all decode (2,677 parts, no part errors; previously 394 models with 18% of parts skipped); 256 of 292 tested colour textures decode. Offline renders of signs and a dumpster through the server's own output show correct UV orientation (decals, rust along edges). Stop sign face is missing: it is in the layered shader's overlay slot (0x7485dafb) and uses the unsupported codec.

2026-11-21 — Second title: textures, LOD and interiors - what closed, what is blocked

  • Unsupported texture codec: searched every DLL/EXE of both dumps and the OS image for a software BCPack (or other) decoder: none. Blocked on a decoder; no guessing.
  • Short texture records: ttpfexport.decode (mip fallback, in-span only by default; an overlap mode reads past the span avoiding other textures' footprints). Visual samples: small textures do sit in unused parts of larger layouts, but ~25% stay garbled even within their own span under every layout tried, so short records are still refused.
  • Map structure: map resources are a table of hashed sections (header +0x38, count +0x48); 0xce501483 = the placement array, 0xd3593fa6 = map header (name hash at +0x08, two bounding boxes, placement count), 0x4a = list of other maps' name hashes. 20,404 map files carry the header.
  • LOD links: (+0x58, +0x5a) tested as (index into 0x4a, index into that map's placements): parents are _lod models (897 of 906) but their distance to the children equals an off-by-one baseline; most +0x58 values exceed the list. Not decoded.
  • Viewer LOD: per tile, one detail level by distance (full < R, _lod < 3R, _slod < 8R, by model name; fallback to the nearest level the tile has); per-level tile fetches. World placements by level: 1,537,819 / 84,102 / 34,152.
  • Interiors: no placement record found (368-byte section 0xba049770 holds bounding boxes and bitmasks, no rotation).

2026-11-22 — DXC coverage of the RPF9 shader archive

xscan shaders.rpf --compile 1 --fresh 1 --jobs 12 --shader-limit 3 processed 25,889 distinct containers from the same 26,503 named records on Windows with SDK DXC 10.0.26100.0. The pipeline produced DXIL for 1,792 shaders. The time limit covers extraction, translation and compilation. It expired for 337 records before the worker reported a stage.

DXIL stage Compiled Failed with a stage
Geometry 195 0
Pixel 928 10,841
Vertex 664 1,527
Compute 5 2,627
Mesh 0 8,765

The most common translation errors besides unsupported mesh were a dynamic scalar descriptor-load offset (6,674), an unknown MUBUF descriptor-table kind (2,732), and unsupported integer wave reductions. All 1,792 shaders that reached DXC and reported an outcome compiled. Rendering was not measured.

Across the 9,282 mesh records, PSV0 consistently reports 128×1×1 threads, triangle topology, up to 128 output vertices and 128 primitives, and zero payload bytes. None has an RTS0 chunk. The archive contains no amplification program in the named records. Synthetic shader tests exercise DXC at ms_6_5 and as_6_6, including reading the compiled PSV0 metadata.

Matching DXBC to pipeline cache metadata

All 25,889 distinct DXBCs contain PSV0 and none contains RTS0. The shaders.rpf from build 1.0.2.1 also contains a zlib-compressed PS\x00\x09 cache at archive offset 0x10579000. Inflating each stream and aligning its end to 16 bytes gives 4,205 streams and 275,540,780 uncompressed bytes. The cache header gives 25,471 graphics PSOs, 2,693 compute PSOs, 54,576 metadata entries and 21,522 code entries.

Matching the 16-byte DXBC HASH payload to 0x43 tags inside indexed metadata entries identified candidates for 19,096 distinct DXBCs (18,663 distinct matching shader hash values). A hash can occur in multiple metadata entries. For VSPointLight_13aa26a1_Wrapped, entry 17852 contains three 32-byte 0x41 records. Their dword offsets correspond to the three scalar descriptor loads from s12 in the ISA. The register numbers and resource kinds agree with PSV0.

Offset from s12 PSV0 resource
0x60 Structured SRV, t320, space1
0x1e0 CBV, b38, space1
0x200 CBV, b0, space1

This shader reaches buffer_load_dwordx3 at ISA offset 0x68. The current translator expects one resource kind per descriptor table and reports an unknown kind. The metadata above demonstrates why this table needs per-entry resource kinds. Dynamic offsets additionally need a runtime descriptor index and a mapping to register spaces. See PercyStar's format notes for the cache layout and metadata tags.

An independent build of PR #4 at 991903d compiled 102 of the 320 shaders in the comparison sample, up from 93 at 7e8064f. The nine additional shaders were all pixel shaders. Both runs used empty compiler caches.

2026-11-22 — Merge of upstream (PSO-aware bindings, v_cmpx decoding, capture diagnostics)

  • Upstream reimplemented parts of the translator in parallel. Resolution in hlsl.rs: PSO bindings (translate_with_pso, raw buffers, register spaces, inline samplers, dynamic descriptor offsets) kept and combined with heap mode (exclusive: bindings turn heap mode off); my wave-reduction lowering, compare emitter (class f16, 64-bit operands) and typed declarations kept, with declarations routed through upstream's register().
  • Mesh shaders, owner's decision: upstream's strict path (hlsl/mesh.rs: 128 threads, one immediate GS_ALLOC_REQ, no branches, no entry registers) is the default; the inferred-ABI path is behind Options::infer_mesh_abi (xscan --infer-mesh-abi 1, tombox-viewer on). The runtime uses the default.
  • Upstream test mesh_allocation_and_triangle_exports_compile_to_dxil failed on upstream's own branch (asserted SetMeshOutputCounts(m0 & 0xfffu, the code emits named counts); assertion corrected, DXC compile part passes.
  • Checks: workspace tests 68 passed, 0 failed; Fortnite archive 105,506 / 105,506 translated (no mesh shaders). Second title corpus not re-measured after the merge.

2026-11-22 — Unreal Engine level importer (second title's map)

  • ue/Plugins/TomBoxLevelImport (UE 5.5 editor module): client of the map server. Imports an area (centre, radius, detail level) as one static mesh per model (one material slot per part, normals from the model or area-weighted face normals), Texture2D assets from the server's PNGs, material instances of a two-sided base material, and a map with one HISM actor per model plus sun, sky light, atmosphere and fog. Game right-handed metres -> UE left-handed centimetres by mirroring Y (winding reversed; rotation conj(q) mirrored to (x, -y, z, w)); area re-centred. Tools menu window and a TomBoxImport commandlet.
  • Built with UE 5.5 against the VS 2026 toolset (MSVC 14.51); no plugin warnings.
  • Headless test (100 m around -375, -875, full detail): 1,971 placements (2 without a model), 367 models built, 0 failed, 1 part skipped, 718 textures, 73 undecodable; 3.5 minutes.
  • Fixed during the test: -center=X,Y was cut at the comma (FParse separator); the commandlet's options object was garbage-collected during asset saves (now held by TStrongObjectPtr).
  • Not verified: the result in the editor viewport (orientation of the mirrored transforms has not been checked visually in UE).

2026-11-22 — UE importer: image quality pass

  • User report: the imported area looks low quality. Causes: no renderer settings in the host project (no Lumen / virtual shadow maps), textures capped at 512 px, colour map only, nothing outside the import radius.
  • Normal-map slot identified visually: 0x1e77bf4c holds blue-purple tangent-space normal maps (BC1 / BC7 linear) in sampled shaders (drawable.NORMAL, normal_texture); 0x739e3d0d and SpecularTex (0xc6f46e79) look like packed masks (meaning not decoded, not used).
  • Tile layouts re-checked by smoothness (each texture untiled with every candidate layout): 215 of 217 sampled colour/normal textures are smoothest with the current rule.
  • Server: /api/tex/<key>?max=N (up to 4096); model parts carry their normal-map key.
  • Plugin: lit base material (colour + normal parameters), normal textures imported linear as TC_Normalmap (optional green flip), MaxTextureSize (default 2048), surroundings ring of the next coarser level (default 1 km), unbound post-process volume forcing Lumen GI and reflections. Host project (local) config: DX12, Lumen, virtual shadow maps, TSR.

2026-11-22 — Fortnite lobby: bloom "yellow boxes" traced to missing wave lockstep in LDS code

  • Output path checked first: PresentX now logs the plane / parameter structures the title passes (template copied in FD3D12Viewport::PresentInternal, filled at run time). Every field beyond token, resource count and resource pointer is zero, i.e. no HDR colour space: the title presents SDR, matching the host swap chain. Not the cause.
  • Capture (lobby, raw dumps): scene colour targets have no non-finite values; the bloom chain does. In two levels (400x225, 800x450) the sources are blocks exactly 10 pixels wide and about 3 rows tall, red channel only, in the top rows, where the full-resolution input is 0; the other levels hold the same blocks spread by the blur into hard-edged rectangles (the flashing yellow boxes after tone mapping).
  • The two full-resolution compute shaders at the start of the chain (251ed6ba5631cd6d, 1e8bbd9bbe7ab9b7, 8x8 threads) use LDS without any s_barrier. 251ed6ba counts lanes that pass a test (all write slot 0, atomically add, read back, compare with 64); 1e8bbd9b exchanges values between lanes. On console the 64 threads are one wave in lockstep; on PC the group can run as several waves, so the count was read early and groups took the wrong path. Fix: for compute shaders of <= 64 threads with LDS and no s_barrier, a group barrier is emitted at the first top-level point after each LDS access (before the next top-level LDS access, a skip block or a loop). Test one_wave_compute_lds_phases_get_group_barriers; both shaders compile with DXC; Fortnite archive still 105,506 / 105,506 translated.
  • Mistake during the analysis, recorded: the first capture read was a folder from 2026-11-18 (picked by sorting on modification time); the conclusions were re-checked on the current captures.
  • Not yet verified in the running title (needs a restart with the new DLL).

2026-11-22 — Runtime CPU cost: shader cache by input, texture-pump backoff

User report: the title uses about 45% CPU. Two costs identified in the code and the last run's log (not yet profiled in a running title):

  • Shader cache keyed by generated HLSL: every launch translated every shader again just to compute the key. New input-keyed cache by_blob (console container hash x translator revision x compiler; TRANSLATOR_REV = hash of the translator's source, from build.rs): a hit skips extraction and translation. The runtime fills it after every successful compile or HLSL-cache hit; xscan --compile fills it too, so a sweep pre-warms launches. Overrides (tombox_shader_override) bypass it. The PSO counter line reports the hits.
  • Texture upload pump: never-uploaded textures with unreadable (uncommitted) memory were checked every frame, one VirtualQuery walk per subresource, without counting against the per-frame budget (last run: 15.4 million unreadable skips, about 3,600 per frame). Now each such texture backs off (1, 2, 4 ... 256 pumps) until its memory is readable.
  • The two translator changes of the day (merge, LDS barriers) changed many shaders' HLSL: a sweep recompiled about 15,000 entries in 9.5 minutes.