feat(xmem): implement XMemAlloc, XMemFree, XMemVirtualQuery and XMemGetWorkingSetStatistics #18

Closed
opened 2026-11-26 19:14:13 +00:00 by github-bot · 0 comments
Owner

@⁠Dark3581 on GitHub · 2026-11-21 14:02 UTC · original

Middleware that titles ship themselves imports these, so a title that bundles it stops here: an import audit shows the FidelityFX upscaler and Bink 2 importing XMemAlloc and XMemFree (the upscaler also XMemGetWorkingSetStatistics), and a BVH builder DLL importing XMemVirtualQuery. All four are stubs in Inventory.cpp.

  • XMemAlloc
  • XMemFree
  • XMemVirtualQuery
  • XMemGetWorkingSetStatistics

Unknown, to settle first

  • The signatures. The declarations in Exports.hpp are placeholders. If the public GDK headers do not declare these functions, recover them from the call sites in a bundled DLL with ImportCallArgs.java (see GAME_TESTING.md) and put the evidence in the PR text, not the repository.
  • The meaning of the allocation attribute argument (alignment, page size, memory type, allocator ID). Decode the bits you can source; any other value calls AbxUnsupported.

A host implementation on top of VirtualAlloc / VirtualQuery is the expected shape, but XMemFree must accept exactly what XMemAlloc returned, including any alignment it applied.

How to do it

  • Each stub's declaration in include/Exports.hpp has no parameters yet. Give it the exact signature from the public GDK headers; do not copy the headers into the repository.
  • Implement each function for every input. A path whose behaviour on a desktop host is unknown calls AbxUnsupported(__func__, "what is unknown"); never return a made-up success.
  • List known gaps in a debt fragment under docs/dev/debt/changes/, and add an e2e scenario (core/libs/tests/FakeTitle.cpp, e2e.py).
  • Rules: CONTRIBUTING.md. One PR may take the whole issue or part of it; say which in the PR.
**@⁠Dark3581** on GitHub · 2026-11-21 14:02 UTC · [original](https://github.com/Dark3581/AnyBox/issues/18) Middleware that titles ship themselves imports these, so a title that bundles it stops here: an import audit shows the FidelityFX upscaler and Bink 2 importing `XMemAlloc` and `XMemFree` (the upscaler also `XMemGetWorkingSetStatistics`), and a BVH builder DLL importing `XMemVirtualQuery`. All four are stubs in [Inventory.cpp](https://github.com/Dark3581/AnyBox/blob/main/core/libs/xdll/xmem/Inventory.cpp). - `XMemAlloc` - `XMemFree` - `XMemVirtualQuery` - `XMemGetWorkingSetStatistics` **Unknown, to settle first** - The signatures. The declarations in [Exports.hpp](https://github.com/Dark3581/AnyBox/blob/main/core/libs/xdll/xmem/include/Exports.hpp) are placeholders. If the public GDK headers do not declare these functions, recover them from the call sites in a bundled DLL with [ImportCallArgs.java](https://github.com/Dark3581/AnyBox/blob/main/tools/ghidra/ImportCallArgs.java) (see [GAME_TESTING.md](https://github.com/Dark3581/AnyBox/blob/main/docs/dev/GAME_TESTING.md)) and put the evidence in the PR text, not the repository. - The meaning of the allocation attribute argument (alignment, page size, memory type, allocator ID). Decode the bits you can source; any other value calls `AbxUnsupported`. A host implementation on top of `VirtualAlloc` / `VirtualQuery` is the expected shape, but `XMemFree` must accept exactly what `XMemAlloc` returned, including any alignment it applied. **How to do it** - Each stub's declaration in `include/Exports.hpp` has no parameters yet. Give it the exact signature from the public GDK headers; do not copy the headers into the repository. - Implement each function for every input. A path whose behaviour on a desktop host is unknown calls `AbxUnsupported(__func__, "what is unknown")`; never return a made-up success. - List known gaps in a debt fragment under `docs/dev/debt/changes/`, and add an e2e scenario (`core/libs/tests/FakeTitle.cpp`, `e2e.py`). - Rules: [CONTRIBUTING.md](https://github.com/Dark3581/AnyBox/blob/main/CONTRIBUTING.md). One PR may take the whole issue or part of it; say which in the PR.
github-bot 2026-11-26 19:14:13 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:13 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Dark3581--AnyBox#18
No description provided.