Demon's Souls (PPSA01342 v1.005, Windows): start-up crash comes from the Acm module (0x10b) being reported as loaded; black screen afterwards #3710
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 mcsilva-dev on 2026-10-11T15:45:48Z.
Hi all — first of all, thanks for AnyPS5. I've been trying to get Demon's Souls running on Windows and spent a good while digging into why it dies right at start-up. I think I found the cause of the crash, plus a couple of things that might be useful to whoever is working on this title. Sharing everything here in case it saves someone time.
Setup
eboot.binand bothsce_modulelibraries are fake-signed SELFs with plaintext segments, unwrapped to ELF.sce_module(libc.prx,libSceNpCppWebApi.prx).mainatf1ae427bplus #1482 and #846 merged locally, built with-DANYPS5_ENABLE_SPIRV_TOOLS=ON(same as CI).All code addresses below are
eboot.binvirtual addresses (on the Windows build, the PE RVA is the same address +0x10000).The start-up crash: the Acm module is reported as loaded
The game opens a black window and dies a few seconds later with a null read inside its audio graph. The exact site moves between runs, but it is always "a piece of the audio graph that was never built":
0x1eb1ad7(mix-bus node,memcpyof 0x400 bytes)[desc+0x50])APS5_SPIRV_OPT=noneAPS5_TRACE_AUDIOOUT2=1(slower)0x1e9b7e5(multi-input node)[[input+0x70]+0x18]+0x80x1e6ffc5Things I ruled out along the way:
APS5_SPIRV_OPT=nonethe two "SPIR-V validation after optimization failed" messages go away, but the crash is identical.tools/import_audit.pyreports 1303 unique imports, 0 absent, 62 stubs, none of them audio (they're AGC capture/marker helpers,scePsmlMfsr*, Http/Ssl and a few utilities).What never changes is when it happens: always right after
sceSysmoduleLoadModule unknown id: 267. 267 is0x10b, the Acm co-processor module (see #3240 / #3203). The game's audio init around0x1e707falooks like this:So the title has its own fallback for when Acm isn't there. Since
sceSysmoduleLoadModulereturns 0 for ids it doesn't know, the game takes the Acm convolution-reverb path, butlibSceAcmis still a no-op (batches "complete" without doing anything,sceAcm_ConvReverb_SharedInputignores its arguments), and the audio graph ends up half built.Confirmed: making the load of
0x10bfail (I added a small env switch locally,ANYPS5_SYSMODULE_UNAVAILABLE=0x10b, which also makessceSysmoduleIsLoadedreport it unloaded) makes the crash go away completely — the game keeps running.Interestingly the Acm code is byte-for-byte the same as when #5 got this game to character creation, so something else on the path changed since then; I didn't track down what.
I know CONTRIBUTING asks not to paper over missing pieces with fallbacks, so I'm not suggesting the env switch as the fix — it was just the quickest way to prove the cause. A cleaner option might be for
sceSysmoduleLoadModule(0x10b)to fail untillibSceAcmactually processes batches, since the title handles that case itself. Happy to turn the patch into a PR in whatever shape you prefer.What comes next: black screen, all job workers spinning
With Acm reported unavailable, the game no longer crashes but sits on a black screen. What I could see:
[MSG-Init] ResourcePool::GatherResourceFileInfo() took ~15-22s(it walks all ~223k files of the dump).APS5_TRACE_SYNC=1, the job workers park on thePS5SyncEventevent flag when idle: 631 waits / 631 sets, perfectly balanced until that point. After it, no thread waits on anything anymore.APS5_HANG_DUMP_SECS=150shows all 13BPE JobWorkerThreads inside the job scheduler (0x8210af,0x821381,0x821556…), scanning the queue withlock cmpxchgand finding slots that are occupied but never become runnable.Core.Res.*loader threads, Bink and the AGC/VideoOut host threads are all idle. No flip is ever presented.So some job is waiting on a dependency that never gets satisfied — maybe a consequence of the Acm fallback path itself, maybe something unrelated. The job-scheduler addresses are close to the ones in #2552, so this could be related.
A side finding in APR (not the cause here)
Apr.cppexecutesWaitOnAddress/WaitOnCountercommands synchronously, insidesceKernelAprSubmitCommandBuffer, polling withPreciseSleepUs(50)on the submitting thread. On hardware those waits only stall the APR queue while the CPU carries on, so a streaming engine can legitimately submit "wait until X, then read" and release X after the submit returns. With the current behaviour that would deadlock the submitting thread. In my hang none of the threads were sitting in that loop, so it isn't what blocks Demon's Souls right now, but it seemed worth mentioning.One more note
I also tried the configuration from #5 (relink without the bundled
libc.prx, using--exclude-sce-module libc.prx, withAPS5_HOST_IMPORT_MIB=16384). On currentmainthat aborts immediately after "Transferring control to ELF entry point", so that path doesn't seem to work anymore — not a problem per se, just noting it for anyone who reads #5 and tries the same.I can share full logs, the import audit output or run more tests if that helps.
Disclosure: this investigation (disassembly, log analysis, and the write-up) was done with the help of Claude Code (an AI assistant); I reviewed it and ran every test myself on my machine.
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-11T22:15:28Z.
Same title and version (PPSA01342 v1.005) on Windows with an RTX 3060 (NVIDIA 591.86), for comparison.
maina11c8f7f7.sceSysmoduleLoadModule unknown id: 267is printed, but the audio graph never faulted here, so it may depend on timing or the GPU. (#3716 changes that load.)main. #3871 explains and fixes that one: mingw'sfprintfholds stderr's lock while it writes a 15-20 KB RecompileRequest one character at a time, and a job worker logging insceSaveDataDirNameSearchwaits behind it, soGameCoreLoop::MasterGameLoopnever finishes a frame.Past that, the stops on this machine, in order:
presentation failed: DB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported (register 0x0 = 0x00000010): a resummarize draw that writes no depth, stencil or colour. I have a fix with a test and will open it once #3871 is in.WAIT_REG_MEM ... timed outon labels that queue 0 writes later, while queue 0 sits invkCreateComputePipelines. The pipeline is compute shader0x248910200(4,816 guest code words) recompiled to 940,910 SPIR-V words, which takes about 37 s to compile cold on NVIDIA. About 70 shaders of this title produce 0.5-0.9 M words and take 15-40 s each, once; they are cached afterwards. In four earlier runs that one pipeline never finished (over 5 minutes at 100% CPU innvgpucomp64); I could not reproduce that afterwards and suspect a bad NVIDIA shader-cache entry.storage image access to depth/stencil surface ...): #425 + #2904 get past it.bindless image table: 18 distinct keys exceed the 16 slots: #757's area.With all four passed locally, the title plays its logos, menus and the opening cinematic at about 2 fps.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-12T00:04:42Z.
Tested this on PPSA01341 v1.07 (US) on Linux, current
mainbab7b328, with a local switch that makessceSysmoduleLoadModule(0x10b)fail andsceSysmoduleIsLoaded(0x10b)report it unloaded.maindoesn't hit an audio-graph or start-up crash here. It finishes initialization, opens the window and presents 2 frames, then stops onDB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported. That happens both with SPIR-V tools ON and OFF.So on this build and platform the failed load makes things worse rather than better. Full table and runs in #2552: https://github.com/boykopovar/AnyPS5/issues/2552#issuecomment-6115397757
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by btsouth on 2026-10-12T00:21:21Z.
Some results from Linux past the
DB_RENDER_CONTROLstop, on PPSA01342 v1.005 (US). Setup: mainbab7b328with #4049 and #758 merged locally (#758 needed a manual merge against main in 3 files), Release,ANYPS5_ENABLE_SPIRV_TOOLS=ON,APS5_SPIRV_OPT=none. RTX 4070 SUPER, driver 615.78.08.GetImageResource dword 0 is not a valid runtime valueshader failures this title has on main.Finished Initialization: 6.93s,Starting main loop: 9.05swith a warm shader cache). The window shows 2 frames and then nothing more.APS5_TRACE_SYNC=1, the main thread waits insceKernelWaitEventFlagon aPS5SyncEvent(want 0x1) that is created at start-up and never set. The wait starts right after the title loadssound/banks/buss/cp11_buss_acv.irpackand callssceSysmoduleLoadModule(0x10b). The call returns to+0x826fd8in the relinked executable, called from+0xb0783f.sceKernelUsleep(1)at+0x1e22b02while an internal call returns -5. That fits the "submitted serial 1, completed serial 0" stop @Mouhand-Kaddo reported.So on Linux both Acm paths end up waiting on audio, at different points.
Imported from boykopovar/AnyPS5. Originally posted by btsouth on 2026-10-12T01:19:45Z.
Follow-up and a correction to my comment above. On Linux, the path where the Acm module (0x10b) loads does not deadlock. It is slow. With the same setup (main
bab7b328with #4049 and #758), the title now gets through the PlayStation logo and the start prompts into the opening cutscene.What I had wrong: the main thread's
PS5SyncEventwait does complete. It depends on work behind the GPU queues, and the first large queue 0 submission (5547 dwords) took about 260 s to execute. The compute queues 0x20 to 0x50 wait on a label that this submission writes near its end (aWRITE_DATAof 0 at packet 5535), so every queue looked stuck.Most of that time went to specialized modules being built on the queue worker inside
dispatchIndirect(buildSpecializedModule, which runsSpecializeSpirvand SPIR-V validation). They are not kept in the disk cache, so this repeats on every launch. Locally, skipping validation for specialized modules brought the same submission down to about 128 s, from not finishing within 240 s in an otherwise identical run.While new shaders compile it runs at roughly 4 to 14 FPS. The result for the failing Acm load still stands: initialization never finishes. One crash on the way is filed as #4205.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-12T02:56:31Z.
Numbers from PPSA01341 v1.07 (US) on Linux, to go with @btsouth's v1.005 results. Setup: main
7a84b222with #4049 and #758 merged locally (#758 needed a manual merge in the same 3 files), Release,ANYPS5_ENABLE_SPIRV_TOOLS=ON, RTX 5070 Ti, NVIDIA 595.91.07. The Acm load is left as it is on main (unknown id: 267, returns 0).The main thread's wait is the same one on v1.07. It is a
PS5SyncEvent(want 0x1) created at start-up, waited on fromGameCoreLoop::MasterGameLoop(return address app+0xb2761f, the event wrapper is at app+0x841620). The window shows 2 frames, then the third one arrives once queue 0 gets through the specialized-module builds.Time spent in
buildSpecializedModule, measured with bpftrace uprobes on the driver library (131 modules per launch, mostly on the queue 0 worker thread):So the disk cache and the Vulkan pipeline cache carry over between launches, but the specialized modules do not. Each launch rebuilds the same 131 of them, for about 180 s on this machine. With a warm cache, that is nearly all of the stall after the main loop starts. In the cold run, the queue 0 indirect dispatches spent 444 s in total inside their "pipeline" phase. Specialization accounts for 185 s of that, and the rest goes away on the second launch, so I assume it was the driver compile.
How the 180 s splits up (run52; the probes nest, so the numbers overlap a little):
SpecializeSpirv: 9 sspvtools::SpirvTools::Validate: 62 sspvtools::Optimizer::Run: 125 s (this includes some validation of its own)In run50, the first
ValidateAndOptimizeSpirvcall per module (validate, optimize, validate again) took 162 of the 185 s, and the second one took 13 s. On this machine the optimizer costs more than validation, so skipping validation alone would save about a third of the stall. Skipping the optimizer as well would save most of it. The single largest modules took 6 to 10 s each.Two crashes on the way, both the same validation rule:
Finished Initialization:SPIR-V validation after optimization failed: level=2 word=6177: The continue construct with the continue target '76[%76]' is not structurally post dominated by the back-edge block '6184[%6184]'. The shader is compute 0x2489e0100. On colder runs the same failure only shows up asShader 0x2489e0100 could not be prepared after registrationand the title carries on. This looks like the case #4018 covers.APS5_SPIRV_OPT=nonegets past it.APS5_SPIRV_OPT=none, every run (3 of 3) aborts right after the third frame:level=2 word=10069: The continue construct with the continue target '85[%85]' is not structurally post dominated by the back-edge block '14815[%14815]'. That is #4205 (v1.005 reported word=10090, also target 85), so v1.07 has it too.With #4241 merged on top (local branch: main
7a84b222+ #4049 + #758 + #4241,APS5_SPIRV_OPT=none, warm cache, booted through the debug start menu into the tutorial), the same failure logsSPIR-V validation after optimization failed; using validated inputonce and the title keeps going instead of aborting.Finished Initializationcame at 68 s andStarting main loopat 104 s. By about 490 s it had presented 87 frames, with the title bar at 5.8 FPS, and level loading had started (sys_loading_fog_transition). It then presented only 5 more frames and crashed at about 880 s, during the level load, withsegfault at 1a ip 000000000000001a, a call through a bad pointer. I haven't looked into that one yet.The start-up
PS5SyncEventthat the main thread waits on had nosceKernelSetEventFlagin any of these runs before the crash (APS5_TRACE_SYNC=1), even though the third frame was presented. I don't know yet whether a later set would release it.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:09:06Z.
0x10Bis registered since #4068, sosceSysmoduleLoadModuleloads libSceAcm instead of returning 0 for an unknown id; #3871 and #4049 are in as well. Does v1.005 still crash at start-up on current main on your machine?Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-16T23:53:55Z.
Reminder on my question from 10-13: the Acm module id is registered since #4068, so the original crash at
sceSysmoduleLoadModuleshould be gone. Does v1.005 still crash at start-up on current main? Later stops for this title are tracked in #4276 and #5806.Imported from boykopovar/AnyPS5. Originally posted by btsouth on 2026-10-17T01:02:42Z.
Linux data point for v1.005 on current main (
f3263dfbf3, RTX 4070 SUPER): libSceAcm now loads (nounknown id: 267since #4068). Initialization finished at 3.3 s and the main loop started at 7.2 s. With an empty shader cache it then compiled shaders for the rest of an 8-minute run with no crash before I stopped it, so I don't see a start-up crash here. I can't test Windows, so @mcsilva-dev would need to confirm the original one.