feat(libSceAudioPropagation): implement the no-acoustic-propagation path with recovered signatures #482

Merged
ThisIsAkill merged 1 commit from upstream-pr/482 into main 2026-10-04 22:43:24 +00:00
ThisIsAkill commented 2026-10-03 21:29:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-03T21:29:15Z.


What

Implements libSceAudioPropagation as an explicit no-acoustic-propagation path, using the call shapes recovered from PPSA21567 (Astro Bot) in #481. Every export either has defined behaviour or throws.

Signature corrections to the assumed declarations:

Function Was Now (recovered)
RoomDestroy / PortalDestroy / SourceDestroy (Handle object) (Handle system, Handle object)
PortalSetAttributes / SourceSetAttributes (Handle, const void*) (Handle, const Attribute*, u32 count)
SourceCreate (Handle, const void* params, Handle* out) (Handle system, Handle* out)
SystemUnregisterMaterial (Handle system, u32 id) (Handle material)
SourceGetAudioPath (Handle, u32, void*) (Handle source, u32 index, Handle* out) (out type assumed)
SourceCalculateAudioPaths (Handle, const void*) (Handle source, const Ray*, u32 rayCount, u32, void* paths, u32 pathCount)
SourceRender (Handle source, const void*, void*) (Handle system, const RenderInfo*)

The other 15 match the existing declarations. Struct descriptor ids and sizes ({u32 id; size_t size} at +0, written by the title) are checked on entry: SystemMemory 0x010107d4/0x30, Material 0x010107d1/0x40, PortalParams 0x010107d8/0x60. Attribute is 0x20 bytes.

Model:

  • SystemQueryMemory reports 16 bytes of CPU memory and no GPU memory. SystemCreate keeps a header in that title-owned memory, and the system handle is its address. The title frees the memory only after SystemDestroy.
  • Rooms, portals, sources and materials get counter handles (not addresses), tracked per system. A portal must connect two rooms of its own system.
  • Attributes are validated (pointer, size) and have no effect.
  • No rays are requested (GetRays reports 0) and sources report 0 audio paths. Non-empty ray results, path calculation and audio paths throw, and SourceGetAudioPath reports any index as out of range. A direct path is not reported, because the 0xe0-byte path record layout is unknown.
  • SourceRender stays unimplemented.
  • No error code could be confirmed (the title only tests eax != 0), so invalid input throws std::invalid_argument.
  • Objects still alive when their system is destroyed become unusable, and their later destroy or unregister is a no-op. The title releases reference-counted room, portal and source owners just before SystemDestroy, so the order is not proven for every object.

Documented in TechnicalDebt (a silent-stub entry like libSceHmd's, plus the unknowns). Signatures come from the title's own calls, cross-checked as facts against KytyPS5 and sharpemu (no code taken). Repositories that appear to contain decompiled system libraries were not used.

Tested

  • Linux (CachyOS, GCC 16.2): full build, ctest 146/146 on main + this branch, including the new guest_audio_propagation test (lifecycle, descriptor and attribute validation, handle kinds, orphaned destroys, throwing paths).
  • PPSA21567 on Linux, on main with #285, #290 and local changes (not clean main): the title previously stopped at sceAudioPropagationSystemQueryMemory not implemented. With this PR, its AudioPropagation calls pass without a throw and it runs on to an unrelated libSceFont export. Audio output was not checked (the runs were on a virtual display).

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 (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude). I reviewed it and take responsibility for every line.

Refs #481 (recovered signatures and how they were obtained).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4729818037 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/482). Originally posted by [ThisIsAkill](https://github.com/ThisIsAkill) on 2026-10-03T21:29:15Z. --- ### What Implements `libSceAudioPropagation` as an explicit no-acoustic-propagation path, using the call shapes recovered from PPSA21567 (Astro Bot) in #481. Every export either has defined behaviour or throws. Signature corrections to the assumed declarations: | Function | Was | Now (recovered) | |---|---|---| | RoomDestroy / PortalDestroy / SourceDestroy | `(Handle object)` | `(Handle system, Handle object)` | | PortalSetAttributes / SourceSetAttributes | `(Handle, const void*)` | `(Handle, const Attribute*, u32 count)` | | SourceCreate | `(Handle, const void* params, Handle* out)` | `(Handle system, Handle* out)` | | SystemUnregisterMaterial | `(Handle system, u32 id)` | `(Handle material)` | | SourceGetAudioPath | `(Handle, u32, void*)` | `(Handle source, u32 index, Handle* out)` (out type assumed) | | SourceCalculateAudioPaths | `(Handle, const void*)` | `(Handle source, const Ray*, u32 rayCount, u32, void* paths, u32 pathCount)` | | SourceRender | `(Handle source, const void*, void*)` | `(Handle system, const RenderInfo*)` | The other 15 match the existing declarations. Struct descriptor ids and sizes (`{u32 id; size_t size}` at +0, written by the title) are checked on entry: `SystemMemory` 0x010107d4/0x30, `Material` 0x010107d1/0x40, `PortalParams` 0x010107d8/0x60. `Attribute` is 0x20 bytes. Model: - `SystemQueryMemory` reports 16 bytes of CPU memory and no GPU memory. `SystemCreate` keeps a header in that title-owned memory, and the system handle is its address. The title frees the memory only after `SystemDestroy`. - Rooms, portals, sources and materials get counter handles (not addresses), tracked per system. A portal must connect two rooms of its own system. - Attributes are validated (pointer, size) and have no effect. - No rays are requested (`GetRays` reports 0) and sources report 0 audio paths. Non-empty ray results, path calculation and audio paths throw, and `SourceGetAudioPath` reports any index as out of range. A direct path is not reported, because the 0xe0-byte path record layout is unknown. - `SourceRender` stays unimplemented. - No error code could be confirmed (the title only tests `eax != 0`), so invalid input throws `std::invalid_argument`. - Objects still alive when their system is destroyed become unusable, and their later destroy or unregister is a no-op. The title releases reference-counted room, portal and source owners just before `SystemDestroy`, so the order is not proven for every object. Documented in TechnicalDebt (a silent-stub entry like libSceHmd's, plus the unknowns). Signatures come from the title's own calls, cross-checked as facts against KytyPS5 and sharpemu (no code taken). Repositories that appear to contain decompiled system libraries were not used. ### Tested - Linux (CachyOS, GCC 16.2): full build, `ctest` 146/146 on `main` + this branch, including the new `guest_audio_propagation` test (lifecycle, descriptor and attribute validation, handle kinds, orphaned destroys, throwing paths). - PPSA21567 on Linux, on `main` with #285, #290 and local changes (not clean `main`): the title previously stopped at `sceAudioPropagationSystemQueryMemory not implemented`. With this PR, its AudioPropagation calls pass without a throw and it runs on to an unrelated libSceFont export. Audio output was not checked (the runs were on a virtual display). ### 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 (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude). I reviewed it and take responsibility for every line. Refs #481 (recovered signatures and how they were obtained). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-04 05:15:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T05:15:45Z.


Thanks for writing these up. I recovered the same API from PPSA21564 (the other region of the title you used, PPSA21567) for my integration branch, reading the argument setup at each call site. I also find 27 call sites for the 22 imports, and my call shapes match yours for 20 of the 22. The two where #481 and my branch disagreed are below. Addresses are PPSA21564 eboot vaddrs (text at vaddr 0, file offset +0x4000).

SystemUnregisterMaterial: (Handle material), as in #481. My branch had (Handle system, Handle material), which is wrong; I have a fix ready for it. Both call sites set only rdi:

  • 0xf45174 (MaterialSet destructor, loop over all materials): mov rdi,[r14+0x18] then call. rsi is not written in the loop.
  • 0xf45bd0 (material reload): mov rdi,r12 where r12 = [node+0x18], the handle RegisterMaterial wrote through its rdx out pointer (0xf45e44, stored at 0xf45e7e). rsi at the call is a hash bucket pointer. The system handle [rbx] is passed to RegisterMaterial in the same function (0xf45e58) but not to Unregister.

SourceRender: (Handle system, const RenderInfo*, u32 count). There is a third argument, and the title passes 1. Only call site, 0xf5283e:

f527fe  lea  rsi,[rbp-0xd0]        ; RenderInfo {0x010107d6, 0x30}
f52805  mov  edx,0x1               ; count
f5283b  mov  rdi,QWORD PTR [rbx]   ; system
f5283e  call sceAudioPropagationSourceRender

The RenderInfo layout matches yours. A few details: +0x18 is the source's output buffer, +0x20 is m_numOfGrains * 64 bytes, and +0x28 is 2. Afterwards the title adds grains * 16 floats from that buffer into a bus (0xf52910). So I read it as 16 floats per sample frame, but I have not worked out what format 2 means. The result is only tested != 0, and a failure just logs sceAudioPropagationSourceRender failed.

#482 leaves SourceRender throwing, and in PPSA21564 that is reached as soon as a propagated source plays. Reading the code, the call sits in the audio engine's per-voice callback (a std::function that asserts numSamples == m_numOfGrains), so it runs every audio grain for each propagated source with input. I did not measure the frequency at runtime. Just before each render, the title passes that source's mono input through SourceSetAttributes (attribute 4).

My branch implements SourceRender with no propagation: for each of the count RenderInfos it checks the descriptor (0x010107d6 / 0x30) and that the source belongs to the system, zero-fills the output buffer for the given size, and returns 0. The title already clears that buffer before the call, so in practice the propagation output is silence and the title carries on. It does not render a dry signal. I can send that as a follow-up to #482 if useful, rather than a competing PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5976856890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/482#issuecomment-5976856890). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T05:15:45Z. --- Thanks for writing these up. I recovered the same API from PPSA21564 (the other region of the title you used, PPSA21567) for my integration branch, reading the argument setup at each call site. I also find 27 call sites for the 22 imports, and my call shapes match yours for 20 of the 22. The two where #481 and my branch disagreed are below. Addresses are PPSA21564 eboot vaddrs (text at vaddr 0, file offset +0x4000). **SystemUnregisterMaterial: `(Handle material)`, as in #481.** My branch had `(Handle system, Handle material)`, which is wrong; I have a fix ready for it. Both call sites set only rdi: - 0xf45174 (MaterialSet destructor, loop over all materials): `mov rdi,[r14+0x18]` then call. rsi is not written in the loop. - 0xf45bd0 (material reload): `mov rdi,r12` where `r12 = [node+0x18]`, the handle RegisterMaterial wrote through its rdx out pointer (0xf45e44, stored at 0xf45e7e). rsi at the call is a hash bucket pointer. The system handle `[rbx]` is passed to RegisterMaterial in the same function (0xf45e58) but not to Unregister. **SourceRender: `(Handle system, const RenderInfo*, u32 count)`.** There is a third argument, and the title passes 1. Only call site, 0xf5283e: ``` f527fe lea rsi,[rbp-0xd0] ; RenderInfo {0x010107d6, 0x30} f52805 mov edx,0x1 ; count f5283b mov rdi,QWORD PTR [rbx] ; system f5283e call sceAudioPropagationSourceRender ``` The RenderInfo layout matches yours. A few details: +0x18 is the source's output buffer, +0x20 is `m_numOfGrains * 64` bytes, and +0x28 is 2. Afterwards the title adds `grains * 16` floats from that buffer into a bus (0xf52910). So I read it as 16 floats per sample frame, but I have not worked out what format 2 means. The result is only tested `!= 0`, and a failure just logs `sceAudioPropagationSourceRender failed`. #482 leaves SourceRender throwing, and in PPSA21564 that is reached as soon as a propagated source plays. Reading the code, the call sits in the audio engine's per-voice callback (a std::function that asserts `numSamples == m_numOfGrains`), so it runs every audio grain for each propagated source with input. I did not measure the frequency at runtime. Just before each render, the title passes that source's mono input through SourceSetAttributes (attribute 4). My branch implements SourceRender with no propagation: for each of the `count` RenderInfos it checks the descriptor (0x010107d6 / 0x30) and that the source belongs to the system, zero-fills the output buffer for the given size, and returns 0. The title already clears that buffer before the call, so in practice the propagation output is silence and the title carries on. It does not render a dry signal. I can send that as a follow-up to #482 if useful, rather than a competing PR.
github-actions[bot] commented 2026-10-04 05:33:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T05:33:27Z.


Progress report (ccd60ce → ac66e70)

📈 System libraries: 77.94% (+0.66%, +21 implemented functions)

✅ 21 implemented
Library Name
libSceAudioPropagation sceAudioPropagationPortalCreate
libSceAudioPropagation sceAudioPropagationPortalDestroy
libSceAudioPropagation sceAudioPropagationPortalSetAttributes
libSceAudioPropagation sceAudioPropagationRoomCreate
libSceAudioPropagation sceAudioPropagationRoomDestroy
libSceAudioPropagation sceAudioPropagationSourceCalculateAudioPaths
libSceAudioPropagation sceAudioPropagationSourceCreate
libSceAudioPropagation sceAudioPropagationSourceDestroy
libSceAudioPropagation sceAudioPropagationSourceGetAudioPath
libSceAudioPropagation sceAudioPropagationSourceGetAudioPathCount
libSceAudioPropagation sceAudioPropagationSourceGetRays
libSceAudioPropagation sceAudioPropagationSourceSetAttributes
libSceAudioPropagation sceAudioPropagationSourceSetAudioPaths
libSceAudioPropagation sceAudioPropagationSystemCreate
libSceAudioPropagation sceAudioPropagationSystemDestroy
libSceAudioPropagation sceAudioPropagationSystemGetRays
libSceAudioPropagation sceAudioPropagationSystemQueryMemory
libSceAudioPropagation sceAudioPropagationSystemRegisterMaterial
libSceAudioPropagation sceAudioPropagationSystemSetAttributes
libSceAudioPropagation sceAudioPropagationSystemSetRays
libSceAudioPropagation sceAudioPropagationSystemUnregisterMaterial
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5976963958 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/482#issuecomment-5976963958). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T05:33:27Z. --- <!-- progress-report --> ### Progress report (ccd60ce → ac66e70) 📈 **System libraries**: 77.94% (+0.66%, +21 implemented functions) <details> <summary>✅ 21 implemented</summary> | Library | Name | | - | - | | libSceAudioPropagation | `sceAudioPropagationPortalCreate` | | libSceAudioPropagation | `sceAudioPropagationPortalDestroy` | | libSceAudioPropagation | `sceAudioPropagationPortalSetAttributes` | | libSceAudioPropagation | `sceAudioPropagationRoomCreate` | | libSceAudioPropagation | `sceAudioPropagationRoomDestroy` | | libSceAudioPropagation | `sceAudioPropagationSourceCalculateAudioPaths` | | libSceAudioPropagation | `sceAudioPropagationSourceCreate` | | libSceAudioPropagation | `sceAudioPropagationSourceDestroy` | | libSceAudioPropagation | `sceAudioPropagationSourceGetAudioPath` | | libSceAudioPropagation | `sceAudioPropagationSourceGetAudioPathCount` | | libSceAudioPropagation | `sceAudioPropagationSourceGetRays` | | libSceAudioPropagation | `sceAudioPropagationSourceSetAttributes` | | libSceAudioPropagation | `sceAudioPropagationSourceSetAudioPaths` | | libSceAudioPropagation | `sceAudioPropagationSystemCreate` | | libSceAudioPropagation | `sceAudioPropagationSystemDestroy` | | libSceAudioPropagation | `sceAudioPropagationSystemGetRays` | | libSceAudioPropagation | `sceAudioPropagationSystemQueryMemory` | | libSceAudioPropagation | `sceAudioPropagationSystemRegisterMaterial` | | libSceAudioPropagation | `sceAudioPropagationSystemSetAttributes` | | libSceAudioPropagation | `sceAudioPropagationSystemSetRays` | | libSceAudioPropagation | `sceAudioPropagationSystemUnregisterMaterial` | </details>
ThisIsAkill commented 2026-10-04 06:12:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-04T06:12:30Z.


Thanks for cross-checking this against PPSA21564.

Both points match PPSA21567. SystemUnregisterMaterial takes only the material handle. SourceRender does have the third argument: the only call site sets mov edx,0x1 at 0xf6efa5 before the call at 0xf6efde, and I had missed it. The RenderInfo fields there match yours: +0x18 output buffer, +0x20 grains * 64 bytes, +0x28 = 2. I've posted the correction on #481.

On SourceRender in this PR and your follow-up offer, I'll come back to you shortly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5977211713 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/482#issuecomment-5977211713). Originally posted by [ThisIsAkill](https://github.com/ThisIsAkill) on 2026-10-04T06:12:30Z. --- Thanks for cross-checking this against PPSA21564. Both points match PPSA21567. `SystemUnregisterMaterial` takes only the material handle. `SourceRender` does have the third argument: the only call site sets `mov edx,0x1` at 0xf6efa5 before the call at 0xf6efde, and I had missed it. The RenderInfo fields there match yours: +0x18 output buffer, +0x20 `grains * 64` bytes, +0x28 = 2. I've posted the correction on #481. On SourceRender in this PR and your follow-up offer, I'll come back to you shortly.
ThisIsAkill commented 2026-10-04 06:13:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-04T06:13:33Z.


Yes please, a follow-up on top of #482 for SourceRender would be great. Thanks again for catching the third argument. Your no-propagation version fits this PR's model (silence, with the descriptor and ownership checked), and it has been tested on PPSA21564, so it's better than leaving the export throwing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5977218521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/482#issuecomment-5977218521). Originally posted by [ThisIsAkill](https://github.com/ThisIsAkill) on 2026-10-04T06:13:33Z. --- Yes please, a follow-up on top of #482 for SourceRender would be great. Thanks again for catching the third argument. Your no-propagation version fits this PR's model (silence, with the descriptor and ownership checked), and it has been tested on PPSA21564, so it's better than leaving the export throwing.
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!482
No description provided.