Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
ThisIsAkill:feat/audiopropagation-no-propagation
Oct 4, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
ThisIsAkill:feat/audiopropagation-no-propagation

Conversation

@ThisIsAkill

Copy link
Copy Markdown
Contributor

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

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

…ath with recovered signatures

The 22 exports used by PPSA21567 take the call shapes recovered from its
call sites (boykopovar#481): destroys take the system and the object, attribute
setters take a count, SourceCreate takes only an output handle,
UnregisterMaterial only the material.

The system lives in the title's CPU memory (16-byte header, no GPU memory)
and its handle is that address; rooms, portals, sources and materials are
counter handles. Attributes are validated and have no effect; no rays are
requested and sources report no audio paths. Non-empty ray results, path
calculation and audio paths throw, SourceRender stays unimplemented, and
invalid input throws because no error code is known. Objects left when
their system is destroyed become unusable; their later destroy or
unregister is a no-op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

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

@ThisIsAkill

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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.

@oneandonlydean
oneandonlydean merged commit d1b8565 into boykopovar:main Oct 4, 2026
3 checks passed
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 5, 2026
Conflicts resolved:
- libSceAudioPropagation/Export.cpp: upstream's boykopovar#482 + boykopovar#489 version taken; it is
  the same no-propagation model as astrobot's stand-in, with SourceRender and the
  handle-only UnregisterMaterial already in it.
- State.cpp (boykopovar#453): astrobot's resident depth model kept; it already skips the
  tests of an absent plane (boykopovar#453's test is on astrobot since e087a4f).
- Graphics.cpp, State.hpp, ShaderResources.cpp: astrobot's DepthTarget model kept
  (exportIndex, no DepthSurface.hpp), upstream's ThreadOwned include added.
- BdaResources.cpp: astrobot's form with boykopovar#390's message.
- VulkanDevice.cpp, Context.hpp, PacketExecution.cpp: both sides kept
  (calibrated timestamps, host query reset, GDS, memory budget; pipeline stats).
- Spirv: astrobot's split-wave rules first, then boykopovar#608's wave-mask ballot and
  boykopovar#587's host subgroup lane; astrobot's function LDS sizing and boykopovar#573's LDS lock
  both kept; conditionalDepth kept in the atomic update loops; upstream's
  buffer atomics (boykopovar#321 boykopovar#332 boykopovar#594) and 64-bit LDS atomics taken.
- TechnicalDebt.md: both sides, duplicate lines dropped.


Build fixes folded in: the upstream boykopovar#453 test block duplicated next to
astrobot's adapted copy removed; a lost closing brace after the host
query reset block restored; lookupLog() is a function since boykopovar#590; the
duplicate MUTEX_TYPE_ADAPTIVE constant (astrobot's 93b2d0e equals boykopovar#156)
removed; the ops boykopovar#596 drops removed from the masked-select list and the
BDA test message updated (the gate-batch-2 integ commits 559e4fab6 and
2ec968fb5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants