feat(libSceNgs2): share the native audio implementation #451

Closed
Wessamdevil wants to merge 1 commit from upstream-pr/451 into main
Wessamdevil commented 2026-10-03 11:12:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Wessamdevil on 2026-10-03T11:12:03Z.


What

Quake II PS5 (PPSA09477, 01.003.000) imports libSceNgs2 without .native. That module currently exports only APS5_DUMMY_FUN, so Windows startup fails resolving gbMKV+8Enuo before entering the game.

Build both NGS2 module names from the existing implementation through a shared CMake function. This exposes the existing system, rack, voice, PCM and ATRAC9 behavior under the name the title imports. No audio algorithms or guest layouts change. Panning, geometry and other unsupported paths retain their explicit exceptions.

Run the existing PCM-rendering and ATRAC9 tests against each module independently. The new tests verify samples, mixing, pitch/repeats, callbacks, allocator lifetimes, waveform parsing and error behavior through libSceNgs2; they do not just inspect exports.

Tested

Windows 11 x86-64, MinGW-w64 GCC 15.2.0, CMake 3.31.10, Ninja, Release, SPIRV-Tools validation enabled.

  • Default build and libs packaging pass. Both NGS2 PRX files are NID-patched.
  • ngs2_render, ngs2_atrac9, ngs2_core_render, ngs2_core_atrac9 pass. The new render executable imports libSceNgs2.prx, independently of .native.
  • Full CTest: 146/148 pass. The two failures reproduce on the unchanged base: agc_shader_memory rejects a scalar-condition/vector-result SPIR-V OpSelect, and agc_driver_flip segfaults in its invalid-submission cases.
  • Prepared Quake II with its four bundled guest modules. The new host module loads successfully and the original missing import resolves. A static audit of its 1,442 unique main-executable imports drops from 23 unresolved symbols to 11. Startup now stops at XhWHn6P5R7U (pthread_rwlock_trywrlock, covered by open #344), with Windows 0xC0000139. No menu, rendering, audio playback or gameplay claim is made; panning remains unimplemented.
  • Linux and a physical console were not tested.

The previous decision in #247 to leave the unsuffixed module empty was based on having no title importing it. This test supplies that missing case. Game binaries, assets and investigation files remain outside Git. The test preparation tooling from #450 was used locally, but this implementation has no source dependency on that PR.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files, images or application assets in the repository
  • No new third-party code
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4726114002 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/451). Originally posted by [Wessamdevil](https://github.com/Wessamdevil) on 2026-10-03T11:12:03Z. --- ### What Quake II PS5 (`PPSA09477`, `01.003.000`) imports `libSceNgs2` without `.native`. That module currently exports only `APS5_DUMMY_FUN`, so Windows startup fails resolving `gbMKV+8Enuo` before entering the game. Build both NGS2 module names from the existing implementation through a shared CMake function. This exposes the existing system, rack, voice, PCM and ATRAC9 behavior under the name the title imports. No audio algorithms or guest layouts change. Panning, geometry and other unsupported paths retain their explicit exceptions. Run the existing PCM-rendering and ATRAC9 tests against each module independently. The new tests verify samples, mixing, pitch/repeats, callbacks, allocator lifetimes, waveform parsing and error behavior through `libSceNgs2`; they do not just inspect exports. ### Tested Windows 11 x86-64, MinGW-w64 GCC 15.2.0, CMake 3.31.10, Ninja, Release, SPIRV-Tools validation enabled. - Default build and `libs` packaging pass. Both NGS2 PRX files are NID-patched. - `ngs2_render`, `ngs2_atrac9`, `ngs2_core_render`, `ngs2_core_atrac9` pass. The new render executable imports `libSceNgs2.prx`, independently of `.native`. - Full CTest: 146/148 pass. The two failures reproduce on the unchanged base: `agc_shader_memory` rejects a scalar-condition/vector-result SPIR-V `OpSelect`, and `agc_driver_flip` segfaults in its invalid-submission cases. - Prepared Quake II with its four bundled guest modules. The new host module loads successfully and the original missing import resolves. A static audit of its 1,442 unique main-executable imports drops from 23 unresolved symbols to 11. Startup now stops at `XhWHn6P5R7U` (`pthread_rwlock_trywrlock`, covered by open #344), with Windows `0xC0000139`. No menu, rendering, audio playback or gameplay claim is made; panning remains unimplemented. - Linux and a physical console were not tested. The previous decision in #247 to leave the unsuffixed module empty was based on having no title importing it. This test supplies that missing case. Game binaries, assets and investigation files remain outside Git. The test preparation tooling from #450 was used locally, but this implementation has no source dependency on that PR. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation files, images or application assets in the repository - [x] No new third-party code - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!451
No description provided.