Commit Graph

4 Commits

Author SHA1 Message Date
gookie a2bb991171 fix(libSceNgs2.native): keep the system list and its mutex alive through static teardown
sceNgs2SystemRender and the other entry points look up their handles in a
function-local std::vector guarded by a function-local std::recursive_mutex.
Both were destroyed with the other statics when the process exits, while a
title's audio thread can still be rendering: std::exit runs the destructors
on the exiting thread and other threads keep running until the process
ends. The freed vector then no longer holds the system, so rendering
returns SCE_NGS2_ERROR_INVALID_SYSTEM_HANDLE, and a lookup that walks the
racks reads freed memory and crashes.

Both are now allocated once and never destroyed, as other driver state that
must outlive static teardown already is.

PPSA21402 (Balatro) printed "Error: sceNgs2SystemRender() 804A0230" and
segfaulted in Ngs2FindVoice (from sceNgs2VoiceGetState) when it was closed.

ngs2_render now renders from an atexit handler registered before the first
NGS2 call, which runs after the library's statics are destroyed; without
this change it fails on that render.
2026-10-07 14:00:37 +02:00
JAB e289b56e6f
feat(libSceNgs2.native): implement sceNgs2RackGetInfo, sceNgs2VoiceGetPortInfo and sceNgs2VoiceQueryInfo (#958)
RackGetInfo reports the rack's handles, buffer, id, uid, option limits,
render count and active voices. VoiceGetPortInfo reports a port's matrix,
volume and destination. VoiceQueryInfo answers info id 0x4001 with the
voice channel count and throws for other ids. Assumptions are recorded in
TechnicalDebt.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:10:30 +13:00
Adrià Franch 6dbdd927ee feat(ngs2): system sample rate, user data and lock
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-06 08:02:42 +02:00
Adrià Franch 90295d3733 feat(libSceNgs2.native): implement system, racks, voices and PCM rendering
libSceNgs2 keeps its stubs; its types now come from the .native header.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 09:24:46 +02:00