Revert "Guard XMA loop handling against degenerate loop metadata"

This reverts commit 466cac7c00.
The guard's reject test (loop_start >= loop_end) also matches a legitimate
"loop from start" encoding, so it suppressed real BGM metadata loops and
playback ran past the loop point.
This commit is contained in:
Dipshet
2026-08-06 17:03:49 +02:00
parent deb406bdb0
commit 201a4038ea
2 changed files with 3 additions and 31 deletions
+1 -4
View File
@@ -19,12 +19,9 @@ REXCVAR_DEFINE_BOOL(audio_trace_render_driver_verbose, false, "Audio",
"Trace render-driver activity");
REXCVAR_DEFINE_BOOL(audio_deep_trace, false, "Audio",
"Enable verbose runtime audio tracing");
// The four audio_xma_* guards below are correctness fixes debugged on Ace
// The audio_xma_* guards below are correctness fixes debugged on Ace
// Combat 6 (details in the commits introducing each). All default on; off
// restores the legacy behaviour for A/B comparison.
REXCVAR_DEFINE_BOOL(audio_xma_loop_guard, true, "AC6/Fixes",
"Guard XMA looping against degenerate loop metadata that "
"truncates streamed voices. Off = legacy behaviour for A/B.");
REXCVAR_DEFINE_BOOL(audio_xma_header_straddle_fix, true, "AC6/Fixes",
"Decode XMA frames whose header straddles a packet boundary. "
"Off = legacy walk, which drops a frame per occurrence and "
+2 -27
View File
@@ -1,4 +1,4 @@
/**
/**
* ReXGlue native audio runtime
* Part of the AC6 Recompilation project
*/
@@ -17,7 +17,6 @@
#include <native/stream.h>
REXCVAR_DECLARE(bool, audio_deep_trace);
REXCVAR_DECLARE(bool, audio_xma_loop_guard);
REXCVAR_DECLARE(bool, audio_xma_preserve_timeline);
REXCVAR_DECLARE(bool, audio_xma_header_straddle_fix);
REXCVAR_DECLARE(bool, audio_xma_loop_end_guard);
@@ -345,31 +344,7 @@ void XmaContext::UpdateLoopStatus(XMA_CONTEXT_DATA* data) {
const uint32_t loop_start = std::max(kBitsPerPacketHeader, data->loop_start);
const uint32_t loop_end = std::max(kBitsPerPacketHeader, data->loop_end);
if (REXCVAR_GET(audio_xma_loop_guard)) {
// Xenia master's TrySetupNextLoop guard (PR #1808, debugged on Ace
// Combat 6): streamed voices can carry degenerate loop metadata
// (loop_count=0xff, loop_start == loop_end == 0). The clamps above turn
// that into start == end == kBitsPerPacketHeader, and SwapInputBuffer
// resets the read offset to exactly kBitsPerPacketHeader, so without a
// real-window check every buffer swap re-fires the loop machinery -
// the frame output limit truncates that frame and the loop-start skip
// drops subframes. Require loop_start < loop_end (raw values) and use
// master's read_offset >= loop_end trigger.
if (data->loop_start >= data->loop_end ||
data->input_buffer_read_offset < loop_end) {
if (data->loop_start >= data->loop_end &&
data->input_buffer_read_offset == loop_end && IsDeepTraceEnabled()) {
REXAPU_DEBUG(
"XmaContext {}: loop guard suppressed degenerate loop fire "
"(loop_start={} loop_end={} loop_count={} read_offset={})",
id(), static_cast<uint32_t>(data->loop_start),
static_cast<uint32_t>(data->loop_end),
static_cast<uint32_t>(data->loop_count),
static_cast<uint32_t>(data->input_buffer_read_offset));
}
return;
}
} else if (data->input_buffer_read_offset != loop_end) {
if (data->input_buffer_read_offset != loop_end) {
return;
}