Skip to content

feat(libSceAudioOut): implement sceAudioOutGetSystemState - #5965

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
bcortezf:feat/audioout-get-system-state
Oct 23, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
bcortezf:feat/audioout-get-system-state

Conversation

@bcortezf

@bcortezf bcortezf commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

Red Dead Redemption (PPSA30528) imports sceAudioOutGetSystemState (NID R5hemoKKID8) and fails to load without it:

FAIL: unresolved ELF import R5hemoKKID8 from libSceAudioOut.prx

This PR adds it:

  • Arguments and state: it takes a pointer to a 32-byte system state (float loudness, 4 reserved bytes, 3 reserved 64-bit words, checked by a static_assert) and reports a loudness of 0.0f.
  • Null pointer: returns 0x80260004, like the other AudioOut calls.

The layout follows shadPS4's OrbisAudioOutSystemState and SharpProspero's SceAudioOutSystemState (Size = 32), not a console measurement. The debt entry in docs/dev/debt/libSceAudioOut.md records that, and that the constant 0.0f is unconfirmed (SharpProspero documents loudness in LKFS) and that shadPS4's NOT_INIT before sceAudioOutInit is not modelled.

A unit test (audio_out_system_state) checks the result, the loudness and the null pointer.

Tested

Windows 11 (10.0.26200), MinGW build, on current main (a6dcea927) + this commit (abd3af907)

  • Unit test: ctest -R audio_out_system_state passes.
  • Conventions: python3 tools/check_conventions.py --base origin/main passes.
  • PPSA30528: executable converted again with this branch's relinker, libs from this branch only, no local workarounds: the title loads past the import and reaches gameplay (Blackwater, screenshot attached).

Not tested: Linux/macOS.

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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA30528 (Red Dead Redemption): it does not load without this export
  • GPUs tested: n/a
  • AI-assisted: yes

@bcortezf

Copy link
Copy Markdown
Contributor Author

could someone check this? @adriadam10

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@bcortezf
bcortezf force-pushed the feat/audioout-get-system-state branch from 8f22c85 to 46cd6d5 Compare October 14, 2026 23:36
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libSceAudioOut/CMakeLists.txt
docs/dev/debt/libSceAudioOut.md
PR 6044 core/libs/prx/libSceAudioOut/CMakeLists.txt
PR 7081 core/libs/SceTypes.hpp
PR 7412 core/libs/SceTypes.hpp
PR 8285 core/libs/SceTypes.hpp
PR 8649 core/libs/SceTypes.hpp
PR 8652 core/libs/prx/libSceAudioOut/src/AudioOut.cpp
docs/dev/debt/libSceAudioOut.md
PR 9818 core/libs/prx/libSceAudioOut/src/AudioOut.cpp
PR 9826 core/libs/prx/libSceAudioOut/src/AudioOut.cpp

This was referenced Oct 15, 2026
@adriadam10 adriadam10 self-assigned this Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Progress report (e78acf4 → de28243)

➖ System libraries: 47.89% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAudioOut sceAudioOutGetSystemState

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Build and the AudioOut ctest scope are green here, and audio_out_system_state fails to build without the change. One thing to fix:

  • core/libs/SceTypes.hpp:575 AudioOutSystemState is 64 bytes (copied from AudioOut2SystemState), but the sources the debt line cites say 32: shadPS4's OrbisAudioOutSystemState is float loudness; u8 reserved8[4]; u64 reserved64[3], and SharpProspero's SceAudioOutSystemState has Size = 32. Please use the 32-byte layout (std::uint64_t reserved[3]), and add a static_assert(sizeof(...) == 32).
  • docs/dev/debt/libSceAudioOut.md:15: the layout is not from shadPS4/fpPS4 as written, so correct it once the struct matches. Also note there that shadPS4 returns NOT_INIT before init (not modelled) and that SharpProspero documents loudness in LKFS, so the constant 0.0f is unconfirmed.

@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@bcortezf this PR now conflicts with main in docs/dev/debt/libSceAudioOut.md (the sceAudioOutSysOpen entry was rewritten there).

In case it helps: I rebased your commit onto current main (cd700fe9ec) without changing it, keeping you as its author, and resolved only that debt conflict (your sceAudioOutGetSystemState entry stays, the main text of the sceAudioOutSys* entry stays): branch xXPBSXx:carry/5965-audioout-system-state, head 4bff38aa2d. You can take it with git fetch https://github.com/xXPBSXx/AnyPS5 carry/5965-audioout-system-state and git reset --hard FETCH_HEAD, or rebase yourself; I will not open a second PR for it.

Windows 10 19045, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on that head:

  • ctest -R '^audio_out_system_state$' passes 3 of 3; the 38 audio_out* tests pass (38 of 38).
  • With core/libs/SceTypes.hpp and libSceAudioOut/src/AudioOut.cpp restored to main (your new test kept), audio_out_system_state_tests does not compile ('AudioOutSystemState' was not declared).
  • python tools/check_conventions.py --base upstream/main passes.
    Not tested: Linux/macOS, a title run (PPSA30528).

AI-assisted (Claude Code).

@bcortezf

Copy link
Copy Markdown
Contributor Author

@adriadam10 Done. struct is now 32 bytes with a static_assert, debt entry corrected (sources, LKFS, NOT_INIT not modelled), rebased on current main.

@bcortezf

Copy link
Copy Markdown
Contributor Author

btw, with this, im able to run rdr1 at 17 fps

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@krishalivaibhav

Copy link
Copy Markdown
Contributor

Re-checked head abd3af9: AudioOutSystemState is now 32 bytes, with the static_assert, so adriadam10's size point looks resolved. The null path returns 0x80260004, as described. Small nit: only loudness is written, so the reserved fields keep the caller's bytes; *state = {} before setting loudness would match the other AudioOut getters. Not blocking. (Code review only; I don't have PPSA30528 to test.)

@adriadam10
adriadam10 force-pushed the feat/audioout-get-system-state branch from abd3af9 to de28243 Compare October 23, 2026 18:42
@adriadam10
adriadam10 merged commit 40564ce into boykopovar:main Oct 23, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Both points are fixed: the struct is 32 bytes with the static_assert, and the debt entry now cites the right layout, LKFS and the missing NOT_INIT check.

Added one commit on your branch: sceAudioOutGetSystemState now zeroes the whole struct before setting loudness (the reserved fields no longer keep the caller's bytes), and the test pins it with non-zero reserved bytes. Rebased on current main; AudioOut ctest scope green (113 tests); merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants