upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNotRexed <therealnothingfn@gmail.com>2026-11-25 17:25:05 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-11-25 17:25:05 -0500
commit908fb65d8aac439edf9c9d5a2c6a6764a58ece52 (patch)
treeb88f96ed1b493395a0b153346ab500468ea51c94 /scripts
parented5d8570f19d521e5f8d3125ff99ac0c4ba1773c (diff)
runtime: port VIctory's audio HLE (xapu, chad, acphal coprocessor, XMA)
Ported from VIctory (victory/crates/victory-hle/src/modules/apu.rs, dsp.rs, audio.rs; victory-formats/src/xma.rs), GPL-3.0-or-later, Marvisak and contributors (DexNom fork), keeping its measured ABI: XApu records (CommandId 0x18, Activate 0x38, Process 0x40, ApuResult 0x50), command kinds, options and HRESULTs; XDsp StreamDesc 0x1c, Status 16, Command 0x20; IAcpHal slot order, 28-byte messages, command ids 1-3, 5-8, 18; SHAPE_CONTEXTS 0x60. - shims/xapu.cpp (xapu.dll): queues and results are real. PLACEHOLDER decoding: no Opus decoder is in the repository (VIctory uses the opus-pure crate), so a process command parses its packet (src/opus_packet.h, RFC 6716 framing as libopus checks it) for its frame count, output length and errors, and writes silence. Malformed packets fail with BAD_PACKET; rate conversion stays E_NOTIMPL. - shims/chad_dsp.cpp (chad.dll): completion (status words, tickets) is real; convolutions and transforms output silence, as in VIctory. - shims/acphal.cpp: the coprocessor acknowledges commands with VIctory's messages (fmod waits for the first in System_Create; the old stub never answered), sets notification words, and decodes enabled XMA contexts on a thread into their rings. Context arrays get device addresses that map back. Fixes: SHAPE_CONTEXTS is 0x60 (APU addresses are 32-bit; 120 bytes wrote 24 past the title's structure); AcpHalReleaseShapeContexts writes nothing through its argument (the title passes a handle); the non-cached heap's device addresses start on a 64 KiB boundary; state the decoding thread reads is immortal. - src/xma_decode.*, src/xma_tables.h: real XMA2 decoding (VIctory's port of FFmpeg's WMA Pro decoder) with four fixes from VIctory's history that the DexNom snapshot lacks (ba42db643, d4d182204, 03a6f2290, 4eb0898b3); src/xma_context.*: the context machine, with three more (7a5d85e6a, 1054fe87d, 985d8d4b0). Host output is unchanged: the title's middleware opens WASAPI through COM (com_shim.cpp forwards CoCreateInstance to the host), as in VIctory. Tests (CPU only, no game data, in CTest): xma (decoder against a direct-sum IMDCT, VIctory's frame walk, noise and ring tests), xapu, chad_dsp, and acphal extended (messages, notification words, the decoding thread filling a ring). gta6rt --dry-run on 1.0.2.1 binds all ten xapu/chad imports (unimplemented 11 -> 1: DStorageGetFactory). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build_runtime.ps12
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/build_runtime.ps1 b/scripts/build_runtime.ps1
index 394c24287..8a0478815 100644
--- a/scripts/build_runtime.ps1
+++ b/scripts/build_runtime.ps1
@@ -81,7 +81,7 @@ $build || exit /b 1
81 Write-Warning "CMake and Ninja weren't found (neither VS C++ CMake tools nor native PATH tools): building with cl.exe directly, without the GameInput shim (SDL3). Install CMake + Ninja or VS's CMake tools component to get it." 81 Write-Warning "CMake and Ninja weren't found (neither VS C++ CMake tools nor native PATH tools): building with cl.exe directly, without the GameInput shim (SDL3). Install CMake + Ninja or VS's CMake tools component to get it."
82 $xtaskqueueDir = Join-Path $root "third_party\xtaskqueue" 82 $xtaskqueueDir = Join-Path $root "third_party\xtaskqueue"
83 $xtaskqueueFiles = "Source\Task\TaskQueue.cpp", "Source\Task\AsyncLib.cpp", "Source\Task\ThreadPool_win32.cpp", "Source\Task\WaitTimer_win32.cpp" | ForEach-Object { "`"$xtaskqueueDir\$_`"" } 83 $xtaskqueueFiles = "Source\Task\TaskQueue.cpp", "Source\Task\AsyncLib.cpp", "Source\Task\ThreadPool_win32.cpp", "Source\Task\WaitTimer_win32.cpp" | ForEach-Object { "`"$xtaskqueueDir\$_`"" }
84 $files = "src\main.cpp", "src\host_cpu.cpp", "src\pe_loader.cpp", "shims\registry.cpp", "shims\file_system.cpp", "shims\xmem.cpp", "shims\xg_xs.cpp", "shims\acphal.cpp", "shims\d3d12_xs.cpp", "shims\d3d12_xs_device.cpp", "shims\d3d12_xs_rootsig.cpp", "shims\xgameruntime.cpp", "shims\xgameruntime_user.cpp", "shims\xgameruntime_gamesave.cpp", "shims\xgameruntime_store.cpp", "shims\xgameruntime_offline.cpp", "shims\winhttp_offline.cpp", "shims\library_loader.cpp", "shims\process.cpp", "shims\com_shim.cpp", "shims\bcrypt_rng.cpp" | ForEach-Object { "`"$src\$_`"" } 84 $files = "src\main.cpp", "src\host_cpu.cpp", "src\pe_loader.cpp", "shims\registry.cpp", "shims\file_system.cpp", "shims\xmem.cpp", "shims\xg_xs.cpp", "shims\acphal.cpp", "shims\xapu.cpp", "shims\chad_dsp.cpp", "src\xma_decode.cpp", "src\xma_context.cpp", "shims\d3d12_xs.cpp", "shims\d3d12_xs_device.cpp", "shims\d3d12_xs_rootsig.cpp", "shims\xgameruntime.cpp", "shims\xgameruntime_user.cpp", "shims\xgameruntime_gamesave.cpp", "shims\xgameruntime_store.cpp", "shims\xgameruntime_offline.cpp", "shims\winhttp_offline.cpp", "shims\library_loader.cpp", "shims\process.cpp", "shims\com_shim.cpp", "shims\bcrypt_rng.cpp" | ForEach-Object { "`"$src\$_`"" }
85 $includes = "/I `"$src\src`" /I `"$src\shims`" /I `"$src\shims\xtaskqueue`" /I `"$xtaskqueueDir\Include`" /I `"$xtaskqueueDir\Source\Task`" /I `"$xtaskqueueDir\Source\Common`"" 85 $includes = "/I `"$src\src`" /I `"$src\shims`" /I `"$src\shims\xtaskqueue`" /I `"$xtaskqueueDir\Include`" /I `"$xtaskqueueDir\Source\Task`" /I `"$xtaskqueueDir\Source\Common`""
86 $opt = if ($Debug) { "/Od /MDd" } else { "/O2 /MD" } 86 $opt = if ($Debug) { "/Od /MDd" } else { "/O2 /MD" }
87 $body = @" 87 $body = @"