Repository navigation
Conversation
|
A review note on the AcpHal hardware object, from facts in sammwyy/xvalkyrie (GPL-3.0;
AI-assisted. |
|
Thanks, taken in 280ee42: slots 3 and 4 now return 0 instead of
Not run against the retail executable. AI-assisted (Claude Code). |
|
Static check of the call sites at
That matches the PR's "What the call sites show" section. I cannot run the Windows ctest here, so this is a static confirmation only; the 28-check run remains the runtime evidence. No game data: counts, offsets and RVAs only. AI-assisted. |
devnull34
left a comment
There was a problem hiding this comment.
Hardware & Environment
- Host: Windows 11 Build 26300 x64
- Toolchain: MSVC 19.44 (Visual Studio 2022), CMake 4.4, Python 3.15
Verification Summary
Targets compiled with MSVC 19.44 and executed natively:
-
**\�cphal_test.exe**:
- Passed with 28 checks, 0 failures.
- Verified audio heap creation (\ApuCreateHeap), aligned allocations (\ApuAlloc), address validity checks, 32-bit APU-to-virtual address translations (\ApuMapVirtualAddress\ / \ApuMapApuAddress), shape context allocation/release, and no-op \AcpHalCreate\ object lifecycle (with message poll slots 3 and 4 answering 0 when empty).
-
**\xgameruntime_offline_test.exe\ & \xgameruntime_test.exe**:
- Passed with 143 checks OK.
- Verified \XAccessibilityImpl\ (closed captions, high contrast, synthesizer voice enumeration / creation stubs) and \XLauncherImpl\ (URI and title launches) offline interfaces.
-
CTest & Regression Tests:
- \�cphal: Passed (0.01s)
- \xgameruntime_offline: Passed (0.01s)
- \xgameruntime_offline_hdr: Passed (0.01s)
- Total: 3/3 passed (100%).
- \ ests/test_gdk_runtime_calls.py: 22/22 tests passed.
-
Hygiene & Compliance:
- Clean-room compliant: pure synthetic unit tests; zero game assets or proprietary code.
- \git diff origin/main..HEAD --check: Clean (0 whitespace/formatting defects).
LGTM!
280ee42 to
4bc4661
Compare
|
Thanks, both points were right and are fixed at
Tested on Windows 11, MSVC 19.44 (AMD Radeon RX 9070 XT, driver 32.0.32029.2010; no GPU used). Not run against the retail executable. AI-assisted (Claude Code). |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
Adds runtime/shims/acphal.cpp and runtime/test/acphal_test.cpp: nine AcpHal.dll imports (APU heap allocation/mapping, shape contexts, and a no-op AcpHal object) are registered, wired into CMake, and covered by tests. Also adds offline XAccessibilityImpl and XLauncherImpl classes, updates the shim registry and feature table, and documents all of it.
Why merge
This fills concrete executable imports that otherwise fail at runtime, modeling the APU heap and audio object with call shapes read from the executable while dropping commands on a PC. The companion offline GDK classes let early boot calls succeed, and both paths ship with dedicated tests and documentation.
Verdict: Approve
SummaryAdds Why mergeThis fills concrete executable imports that otherwise fail at runtime, modeling the APU heap and audio object with call shapes read from the executable while dropping commands on a PC. The companion offline GDK classes let early boot calls succeed, and both paths ship with dedicated tests and documentation. Verdict: Approve |
4bc4661 to
df9745b
Compare
|
Rebased onto main AI-assisted (Claude Code). |
|
Tested The rebase to
|
|
Tested
|
|
Wine data point for #6885: pass. Built
All nine Full Nothing from the executable was run: |
|
Tested
|
|
New head
Not run against the retail executable. AI-assisted (Claude Code). |
…IMPL Measured on the retail boot once ApuAlloc gives memory: the audio init calls AcpHalCreate, then object slot 0 with (0x1000, 0x1000) and slot 2 with (command, dword, dword, pointer, dword), checks both, and a failure is its fatal assert. The local object took slots 0/1 for AddRef/Release and answered E_NOTIMPL from slot 2 on. The slots now follow the title's call shapes, read the same way by ItsNotRexed#6885 (its whole AcpHal rewrite was not merged: this tree already has ItsNotRexed#7009's shim): 0 connect and 1 disconnect succeed, 2 accepts and drops each command (no audio processor on a PC, logged once), 3 and 4 answer 0 (no message), 5 is the release at shutdown. Names are hypotheses. acphal_test: the slots in those shapes (36 checks, 0 failures). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 3b7c9f4 (merged onto main 867d922) on RTX 5070, NVIDIA 621.24, Windows 11 (build 26200), Vulkan validation layer on (
Ran the tests that belong to the test files this PR changes (ctest entries, or the test program directly when it is not registered), with no game files ( |
|
checked: #68853b7c9f4 | with: AI-assisted (Claude Code). |
|
checked: #6885 at From a clean checkout of the PR head, I built and ran the unmodified CPU fixture: x86_64-w64-mingw32-clang++ -std=c++20 -O2 -static -fms-extensions \
-DWIN32_LEAN_AND_MEAN -DNOMINMAX -Iruntime/shims \
runtime/test/acphal_test.cpp runtime/shims/acphal.cpp runtime/shims/registry.cpp \
-o /tmp/acphal_test.exe
WINEDEBUG=-all WINEPREFIX="$(mktemp -d)" wine /tmp/acphal_test.exeThe checks cover heap creation, aligned allocation with flags 2, address round-trip, free and reuse, and the registered COM command path. In a separate downstream MinGW/Vulkan integration on a GeForce RTX 5060 Ti (driver 595.104.02), adding this AcpHal revision moved strict startup from an unresolved agent: yes (Codex-assisted build and verification). |
|
Tested Merged onto @tibzejoker's
Traces stay local; only outcomes, slot numbers and public formats here. AI-assisted (Claude Code). |
…p with a 32-bit address mapping and a no-op hardware object (RT-489) Squashed from ItsNotRexed#6885 by Jadiac5, head 921fa77 (security scan PASS).
…onnections that succeed with an empty result queue (RT-489) Squashed from ItsNotRexed#6981 by Jadiac5, head eaeee26 (security scan PASS). Conflicts in runtime/CMakeLists.txt and docs/runtime_imports.md with ItsNotRexed#6885: kept both sides.
|
Tested Boot integration datapoint (base
Control: without the audio shims the same build stops earlier at a deterministic AV in the audio-object initialization ( |
LaugeM
left a comment
There was a problem hiding this comment.
Read at 3b7c9f42 against main 5d74c2723. This should be the AcpHal.dll shim that lands. It applies cleanly to main, and with #6981 it conflicts only on adjacent lines in runtime/CMakeLists.txt and docs/runtime_imports.md. KevinPratap's retail run with both got past the audio init and ran 10 minutes with no crash.
Compared with the other two AcpHal shims:
- #7009 writes six pointers and six
APU_ADDRESSfields (0x78 bytes) into the caller's struct, and itsAcpHalReleaseShapeContextsfrees pointers read through an argument the title doesn't pass. HereAcpHalAllocateShapeContexts(runtime/shims/acphal.cpp:136-147) writes only the pointers for non-zero counts, andAcpHalReleaseShapeContexts(:149) takes no argument and frees its own globals. - #9515 adds the same
runtime/shims/acphal.cpp, so the two conflict outright. At its head it doesn't compile (twostatic_assertfailures, see the comments there).
Two things are still open:
- The fallback
$fileslist inscripts/build_runtime.ps1:84still lacksshims\acphal.cpp(mohammadallami75-ops and Hiiva raised it). Main already missesxg_xs.cppthere (#8393, #9339), and this PR adds a second missing name. #9515 has the line, so it could be taken from there. - The shape contexts come from
_aligned_mallocoutside the APU heap (acphal.cpp:141).ApuIsVirtualAddressValid(:99) andApuMapVirtualAddress(:111) only know the heap, so they give FALSE and 0 for a context address. One of the four validity sites indocs/audio_hal_exe_calls.mdpasses 0x40, the XMA context stride. If that site checks a context, the title takes its false branch. That is a hypothesis, not measured. The retail runs reported here don't stop there, so it isn't a blocker. It's worth checking once the audio path runs.
AI-assisted review (Opus 5.5). Read the diff against main; not built.
Item:
AcpHal.dllshim (RT-5 follow-up), claimed in #6750 (comment)What the imports are for
AcpHal.dllis the console's audio hardware layer. The game executable imports nine functions from it (the list in #6715). TheApu*functions manage a heap of memory the audio processor reads, with 32-bit APU addresses for it.AcpHalCreatereturns the object the game sends commands through, andAcpHalAllocateShapeContextshands out the per-voice context records.What the call sites show (static read of the executable, nothing executed or mapped)
Each import has one thunk. There are 16 call sites in all:
ApuCreateHeap(1): a size in MiB shifted left by 20, then a byte count. The result is tested for failure, and failure stops the game.ApuAlloc(1): five arguments. The output pointer comes first. The APU-address out pointer is NULL, the alignment is 0x800 and the flags are 2. The result is not tested; the caller reads the output pointer straight after the call. The size is the non-cached heap size minus 16 KiB.ApuFree(1): one pointer, as a tail call at shutdown. The result is ignored.ApuIsVirtualAddressValid(4): a pointer and an alignment of 0x40, 0x80 or 0x800. The result is a bool in AL.ApuMapVirtualAddress(4): a pointer in, and a 32-bit value out that goes into a context field. One site can pass NULL.ApuMapApuAddress(2): a 32-bit value in, and a pointer out. The pointer is tested for NULL and then written through.AcpHalAllocateShapeContexts(1): one pointer to a struct. The caller zeroes six dwords and sets the fifth to 350. After the call it reads a pointer at +0x38 and clears count × 64 bytes there. No other code in the image touches the struct. Failure stops the game.AcpHalCreate(1): one out pointer. Failure stops the game. The game calls four vtable slots on the object:AcpHalReleaseShapeContexts(1): no argument registers are set up. The result is ignored.What each function does now
ApuCreateHeapcommits one block of ordinary memory for both sizes. A PC has no cached/non-cached split.ApuAllocandApuFreemanage that block first fit. A new allocation is zeroed. An APU address is a fixed nonzero base plus the offset into the block.ApuMapVirtualAddressandApuMapApuAddressconvert between the two by arithmetic. Anything outside the heap maps to 0 or NULL.ApuIsVirtualAddressValidreturns TRUE only for an address inside a live block whose APU address is a multiple of the alignment.AcpHalAllocateShapeContextsgives each nonzero count zeroed memory of count × 64 bytes and writes a NULL pointer for each zero count.AcpHalReleaseShapeContextsfrees that memory.AcpHalCreatereturns an object:Hypotheses:
Tests
acphal_test(new, ctestacphal): 29 checks, 28 pass. It resolves every export throughrt::shims::find. It calls them in the shapes and order of the call sites, and it calls the object through raw vtable slots 0, 2, 3, 4, 1 and 5.ctest -R "^(acphal|xmem|unimplemented_policy|pe_loader)$": 4 of 4 pass, run after the rebase on548ac1032.gta6rtbuilds with the new table.python -I tests/test_docs_repo_paths.py: OK.python -I scripts/check_no_game_data.py: exit 0.Not tested: it has not been run against the retail executable. No audio output either, because there is none.
Tested on Windows 11, MSVC 19.44.
AI-assisted (Claude Code).