fix: expand %VAR% environment variables in path resolution + AudioOut2 state parity (ASTRO BOT sound init) #3959
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3959"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-10-11T19:56:01Z.
The problem. ASTRO BOT (PPSA21564) dies during start-up. Its own SoundManager asserts
defaultBusses.size() == 1(SoundManager.cpp:306) and the game exits. The cause: the game builds its sound-config paths with a%ASOBI_ROOT%token in them (for example<root>/target/data/common/sound/config.xml). AnyPS5's path resolution passed that token through literally, so the config lookup failed, the sound system never loaded its bus definitions, and the assertion fired. Without those definitions the game also grew to ~13.9 GB in about 20 seconds and then crashed.What this changes.
core/libs/prx/libc/src/General.cpp— path resolution now expands%VAR%environment variables (via the PS5 environment lookup) before resolving a path. WithASOBI_ROOTset, the sound config is found and the sound system initialises normally.core/libs/prx/libSceAudioOut/src/AudioOut2Port.cppandAudioOut2SpeakerArray.cpp—sceAudioOut2PortGetState/sceAudioOut2GetSpeakerInfonow report the same state a real PS5 reports:output= main, channel count taken from the port's own data format, volume at max, and a stereo speaker layout with the two front angles. Previously these were fixed placeholder values.core/libs/tests/AudioOut2PortState.cpp— new regression test: creates a real port and checks the returned state against the port's format. It fails on the previous values and passes with the change.Verification (Linux, CachyOS, gcc 16.2.1, RX 7800 XT / RADV).
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R 'audio_out|audioout').tools/check_conventions.py --base origin/main: all checks passed.Notes. The game needs
ASOBI_ROOTset in the environment (this is the title's own requirement, the same as on hardware). Could not verify Windows or macOS. Rendering is a separate open issue (the game's scene currently renders black during start-up; tracked separately).Related: #3480.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T21:39:23Z.
Tested the
AudioOut2Port.cpphunk from head6ec3c56dcagainst Windows main989146c3bwith the Windows build guard from #4021 and shader fix from #4018. This is an isolated test of the port-state change, not the environment-variable/path changes in this PR.Demon's Souls PPSA01342 v1.04 calls
sceAudioOut2PortGetStatefor its main port created withdata_format=0x880(8 float channels). Nevertheless, the port-state change does not resolve this copy's current startup stop: baseline exits after 14.28 s and the changed version after 13.91 s, both with:audio_out2_latency,audio_out2_port_layouts,audio_out2_port_buffers, andaudio_out2_timing: 4/4 pass with the changed library. Tests used Windows 11 x64, i7-13700K, RX 6900 XT, MinGW GCC 15.2 Release,ANYPS5_ENABLE_SPIRV_TOOLS=OFF(default). No menu reached. Original game files preserved. AI-assisted with Codex.Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-11T22:05:55Z.
Thanks for digging into ASTRO BOT. A few things before this can go in:
section 'What' / 'Tested' / 'Checklist' is missing or empty.%VAR%expansion isn't console behaviour. The PS5 kernel and libc don't expand%...%in paths, so this is tailored to one title. It also changes the meaning of any legitimate path that contains two%signs. If the title builds%ASOBI_ROOT%paths, the fix probably belongs wherever the title's own expansion fails (for example agetenv/sceKernelGetenv-style call returning null). Telling users to setASOBI_ROOT"as on hardware" also needs a source, since retail consoles don't have user-set environment variables.GetSpeakerInfo, the namedSpeakerTypeStereobecame a bare0.#include <atomic>is unused.(void)flagsbrings back an unused-parameter warning.AI-assisted: yes. Written with AI assistance (Claude Code); I reviewed it.
Imported from boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-10-12T03:31:07Z.
Thanks for the review — all fair points, and the
%VAR%one is right: we traced the title's path building and the unexpanded token reaching the filesystem, but the layer we fixed is the wrong one. The title's own expansion fails because its environment lookup returns null, which is exactly where the fix belongs. Plan:%VAR%expansion with a fix at the lookup the title actually uses (getenv/sceKernelGetenv-style call returning null). We will find the exact call in the title and make it return the value the OS provides there, and drop the path-level expansion entirely (including the two-%problem).9a120b13: namedSpeakerTypeStereoconstant restored, unused#include <atomic>removed,(void)flagsrestored.One question: for the environment fix, do you want the value served from AnyPS5's app-info/system-parameter layer (so titles see the same root the OS would give), or is there an existing convention in the repo for title-root variables we should follow?
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-10-12T03:47:50Z.
Closing in favor of #4274.
This PR combined two changes:
The root cause was that ASTRO BOT calls getenv("ASOBI_ROOT") to expand path tokens, and without the variable the paths fail. PR #4274 provides ASOBI_ROOT in the guest environment, which is the correct fix.
The AudioOut2 changes here were exploratory and are not required for the title to boot. If they prove necessary for later stages, they can be submitted separately with evidence.
Pull request closed