Skip to content

runtime: integrate 15 console import bindings with explicit audio limits - #7763

Closed
FarhatFIN wants to merge 2 commits into
ProjectLeonida:mainfrom
FarhatFIN:farhat/imports15-20261124
Closed

FarhatFIN wants to merge 2 commits into
ProjectLeonida:mainfrom
FarhatFIN:farhat/imports15-20261124

Conversation

@FarhatFIN

Copy link
Copy Markdown
Contributor

This is an incomplete, AI-assisted integration of 15 missing import bindings, not 15 fully emulated APIs or a working game port.

It adapts DirectStorage from #4348, AcpHal memory/context management from #6885, and the XApu connection portion of #6981. It also carries the GameInput ordinal fix from #7216. Credit for those implementations belongs to their original authors. This branch overlaps those PRs; review as an integration proposal, not an independent replacement.

Depends on: #4348, #6885, #6981, #7216 (adapted/carried locally; they appear in this diff).

Behavior and limitations

  • Six Apu memory exports and two shape-context exports provide host-backed allocation/mapping; only the measured fifth context type is supported. Address/layout assumptions remain documented.
  • XApu connection memory is managed, but no DSP decoder exists. AcpHalCreate and XApuEnqueueCommand explicitly return E_NOTIMPL instead of reporting successful hardware processing; results remain empty.
  • DirectStorage supports ordinary file/memory reads, ordered queues and notifications. Zlib, BCPack, swizzle and physical-page requests remain unsupported.
  • A local dry run binds the 15 names and leaves 7 imports unbound. This count excludes unsupported behavior behind registered handlers and does not establish launchability.
  • No game entry point, game TLS callback or game DllMain was executed. No game data or binaries are included.

Validation

Linux, clang-cl 21, xwin SDK 10.0.26100, Wine 10.0; synthetic CPU data:

  • acphal, xapu, dstorage, xmem, gameinput and unimplemented_policy CTest suites passed.
  • Fallback-build checks passed, with one Windows-only case skipped; Linux CMake configuration passed.
  • DirectStorage pending-statistics test uses a test-only before-copy hook because the expected PAGE_GUARD exception was not delivered on this Wine setup. Production copying is unchanged; pending/completion/content assertions remain enabled.
  • Diff whitespace and no-game-data checks passed. Full GPU/translator suites were not run; no GPU rendering was tested.

See docs/local_imports15.md for scope, attribution and remaining work. Coordination claim linked below.

Claimed in the coordination issue: #7694 (comment)

gkissel and others added 2 commits November 23, 2026 23:57
…ameInputCreate import

The retail executable imports GameInputCreate from GameInput.dll by ordinal 1. The loader looks ordinal imports up
as "ProjectLeonida#1", which the shim table did not have, so the import bound to the host's GameInput.dll. On Windows the
installed GameInput answers; under Wine it is the builtin stub, the call fails and the title stops on its result.
The alias maps ProjectLeonida#1 to the same GameInputCreate, and gameinput_test checks it.
Integrate DirectStorage from upstream PR ItsNotRexed#4348 and adapt memory/connection code from ItsNotRexed#6885 and ItsNotRexed#6981. Reject unsupported audio commands instead of reporting successful processing. Validate with synthetic CPU tests under Wine; game execution remains untested.
@FarhatFIN

Copy link
Copy Markdown
Contributor Author

Full implementation is not ready. This PR adds 15 import bindings, not 15 fully emulated APIs. AcpHalCreate and XApuEnqueueCommand return E_NOTIMPL; audio DSP processing is absent. DirectStorage decompression (zlib/BCPack), swizzle and physical-page requests are unsupported, and texture/DSP imports remain unbound. Six targeted synthetic test suites passed, but gameplay and launchability have not been tested; game code was not executed.

This is AI-assisted integration work by FarhatFIN, adapted from the original authors’ PRs #4348, #6885, #6981 and #7216. The PR description and docs/local_imports15.md list the scope and remaining assumptions.

@Ekabusto

Copy link
Copy Markdown

Tested b4eb9e734 natively on Windows 11 10.0.26300 (not Wine), AMD Ryzen 9 5900X, MSVC 19.44.35230 RelWithDebInfo:
pass for the suites in the description.

ctest -R "^(acphal|xapu|dstorage|xmem|gameinput_host|unimplemented_policy)$": 6/6 passed. Run directly, with no
SKIP lines in any of them:

test result
dstorage 272 checks, 0 failures
acphal 30 checks, 0 failures
xapu 24 checks, 0 failures
xmem 173 checks, OK
unimplemented_policy 98 checks, 0 failed
gameinput_host passed under ctest

One note: dstorage_test always pauses the copy through set_before_copy_hook (dstorage_test.cpp:886-951),
including on Windows. So this native run doesn't exercise the PAGE_GUARD route either. If you want that path covered
on Windows, the hook could be limited to Wine.

Not run: no GPU rendering, the full runtime CTest set, or anything with a game copy.

AI-assisted: yes (Claude ran the build and tests; results checked by me).

@eizispark

Copy link
Copy Markdown

Tested b4eb9e7 merged into main (dde82f2) on AMD Radeon RX 9070 XT, Adrenalin 26.11.1 (LLPC / Vulkan 1.4.359), Windows 11: pass.

  • Built acphal_test, dstorage_test, gameinput_test, unimplemented_policy_test, xapu_test, tiny_game, gta6rt (RelWithDebInfo, clang-cl / lld-link)
  • ctest --test-dir runtime/build -C RelWithDebInfo -R ^(acphal|dstorage|gameinput|unimplemented_policy|xapu|shim_registry|run_tiny_game)$ --output-on-failure: 6/6 passed (unimplemented_policy, dstorage, gameinput, run_tiny_game, acphal, xapu)
  • gta6rt --dry-run (exit 0)

@coolab342

Copy link
Copy Markdown

Tested b4eb9e734 natively on Windows 11 (not Wine), AMD Radeon RX 6700 XT (RDNA2, AMD driver 32.0.21045.29003), Clang 23.1.6 (clang-cl + xwin SDK 10.0.26100), RelWithDebInfo: pass.

  • ctest -R "^(acphal|xapu|dstorage|xmem|gameinput_host|unimplemented_policy)$": 6/6 passed (gameinput_host, unimplemented_policy, xmem, dstorage, acphal, xapu).
  • gta6rt --dry-run on own 1.0.2.1 package: 5 modules mapped, unimplemented imports reduced from 22 to 7 (hresult=0 other=7), matching the 15 bound imports described in the PR.

AI-assisted.

@rideinstead

Copy link
Copy Markdown

✅ Automated security review: CLEAN (commit b4eb9e73)

  • No findings.

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

@Cryserrrrr

Copy link
Copy Markdown

Tested b4eb9e734 merged onto main dde82f27e (clean) on AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2 gfx1036, AMD 25.10.36, subgroup 32..64) and RTX 4080 SUPER (610.88, subgroup 32), Windows 11: pass. Heads-up: it now conflicts with main 867d922f0 in docs/runtime_imports.md, where main added xg_xs.dll to the same owns_dll line.

AI-assisted (Claude Code).

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

Only the DirectStorage part (the audio part is reviewed separately). runtime/shims/dstorage.cpp, dstorage_xs_abi.h and runtime/test/dstorage_test.cpp here are #4348's 45c39cf6f plus one change: a LEONIDA_DSTORAGE_TEST_HOOKS before-copy hook (dstorage.cpp, the memory-source path in execute_request, and its declaration in dstorage_xs_abi.h), defined only for dstorage_test in runtime/CMakeLists.txt:263. It fixes the same Wine failure in test_stats_timing that #7343 fixes in the test alone, without test code in the shim.

#4348 is closed and #8461 is its takeover. Merged onto #8461 this branch conflicts add/add in all three DirectStorage files, in runtime/CMakeLists.txt, scripts/build_runtime.ps1 and docs/runtime_imports.md (git merge-tree). I would drop these files from the branch and say Depends on: #8461, with #7343 as the fix for the test.

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.

9 participants