Skip to content

feat(libSceAjm.native): build the WVorbis header packet - #9034

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
hypermoist:feat/ajm-wvorbis-header-packet
Oct 23, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
hypermoist:feat/ajm-wvorbis-header-packet

Conversation

@hypermoist

Copy link
Copy Markdown
Contributor

What

sceAjmDecWVorbisCreateHeaderPacket (Z4HDpe1ZEa4) threw. PPSA08427 and PPSA29340 import it, through the Wwise Vorbis hardware-decoder module they ship.

In the decrypted PS5 12.00 module (0x59a0) it takes one 0x48-byte parameter. The fields are: structure size, channels, sample rate, bytes per second, the two block-size exponents, the setup packet and its size, the output buffer and its size, and the written size.

It checks, in this order:

  • null parameter: 0x8A6E0001;
  • size other than 0x48: 0x8A6E0002;
  • negative byte rate: 0x8A6E0001;
  • 1 << blockSize0 below 64, blockSize1 < blockSize0, or 1 << blockSize1 above 8192: 0x8A6E0001. The shift is a 32-bit shlx, so exponents are taken modulo 32, and this is reproduced;
  • null setup packet: 0x8A6E0001;
  • setup packet under 9 bytes: 0x8A6E0004;
  • null output: 0x8A6E0001;
  • output under 10 bytes: 0x8A6E0003.

It then writes, with an LSB-first bit writer:

  1. a table of five little-endian 16-bit lengths: 0, 30, 16, the setup packet's part-1 length (its bytes 7–8), and the setup size minus that length;
  2. a Vorbis identification header: version 0, channels, sample rate, maximum and minimum bitrate 0, nominal bitrate = bytes per second × 8, the two 4-bit block sizes, framing bit;
  3. a Vorbis comment header with an empty vendor and no comments;
  4. the setup packet unchanged.

The written size is 56 plus the setup size.

This PR writes the same bytes directly. One difference, recorded under Functional in the debt file: the console's bit writer only checks that each write starts inside the buffer, so it can accept a buffer a few bytes short and write past it. Here any output smaller than the whole packet returns 0x8A6E0003.

sceAjmDecWVorbisCreateSetupPacket still throws. It rebuilds Wwise's codebook references into the decoder's own codebook format and will be a separate PR. Ajm here has no WVorbis decoder, so a title gets past header creation but not decoding.

The code is written from the observed behaviour and the public Vorbis header layout; nothing from the module is copied.

Tested

Linux (CachyOS, GCC, Release). The new guest_ajm_wvorbis checks:

  • every validation result in the module's order, including the modulo-32 exponent and null-before-size cases;
  • an output one byte too small;
  • the exact 56-byte table and headers for 2 channels, 48 kHz, 16000 B/s and block sizes 256/2048;
  • the copied setup packet, and that nothing is written past it.

All four guest_ajm* tests pass.

tools/check_conventions.py is clean. No open PR implements these exports. Three-way merges with the open PRs touching these files add no conflicts: #3205, #6044, #6977, #8087, #8353, #8468.

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
  • Fixes: none
  • Unblocks: PPSA08427 and PPSA29340 import it; neither was run with this change
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK

sceAjmDecWVorbisCreateHeaderPacket checks its 0x48-byte parameter as the
PS5 module does and writes a five-entry length table, a Vorbis
identification header from the parameters, an empty comment header and
the setup packet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Progress report (8c26eac → 9f6a71b)

📈 System libraries: 42.34% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAjm.native sceAjmDecWVorbisCreateHeaderPacket

@github-actions

github-actions Bot commented Oct 21, 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 3205 core/libs/prx/libSceAjm.native/Export.cpp
PR 6044 core/libs/prx/libSceAjm.native/CMakeLists.txt

…ader-packet

# Conflicts:
#	core/libs/prx/libSceAjm.native/Export.cpp
#	docs/dev/debt/libSceAjm.native.md
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit 928b2a5 into boykopovar:main Oct 23, 2026
10 checks passed
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.

2 participants