Skip to content

runtime/README: AcpHal, chad, xapu and XCRDAPI have shims; DStorage decodes BCPack (DOC-RUNTIME-README-SHIMS) - #1517

Open
Mike7581 wants to merge 4 commits into
ProjectLeonida:mainfrom
Mike7581:docs/runtime-readme-shims
Open

Mike7581 wants to merge 4 commits into
ProjectLeonida:mainfrom
Mike7581:docs/runtime-readme-shims

Conversation

@Mike7581

Copy link
Copy Markdown

Claimed in the coordination issue as: DOC-RUNTIME-README-SHIMS (#14 (comment))

What and why

runtime/README.md had two stale statements:

  • The LEONIDA_COMPAT_DIR section said the AcpHal, chad, xapu and XCRDAPI console DLLs "have no shim here". shims/acphal.cpp, shims/chad.cpp, shims/xapu.cpp and shims/dstorage.cpp (which serves xcrdapi.dll) exist now. The paragraph keeps the xbox-emulator crates as an example of drop-in DLLs, names the four shims, says a DLL in the folder replaces its module's shim, and marks the 867d922 measurement as taken before those shims.
  • The DirectStorage entry said "BCPack, swizzle and physical-page requests are not done yet". docs/directstorage.md and shims/dstorage.cpp describe the BCPack decoder in src/bcpack.cpp (BC1/3/4/5/6H/7; BC2 is E_NOTIMPL), the optional macro-unshuffle and physical page numbers resolved through xmem. The entry now says that.

Docs only; no code changes.

Tested

python -I scripts/check_no_game_data.py runtime/README.md. Checked every statement against the current main sources and docs/directstorage.md.

GPUs tested: n/a

AI-assisted: yes (Claude Code, Claude Opus 5.5)

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)

…ecodes BCPack (DOC-RUNTIME-README-SHIMS)

The compat-modules section still said those four console DLLs have no shim here, and the DirectStorage entry
said BCPack, swizzle and physical-page requests are not done. shims/acphal.cpp, chad.cpp, xapu.cpp and
dstorage.cpp exist, and docs/directstorage.md describes the BCPack decoder, macro-unshuffle and xmem
physical-page resolution. The 867d922 measurement is kept and marked as taken before those shims.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ytsodacan

ytsodacan commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

[KEEP]

  • Docs-only change to runtime/README.md (two paragraphs): names the now-existing acphal/chad/xapu/dstorage shims and updates the DirectStorage BCPack/swizzle/physical-page text; no duplicate PR found (docs: document LEONIDA_RNG_SEED in runtime/README.md #163 touches a different section).
  • No CI checks have reported on the branch (gh pr checks: none), so the no-game-data check and any doc-reading tests have not run.
  • Claims about src/bcpack.cpp (BC2 returns E_NOTIMPL) and docs/directstorage.md were not re-verified here; a maintainer should confirm them against main before merging.
  • No conflicts; fine to merge once checks run green.

@Andretuta Andretuta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the docs update. I checked every claim against current main (3f81d46). The BCPack, BC2 E_NOTIMPL, swizzle and xmem page-list statements match the code, and the PR merges cleanly. One path is wrong, and one switch is worth a sentence. Line numbers refer to the PR head 99c9874.

Should-fix: runtime/README.md:119 names shim files the runtime no longer links

The new paragraph points to shims/chad.cpp and shims/xapu.cpp. The runtime executable target links shims/xapu_chad.cpp for both DLLs, and that file registers a xapu.dll table and a chad.dll table. runtime/CMakeLists.txt on main says so itself, in the comment above xapu_test: the earlier shims/xapu.cpp and shims/chad.cpp are no longer linked into the runtime, which serves both DLLs from xapu_chad.cpp. Those two files are only built for xapu_test and chad_test.

Suggested wording:

All four modules now have a shim here as well (`shims/acphal.cpp`, `shims/xapu_chad.cpp` for both `xapu.dll`
and `chad.dll`, and `shims/dstorage.cpp` for `xcrdapi.dll`); a DLL in the folder replaces its module's shim, as above.

Nit: runtime/README.md:280, mention the switch that turns the new paths off

runtime/shims/dstorage.cpp:996 returns E_NOTIMPL for BCPack, swizzle and physical-page requests when LEONIDA_DSTORAGE_EXTENDED=0. Suggested sentence after the feature description:

These paths are on by default; `LEONIDA_DSTORAGE_EXTENDED=0` makes requests that use BCPack, swizzle or physical
page lists return `E_NOTIMPL`.

What was checked

  • Shim registrations on main:

    • acphal.cpp (AcpHal)
    • xapu_chad.cpp (both xapu.dll and chad.dll; it is the source the runtime target links)
    • dstorage.cpp (xcrdapi.dll!DStorageGetFactory)
  • src/bcpack.cpp handles BC1/3/4/5/6H/7 and BC2 is refused at dstorage.cpp:997. The macro-unshuffle and the xmem page-list path are in dstorage.cpp.

  • git merge-tree with main: clean. Python tests run:

    • test_bcpack
    • test_amd_swizzle*
    • test_acphal_abi
    • test_docs_env_vars

    All pass.

Review done with AI assistance (Claude Code and GPT-6.2 Sol, cross-checked against each other). Every finding above was checked against the code.

… LEONIDA_DSTORAGE_EXTENDED=0

Review follow-up for ProjectLeonida#1517: the runtime target links shims/xapu_chad.cpp for both xapu.dll and chad.dll (shims/xapu.cpp and shims/chad.cpp only build for their ABI tests), and LEONIDA_DSTORAGE_EXTENDED=0 makes BCPack, swizzle and physical-page requests return E_NOTIMPL (shims/dstorage.cpp validate_request).
…processes them

EnqueueRequest returns void; validate_request runs on the queue worker (execute_request and prepare_in_background), so BC2 and, with LEONIDA_DSTORAGE_EXTENDED=0, BCPack, swizzle and page-list requests fail there rather than returning the error.
@Mike7581

Copy link
Copy Markdown
Author

Thanks for checking every claim against main. Both points are fixed:

  • 4ad6d3f: the shim list names shims/xapu_chad.cpp for both xapu.dll and chad.dll, matching what the runtime target links; added your sentence on LEONIDA_DSTORAGE_EXTENDED=0.
  • 1f8ccc6: since EnqueueRequest returns void and validate_request runs on the queue worker, the text now says BC2 requests (and, with LEONIDA_DSTORAGE_EXTENDED=0, BCPack/swizzle/page-list requests) fail with E_NOTIMPL when processed, rather than "return" it.

check_no_game_data.py and tests/test_docs_env_vars.py pass.

@nicoco23

Copy link
Copy Markdown
Contributor

Read through the diff (not built here). One line is out of date since #1144 merged (via #2350): shims/xapu_chad.cpp now serves only chad.dll, and xapu.dll comes from shims/xapu_queue.cpp — that is what runtime/CMakeLists.txt links into gta6rt and what the cl.exe fallback list in scripts/build_runtime.ps1 compiles. Suggest "(shims/acphal.cpp, shims/xapu_queue.cpp for xapu.dll, shims/xapu_chad.cpp for chad.dll, and shims/dstorage.cpp for xcrdapi.dll)". The rest matches main as far as I can see. AI-assisted review (Claude Code).

…by shims/xapu_chad.cpp

Since ubiquitarianism#1144 merged (via ubiquitarianism#2350), xapu_chad.cpp serves only chad.dll and xapu.dll comes from xapu_queue.cpp, which runtime/CMakeLists.txt links into gta6rt and build_runtime.ps1's cl.exe fallback compiles. Wording from nicoco23's review.
@Mike7581

Copy link
Copy Markdown
Author

@nicoco23 Thanks, you're right: since #2350, xapu.dll comes from shims/xapu_queue.cpp and xapu_chad.cpp serves only chad.dll. Fixed in c8fabf8 with your wording (and the rest of the paragraph rewrapped).

Written with AI assistance (Claude Code, Claude Opus 5.5).

@Andretuta Andretuta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked at c8fabf8 merged cleanly onto current main (d1dff7949).

All earlier review items and the post-#2350 split are addressed accurately:

  • runtime/README.md now lists shims/acphal.cpp, shims/xapu_queue.cpp for xapu.dll, shims/xapu_chad.cpp for chad.dll, and shims/dstorage.cpp for xcrdapi.dll — matching both runtime/CMakeLists.txt and scripts/build_runtime.ps1.
  • The DirectStorage paragraph matches runtime/shims/dstorage.cpp (src/bcpack.cpp BC1/3/4/5/6H/7, BC2 failing with E_NOTIMPL, optional macro-unshuffle and xmem physical page lists on by default, and LEONIDA_DSTORAGE_EXTENDED=0 failing those requests with E_NOTIMPL on queue processing).

Verified locally: git merge-tree against d1dff7949 clean, scripts/check_no_game_data.py exit 0, and test_docs_links.py, test_docs_repo_paths.py, test_docs_table_ids.py, test_docs_env_vars.py, test_docs_cli_flags.py, test_docs_encoding.py, and test_text_write_line_endings.py all pass.

AI-assisted review (Antigravity); every claim checked against main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants