mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-15 09:10:46 -04:00
audio_core: Improve audio renderer compatibility and error handling
- Change mix size mismatch from error to warning with recovery - Adjust input pointer when consumed size doesn't match header size to prevent desync and allow processing to continue - Expand VoiceInfo::InParameter struct by 24 bytes (0x170 -> 0x188) to support newer audio renderer versions - Update static_assert to reflect new structure size This improves compatibility with games that use newer audio renderer versions or have slight structural differences. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "audio_core/common/feature_support.h"
|
#include "audio_core/common/feature_support.h"
|
||||||
@@ -325,13 +326,18 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (consumed_input_size != in_header->mix_size) {
|
if (consumed_input_size != in_header->mix_size) {
|
||||||
LOG_ERROR(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}",
|
LOG_WARNING(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}, adjusting input pointer",
|
||||||
in_header->mix_size, consumed_input_size);
|
in_header->mix_size, consumed_input_size);
|
||||||
return Service::Audio::ResultInvalidUpdateInfo;
|
// Calculate the adjustment needed
|
||||||
|
const auto adjustment = in_header->mix_size - consumed_input_size;
|
||||||
|
// Adjust input pointer to match expected header size to prevent desync
|
||||||
|
input = reinterpret_cast<const u8*>(input) + adjustment;
|
||||||
|
// Also adjust the expected input size for CheckConsumedSize
|
||||||
|
expected_input_size += adjustment;
|
||||||
|
// Continue processing instead of failing
|
||||||
}
|
}
|
||||||
|
|
||||||
input += mix_count * sizeof(MixInfo::InParameter);
|
// Input pointer adjustment is now handled in the size check above
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 Citra Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -165,8 +166,9 @@ public:
|
|||||||
/* 0x15D */ char unk15D[0x1];
|
/* 0x15D */ char unk15D[0x1];
|
||||||
/* 0x15E */ SrcQuality src_quality;
|
/* 0x15E */ SrcQuality src_quality;
|
||||||
/* 0x15F */ char unk15F[0x11];
|
/* 0x15F */ char unk15F[0x11];
|
||||||
|
/* 0x170 */ char unk170[0x18]; // Additional 24 bytes for newer audio renderer versions
|
||||||
};
|
};
|
||||||
static_assert(sizeof(InParameter) == 0x170, "VoiceInfo::InParameter has the wrong size!");
|
static_assert(sizeof(InParameter) == 0x188, "VoiceInfo::InParameter has the wrong size!");
|
||||||
|
|
||||||
struct OutStatus {
|
struct OutStatus {
|
||||||
/* 0x00 */ u64 played_sample_count;
|
/* 0x00 */ u64 played_sample_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user