Return build 19041 XMem free-page counters within the 48-byte output #223
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!223
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/223/head"
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?
@bambermf on GitHub · 2026-11-23 05:56 UTC · original
bambermf:port/xmem-19041-page-statistics→main· +101 −0 · 2 files · 1 commits · closed without mergingLibrary / area — XMem, build 19041 free-page statistics.
Exports changed — XMemGetFreePageStatistics. XMem has no separate exports.txt entry for this function.
Source of behaviour — Fortnite's xmem.dll 10.0.19041.3948, RVA 0x63d0, inspected with headless IDA MCP. I ran the original x64 routine in Unicorn with controlled partition queries. I then exercised the port through the built Windows DLL with the real NT memory manager. The Windows query class, request layout and current-partition pseudo-handle were checked against the System Informer header. The Rust implementation follows the console routine.
What was wrong
The emulator wrote seven 64-bit fields to an output buffer that this build defines as six. Its values came from host memory totals in bytes. The console queries the title partition for per-node page counts. A single-node console writes the first three results twice.
The change
Query the existing title partition or, where the title uses normal PC memory, the Windows current-memory-partition pseudo-handle. Sum the counter pairs and weight the last pair by 512 as the console does. Copy all six results only after a successful query. Map NT errors through RtlNtStatusToDosError. Build selection uses the existing console OS configuration.
Measurements
The original routine received rows containing consecutive numbers starting at zero, supplied by the emulated kernel call. Guard words surrounded the six output slots.
On this single-node Windows host, a call through the rebuilt DLL returned 1 and two identical triples with both guards intact. An invalid-handle query mapped to Windows error 6. The native two-node path was not exercised on physical hardware. The implementation makes the console's one- or two-node request and propagates a rejection from a host whose topology requires a larger request.
Tests
@omonkeyz on GitHub · 2026-11-23 07:49 UTC · original
Applied in
84987a6(merged in451fe11) with your authorship kept, thanks. The code shipped in the r32g release (6a1a4b1), which passed its Trackmania control run.Pull request closed