diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 03:41:48 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 03:41:48 -0500 |
| commit | 8b771908c3c8d7d233e66f39d535a5a7c63047aa (patch) | |
| tree | a5aa45227ef725edba1f021f7f2e10fcb898a834 /docs | |
| parent | f9792cc56de10067f1bbdb233eaac23cd5b2074f (diff) | |
| parent | 237deb64ce2b567283f304b7b89a23152e7b60c0 (diff) | |
Merge main into feat/gdk-lifecycle-window-hook (#769)feat/gdk-lifecycle-window-hook
scripts/build_runtime.ps1 conflicted in the $files list of the build
without CMake: main added shims\silent_audio.cpp there (#1598) after this
branch had merged main, and this branch adds shims\lifecycle.cpp. Both
entries are kept, lifecycle.cpp where this branch had it. The branch's
other change in that file (user32.lib on the link line) merged cleanly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/d3d12_vulkan.md | 7 | ||||
| -rw-r--r-- | docs/runtime_imports.md | 39 |
2 files changed, 45 insertions, 1 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 97d737c8e..e23985ecb 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -2855,7 +2855,12 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv | |||
| 2855 | plane 1. For `R16_TYPELESS`, use `R16_UINT` on plane 0 to access the raw D16 bits. An array UAV selects a | 2855 | plane 1. For `R16_TYPELESS`, use `R16_UINT` on plane 0 to access the raw D16 bits. An array UAV selects a |
| 2856 | contiguous range of layers. The depth/stencil and shader-resource views continue to use the attachment image. | 2856 | contiguous range of layers. The depth/stencil and shader-resource views continue to use the attachment image. |
| 2857 | Slot 133 keeps the guest address. Identical, live placements share their image and writable planes across | 2857 | Slot 133 keeps the guest address. Identical, live placements share their image and writable planes across |
| 2858 | distinct COM objects. A partial overlap or incompatible reinterpretation is refused. | 2858 | distinct COM objects. An incompatible reinterpretation at the same address is refused. A placement's extent is |
| 2859 | the PC allocation size, which can exceed the title's own block (RADV sizes a large D16 target above it, so the | ||
| 2860 | title's next block starts inside the range); a placement that starts inside another one therefore gets its own | ||
| 2861 | image when both layouts are opaque, since D3D12 leaves an alias's contents undefined until reinitialized, and is | ||
| 2862 | refused only for a non-opaque layout. Before this, the retail boot stopped on the title's assert while it created | ||
| 2863 | its D16 depth targets on an RDNA2 iGPU under RADV. A refused depth placement is logged (no trace line covers it). | ||
| 2859 | - Legacy and enhanced texture transitions copy the selected planes and layers to or from their storage images. | 2864 | - Legacy and enhanced texture transitions copy the selected planes and layers to or from their storage images. |
| 2860 | Fence-ordered graphics and compute queues can share UAV access. A dedicated compute family can perform | 2865 | Fence-ordered graphics and compute queues can share UAV access. A dedicated compute family can perform |
| 2861 | the plane transfer itself when `VK_KHR_maintenance10` and the format's depth/stencil copy flags allow it. | 2866 | the plane transfer itself when `VK_KHR_maintenance10` and the format's depth/stencil copy flags allow it. |
diff --git a/docs/runtime_imports.md b/docs/runtime_imports.md index ee0d9946e..3d6efb25f 100644 --- a/docs/runtime_imports.md +++ b/docs/runtime_imports.md | |||
| @@ -238,6 +238,45 @@ calls succeed and do nothing: there is no audio processor, so the game gets no s | |||
| 238 | fail hard, which is why every call succeeds. `acphal_test` covers the call shapes. | 238 | fail hard, which is why every call succeeds. `acphal_test` covers the call shapes. |
| 239 | The table under [The retail executable](#the-retail-executable-rt-5) was measured before this shim and still lists these nine as unimplemented; they are served now. | 239 | The table under [The retail executable](#the-retail-executable-rt-5) was measured before this shim and still lists these nine as unimplemented; they are served now. |
| 240 | 240 | ||
| 241 | ## Audio output off the console (WASAPI) | ||
| 242 | |||
| 243 | Off the console the title's sound goes out through WASAPI, not through the `AcpHal` path above: it creates an | ||
| 244 | `MMDeviceEnumerator` with `CoCreateInstance` (one call, `CLSCTX_ALL`, `IID_IMMDeviceEnumerator`), asks it for the | ||
| 245 | default render endpoint and activates `ISpatialAudioClient` on it (measured: the first interface the title asks the | ||
| 246 | device for). A console always has an output. A host with none | ||
| 247 | answers `GetDefaultAudioEndpoint(eRender, ...)` with `0x80070490` (`ERROR_NOT_FOUND`), and the title's device start | ||
| 248 | then takes an error path that leaves its own output-device lock held by a job worker: the audio engine never mixes, a | ||
| 249 | main-thread command buffer fills up, and the title stops on an `int3` about 47 s into the boot (measured under Wine with | ||
| 250 | its audio drivers disabled; refusing the enumerator itself stops it the same way, and a host null sink removes the stop). | ||
| 251 | |||
| 252 | So `CoCreateInstance` of that class goes to `runtime/shims/silent_audio.cpp` (hooked in `shims/com_shim.cpp`). When | ||
| 253 | the host's enumerator has a default render endpoint it is returned unchanged. When it has none, or cannot be made, or | ||
| 254 | `LEONIDA_AUDIO=silent` is set, the title gets an enumerator whose render answers are a **silent output endpoint** of the | ||
| 255 | runtime's own: `GetDefaultAudioEndpoint(eRender)`, `EnumAudioEndpoints(eRender)` (active devices) and `GetDevice` with | ||
| 256 | its ID give an active `IMMDevice` whose property store has a friendly name and the device format; `Activate` gives | ||
| 257 | `ISpatialAudioClient`, `ISpatialAudioClient2`, `IAudioClient`, `IAudioClient2` or `IAudioClient3` (any other interface | ||
| 258 | is `E_NOINTERFACE`, logged once). The spatial client has a 7.1 bed of static objects and no dynamic objects, as an | ||
| 259 | endpoint with no spatial sound format turned on; its objects are mono 48 kHz float, and its | ||
| 260 | `ISpatialAudioObjectRenderStream` signals the stream's event every 10 ms pass (480 frames) while it runs and hands | ||
| 261 | each object a scratch buffer between `BeginUpdatingAudioObjects` and `EndUpdatingAudioObjects`. The client | ||
| 262 | takes any PCM or float format in shared mode (event-driven or polled), and `GetService` gives `IAudioRenderClient` | ||
| 263 | (a scratch buffer), `IAudioClock`, `ISimpleAudioVolume` and `IAudioStreamVolume`. A clock consumes the written frames | ||
| 264 | in real time, so `GetCurrentPadding` drains, and an event-driven stream's event is signalled every 10 ms period | ||
| 265 | while it runs, so a title that paces its mixer on the event keeps running. Capture questions keep the host's answer | ||
| 266 | (with `LEONIDA_AUDIO=silent` the host's enumerator is only made when one comes). Endpoint notification callbacks are | ||
| 267 | accepted and never called. Nothing opens or touches a host audio device, and every sample is discarded. The first | ||
| 268 | silent device handed out prints one `[rt] audio: serving the silent output endpoint (<reason>)` line, the reason being | ||
| 269 | the host's failed call or `LEONIDA_AUDIO=silent`. | ||
| 270 | |||
| 271 | The mix format is 48 kHz, 32-bit float, 7.1 (eight channels, mask `0x63F`). 48 kHz float is the shared-mode | ||
| 272 | format of the Windows audio engine and of the console's. 7.1 is the console's case, and a hypothesis, not measured | ||
| 273 | here: the console's system mixer takes a 7.1 bed whatever output is plugged in and downmixes it for stereo, so a | ||
| 274 | console title is built for eight channels, where stereo would be the usual answer of a PC with headphones. The stream | ||
| 275 | itself takes any channel count, so a title that asks for fewer is not refused. `silent_audio_test` | ||
| 276 | covers the enumerator over stand-in hosts with and without an endpoint and with none, a render stream run for a | ||
| 277 | few periods with its event and padding checked, a spatial stream run for ten passes, and the `CoCreateInstance` hook | ||
| 278 | with `LEONIDA_AUDIO=silent`. | ||
| 279 | |||
| 241 | ## Console paths and the write overlay | 280 | ## Console paths and the write overlay |
| 242 | 281 | ||
| 243 | A title's file calls name the console's drives, so `GAME:\data\x.sps` is a file inside the installed game folder. | 282 | A title's file calls name the console's drives, so `GAME:\data\x.sps` is a file inside the installed game folder. |