[PR #3875] [MERGED] AJM: Collection of Fixes #3772

Closed
opened 2026-02-27 22:04:55 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3875
Author: @roamic
Created: 12/23/2025
Status: Merged
Merged: 12/23/2025
Merged by: @georgemoralis

Base: mainHead: ajm-fixes-collection


📝 Commits (1)

📊 Changes

12 files changed (+163 additions, -99 deletions)

View changed files

📝 src/core/libraries/ajm/ajm.h (+1 -1)
📝 src/core/libraries/ajm/ajm_at9.cpp (+39 -13)
📝 src/core/libraries/ajm/ajm_at9.h (+3 -2)
📝 src/core/libraries/ajm/ajm_batch.h (+1 -0)
📝 src/core/libraries/ajm/ajm_context.cpp (+9 -2)
📝 src/core/libraries/ajm/ajm_instance.cpp (+46 -57)
📝 src/core/libraries/ajm/ajm_instance.h (+11 -3)
📝 src/core/libraries/ajm/ajm_instance_statistics.cpp (+4 -2)
📝 src/core/libraries/ajm/ajm_instance_statistics.h (+1 -0)
📝 src/core/libraries/ajm/ajm_mp3.cpp (+27 -17)
📝 src/core/libraries/ajm/ajm_mp3.h (+4 -2)
src/core/libraries/ajm/ajm_result.h (+17 -0)

📄 Description

All of these fixes come from testing on the original hardware by recording an API trace on the emulator and replaying it on the PS4.

This PR is known to completely fix sound or remove API result inconsistencies in:

  • God of War 3 Remastered
  • The Last of Us: Remastered
  • The Last of Us Part 2
  • Uncharted 4: A Thief's End
  • Ys VIII -Lacrimosa of DANA-
  • Severed Steel
  • The Persistence
  • Bloodborne

Fixes contained in this pack:

  • Do not add skipped samples to total_decoded_samples
  • Do not stop decoding on gapless end when gapless loop flag is set
  • Do not stop decoding if output buffer is full. First check that decoding will output any data (in case samples need to be skipped)
  • Skip skip_samples samples even if total_samples in gapless is 0
  • Check that there's enough data to decode the mp3 frame or at9 superframe, else return ORBIS_AJM_RESULT_PARTIAL_INPUT
  • Fill sideband information for the run even if there's no input buffer
  • Accumulate result flags instead of returning on first issue
  • AJM mp3: initialize gapless from MP3 header
  • AJM mp3: track frame size and return it as minimum input buffer size
  • AJM at9: drain superframe of remaining frames on gapless end and count them as frames_decoded
  • Do not crash on codec error, instead return ORBIS_AJM_RESULT_CODEC_ERROR | ORBIS_AJM_RESULT_FATAL
  • Do not process cancelled batches

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3875 **Author:** [@roamic](https://github.com/roamic) **Created:** 12/23/2025 **Status:** ✅ Merged **Merged:** 12/23/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `ajm-fixes-collection` --- ### 📝 Commits (1) - [`39c2cb8`](https://github.com/shadps4-emu/shadPS4/commit/39c2cb8929b39aa3fb6a8cc4da2bfd3483703328) ajm fixes ### 📊 Changes **12 files changed** (+163 additions, -99 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/ajm/ajm.h` (+1 -1) 📝 `src/core/libraries/ajm/ajm_at9.cpp` (+39 -13) 📝 `src/core/libraries/ajm/ajm_at9.h` (+3 -2) 📝 `src/core/libraries/ajm/ajm_batch.h` (+1 -0) 📝 `src/core/libraries/ajm/ajm_context.cpp` (+9 -2) 📝 `src/core/libraries/ajm/ajm_instance.cpp` (+46 -57) 📝 `src/core/libraries/ajm/ajm_instance.h` (+11 -3) 📝 `src/core/libraries/ajm/ajm_instance_statistics.cpp` (+4 -2) 📝 `src/core/libraries/ajm/ajm_instance_statistics.h` (+1 -0) 📝 `src/core/libraries/ajm/ajm_mp3.cpp` (+27 -17) 📝 `src/core/libraries/ajm/ajm_mp3.h` (+4 -2) ➕ `src/core/libraries/ajm/ajm_result.h` (+17 -0) </details> ### 📄 Description All of these fixes come from testing on the original hardware by recording an API trace on the emulator and replaying it on the PS4. This PR is known to completely fix sound or remove API result inconsistencies in: * God of War 3 Remastered * The Last of Us: Remastered * The Last of Us Part 2 * Uncharted 4: A Thief's End * Ys VIII -Lacrimosa of DANA- * Severed Steel * The Persistence * Bloodborne Fixes contained in this pack: * Do not add skipped samples to `total_decoded_samples` * Do not stop decoding on gapless end when gapless loop flag is set * Do not stop decoding if output buffer is full. First check that decoding will output any data (in case samples need to be skipped) * Skip `skip_samples` samples even if `total_samples` in gapless is `0` * Check that there's enough data to decode the mp3 frame or at9 superframe, else return `ORBIS_AJM_RESULT_PARTIAL_INPUT` * Fill sideband information for the run even if there's no input buffer * Accumulate result flags instead of returning on first issue * AJM mp3: initialize gapless from MP3 header * AJM mp3: track frame size and return it as minimum input buffer size * AJM at9: drain superframe of remaining frames on gapless end and count them as `frames_decoded` * Do not crash on codec error, instead return `ORBIS_AJM_RESULT_CODEC_ERROR | ORBIS_AJM_RESULT_FATAL` * Do not process cancelled batches --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:04:55 +03:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3772
No description provided.