runtime/shims: shim GetLogicalProcessorInformation and GlobalMemoryStatusEx (OLD-9816) #1104

Open
github-bot wants to merge 1 commit from github-bot/gh-1104 into main AGit
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 18:33 UTC · original
ambroseautomation:carry/old-9816-sysinfo-shims → main · +489 −2 · 4 files · 1 commits · open

Claimed in the coordination issue as: OLD-9816 (#14)

What and why

Carries forward old-pr/9816 (draft #88, original commit author piyonchu preserved; indexed in #17), rebased cleanly onto current main (71f99e224) without the stray UTF-8 BOM in scripts/build_runtime.ps1.

Shims GetLogicalProcessorInformation and GlobalMemoryStatusEx across kernel32.dll, kernelbase.dll, and api-ms-win-core-sysinfo-l1-1-0.dll in runtime/shims/sysinfo.cpp:

  • Preserves the two-step GetLogicalProcessorInformation size-probe contract (FALSE + ERROR_INSUFFICIENT_BUFFER with required byte count) and falls back to a synthesized topology if the host fails or returns an empty buffer.
  • Supports deterministic console parity overrides via LEONIDA_CPU_TOPOLOGY (xbox/scarlett for 8c/16t with SMT + L1/L2/L3/NUMA/package records, NxM, N, or host) and LEONIDA_SYSTEM_MEMORY_MB (xbox/scarlett for 16384 MiB, or explicit MiB clamped to [256, 1048576]).
  • Keeps owns_dll false for kernel32.dll, kernelbase.dll, and api-ms-win-core-sysinfo-l1-1-0.dll.
  • Registers sysinfo_test in runtime/CMakeLists.txt and adds shims\sysinfo.cpp to scripts/build_runtime.ps1.

Tested

  • Compiled and ran sysinfo_test.exe natively on Windows 11 with MSVC (/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2): sysinfo_test: PASS (0 failures), zero compiler warnings.
  • Built runtime/build/gta6rt.exe via .\scripts\build_runtime.ps1 -jobs 8: succeeded cleanly with shims\sysinfo.cpp linked.
  • python -I tests/test_build_runtime_fallback.py: 10 tests, OK.
  • python -I tests/test_text_write_line_endings.py: 3 tests, OK.
  • python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/sysinfo.cpp runtime/test/sysinfo_test.cpp scripts/build_runtime.ps1: exit 0 (no game data).

GPUs tested: n/a (CPU/OS runtime shim; built and tested on Windows 11 Pro 64-bit, MSVC VS 18)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — runtime shim)
**@⁠ambroseautomation** on GitHub · 2026-11-24 18:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1104) `ambroseautomation:carry/old-9816-sysinfo-shims` → `main` · +489 −2 · 4 files · 1 commits · open Claimed in the coordination issue as: OLD-9816 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Carries forward `old-pr/9816` (draft #88, original commit author `piyonchu` preserved; indexed in #17), rebased cleanly onto current `main` (`71f99e224`) without the stray UTF-8 BOM in `scripts/build_runtime.ps1`. Shims `GetLogicalProcessorInformation` and `GlobalMemoryStatusEx` across `kernel32.dll`, `kernelbase.dll`, and `api-ms-win-core-sysinfo-l1-1-0.dll` in `runtime/shims/sysinfo.cpp`: - Preserves the two-step `GetLogicalProcessorInformation` size-probe contract (`FALSE` + `ERROR_INSUFFICIENT_BUFFER` with required byte count) and falls back to a synthesized topology if the host fails or returns an empty buffer. - Supports deterministic console parity overrides via `LEONIDA_CPU_TOPOLOGY` (`xbox`/`scarlett` for 8c/16t with SMT + L1/L2/L3/NUMA/package records, `NxM`, `N`, or `host`) and `LEONIDA_SYSTEM_MEMORY_MB` (`xbox`/`scarlett` for 16384 MiB, or explicit MiB clamped to `[256, 1048576]`). - Keeps `owns_dll` false for `kernel32.dll`, `kernelbase.dll`, and `api-ms-win-core-sysinfo-l1-1-0.dll`. - Registers `sysinfo_test` in `runtime/CMakeLists.txt` and adds `shims\sysinfo.cpp` to `scripts/build_runtime.ps1`. ### Tested - Compiled and ran `sysinfo_test.exe` natively on Windows 11 with MSVC (`/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`): `sysinfo_test: PASS (0 failures)`, zero compiler warnings. - Built `runtime/build/gta6rt.exe` via `.\scripts\build_runtime.ps1 -jobs 8`: succeeded cleanly with `shims\sysinfo.cpp` linked. - `python -I tests/test_build_runtime_fallback.py`: 10 tests, OK. - `python -I tests/test_text_write_line_endings.py`: 3 tests, OK. - `python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/sysinfo.cpp runtime/test/sysinfo_test.cpp scripts/build_runtime.ps1`: exit 0 (no game data). GPUs tested: n/a (CPU/OS runtime shim; built and tested on Windows 11 Pro 64-bit, MSVC VS 18) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — runtime shim)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:26 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:39 UTC · original · approved these changes

Audited and verified. Shims GetLogicalProcessorInformation and GlobalMemoryStatusEx in
untime/shims/sysinfo.cpp with support for LEONIDA_CPU_TOPOLOGY (8c/16t Xbox topology) and LEONIDA_SYSTEM_MEMORY_MB, strictly preserving the two-step Win32 buffer probe contract (ERROR_INSUFFICIENT_BUFFER) required by the retail boot sequence. Tests in
untime/test/sysinfo_test.cpp pass cleanly. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1104#pullrequestreview-6045197752) · **approved these changes** Audited and verified. Shims GetLogicalProcessorInformation and GlobalMemoryStatusEx in untime/shims/sysinfo.cpp with support for LEONIDA_CPU_TOPOLOGY (8c/16t Xbox topology) and LEONIDA_SYSTEM_MEMORY_MB, strictly preserving the two-step Win32 buffer probe contract (ERROR_INSUFFICIENT_BUFFER) required by the retail boot sequence. Tests in untime/test/sysinfo_test.cpp pass cleanly. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:52 UTC · original · approved these changes

Clean-Room Audit — PR #1104 (OLD-9816 SysInfo Shims)

Clean carry-forward of runtime/shims/sysinfo.cpp shimming GetLogicalProcessorInformation and GlobalMemoryStatusEx with LEONIDA_CPU_TOPOLOGY and LEONIDA_SYSTEM_MEMORY_MB configuration plus runtime/test/sysinfo_test.cpp coverage. CMake/build integration clean; 0 game data.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1104#pullrequestreview-6045382534) · **approved these changes** ### Clean-Room Audit — PR #1104 (`OLD-9816` SysInfo Shims) Clean carry-forward of `runtime/shims/sysinfo.cpp` shimming `GetLogicalProcessorInformation` and `GlobalMemoryStatusEx` with `LEONIDA_CPU_TOPOLOGY` and `LEONIDA_SYSTEM_MEMORY_MB` configuration plus `runtime/test/sysinfo_test.cpp` coverage. CMake/build integration clean; 0 game data. **Verdict: APPROVED**
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:36 UTC · original

Tested 4dc12a4c3 on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build):

  • ctest --test-dir runtime/build/win -R "^sysinfo$" --output-on-failure: Passed (5.32 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1104#issuecomment-7142327406) Tested `4dc12a4c3` on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build): - `ctest --test-dir runtime/build/win -R "^sysinfo$" --output-on-failure`: **Passed** (5.32 s) AI-assisted: yes
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:17 UTC · original

Recommendation: [MERGE]

Reasoning: Carries #88: shims GetLogicalProcessorInformation and GlobalMemoryStatusEx across kernel32/kernelbase/api-set with the size-probe contract preserved, plus a 176-line test; also drops the stray BOM from build_runtime.ps1. Self-contained new shim file. Verified on Arch + Wine (sysinfo passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 4/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1104#issuecomment-7143315037) **Recommendation:** [MERGE] **Reasoning:** Carries #88: shims `GetLogicalProcessorInformation` and `GlobalMemoryStatusEx` across kernel32/kernelbase/api-set with the size-probe contract preserved, plus a 176-line test; also drops the stray BOM from `build_runtime.ps1`. Self-contained new shim file. Verified on Arch + Wine (`sysinfo` passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 4/10
This pull request has changes conflicting with the target branch.
  • scripts/build_runtime.ps1
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1104/head:github-bot/gh-1104'
git switch 'github-bot/gh-1104'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1104'
git switch 'github-bot/gh-1104'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1104'
git switch 'github-bot/gh-1104'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1104'
git switch 'main'
git merge --squash 'github-bot/gh-1104'
git switch 'main'
git merge --ff-only 'github-bot/gh-1104'
git switch 'main'
git merge 'github-bot/gh-1104'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.