[XMA] Fix multiple audio issues in new decoder

- Handle XMA2 frames with headers split across packet boundaries
  (fixes audio cutoff in Capcom games)
- Output buffer minimum space check using actual frame size instead
  of SDC-based formula, allowing tight-buffer contexts to decode
  (fixes PGR4 engine sounds)
- Gate consume-only context clearing with tight-buffer heuristic to
  prevent disrupting playback while still allowing stream completion
  signaling (fixes Borderlands 2 dialog)
- Clamp read offset 0 to packet header size to prevent decode rejection
  loop (fixes Dirt 2 crashes)
This commit is contained in:
Herman S.
2026-02-16 23:27:26 +09:00
parent 7213f7e69b
commit 6e5b2a95b0
2 changed files with 65 additions and 4 deletions

View File

@@ -154,6 +154,11 @@ struct XMA_CONTEXT_DATA {
const bool IsConsumeOnlyContext() const {
return (input_buffer_0_packet_count | input_buffer_1_packet_count) == 0;
}
// Whether the SDC-based minimum exceeds the output buffer size.
const bool HasTightOutputBuffer() const {
return (int32_t)((subframe_decode_count * 2) - 1) >
(int32_t)output_buffer_block_count;
}
};
static_assert_size(XMA_CONTEXT_DATA, 64);