runtime: serve the Bink heap shim from era_heap #188
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/189"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by raulmoracode on 2026-11-21T18:10:42Z.
Change
The Bink heap shim allocated with
HeapAllocand released withHeapFree, duplicating the policy thatsrc/era_heap.cppalready implements from the decoded attribute word. The two could drift while both are described asXMemAlloc/XMemFreebindings.windows_allocatenow callsera_heap::allocate(bytes, flags)andwindows_releasecallsera_heap::release_with_attributes(base, flags). The profile's guard (a nonempty payload needs 64 bytes of headroom) and the observer hooks used by the test are unchanged. The CMake target linkssrc/era_heap.cppand includessrc.bink_heap_check.pyadds two direct calls to the binding: a 97- and a 129-byte request with0x05e50000must return a 32-byte-aligned, zeroed block, and the matching release must free it.Fixes #188
Verification
Commit
d4acadeon Windows 10 22H2 build 19045.6466, VS Build Tools 2022 17.14, MSVC 14.44.35207, Windows SDK 10.0.26100, CMake 4.4.4, Python 3.12.10.Result:
The seven are
cpu_aot_bink_heapand the sixera_heap_*scenarios, includingera_heap_observed_wordsfrom #134.Evidence and follow-up
The added assertions are the control for the changed allocation path: they read alignment and contents from the returned block. The previous
HeapAllocpath made neither guarantee, so the check is meaningful even though a deterministic unaligned, dirty-memory allocator is not part of the fixture. The existing 32-residue loop inbink_heap_check.pystill covers the caller's own headroom arithmetic.The package-only case
cpu_aot_bink_package_heapneedsBINK_HEAP_IMAGEand was not run; this change does not touch its translation.The remaining half of the shared contract is graphics memory:
era_heapalready servesGRAPHICS_1–6throughVirtualAlloc, but no experiment allocates from that path yet.Checklist
AI-assisted.