Skip to content

feat(ajm): decode ATRAC9 vibration streams - #6721

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
JJenkx:feat/ajm-atrac9-vibration
Oct 21, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
JJenkx:feat/ajm-atrac9-vibration

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

Decode ATRAC9 vibration streams in AJM. Ghost of Yōtei PPSA26344 02.002.000 passes configuration fe 7e 03 f0 (channel index 7); the existing decoder rejects it, and the game then divides by zero in audio setup. The new path parses and decodes vibration mono (6) and dual mono (7) using vgmstream's pinned V3 decoder. Ordinary ATRAC9 and discrete multichannel streams keep their existing LibAtrac9 path. Reset, partial-input handling, gapless/sample accounting and PCM16/PCM32/float output use the existing AJM job pipeline.

Semantics come from the pinned channel table and decoder and vibration block reader. Build only the two decoder sources from a submodule; release archives include its license. Console PCM rounding and physical controller haptics remain unverified and are recorded in debt.

Tested

Latest rebase: e7ebd9df1eb3d4ca94d7de1655605407fa784c59 on upstream 16c607a9373654e1e87c1a809845b1257f6acfed. Three linear commits, no merge commits. The only stopped conflict was additive docs/dev/debt/libSceAjm.native.md after the instance-slot exhaustion entry landed; both entries are retained. Range-diff confirms decoder and test behavior unchanged. Full libs and all five AJM test executables build; 5/5 affected checks pass, no skips (1.46 s). Packaging: 28 run, 4 platform-specific skips, no failures. Conventions against origin/main and whitespace pass. Local Linux validation only; no new native title or Windows run. Rebase validation summary.

Arch Linux 7.2.9, GCC 16.2.1, Ryzen 9 7950X:

  • On main 5d9dcc42d plus this change, all five affected checks pass: guest_ajm, guest_ajm_vibration, guest_ajm_teardown, atrac9_config_data, atrac9_gradient.
  • Synthetic vibration fixtures cover both channel layouts at 12/24/48 kHz; 48 kHz PCM16/PCM32/float conversion, independent mono vs dual-mono interleaving, a partial superframe that leaves output untouched, and decoder reset after a malformed first-frame flag. Removing vibration decoder initialization makes the new regression fail; restoration passes.
  • Release packaging: 27 tests run, three platform-specific skips; the new test verifies license contents in ZIP and tar archives.
  • Native PPSA26344 uses the same converted game/modules and current-main experimental graphics stack as the earlier fault report. First candidate integration head af6f2c37a578 renders the PlayStation intro, reaches a loading spinner and closes normally (exit 0, 152.69 seconds, 698 presentations). A single-library negative control, rebuilding only AJM from exact main source with the same build configuration, then loading it against those same graphics libraries, restores native exit 136 after 28.59 seconds. This is not a separate complete main build. Actual library mappings were verified and the temporary kernel limit was restored in both runs.
  • Final-head native repeat on combined head 0b8281d50a251: PlayStation intro and loading spinner; normal close, exit 0 after 153.91 seconds, 768 presentations. No inputs or skipped work. The temporary kernel limit was restored.
  • Combined with fix(ajm): preserve live decoder handles across ID wrap #6051 (e60dd9d5a) on validation head 8476d4030841, all five affected Linux checks pass, including its handle-wrap/decoder-lifetime regression and this PR’s vibration fixtures. Source and tests merge cleanly; both additive debt entries were retained. Exact combined source.
  • The pinned decoder’s two C sources compile with MinGW-w64 GCC 16.2.0. A standalone PE64 probe under Wine 11.19 checks nine synthetic cases at 12/24/48 kHz, mono/dual mono, PCM16/float output, reset and independent-channel interleaving; all nine PCM16 hashes match Linux GCC 16.2.1. This is backend-only portability evidence, not a full Windows AJM DLL build or native Windows run. Probe source and results; reproducer.

Run summaries and limits. Exact combined source.

No gameplay, audio-quality, physical-haptics or performance-gain claim. Native validation includes other open changes; their individual necessity has not been isolated. Full Windows/macOS AJM builds have not been run locally; the standalone Windows decoder probe is described above.

Overlap

#5797 adds the same 3rdparty/vgmstream path, URL and exact pin for HE-VAG, a separate decoder. Keep that shared dependency once. Both PRs add release-license packaging: when the second merges, combine the consumer condition for AJM and NGS2 and retain a single license entry. There is no decoder-code dependency on #5797. Proposed order: this verified startup fix first, then its additional NGS2 consumer. The new ATRAC9 vibration implementation was not present in the open PR search.

#6051 changes instance-ID allocation, independently of vibration decoding. The only conflict when combining it here is the debt-file insertion; keep both entries. Its live-handle regression and this PR’s checks pass together as documented above. No dependency on #6051.

#6044 (5fa62e596) relocates existing AJM tests to tests/media/ and changes registrations to add_library_test(media ...); it does not change their decoder behavior. When combining, move/register GuestAjmVibration.cpp consistently with that organization and retain the decoder target/link changes. No runtime dependency on #6044.

I inspected the archived shared .gitmodules and packaging hunks in the older branches listed as not comparable by the bot: they do not add this vibration decoder or the vgmstream path/license. This is a scoped metadata review, not a claim that every old integration branch merges with this PR.

Checklist

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 5797 3rdparty/vgmstream

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 674 .gitmodules
tools/package_release.py
PR 1835 .gitmodules
PR 5021 .gitmodules
PR 5797 .gitmodules
3rdparty/vgmstream
tools/package_release.py
tools/tests/test_package_release.py
PR 6044 core/libs/prx/libSceAjm.native/CMakeLists.txt
PR 6977 core/libs/prx/libSceAjm.native/CMakeLists.txt

@JJenkx

JJenkx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed the overlap warning. #6051’s production/test changes combine cleanly with this decoder; only the additive debt insertion needs both entries retained. All five affected Linux checks pass on the combined head, including its handle-lifetime regression. #6044 is a test relocation/label change; the new vibration fixture should follow its media directory and registration helper when combining. The shared vgmstream pin and release-license handling with #5797 remain documented in the description. None is a runtime prerequisite for this PR.

I added exact combined source and a separate Windows backend portability probe: the pinned C decoder builds with MinGW, and nine synthetic cases under Wine match Linux PCM16 hashes. This does not claim a full Windows AJM DLL build or native Windows validation. Details, source and limits are now in the PR description.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 16, 2026
@JJenkx
JJenkx force-pushed the feat/ajm-atrac9-vibration branch from 8303250 to bc3aed5 Compare October 16, 2026 19:38
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 16, 2026
@JJenkx
JJenkx force-pushed the feat/ajm-atrac9-vibration branch from bc3aed5 to e7ebd9d Compare October 17, 2026 04:49
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line and removed needs rebase Conflicts with main, rebase needed labels Oct 17, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
FardinHaque70 pushed a commit to FardinHaque70/AnyPS5 that referenced this pull request Oct 19, 2026
Attribute inherited Celegans Windows results and JJenkx PR boykopovar#6721; document exact tested runtime, focused validation, cache state and unverified gameplay. Documentation only; no runtime change. AI-assisted: yes.
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Picking this up for our testing: it addresses the stop we see in PPSA26344 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.

@oneandonlydean oneandonlydean self-assigned this Oct 20, 2026
@Dextroid17

Copy link
Copy Markdown
Contributor

@oneandonlydean, since you are picking this up: one thing this thread does not have yet. On my install of Ghost of Yōtei (PPSA26344), which has only playgo-scenario.json and no chunk table, the game reaches the config this PR handles only since 842bfcce6 (#7726). JJenkx's native control on 5d9dcc42d, which predates #7726, already ended with exit 136, so installs differ in when they reach it. Below are the bisect and lavapipe runs. They repeat JJenkx's startup result on a different driver; they say nothing new about the decoder.

Bisect. I bisected the first-parent merges between b106f6f8c (good) and b85d972f4 (bad), each with the same local commits applied, in 9 steps. A step counted as bad when the AJM trace printed parse config fe 7e 03 f0 -> invalid, and the script stopped the game there (frame 3 to 5). It counted as good when it reached frame 30 with no such line. First bad merge: 842bfcce6. With it, the game opens /app0/cache_ps5/loc/noloc.larc and passes fe 7e 03 f0 to sceAjmDecAt9ParseConfigData, which returns SCE_AJM_ERROR_INVALID_PARAMETER without writing the output.

Three arms on the same tree, one run each, 600 s limit:

I did not review #7726 itself. These runs only show that its chunk list lets this install reach the config this PR decodes.

Setup: Release build, Linux (CachyOS, kernel 7.2.9), llvmpipe (LLVM 23.1.1, 256 bits) from a local lavapipe build of Mesa 26.2.4 that carries one env-gated patch, unset for these runs. Runs used APS5_SKIP_REFUSED_DRAWS=1 (skips draws the recompiler refuses), APS5_NO_PIPELINE_JOURNAL=1 and APS5_TRACE_AJM=1; frame numbers come from a local env-gated probe. The tree is b85d972f4 plus 18 commits: 10 unsubmitted shader and recompiler commits I use for this title on lavapipe, the APS5_SKIP_REFUSED_DRAWS change from #8206, and 7 local probe, memory-test and cache-assert commits. By file list, none of them touch AJM, PlayGo or ATRAC9. The cherry-pick applied without conflicts. The PR head e7ebd9df1 also merges cleanly into main at a8b92e43c (checked with git merge-tree, not built).

Not checked: plain main without the local commits; runs without APS5_SKIP_REFUSED_DRAWS; RADV or NVIDIA; more than one run per arm; frame rate or memory differences between arms; audio output, haptics, Windows/macOS; whether the decoded vibration samples match hardware.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit 4936df7 into boykopovar:main Oct 21, 2026
11 checks passed
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Dextroid17 thanks, this is useful, and the bisect explains why installs differ. Since #7726, a scenario-only install like yours opens noloc.larc and reaches the fe 7e 03 f0 config at startup, where older trees didn't get that far. That matches what we see on our side: on main PPSA26344 stopped at about 136 s with the same SIGFPE, and with this PR it ran the full 900 s (and 40 minutes in a later run) with no abort on an RTX 4090. It still sits on the loading screen after that, which looks like a separate texture re-upload issue.

This is merged now. @JJenkx, thank you for the decoder and the Windows probe.

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