feat(tools): add module_check.py to load a title's converted DLLs one by one #29

Manually merged
github merged 2 commits from gh-pr/29/head into gh-pr/29/base 2026-11-26 19:14:21 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 02:12 UTC · original
Dark3581:feat/module-check → main · +334 −0 · 8 files · 2 commits · merged 2026-11-22 02:17 UTC

What

A way to check a title's converted DLLs before (or without) its executable:

  • anybox-module-probe.exe (built into the build root, Windows only) loads one DLL with LoadLibraryW, which runs its DllMain, and prints loaded or failed <Win32 error>. A vectored handler records the last error-class exception raised during the load, so a fault inside DllMain, which the loader reports only as ERROR_DLL_INIT_FAILED (1114, measured here on Windows 10 19045), is printed with its code, module and offset.
  • tools/module_check.py <converted folder> --build-dir build copies the probe into the folder (so the title's own copies of runtime DLLs win the search order), runs it once per converted DLL (those with a .registry.json; every non-ab_* DLL when none has one), each in its own process with its own ANYBOX_REPORT, and classifies the result: loaded, failed (with the fault when there was one), stopped (not-implemented / unsupported, with library and function from the run report), crashed, or timeout. Exit code 1 when any module does not load; --json writes the results.
  • Documented under "Before a run" in GAME_TESTING.md.

Tested

  • Windows 10, MinGW WinLibs GCC 15.2 UCRT, Ninja, Release, clean build directory: no warnings, CTest 52/52 (new: module_check, tools_test_module_check); module_check passed 10 repeats.
  • module_check builds four fake modules (DllMain returns TRUE, returns FALSE, calls D3D12XboxCreateDevice, writes through a null pointer) plus one without a registry file, and checks each classification, the skipped module and that the probe is removed again.
  • python -m unittest discover -s tools/tests: 52/52, including module selection, output parsing and messages.
  • check_conventions.py, debt_fold.py --check, progress.py --json pass.
  • On one title's 16 bundled DLLs (C++ runtime, HTTP client, video codec, upscaler, BVH builder), relinked with current main: 16 of 16 load. No game data in the PR.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: Win32 LoadLibraryW, AddVectoredExceptionHandler, GetModuleHandleExW documentation; loader behaviour for a fault in DllMain measured on Windows 10 19045
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 02:12 UTC · [original](https://github.com/Dark3581/AnyBox/pull/29) `Dark3581:feat/module-check` → `main` · +334 −0 · 8 files · 2 commits · merged 2026-11-22 02:17 UTC ### What A way to check a title's converted DLLs before (or without) its executable: - `anybox-module-probe.exe` (built into the build root, Windows only) loads one DLL with `LoadLibraryW`, which runs its `DllMain`, and prints `loaded` or `failed <Win32 error>`. A vectored handler records the last error-class exception raised during the load, so a fault inside `DllMain`, which the loader reports only as `ERROR_DLL_INIT_FAILED` (1114, measured here on Windows 10 19045), is printed with its code, module and offset. - `tools/module_check.py <converted folder> --build-dir build` copies the probe into the folder (so the title's own copies of runtime DLLs win the search order), runs it once per converted DLL (those with a `.registry.json`; every non-`ab_*` DLL when none has one), each in its own process with its own `ANYBOX_REPORT`, and classifies the result: loaded, failed (with the fault when there was one), stopped (`not-implemented` / `unsupported`, with library and function from the run report), crashed, or timeout. Exit code 1 when any module does not load; `--json` writes the results. - Documented under "Before a run" in GAME_TESTING.md. ### Tested - Windows 10, MinGW WinLibs GCC 15.2 UCRT, Ninja, Release, clean build directory: no warnings, CTest 52/52 (new: `module_check`, `tools_test_module_check`); `module_check` passed 10 repeats. - `module_check` builds four fake modules (DllMain returns TRUE, returns FALSE, calls `D3D12XboxCreateDevice`, writes through a null pointer) plus one without a registry file, and checks each classification, the skipped module and that the probe is removed again. - `python -m unittest discover -s tools/tests`: 52/52, including module selection, output parsing and messages. - `check_conventions.py`, `debt_fold.py --check`, `progress.py --json` pass. - On one title's 16 bundled DLLs (C++ runtime, HTTP client, video codec, upscaler, BVH builder), relinked with current `main`: 16 of 16 load. No game data in the PR. ### Checklist <!-- Rules behind each item: CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: Win32 `LoadLibraryW`, `AddVectoredExceptionHandler`, `GetModuleHandleExW` documentation; loader behaviour for a fault in `DllMain` measured on Windows 10 19045 - [x] AI-assisted: yes
anybox-module-probe.exe loads one DLL and reports whether it loaded, the Win32 error otherwise and, when DllMain raised one, the exception code with module and offset (the loader turns a fault in DllMain into ERROR_DLL_INIT_FAILED). module_check.py runs it for every converted DLL of a title, each in its own process with its own run report, so a DLL that calls an AnyBox stub names the function. It needs no executable. Four fake modules (loads, returns FALSE, calls a stub, faults) cover each result in the module_check test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:20 +00:00
github manually merged commit 514d00cb74 into gh-pr/29/base 2026-11-26 19:14:21 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.