Skip to content

runtime: add initial bring-up shims for xcrdapi, xg_xs, chad, xapu, a… - #9168

Closed
canalmaloqueru-design wants to merge 2 commits into
ProjectLeonida:mainfrom
canalmaloqueru-design:feat/console-bringup-shims
Closed

canalmaloqueru-design wants to merge 2 commits into
ProjectLeonida:mainfrom
canalmaloqueru-design:feat/console-bringup-shims

Conversation

@canalmaloqueru-design

Copy link
Copy Markdown

…nd acphal

Claimed in the coordination issue as:

Depends on:

What and why

Tested

AI-assisted:

Checklist

  • 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.

@Ysergic Ysergic left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI-assisted independent review at f43e554. Cross-compiled the existing xg_xs test with Clang 23.1.6/MSVC SDK 14.44.17.14 and ran it under Proton Wine 11.0 on Linux x86_64, using the real registry and shim source files. No game files or GPU used. The control passes 16/16 checks; appending this PR's new translation unit produces three assertion failures before the test stops. Also please coordinate the chad.dll entries with the already implemented and independently retested #8848; registering another table for those names would create the same ownership conflict when combined.

HRESULT WINAPI XGCreateTextureComputer_stub(const void* /*desc*/, void** out) {
static std::atomic<bool> logged{false};
log_once(logged, "xg_xs", "XGCreateTextureComputer -> E_NOTIMPL");
if (out) *out = nullptr;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Keep the existing xg_xs handlers instead of replacing them. runtime/shims/xg_xs.cpp already registers both exports, and Table::Table in registry.cpp overwrites an existing key with the last registration. With this translation unit appended as in the new CMake source list, the existing registered-API test changes from 16/16 passing to failures for Suggest's HRESULT, Create(desc, nullptr), and the returned computer. In particular this line clears the computer that the existing implementation deliberately supplies because two documented callers dereference it without checking the failed HRESULT. The replacement therefore reintroduces a null dereference on that path. Remove these duplicate registrations or extend the existing implementation while preserving its measured call contract; the stock xg_xs test should also run with the full installed table set. Reproducer: link runtime/test/xg_xs_test.cpp + shims/registry.cpp + shims/xg_xs.cpp, then append shims/xbox_console_stubs.cpp and rerun the same binary test.

@LaugeM LaugeM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Read at a0238e33 (only a merge of main on top of f43e5540) against main 5d74c2723. This would move the boot backwards, and I'd close it.

  • It replaces main's xg_xs.dll shim. SHIM_TABLE(xbox_console_stubs, …) registers XGCreateTextureComputer and XGSuggestSwizzleMode again (runtime/shims/xbox_console_stubs.cpp:180-181). The file is added after shims/process.cpp (runtime/CMakeLists.txt:121), so it links after shims/xg_xs.cpp (:111), and Table::Table (runtime/shims/registry.cpp:478-480) keeps the last one registered. The stub sets *out = nullptr (xbox_console_stubs.cpp:37-41). Two of the four measured callers ignore the HRESULT and call through *out (main's runtime/shims/xg_xs.cpp:8-10), which is why main stores an object there. Ysergic's run above shows xg_xs_test failing once this file is linked in. Confirmed (code read, and Ysergic's test).
  • The audio init can't pass. AcpHalCreate returns E_NOTIMPL (:116-120), and per #7864 that goes straight to the title's int3. AcpHalAllocateShapeContexts (:123) takes no argument and returns S_OK without filling the fifth context pointer, which #7864 says the title clears count x 64 bytes through. ApuMapApuAddress always returns null (:170), and the title tests that result (docs/audio_hal_exe_calls.md). XDspActivate (:52) writes no outputs, the same problem as #7009. Confirmed against docs/audio_hal_exe_calls.md and #7864.
  • XGSuggestSwizzleMode has the wrong shape (:44). The title passes (desc, 0, mode*) (main's xg_xs.cpp:4), but this stub takes one argument and returns a mode in eax. The 0 reads as S_OK and the mode isn't written, so it happens to do what main does, but the signature is wrong.

#6885 (AcpHal), #6981 (xapu, chad) and #4348 (DStorage) cover the same names with measured shapes, and xg_xs.dll is already on main.

AI-assisted review (Opus 5.5). Read the diff against main; not built.

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