From 03746be097a28db429f05512275a4efe49bd0798 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 29 Apr 2019 18:26:15 -0400 Subject: service/audren_u: Handle version 2 of performance frame info in GetWorkBufferSize() Introduced in REV5. This is trivial to add support for, now that everything isn't a mess of random magic constant values. All this is, is a change in data type sizes as far as this function cares. --- src/core/hle/service/audio/audren_u.cpp | 18 ++++++++++++------ src/core/hle/service/audio/audren_u.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 4c9e124cb..0f325fe07 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -426,15 +426,19 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { }; // Calculates the part of the size related to performance statistics. - const auto calculate_performance_size = [](const AudioCore::AudioRendererParameter& params) { + const auto calculate_perf_size = [this](const AudioCore::AudioRendererParameter& params) { // Extra size value appended to the end of the calculation. constexpr u64 appended = 128; + // Whether or not we assume the newer version of performance metrics data structures. + const bool is_v2 = + IsFeatureSupported(AudioFeatures::PerformanceMetricsVersion2, params.revision); + // Data structure sizes constexpr u64 perf_statistics_size = 0x0C; - constexpr u64 header_size = 0x18; - constexpr u64 entry_size = 0x10; - constexpr u64 detail_size = 0x10; + const u64 header_size = is_v2 ? 0x30 : 0x18; + const u64 entry_size = is_v2 ? 0x18 : 0x10; + const u64 detail_size = is_v2 ? 0x18 : 0x10; constexpr u64 max_detail_entries = 100; @@ -474,7 +478,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { size += calculate_effect_info_size(params); size += calculate_sink_info_size(params); size += calculate_voice_state_size(params); - size += calculate_performance_size(params); + size += calculate_perf_size(params); size += calculate_command_buffer_size(); // finally, 4KB page align the size, and we're done. @@ -525,7 +529,9 @@ bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap switch (feature) { case AudioFeatures::Splitter: - return version_num >= 2u; + return version_num >= 2U; + case AudioFeatures::PerformanceMetricsVersion2: + return version_num >= 5U; default: return false; } diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index e55d25973..b8f71c37c 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -28,6 +28,7 @@ private: enum class AudioFeatures : u32 { Splitter, + PerformanceMetricsVersion2, }; bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; -- cgit v1.2.3