diff options
101 files changed, 309 insertions, 303 deletions
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp index d982ef630..5bafd4c06 100644 --- a/src/audio_core/renderer/adsp/audio_renderer.cpp +++ b/src/audio_core/renderer/adsp/audio_renderer.cpp | |||
| @@ -132,7 +132,7 @@ void AudioRenderer::CreateSinkStreams() { | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | void AudioRenderer::ThreadFunc() { | 134 | void AudioRenderer::ThreadFunc() { |
| 135 | constexpr char name[]{"AudioRenderer"}; | 135 | constexpr static char name[]{"AudioRenderer"}; |
| 136 | MicroProfileOnThreadCreate(name); | 136 | MicroProfileOnThreadCreate(name); |
| 137 | Common::SetCurrentThreadName(name); | 137 | Common::SetCurrentThreadName(name); |
| 138 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); | 138 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); |
| @@ -144,7 +144,7 @@ void AudioRenderer::ThreadFunc() { | |||
| 144 | 144 | ||
| 145 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK); | 145 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK); |
| 146 | 146 | ||
| 147 | constexpr u64 max_process_time{2'304'000ULL}; | 147 | constexpr static u64 max_process_time{2'304'000ULL}; |
| 148 | 148 | ||
| 149 | while (true) { | 149 | while (true) { |
| 150 | auto message{mailbox->ADSPWaitMessage()}; | 150 | auto message{mailbox->ADSPWaitMessage()}; |
diff --git a/src/audio_core/renderer/command/data_source/decode.cpp b/src/audio_core/renderer/command/data_source/decode.cpp index ff5d31bd6..68a0aa15d 100644 --- a/src/audio_core/renderer/command/data_source/decode.cpp +++ b/src/audio_core/renderer/command/data_source/decode.cpp | |||
| @@ -27,8 +27,8 @@ constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4}; | |||
| 27 | template <typename T> | 27 | template <typename T> |
| 28 | static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, | 28 | static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, |
| 29 | const DecodeArg& req) { | 29 | const DecodeArg& req) { |
| 30 | constexpr s32 min{std::numeric_limits<s16>::min()}; | 30 | constexpr static s32 min{std::numeric_limits<s16>::min()}; |
| 31 | constexpr s32 max{std::numeric_limits<s16>::max()}; | 31 | constexpr static s32 max{std::numeric_limits<s16>::max()}; |
| 32 | 32 | ||
| 33 | if (req.buffer == 0 || req.buffer_size == 0) { | 33 | if (req.buffer == 0 || req.buffer_size == 0) { |
| 34 | return 0; | 34 | return 0; |
| @@ -101,8 +101,8 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, | |||
| 101 | */ | 101 | */ |
| 102 | static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, | 102 | static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, |
| 103 | const DecodeArg& req) { | 103 | const DecodeArg& req) { |
| 104 | constexpr u32 SamplesPerFrame{14}; | 104 | constexpr static u32 SamplesPerFrame{14}; |
| 105 | constexpr u32 NibblesPerFrame{16}; | 105 | constexpr static u32 NibblesPerFrame{16}; |
| 106 | 106 | ||
| 107 | if (req.buffer == 0 || req.buffer_size == 0) { | 107 | if (req.buffer == 0 || req.buffer_size == 0) { |
| 108 | return 0; | 108 | return 0; |
diff --git a/src/audio_core/renderer/command/effect/biquad_filter.cpp b/src/audio_core/renderer/command/effect/biquad_filter.cpp index dea6423dc..84fb6ae7a 100644 --- a/src/audio_core/renderer/command/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/command/effect/biquad_filter.cpp | |||
| @@ -20,8 +20,8 @@ namespace AudioCore::AudioRenderer { | |||
| 20 | void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input, | 20 | void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input, |
| 21 | std::array<s16, 3>& b_, std::array<s16, 2>& a_, | 21 | std::array<s16, 3>& b_, std::array<s16, 2>& a_, |
| 22 | VoiceState::BiquadFilterState& state, const u32 sample_count) { | 22 | VoiceState::BiquadFilterState& state, const u32 sample_count) { |
| 23 | constexpr f64 min{std::numeric_limits<s32>::min()}; | 23 | constexpr static f64 min{std::numeric_limits<s32>::min()}; |
| 24 | constexpr f64 max{std::numeric_limits<s32>::max()}; | 24 | constexpr static f64 max{std::numeric_limits<s32>::max()}; |
| 25 | std::array<f64, 3> b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(), | 25 | std::array<f64, 3> b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(), |
| 26 | Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(), | 26 | Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(), |
| 27 | Common::FixedPoint<50, 14>::from_base(b_[2]).to_double()}; | 27 | Common::FixedPoint<50, 14>::from_base(b_[2]).to_double()}; |
| @@ -61,8 +61,8 @@ void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input, | |||
| 61 | static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> input, | 61 | static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> input, |
| 62 | std::array<s16, 3>& b, std::array<s16, 2>& a, | 62 | std::array<s16, 3>& b, std::array<s16, 2>& a, |
| 63 | VoiceState::BiquadFilterState& state, const u32 sample_count) { | 63 | VoiceState::BiquadFilterState& state, const u32 sample_count) { |
| 64 | constexpr s64 min{std::numeric_limits<s32>::min()}; | 64 | constexpr static s64 min{std::numeric_limits<s32>::min()}; |
| 65 | constexpr s64 max{std::numeric_limits<s32>::max()}; | 65 | constexpr static s64 max{std::numeric_limits<s32>::max()}; |
| 66 | 66 | ||
| 67 | for (u32 i = 0; i < sample_count; i++) { | 67 | for (u32 i = 0; i < sample_count; i++) { |
| 68 | const s64 in_sample{input[i]}; | 68 | const s64 in_sample{input[i]}; |
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp index 2187d8a65..98217cd2d 100644 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp | |||
| @@ -244,16 +244,16 @@ template <size_t NumChannels> | |||
| 244 | static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state, | 244 | static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state, |
| 245 | std::span<std::span<const s32>> inputs, | 245 | std::span<std::span<const s32>> inputs, |
| 246 | std::span<std::span<s32>> outputs, const u32 sample_count) { | 246 | std::span<std::span<s32>> outputs, const u32 sample_count) { |
| 247 | constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{ | 247 | constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{ |
| 248 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 248 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 249 | }; | 249 | }; |
| 250 | constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{ | 250 | constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{ |
| 251 | 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, | 251 | 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, |
| 252 | }; | 252 | }; |
| 253 | constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{ | 253 | constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{ |
| 254 | 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3, | 254 | 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3, |
| 255 | }; | 255 | }; |
| 256 | constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{ | 256 | constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{ |
| 257 | 2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5, | 257 | 2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5, |
| 258 | }; | 258 | }; |
| 259 | 259 | ||
diff --git a/src/audio_core/renderer/command/effect/light_limiter.cpp b/src/audio_core/renderer/command/effect/light_limiter.cpp index e8fb0e2fc..410e5dac0 100644 --- a/src/audio_core/renderer/command/effect/light_limiter.cpp +++ b/src/audio_core/renderer/command/effect/light_limiter.cpp | |||
| @@ -50,8 +50,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p | |||
| 50 | std::vector<std::span<const s32>>& inputs, | 50 | std::vector<std::span<const s32>>& inputs, |
| 51 | std::vector<std::span<s32>>& outputs, const u32 sample_count, | 51 | std::vector<std::span<s32>>& outputs, const u32 sample_count, |
| 52 | LightLimiterInfo::StatisticsInternal* statistics) { | 52 | LightLimiterInfo::StatisticsInternal* statistics) { |
| 53 | constexpr s64 min{std::numeric_limits<s32>::min()}; | 53 | constexpr static s64 min{std::numeric_limits<s32>::min()}; |
| 54 | constexpr s64 max{std::numeric_limits<s32>::max()}; | 54 | constexpr static s64 max{std::numeric_limits<s32>::max()}; |
| 55 | 55 | ||
| 56 | const auto recip_estimate = [](f64 a) -> f64 { | 56 | const auto recip_estimate = [](f64 a) -> f64 { |
| 57 | s32 q, s; | 57 | s32 q, s; |
diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp index 427489214..ffe108268 100644 --- a/src/audio_core/renderer/command/effect/reverb.cpp +++ b/src/audio_core/renderer/command/effect/reverb.cpp | |||
| @@ -252,16 +252,16 @@ template <size_t NumChannels> | |||
| 252 | static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state, | 252 | static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state, |
| 253 | std::vector<std::span<const s32>>& inputs, | 253 | std::vector<std::span<const s32>>& inputs, |
| 254 | std::vector<std::span<s32>>& outputs, const u32 sample_count) { | 254 | std::vector<std::span<s32>>& outputs, const u32 sample_count) { |
| 255 | constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{ | 255 | constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{ |
| 256 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 256 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 257 | }; | 257 | }; |
| 258 | constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{ | 258 | constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{ |
| 259 | 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, | 259 | 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, |
| 260 | }; | 260 | }; |
| 261 | constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{ | 261 | constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{ |
| 262 | 0, 0, 1, 1, 0, 1, 2, 2, 3, 3, | 262 | 0, 0, 1, 1, 0, 1, 2, 2, 3, 3, |
| 263 | }; | 263 | }; |
| 264 | constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{ | 264 | constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{ |
| 265 | 0, 0, 1, 1, 2, 2, 4, 4, 5, 5, | 265 | 0, 0, 1, 1, 2, 2, 4, 4, 5, 5, |
| 266 | }; | 266 | }; |
| 267 | 267 | ||
diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp index 5f7db12ca..4bd604754 100644 --- a/src/audio_core/renderer/command/resample/upsample.cpp +++ b/src/audio_core/renderer/command/resample/upsample.cpp | |||
| @@ -19,24 +19,24 @@ namespace AudioCore::AudioRenderer { | |||
| 19 | static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input, | 19 | static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input, |
| 20 | const u32 target_sample_count, const u32 source_sample_count, | 20 | const u32 target_sample_count, const u32 source_sample_count, |
| 21 | UpsamplerState* state) { | 21 | UpsamplerState* state) { |
| 22 | constexpr u32 WindowSize = 10; | 22 | constexpr static u32 WindowSize = 10; |
| 23 | constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{ | 23 | constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{ |
| 24 | 0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f, | 24 | 0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f, |
| 25 | -0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f, | 25 | -0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f, |
| 26 | }; | 26 | }; |
| 27 | constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{ | 27 | constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{ |
| 28 | 0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f, | 28 | 0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f, |
| 29 | -0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f, | 29 | -0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f, |
| 30 | }; | 30 | }; |
| 31 | constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{ | 31 | constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{ |
| 32 | 0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f, | 32 | 0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f, |
| 33 | -0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f, | 33 | -0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f, |
| 34 | }; | 34 | }; |
| 35 | constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{ | 35 | constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{ |
| 36 | 0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f, | 36 | 0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f, |
| 37 | -0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f, | 37 | -0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f, |
| 38 | }; | 38 | }; |
| 39 | constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{ | 39 | constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{ |
| 40 | 0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f, | 40 | 0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f, |
| 41 | -0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f, | 41 | -0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f, |
| 42 | }; | 42 | }; |
diff --git a/src/audio_core/renderer/command/sink/circular_buffer.cpp b/src/audio_core/renderer/command/sink/circular_buffer.cpp index ded5afc94..1989873db 100644 --- a/src/audio_core/renderer/command/sink/circular_buffer.cpp +++ b/src/audio_core/renderer/command/sink/circular_buffer.cpp | |||
| @@ -21,8 +21,8 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) { | 23 | void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) { |
| 24 | constexpr s32 min{std::numeric_limits<s16>::min()}; | 24 | constexpr static s32 min{std::numeric_limits<s16>::min()}; |
| 25 | constexpr s32 max{std::numeric_limits<s16>::max()}; | 25 | constexpr static s32 max{std::numeric_limits<s16>::max()}; |
| 26 | 26 | ||
| 27 | std::vector<s16> output(processor.sample_count); | 27 | std::vector<s16> output(processor.sample_count); |
| 28 | for (u32 channel = 0; channel < input_count; channel++) { | 28 | for (u32 channel = 0; channel < input_count; channel++) { |
diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp index e88372a75..2f2e82ae2 100644 --- a/src/audio_core/renderer/command/sink/device.cpp +++ b/src/audio_core/renderer/command/sink/device.cpp | |||
| @@ -20,8 +20,8 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { | 22 | void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { |
| 23 | constexpr s32 min = std::numeric_limits<s16>::min(); | 23 | constexpr static s32 min = std::numeric_limits<s16>::min(); |
| 24 | constexpr s32 max = std::numeric_limits<s16>::max(); | 24 | constexpr static s32 max = std::numeric_limits<s16>::max(); |
| 25 | 25 | ||
| 26 | auto stream{processor.GetOutputSinkStream()}; | 26 | auto stream{processor.GetOutputSinkStream()}; |
| 27 | stream->SetSystemChannels(input_count); | 27 | stream->SetSystemChannels(input_count); |
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index f66b2b890..a8517014e 100644 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp | |||
| @@ -94,7 +94,7 @@ bool SystemManager::Remove(System& system_) { | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | void SystemManager::ThreadFunc() { | 96 | void SystemManager::ThreadFunc() { |
| 97 | constexpr char name[]{"AudioRenderSystemManager"}; | 97 | constexpr static char name[]{"AudioRenderSystemManager"}; |
| 98 | MicroProfileOnThreadCreate(name); | 98 | MicroProfileOnThreadCreate(name); |
| 99 | Common::SetCurrentThreadName(name); | 99 | Common::SetCurrentThreadName(name); |
| 100 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); | 100 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); |
diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp index 1849eeb57..2b3705647 100644 --- a/src/audio_core/renderer/voice/voice_info.cpp +++ b/src/audio_core/renderer/voice/voice_info.cpp | |||
| @@ -177,7 +177,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info, | |||
| 177 | 177 | ||
| 178 | switch (sample_format_) { | 178 | switch (sample_format_) { |
| 179 | case SampleFormat::PcmInt16: { | 179 | case SampleFormat::PcmInt16: { |
| 180 | constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)}; | 180 | constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)}; |
| 181 | if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || | 181 | if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || |
| 182 | wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { | 182 | wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { |
| 183 | LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!"); | 183 | LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!"); |
| @@ -188,7 +188,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info, | |||
| 188 | } break; | 188 | } break; |
| 189 | 189 | ||
| 190 | case SampleFormat::PcmFloat: { | 190 | case SampleFormat::PcmFloat: { |
| 191 | constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)}; | 191 | constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)}; |
| 192 | if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || | 192 | if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || |
| 193 | wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { | 193 | wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { |
| 194 | LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!"); | 194 | LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!"); |
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 06c2a876e..fa3cee3ea 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp | |||
| @@ -24,8 +24,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) { | |||
| 24 | return; | 24 | return; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | constexpr s32 min{std::numeric_limits<s16>::min()}; | 27 | constexpr static s32 min{std::numeric_limits<s16>::min()}; |
| 28 | constexpr s32 max{std::numeric_limits<s16>::max()}; | 28 | constexpr static s32 max{std::numeric_limits<s16>::max()}; |
| 29 | 29 | ||
| 30 | auto yuzu_volume{Settings::Volume()}; | 30 | auto yuzu_volume{Settings::Volume()}; |
| 31 | if (yuzu_volume > 1.0f) { | 31 | if (yuzu_volume > 1.0f) { |
| @@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) { | |||
| 35 | 35 | ||
| 36 | if (system_channels == 6 && device_channels == 2) { | 36 | if (system_channels == 6 && device_channels == 2) { |
| 37 | // We're given 6 channels, but our device only outputs 2, so downmix. | 37 | // We're given 6 channels, but our device only outputs 2, so downmix. |
| 38 | constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f}; | 38 | constexpr static std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f}; |
| 39 | 39 | ||
| 40 | for (u32 read_index = 0, write_index = 0; read_index < samples.size(); | 40 | for (u32 read_index = 0, write_index = 0; read_index < samples.size(); |
| 41 | read_index += system_channels, write_index += device_channels) { | 41 | read_index += system_channels, write_index += device_channels) { |
| @@ -106,8 +106,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) { | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) { | 108 | std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) { |
| 109 | constexpr s32 min = std::numeric_limits<s16>::min(); | 109 | constexpr static s32 min = std::numeric_limits<s16>::min(); |
| 110 | constexpr s32 max = std::numeric_limits<s16>::max(); | 110 | constexpr static s32 max = std::numeric_limits<s16>::max(); |
| 111 | 111 | ||
| 112 | auto samples{samples_buffer.Pop(num_samples)}; | 112 | auto samples{samples_buffer.Pop(num_samples)}; |
| 113 | 113 | ||
| @@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz | |||
| 202 | // If we're paused or going to shut down, we don't want to consume buffers as coretiming is | 202 | // If we're paused or going to shut down, we don't want to consume buffers as coretiming is |
| 203 | // paused and we'll desync, so just play silence. | 203 | // paused and we'll desync, so just play silence. |
| 204 | if (system.IsPaused() || system.IsShuttingDown()) { | 204 | if (system.IsPaused() || system.IsShuttingDown()) { |
| 205 | constexpr std::array<s16, 6> silence{}; | 205 | constexpr static std::array<s16, 6> silence{}; |
| 206 | for (size_t i = frames_written; i < num_frames; i++) { | 206 | for (size_t i = frames_written; i < num_frames; i++) { |
| 207 | std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes); | 207 | std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes); |
| 208 | } | 208 | } |
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index f899b0d54..29b80c328 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h | |||
| @@ -107,7 +107,7 @@ constexpr FixedPoint<I, F> divide( | |||
| 107 | 107 | ||
| 108 | using next_type = typename FixedPoint<I, F>::next_type; | 108 | using next_type = typename FixedPoint<I, F>::next_type; |
| 109 | using base_type = typename FixedPoint<I, F>::base_type; | 109 | using base_type = typename FixedPoint<I, F>::base_type; |
| 110 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 110 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 111 | 111 | ||
| 112 | next_type t(numerator.to_raw()); | 112 | next_type t(numerator.to_raw()); |
| 113 | t <<= fractional_bits; | 113 | t <<= fractional_bits; |
| @@ -127,7 +127,7 @@ constexpr FixedPoint<I, F> divide( | |||
| 127 | 127 | ||
| 128 | using unsigned_type = typename FixedPoint<I, F>::unsigned_type; | 128 | using unsigned_type = typename FixedPoint<I, F>::unsigned_type; |
| 129 | 129 | ||
| 130 | constexpr int bits = FixedPoint<I, F>::total_bits; | 130 | constexpr static int bits = FixedPoint<I, F>::total_bits; |
| 131 | 131 | ||
| 132 | if (denominator == 0) { | 132 | if (denominator == 0) { |
| 133 | throw divide_by_zero(); | 133 | throw divide_by_zero(); |
| @@ -198,7 +198,7 @@ constexpr FixedPoint<I, F> multiply( | |||
| 198 | using next_type = typename FixedPoint<I, F>::next_type; | 198 | using next_type = typename FixedPoint<I, F>::next_type; |
| 199 | using base_type = typename FixedPoint<I, F>::base_type; | 199 | using base_type = typename FixedPoint<I, F>::base_type; |
| 200 | 200 | ||
| 201 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 201 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 202 | 202 | ||
| 203 | next_type t(static_cast<next_type>(lhs.to_raw()) * static_cast<next_type>(rhs.to_raw())); | 203 | next_type t(static_cast<next_type>(lhs.to_raw()) * static_cast<next_type>(rhs.to_raw())); |
| 204 | t >>= fractional_bits; | 204 | t >>= fractional_bits; |
| @@ -216,9 +216,9 @@ constexpr FixedPoint<I, F> multiply( | |||
| 216 | 216 | ||
| 217 | using base_type = typename FixedPoint<I, F>::base_type; | 217 | using base_type = typename FixedPoint<I, F>::base_type; |
| 218 | 218 | ||
| 219 | constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits; | 219 | constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits; |
| 220 | constexpr base_type integer_mask = FixedPoint<I, F>::integer_mask; | 220 | constexpr static base_type integer_mask = FixedPoint<I, F>::integer_mask; |
| 221 | constexpr base_type fractional_mask = FixedPoint<I, F>::fractional_mask; | 221 | constexpr static base_type fractional_mask = FixedPoint<I, F>::fractional_mask; |
| 222 | 222 | ||
| 223 | // more costly but doesn't need a larger type | 223 | // more costly but doesn't need a larger type |
| 224 | const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits; | 224 | const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits; |
diff --git a/src/common/hex_util.h b/src/common/hex_util.h index a00904939..6b024588b 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h | |||
| @@ -47,7 +47,7 @@ template <typename ContiguousContainer> | |||
| 47 | static_assert(std::is_same_v<typename ContiguousContainer::value_type, u8>, | 47 | static_assert(std::is_same_v<typename ContiguousContainer::value_type, u8>, |
| 48 | "Underlying type within the contiguous container must be u8."); | 48 | "Underlying type within the contiguous container must be u8."); |
| 49 | 49 | ||
| 50 | constexpr std::size_t pad_width = 2; | 50 | constexpr static std::size_t pad_width = 2; |
| 51 | 51 | ||
| 52 | std::string out; | 52 | std::string out; |
| 53 | out.reserve(std::size(data) * pad_width); | 53 | out.reserve(std::size(data) * pad_width); |
diff --git a/src/common/tiny_mt.h b/src/common/tiny_mt.h index 5d5ebf158..4689fd55b 100644 --- a/src/common/tiny_mt.h +++ b/src/common/tiny_mt.h | |||
| @@ -223,7 +223,7 @@ public: | |||
| 223 | 223 | ||
| 224 | float GenerateRandomF32() { | 224 | float GenerateRandomF32() { |
| 225 | // Floats have 24 bits of mantissa. | 225 | // Floats have 24 bits of mantissa. |
| 226 | constexpr u32 MantissaBits = 24; | 226 | constexpr static u32 MantissaBits = 24; |
| 227 | return static_cast<float>(GenerateRandomU24()) * (1.0f / (1U << MantissaBits)); | 227 | return static_cast<float>(GenerateRandomU24()) * (1.0f / (1U << MantissaBits)); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| @@ -234,9 +234,9 @@ public: | |||
| 234 | // Nintendo does not. They use (32 - 5) = 27 bits from the first rnd32() | 234 | // Nintendo does not. They use (32 - 5) = 27 bits from the first rnd32() |
| 235 | // call, and (32 - 6) bits from the second. We'll do what they do, but | 235 | // call, and (32 - 6) bits from the second. We'll do what they do, but |
| 236 | // There's not a clear reason why. | 236 | // There's not a clear reason why. |
| 237 | constexpr u32 MantissaBits = 53; | 237 | constexpr static u32 MantissaBits = 53; |
| 238 | constexpr u32 Shift1st = (64 - MantissaBits) / 2; | 238 | constexpr static u32 Shift1st = (64 - MantissaBits) / 2; |
| 239 | constexpr u32 Shift2nd = (64 - MantissaBits) - Shift1st; | 239 | constexpr static u32 Shift2nd = (64 - MantissaBits) - Shift1st; |
| 240 | 240 | ||
| 241 | const u32 first = (this->GenerateRandomU32() >> Shift1st); | 241 | const u32 first = (this->GenerateRandomU32() >> Shift1st); |
| 242 | const u32 second = (this->GenerateRandomU32() >> Shift2nd); | 242 | const u32 second = (this->GenerateRandomU32() >> Shift2nd); |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 47292cd78..7ba13ab51 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -361,7 +361,7 @@ struct System::Impl { | |||
| 361 | // Log last frame performance stats if game was loded | 361 | // Log last frame performance stats if game was loded |
| 362 | if (perf_stats) { | 362 | if (perf_stats) { |
| 363 | const auto perf_results = GetAndResetPerfStats(); | 363 | const auto perf_results = GetAndResetPerfStats(); |
| 364 | constexpr auto performance = Common::Telemetry::FieldType::Performance; | 364 | constexpr static auto performance = Common::Telemetry::FieldType::Performance; |
| 365 | 365 | ||
| 366 | telemetry_session->AddField(performance, "Shutdown_EmulationSpeed", | 366 | telemetry_session->AddField(performance, "Shutdown_EmulationSpeed", |
| 367 | perf_results.emulation_speed * 100.0); | 367 | perf_results.emulation_speed * 100.0); |
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 6bac6722f..5214e88b8 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() { | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void CoreTiming::ThreadEntry(CoreTiming& instance) { | 47 | void CoreTiming::ThreadEntry(CoreTiming& instance) { |
| 48 | constexpr char name[] = "HostTiming"; | 48 | constexpr static char name[] = "HostTiming"; |
| 49 | MicroProfileOnThreadCreate(name); | 49 | MicroProfileOnThreadCreate(name); |
| 50 | Common::SetCurrentThreadName(name); | 50 | Common::SetCurrentThreadName(name); |
| 51 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); | 51 | Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); |
diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index 4bef09bd7..b13c473bb 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp | |||
| @@ -42,7 +42,7 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const | |||
| 42 | // For sample XML files see the GDB source /gdb/features | 42 | // For sample XML files see the GDB source /gdb/features |
| 43 | // This XML defines what the registers are for this specific ARM device | 43 | // This XML defines what the registers are for this specific ARM device |
| 44 | std::string GDBStubA64::GetTargetXML() const { | 44 | std::string GDBStubA64::GetTargetXML() const { |
| 45 | constexpr const char* target_xml = | 45 | constexpr static const char* target_xml = |
| 46 | R"(<?xml version="1.0"?> | 46 | R"(<?xml version="1.0"?> |
| 47 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> | 47 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> |
| 48 | <target version="1.0"> | 48 | <target version="1.0"> |
| @@ -271,7 +271,7 @@ u32 GDBStubA64::BreakpointInstruction() const { | |||
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | std::string GDBStubA32::GetTargetXML() const { | 273 | std::string GDBStubA32::GetTargetXML() const { |
| 274 | constexpr const char* target_xml = | 274 | constexpr static const char* target_xml = |
| 275 | R"(<?xml version="1.0"?> | 275 | R"(<?xml version="1.0"?> |
| 276 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> | 276 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> |
| 277 | <target version="1.0"> | 277 | <target version="1.0"> |
diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp index 5aab428bb..0a86e8b0a 100644 --- a/src/core/file_sys/ips_layer.cpp +++ b/src/core/file_sys/ips_layer.cpp | |||
| @@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) { | |||
| 41 | return IPSFileType::Error; | 41 | return IPSFileType::Error; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}}; | 44 | constexpr static std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}}; |
| 45 | if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) { | 45 | if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) { |
| 46 | return IPSFileType::IPS; | 46 | return IPSFileType::IPS; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}}; | 49 | constexpr static std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}}; |
| 50 | if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) { | 50 | if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) { |
| 51 | return IPSFileType::IPS32; | 51 | return IPSFileType::IPS32; |
| 52 | } | 52 | } |
| @@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) { | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static bool IsEOF(IPSFileType type, const std::vector<u8>& data) { | 57 | static bool IsEOF(IPSFileType type, const std::vector<u8>& data) { |
| 58 | constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}}; | 58 | constexpr static std::array<u8, 3> eof{{'E', 'O', 'F'}}; |
| 59 | if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) { | 59 | if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) { |
| 60 | return true; | 60 | return true; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}}; | 63 | constexpr static std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}}; |
| 64 | return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin()); | 64 | return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin()); |
| 65 | } | 65 | } |
| 66 | 66 | ||
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index f00479bd3..cb172f574 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -97,7 +97,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { | |||
| 97 | 97 | ||
| 98 | /*static*/ ProgramMetadata ProgramMetadata::GetDefault() { | 98 | /*static*/ ProgramMetadata ProgramMetadata::GetDefault() { |
| 99 | // Allow use of cores 0~3 and thread priorities 1~63. | 99 | // Allow use of cores 0~3 and thread priorities 1~63. |
| 100 | constexpr u32 default_thread_info_capability = 0x30007F7; | 100 | constexpr static u32 default_thread_info_capability = 0x30007F7; |
| 101 | 101 | ||
| 102 | ProgramMetadata result; | 102 | ProgramMetadata result; |
| 103 | 103 | ||
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 878d832c2..0f1f76949 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static std::string GetCNMTName(TitleType type, u64 title_id) { | 73 | static std::string GetCNMTName(TitleType type, u64 title_id) { |
| 74 | constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{ | 74 | constexpr static std::array<const char*, 9> TITLE_TYPE_NAMES{ |
| 75 | "SystemProgram", | 75 | "SystemProgram", |
| 76 | "SystemData", | 76 | "SystemData", |
| 77 | "SystemUpdate", | 77 | "SystemUpdate", |
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 836f32c0f..e380da3a4 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -213,7 +213,7 @@ void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& cal | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) { | 215 | void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) { |
| 216 | constexpr std::size_t KEYS_PER_BYTE = 8; | 216 | constexpr static std::size_t KEYS_PER_BYTE = 8; |
| 217 | auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE]; | 217 | auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE]; |
| 218 | const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE)); | 218 | const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE)); |
| 219 | if (status) { | 219 | if (status) { |
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index c10b7bf30..49098d2c9 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp | |||
| @@ -114,13 +114,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() { | |||
| 114 | }(); | 114 | }(); |
| 115 | 115 | ||
| 116 | // Return (possibly) adjusted size. | 116 | // Return (possibly) adjusted size. |
| 117 | constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB; | 117 | constexpr static size_t ExtraSystemMemoryForAtmosphere = 33_MiB; |
| 118 | return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; | 118 | return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() { | 121 | size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() { |
| 122 | // Verify that our minimum is at least as large as Nintendo's. | 122 | // Verify that our minimum is at least as large as Nintendo's. |
| 123 | constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize; | 123 | constexpr static size_t MinimumSize = RequiredNonSecureSystemMemorySize; |
| 124 | static_assert(MinimumSize >= 0x29C8000); | 124 | static_assert(MinimumSize >= 0x29C8000); |
| 125 | 125 | ||
| 126 | return MinimumSize; | 126 | return MinimumSize; |
diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index 571acf4b2..951326a85 100644 --- a/src/core/hle/kernel/init/init_slab_setup.cpp +++ b/src/core/hle/kernel/init/init_slab_setup.cpp | |||
| @@ -129,7 +129,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | size_t CalculateSlabHeapGapSize() { | 131 | size_t CalculateSlabHeapGapSize() { |
| 132 | constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; | 132 | constexpr static size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; |
| 133 | static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax); | 133 | static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax); |
| 134 | return KernelSlabHeapGapSize; | 134 | return KernelSlabHeapGapSize; |
| 135 | } | 135 | } |
| @@ -272,7 +272,7 @@ void KPageBufferSlabHeap::Initialize(Core::System& system) { | |||
| 272 | kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size)); | 272 | kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size)); |
| 273 | 273 | ||
| 274 | // Allocate memory for the slab. | 274 | // Allocate memory for the slab. |
| 275 | constexpr auto AllocateOption = KMemoryManager::EncodeOption( | 275 | constexpr static auto AllocateOption = KMemoryManager::EncodeOption( |
| 276 | KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront); | 276 | KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront); |
| 277 | const PAddr slab_address = | 277 | const PAddr slab_address = |
| 278 | kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption); | 278 | kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption); |
diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 2907cc6e3..374bc2c06 100644 --- a/src/core/hle/kernel/k_capabilities.cpp +++ b/src/core/hle/kernel/k_capabilities.cpp | |||
| @@ -21,8 +21,8 @@ Result KCapabilities::InitializeForKIP(std::span<const u32> kern_caps, KPageTabl | |||
| 21 | m_program_type = 0; | 21 | m_program_type = 0; |
| 22 | 22 | ||
| 23 | // Initial processes may run on all cores. | 23 | // Initial processes may run on all cores. |
| 24 | constexpr u64 VirtMask = Core::Hardware::VirtualCoreMask; | 24 | constexpr static u64 VirtMask = Core::Hardware::VirtualCoreMask; |
| 25 | constexpr u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); | 25 | constexpr static u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); |
| 26 | 26 | ||
| 27 | m_core_mask = VirtMask; | 27 | m_core_mask = VirtMask; |
| 28 | m_phys_core_mask = PhysMask; | 28 | m_phys_core_mask = PhysMask; |
| @@ -170,7 +170,7 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) { | |||
| 170 | template <typename F> | 170 | template <typename F> |
| 171 | Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) { | 171 | Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) { |
| 172 | // Define the allowed memory regions. | 172 | // Define the allowed memory regions. |
| 173 | constexpr std::array<KMemoryRegionType, 4> MemoryRegions{ | 173 | constexpr static std::array<KMemoryRegionType, 4> MemoryRegions{ |
| 174 | KMemoryRegionType_None, | 174 | KMemoryRegionType_None, |
| 175 | KMemoryRegionType_KernelTraceBuffer, | 175 | KMemoryRegionType_KernelTraceBuffer, |
| 176 | KMemoryRegionType_OnMemoryBootImage, | 176 | KMemoryRegionType_OnMemoryBootImage, |
diff --git a/src/core/hle/kernel/k_memory_manager.h b/src/core/hle/kernel/k_memory_manager.h index 401d4e644..d13549b5e 100644 --- a/src/core/hle/kernel/k_memory_manager.h +++ b/src/core/hle/kernel/k_memory_manager.h | |||
| @@ -121,7 +121,7 @@ public: | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | size_t GetSize(Pool pool) { | 123 | size_t GetSize(Pool pool) { |
| 124 | constexpr Direction GetSizeDirection = Direction::FromFront; | 124 | constexpr static Direction GetSizeDirection = Direction::FromFront; |
| 125 | size_t total = 0; | 125 | size_t total = 0; |
| 126 | for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; | 126 | for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; |
| 127 | manager = this->GetNextManager(manager, GetSizeDirection)) { | 127 | manager = this->GetNextManager(manager, GetSizeDirection)) { |
| @@ -142,7 +142,7 @@ public: | |||
| 142 | size_t GetFreeSize(Pool pool) { | 142 | size_t GetFreeSize(Pool pool) { |
| 143 | KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); | 143 | KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); |
| 144 | 144 | ||
| 145 | constexpr Direction GetSizeDirection = Direction::FromFront; | 145 | constexpr static Direction GetSizeDirection = Direction::FromFront; |
| 146 | size_t total = 0; | 146 | size_t total = 0; |
| 147 | for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; | 147 | for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; |
| 148 | manager = this->GetNextManager(manager, GetSizeDirection)) { | 148 | manager = this->GetNextManager(manager, GetSizeDirection)) { |
| @@ -154,7 +154,7 @@ public: | |||
| 154 | void DumpFreeList(Pool pool) { | 154 | void DumpFreeList(Pool pool) { |
| 155 | KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); | 155 | KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]); |
| 156 | 156 | ||
| 157 | constexpr Direction DumpDirection = Direction::FromFront; | 157 | constexpr static Direction DumpDirection = Direction::FromFront; |
| 158 | for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr; | 158 | for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr; |
| 159 | manager = this->GetNextManager(manager, DumpDirection)) { | 159 | manager = this->GetNextManager(manager, DumpDirection)) { |
| 160 | manager->DumpFreeList(); | 160 | manager->DumpFreeList(); |
diff --git a/src/core/hle/kernel/k_page_heap.cpp b/src/core/hle/kernel/k_page_heap.cpp index 7b02c7d8b..ffebf0a35 100644 --- a/src/core/hle/kernel/k_page_heap.cpp +++ b/src/core/hle/kernel/k_page_heap.cpp | |||
| @@ -68,7 +68,7 @@ PAddr KPageHeap::AllocateByRandom(s32 index, size_t num_pages, size_t align_page | |||
| 68 | const size_t align_shift = std::countr_zero(align_size); | 68 | const size_t align_shift = std::countr_zero(align_size); |
| 69 | 69 | ||
| 70 | // Decide on a block to allocate from. | 70 | // Decide on a block to allocate from. |
| 71 | constexpr size_t MinimumPossibleAlignmentsForRandomAllocation = 4; | 71 | constexpr static size_t MinimumPossibleAlignmentsForRandomAllocation = 4; |
| 72 | { | 72 | { |
| 73 | // By default, we'll want to look at all blocks larger than our current one. | 73 | // By default, we'll want to look at all blocks larger than our current one. |
| 74 | s32 max_blocks = static_cast<s32>(m_num_blocks); | 74 | s32 max_blocks = static_cast<s32>(m_num_blocks); |
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 2e13d5d0d..d3e0334ed 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp | |||
| @@ -134,7 +134,7 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type | |||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | // Set code regions and determine remaining | 136 | // Set code regions and determine remaining |
| 137 | constexpr size_t RegionAlignment{2_MiB}; | 137 | constexpr static size_t RegionAlignment{2_MiB}; |
| 138 | VAddr process_code_start{}; | 138 | VAddr process_code_start{}; |
| 139 | VAddr process_code_end{}; | 139 | VAddr process_code_end{}; |
| 140 | size_t stack_region_size{}; | 140 | size_t stack_region_size{}; |
| @@ -2624,7 +2624,7 @@ Result KPageTable::SetMemoryAttribute(VAddr addr, size_t size, u32 mask, u32 att | |||
| 2624 | KMemoryPermission old_perm; | 2624 | KMemoryPermission old_perm; |
| 2625 | KMemoryAttribute old_attr; | 2625 | KMemoryAttribute old_attr; |
| 2626 | size_t num_allocator_blocks; | 2626 | size_t num_allocator_blocks; |
| 2627 | constexpr auto AttributeTestMask = | 2627 | constexpr static auto AttributeTestMask = |
| 2628 | ~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared); | 2628 | ~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared); |
| 2629 | R_TRY(this->CheckMemoryState( | 2629 | R_TRY(this->CheckMemoryState( |
| 2630 | std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr), | 2630 | std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr), |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 5b72eaaa1..563e2681b 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -254,7 +254,7 @@ struct KernelCore::Impl { | |||
| 254 | system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size); | 254 | system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size); |
| 255 | 255 | ||
| 256 | // Reserve secure applet memory, introduced in firmware 5.0.0 | 256 | // Reserve secure applet memory, introduced in firmware 5.0.0 |
| 257 | constexpr u64 secure_applet_memory_size{4_MiB}; | 257 | constexpr static u64 secure_applet_memory_size{4_MiB}; |
| 258 | ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, | 258 | ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, |
| 259 | secure_applet_memory_size)); | 259 | secure_applet_memory_size)); |
| 260 | } | 260 | } |
| @@ -477,9 +477,9 @@ struct KernelCore::Impl { | |||
| 477 | const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd; | 477 | const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd; |
| 478 | 478 | ||
| 479 | // Setup the containing kernel region. | 479 | // Setup the containing kernel region. |
| 480 | constexpr size_t KernelRegionSize = 1_GiB; | 480 | constexpr static size_t KernelRegionSize = 1_GiB; |
| 481 | constexpr size_t KernelRegionAlign = 1_GiB; | 481 | constexpr static size_t KernelRegionAlign = 1_GiB; |
| 482 | constexpr VAddr kernel_region_start = | 482 | constexpr static VAddr kernel_region_start = |
| 483 | Common::AlignDown(code_start_virt_addr, KernelRegionAlign); | 483 | Common::AlignDown(code_start_virt_addr, KernelRegionAlign); |
| 484 | size_t kernel_region_size = KernelRegionSize; | 484 | size_t kernel_region_size = KernelRegionSize; |
| 485 | if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) { | 485 | if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) { |
| @@ -489,11 +489,11 @@ struct KernelCore::Impl { | |||
| 489 | kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel)); | 489 | kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel)); |
| 490 | 490 | ||
| 491 | // Setup the code region. | 491 | // Setup the code region. |
| 492 | constexpr size_t CodeRegionAlign = PageSize; | 492 | constexpr static size_t CodeRegionAlign = PageSize; |
| 493 | constexpr VAddr code_region_start = | 493 | constexpr static VAddr code_region_start = |
| 494 | Common::AlignDown(code_start_virt_addr, CodeRegionAlign); | 494 | Common::AlignDown(code_start_virt_addr, CodeRegionAlign); |
| 495 | constexpr VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign); | 495 | constexpr static VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign); |
| 496 | constexpr size_t code_region_size = code_region_end - code_region_start; | 496 | constexpr static size_t code_region_size = code_region_end - code_region_start; |
| 497 | ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert( | 497 | ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert( |
| 498 | code_region_start, code_region_size, KMemoryRegionType_KernelCode)); | 498 | code_region_start, code_region_size, KMemoryRegionType_KernelCode)); |
| 499 | 499 | ||
| @@ -524,8 +524,8 @@ struct KernelCore::Impl { | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | // Decide on the actual size for the misc region. | 526 | // Decide on the actual size for the misc region. |
| 527 | constexpr size_t MiscRegionAlign = KernelAslrAlignment; | 527 | constexpr static size_t MiscRegionAlign = KernelAslrAlignment; |
| 528 | constexpr size_t MiscRegionMinimumSize = 32_MiB; | 528 | constexpr static size_t MiscRegionMinimumSize = 32_MiB; |
| 529 | const size_t misc_region_size = Common::AlignUp( | 529 | const size_t misc_region_size = Common::AlignUp( |
| 530 | std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign); | 530 | std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign); |
| 531 | ASSERT(misc_region_size > 0); | 531 | ASSERT(misc_region_size > 0); |
| @@ -541,8 +541,8 @@ struct KernelCore::Impl { | |||
| 541 | const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit(); | 541 | const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit(); |
| 542 | 542 | ||
| 543 | // Setup the stack region. | 543 | // Setup the stack region. |
| 544 | constexpr size_t StackRegionSize = 14_MiB; | 544 | constexpr static size_t StackRegionSize = 14_MiB; |
| 545 | constexpr size_t StackRegionAlign = KernelAslrAlignment; | 545 | constexpr static size_t StackRegionAlign = KernelAslrAlignment; |
| 546 | const VAddr stack_region_start = | 546 | const VAddr stack_region_start = |
| 547 | memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( | 547 | memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( |
| 548 | StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel); | 548 | StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel); |
| @@ -563,7 +563,7 @@ struct KernelCore::Impl { | |||
| 563 | const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size; | 563 | const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size; |
| 564 | const PAddr slab_start_phys_addr = code_end_phys_addr; | 564 | const PAddr slab_start_phys_addr = code_end_phys_addr; |
| 565 | const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size; | 565 | const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size; |
| 566 | constexpr size_t SlabRegionAlign = KernelAslrAlignment; | 566 | constexpr static size_t SlabRegionAlign = KernelAslrAlignment; |
| 567 | const size_t slab_region_needed_size = | 567 | const size_t slab_region_needed_size = |
| 568 | Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) - | 568 | Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) - |
| 569 | Common::AlignDown(code_end_phys_addr, SlabRegionAlign); | 569 | Common::AlignDown(code_end_phys_addr, SlabRegionAlign); |
| @@ -575,8 +575,8 @@ struct KernelCore::Impl { | |||
| 575 | slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab)); | 575 | slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab)); |
| 576 | 576 | ||
| 577 | // Setup the temp region. | 577 | // Setup the temp region. |
| 578 | constexpr size_t TempRegionSize = 128_MiB; | 578 | constexpr static size_t TempRegionSize = 128_MiB; |
| 579 | constexpr size_t TempRegionAlign = KernelAslrAlignment; | 579 | constexpr static size_t TempRegionAlign = KernelAslrAlignment; |
| 580 | const VAddr temp_region_start = | 580 | const VAddr temp_region_start = |
| 581 | memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( | 581 | memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( |
| 582 | TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel); | 582 | TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel); |
| @@ -656,7 +656,7 @@ struct KernelCore::Impl { | |||
| 656 | ASSERT(linear_extents.GetEndAddress() != 0); | 656 | ASSERT(linear_extents.GetEndAddress() != 0); |
| 657 | 657 | ||
| 658 | // Setup the linear mapping region. | 658 | // Setup the linear mapping region. |
| 659 | constexpr size_t LinearRegionAlign = 1_GiB; | 659 | constexpr static size_t LinearRegionAlign = 1_GiB; |
| 660 | const PAddr aligned_linear_phys_start = | 660 | const PAddr aligned_linear_phys_start = |
| 661 | Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign); | 661 | Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign); |
| 662 | const size_t linear_region_size = | 662 | const size_t linear_region_size = |
| @@ -737,11 +737,11 @@ struct KernelCore::Impl { | |||
| 737 | void InitializeHackSharedMemory() { | 737 | void InitializeHackSharedMemory() { |
| 738 | // Setup memory regions for emulated processes | 738 | // Setup memory regions for emulated processes |
| 739 | // TODO(bunnei): These should not be hardcoded regions initialized within the kernel | 739 | // TODO(bunnei): These should not be hardcoded regions initialized within the kernel |
| 740 | constexpr std::size_t hid_size{0x40000}; | 740 | constexpr static std::size_t hid_size{0x40000}; |
| 741 | constexpr std::size_t font_size{0x1100000}; | 741 | constexpr static std::size_t font_size{0x1100000}; |
| 742 | constexpr std::size_t irs_size{0x8000}; | 742 | constexpr static std::size_t irs_size{0x8000}; |
| 743 | constexpr std::size_t time_size{0x1000}; | 743 | constexpr static std::size_t time_size{0x1000}; |
| 744 | constexpr std::size_t hidbus_size{0x1000}; | 744 | constexpr static std::size_t hidbus_size{0x1000}; |
| 745 | 745 | ||
| 746 | hid_shared_mem = KSharedMemory::Create(system.Kernel()); | 746 | hid_shared_mem = KSharedMemory::Create(system.Kernel()); |
| 747 | font_shared_mem = KSharedMemory::Create(system.Kernel()); | 747 | font_shared_mem = KSharedMemory::Create(system.Kernel()); |
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 773319ad8..de322cbf9 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp | |||
| @@ -306,7 +306,7 @@ Result ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_tab | |||
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | Result ProcessCapabilities::HandleInterruptFlags(u32 flags) { | 308 | Result ProcessCapabilities::HandleInterruptFlags(u32 flags) { |
| 309 | constexpr u32 interrupt_ignore_value = 0x3FF; | 309 | constexpr static u32 interrupt_ignore_value = 0x3FF; |
| 310 | const u32 interrupt0 = (flags >> 12) & 0x3FF; | 310 | const u32 interrupt0 = (flags >> 12) & 0x3FF; |
| 311 | const u32 interrupt1 = (flags >> 22) & 0x3FF; | 311 | const u32 interrupt1 = (flags >> 22) & 0x3FF; |
| 312 | 312 | ||
diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp index 1dcdb7a15..0fd1b3d4c 100644 --- a/src/core/hle/kernel/svc/svc_activity.cpp +++ b/src/core/hle/kernel/svc/svc_activity.cpp | |||
| @@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle, | |||
| 16 | thread_activity); | 16 | thread_activity); |
| 17 | 17 | ||
| 18 | // Validate the activity. | 18 | // Validate the activity. |
| 19 | constexpr auto IsValidThreadActivity = [](ThreadActivity activity) { | 19 | constexpr static auto IsValidThreadActivity = [](ThreadActivity activity) { |
| 20 | return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused; | 20 | return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused; |
| 21 | }; | 21 | }; |
| 22 | R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue); | 22 | R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue); |
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index ad56e2fe6..c30ba0295 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp | |||
| @@ -193,7 +193,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle | |||
| 193 | return ResultSuccess; | 193 | return ResultSuccess; |
| 194 | 194 | ||
| 195 | case InfoType::ThreadTickCount: { | 195 | case InfoType::ThreadTickCount: { |
| 196 | constexpr u64 num_cpus = 4; | 196 | constexpr static u64 num_cpus = 4; |
| 197 | if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { | 197 | if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { |
| 198 | LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus, | 198 | LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus, |
| 199 | info_sub_id); | 199 | info_sub_id); |
diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 21f818da6..7045c5e69 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp | |||
| @@ -132,7 +132,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas | |||
| 132 | R_UNLESS((address < address + size), ResultInvalidCurrentMemory); | 132 | R_UNLESS((address < address + size), ResultInvalidCurrentMemory); |
| 133 | 133 | ||
| 134 | // Validate the attribute and mask. | 134 | // Validate the attribute and mask. |
| 135 | constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); | 135 | constexpr static u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); |
| 136 | R_UNLESS((mask | attr) == mask, ResultInvalidCombination); | 136 | R_UNLESS((mask | attr) == mask, ResultInvalidCombination); |
| 137 | R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); | 137 | R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); |
| 138 | 138 | ||
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6d1084fd1..5b87bb18c 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -871,7 +871,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont | |||
| 871 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable | 871 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable |
| 872 | // way of confirming things like the TID, we're going to assume a non zero value for the time | 872 | // way of confirming things like the TID, we're going to assume a non zero value for the time |
| 873 | // being. | 873 | // being. |
| 874 | constexpr u64 tid{1}; | 874 | constexpr static u64 tid{1}; |
| 875 | StoreSaveDataThumbnail(ctx, uuid, tid); | 875 | StoreSaveDataThumbnail(ctx, uuid, tid); |
| 876 | } | 876 | } |
| 877 | 877 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index ebcf6e164..01f03effe 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1086,7 +1086,7 @@ private: | |||
| 1086 | 1086 | ||
| 1087 | // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is | 1087 | // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is |
| 1088 | // actually used anywhere | 1088 | // actually used anywhere |
| 1089 | constexpr u64 handle = 0xdeadbeef; | 1089 | constexpr static u64 handle = 0xdeadbeef; |
| 1090 | 1090 | ||
| 1091 | IPC::ResponseBuilder rb{ctx, 4}; | 1091 | IPC::ResponseBuilder rb{ctx, 4}; |
| 1092 | rb.Push(ResultSuccess); | 1092 | rb.Push(ResultSuccess); |
| @@ -1570,7 +1570,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { | |||
| 1570 | const auto& version = res.first->GetVersionString(); | 1570 | const auto& version = res.first->GetVersionString(); |
| 1571 | std::copy(version.begin(), version.end(), version_string.begin()); | 1571 | std::copy(version.begin(), version.end(), version_string.begin()); |
| 1572 | } else { | 1572 | } else { |
| 1573 | constexpr char default_version[]{"1.0.0"}; | 1573 | constexpr static char default_version[]{"1.0.0"}; |
| 1574 | std::memcpy(version_string.data(), default_version, sizeof(default_version)); | 1574 | std::memcpy(version_string.data(), default_version, sizeof(default_version)); |
| 1575 | } | 1575 | } |
| 1576 | 1576 | ||
| @@ -1638,7 +1638,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { | |||
| 1638 | void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { | 1638 | void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { |
| 1639 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1639 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 1640 | 1640 | ||
| 1641 | constexpr bool gameplay_recording_supported = false; | 1641 | constexpr static bool gameplay_recording_supported = false; |
| 1642 | 1642 | ||
| 1643 | IPC::ResponseBuilder rb{ctx, 3}; | 1643 | IPC::ResponseBuilder rb{ctx, 3}; |
| 1644 | rb.Push(ResultSuccess); | 1644 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp index c18236045..962371a99 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp +++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp | |||
| @@ -1180,7 +1180,7 @@ void SoftwareKeyboard::ReplyChangedStringV2() { | |||
| 1180 | .cursor_position{current_cursor_position}, | 1180 | .cursor_position{current_cursor_position}, |
| 1181 | }; | 1181 | }; |
| 1182 | 1182 | ||
| 1183 | constexpr u8 flag = 0; | 1183 | constexpr static u8 flag = 0; |
| 1184 | 1184 | ||
| 1185 | std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), | 1185 | std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), |
| 1186 | current_text.size() * sizeof(char16_t)); | 1186 | current_text.size() * sizeof(char16_t)); |
| @@ -1204,7 +1204,7 @@ void SoftwareKeyboard::ReplyMovedCursorV2() { | |||
| 1204 | .cursor_position{current_cursor_position}, | 1204 | .cursor_position{current_cursor_position}, |
| 1205 | }; | 1205 | }; |
| 1206 | 1206 | ||
| 1207 | constexpr u8 flag = 0; | 1207 | constexpr static u8 flag = 0; |
| 1208 | 1208 | ||
| 1209 | std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), | 1209 | std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), |
| 1210 | current_text.size() * sizeof(char16_t)); | 1210 | current_text.size() * sizeof(char16_t)); |
| @@ -1232,7 +1232,7 @@ void SoftwareKeyboard::ReplyChangedStringUtf8V2() { | |||
| 1232 | .cursor_position{current_cursor_position}, | 1232 | .cursor_position{current_cursor_position}, |
| 1233 | }; | 1233 | }; |
| 1234 | 1234 | ||
| 1235 | constexpr u8 flag = 0; | 1235 | constexpr static u8 flag = 0; |
| 1236 | 1236 | ||
| 1237 | std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); | 1237 | std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); |
| 1238 | std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &changed_string_arg, | 1238 | std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &changed_string_arg, |
| @@ -1257,7 +1257,7 @@ void SoftwareKeyboard::ReplyMovedCursorUtf8V2() { | |||
| 1257 | .cursor_position{current_cursor_position}, | 1257 | .cursor_position{current_cursor_position}, |
| 1258 | }; | 1258 | }; |
| 1259 | 1259 | ||
| 1260 | constexpr u8 flag = 0; | 1260 | constexpr static u8 flag = 0; |
| 1261 | 1261 | ||
| 1262 | std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); | 1262 | std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); |
| 1263 | std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &moved_cursor_arg, | 1263 | std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &moved_cursor_arg, |
diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp index d6de84066..7236f586d 100644 --- a/src/core/hle/service/apm/apm_controller.cpp +++ b/src/core/hle/service/apm/apm_controller.cpp | |||
| @@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode, | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { | 58 | void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { |
| 59 | constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{ | 59 | constexpr static std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{ |
| 60 | PerformanceConfiguration::Config7, | 60 | PerformanceConfiguration::Config7, |
| 61 | PerformanceConfiguration::Config13, | 61 | PerformanceConfiguration::Config13, |
| 62 | PerformanceConfiguration::Config15, | 62 | PerformanceConfiguration::Config15, |
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 5abf22ba4..654d2c493 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp | |||
| @@ -77,7 +77,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) { | |||
| 77 | 77 | ||
| 78 | // This service function is currently hardcoded on the | 78 | // This service function is currently hardcoded on the |
| 79 | // actual console to this value (as of 8.0.0). | 79 | // actual console to this value (as of 8.0.0). |
| 80 | constexpr s32 target_min_volume = 0; | 80 | constexpr static s32 target_min_volume = 0; |
| 81 | 81 | ||
| 82 | IPC::ResponseBuilder rb{ctx, 3}; | 82 | IPC::ResponseBuilder rb{ctx, 3}; |
| 83 | rb.Push(ResultSuccess); | 83 | rb.Push(ResultSuccess); |
| @@ -89,7 +89,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) { | |||
| 89 | 89 | ||
| 90 | // This service function is currently hardcoded on the | 90 | // This service function is currently hardcoded on the |
| 91 | // actual console to this value (as of 8.0.0). | 91 | // actual console to this value (as of 8.0.0). |
| 92 | constexpr s32 target_max_volume = 15; | 92 | constexpr static s32 target_max_volume = 15; |
| 93 | 93 | ||
| 94 | IPC::ResponseBuilder rb{ctx, 3}; | 94 | IPC::ResponseBuilder rb{ctx, 3}; |
| 95 | rb.Push(ResultSuccess); | 95 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index e01f87356..fe975157c 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -209,7 +209,7 @@ private: | |||
| 209 | 209 | ||
| 210 | std::size_t WorkerBufferSize(u32 channel_count) { | 210 | std::size_t WorkerBufferSize(u32 channel_count) { |
| 211 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); | 211 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); |
| 212 | constexpr int num_streams = 1; | 212 | constexpr static int num_streams = 1; |
| 213 | const int num_stereo_streams = channel_count == 2 ? 1 : 0; | 213 | const int num_stereo_streams = channel_count == 2 ? 1 : 0; |
| 214 | return opus_multistream_decoder_get_size(num_streams, num_stereo_streams); | 214 | return opus_multistream_decoder_get_size(num_streams, num_stereo_streams); |
| 215 | } | 215 | } |
diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index 5fbba8673..1c2694645 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp | |||
| @@ -77,8 +77,8 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c | |||
| 77 | 77 | ||
| 78 | // TODO: Update this when we implement the album. | 78 | // TODO: Update this when we implement the album. |
| 79 | // Currently we do not have a method of accessing album entries, set this to 0 for now. | 79 | // Currently we do not have a method of accessing album entries, set this to 0 for now. |
| 80 | constexpr u32 total_entries_1{}; | 80 | constexpr static u32 total_entries_1{}; |
| 81 | constexpr u32 total_entries_2{}; | 81 | constexpr static u32 total_entries_2{}; |
| 82 | 82 | ||
| 83 | LOG_WARNING( | 83 | LOG_WARNING( |
| 84 | Service_Capture, | 84 | Service_Capture, |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 447d624e1..f95ad9253 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -942,7 +942,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | |||
| 942 | 942 | ||
| 943 | const auto parameters = rp.PopRaw<Parameters>(); | 943 | const auto parameters = rp.PopRaw<Parameters>(); |
| 944 | // Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData | 944 | // Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData |
| 945 | constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None); | 945 | constexpr static auto flags = static_cast<u32>(FileSys::SaveDataFlags::None); |
| 946 | 946 | ||
| 947 | LOG_WARNING(Service_FS, | 947 | LOG_WARNING(Service_FS, |
| 948 | "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" | 948 | "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index ba6f04d8d..f4485141c 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -439,7 +439,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) { | |||
| 439 | using btn = Core::HID::NpadButton; | 439 | using btn = Core::HID::NpadButton; |
| 440 | pad_entry.npad_buttons.raw = btn::None; | 440 | pad_entry.npad_buttons.raw = btn::None; |
| 441 | if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) { | 441 | if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) { |
| 442 | constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R | | 442 | constexpr static btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R | |
| 443 | btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp | | 443 | btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp | |
| 444 | btn::StickRRight | btn::StickRDown; | 444 | btn::StickRRight | btn::StickRDown; |
| 445 | pad_entry.npad_buttons.raw = button_state.raw & right_button_mask; | 445 | pad_entry.npad_buttons.raw = button_state.raw & right_button_mask; |
| @@ -447,7 +447,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) { | |||
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) { | 449 | if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) { |
| 450 | constexpr btn left_button_mask = | 450 | constexpr static btn left_button_mask = |
| 451 | btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL | | 451 | btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL | |
| 452 | btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown; | 452 | btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown; |
| 453 | pad_entry.npad_buttons.raw |= button_state.raw & left_button_mask; | 453 | pad_entry.npad_buttons.raw |= button_state.raw & left_button_mask; |
| @@ -759,7 +759,7 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const { | |||
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | Result Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) { | 761 | Result Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) { |
| 762 | constexpr std::size_t max_number_npad_ids = 0xa; | 762 | constexpr static std::size_t max_number_npad_ids = 0xa; |
| 763 | const auto length = data.size(); | 763 | const auto length = data.size(); |
| 764 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); | 764 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); |
| 765 | const std::size_t elements = length / sizeof(u32); | 765 | const std::size_t elements = length / sizeof(u32); |
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 3a2fe938f..a1b187b63 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -670,7 +670,7 @@ ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_ | |||
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) { | 672 | Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) { |
| 673 | constexpr u32 INVALID_INDEX{0xFFFFFFFF}; | 673 | constexpr static u32 INVALID_INDEX{0xFFFFFFFF}; |
| 674 | 674 | ||
| 675 | index = INVALID_INDEX; | 675 | index = INVALID_INDEX; |
| 676 | 676 | ||
diff --git a/src/core/hle/service/nfp/amiibo_crypto.cpp b/src/core/hle/service/nfp/amiibo_crypto.cpp index ffb2f959c..0d9c3d0f6 100644 --- a/src/core/hle/service/nfp/amiibo_crypto.cpp +++ b/src/core/hle/service/nfp/amiibo_crypto.cpp | |||
| @@ -35,7 +35,7 @@ bool IsAmiiboValid(const EncryptedNTAG215File& ntag_file) { | |||
| 35 | LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", ntag_file.CFG1); | 35 | LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", ntag_file.CFG1); |
| 36 | 36 | ||
| 37 | // Validate UUID | 37 | // Validate UUID |
| 38 | constexpr u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3` | 38 | constexpr static u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3` |
| 39 | if ((CT ^ ntag_file.uuid.uid[0] ^ ntag_file.uuid.uid[1] ^ ntag_file.uuid.uid[2]) != | 39 | if ((CT ^ ntag_file.uuid.uid[0] ^ ntag_file.uuid.uid[1] ^ ntag_file.uuid.uid[2]) != |
| 40 | ntag_file.uuid.uid[3]) { | 40 | ntag_file.uuid.uid[3]) { |
| 41 | return false; | 41 | return false; |
| @@ -247,7 +247,7 @@ void Cipher(const DerivedKeys& keys, const NTAG215File& in_data, NTAG215File& ou | |||
| 247 | mbedtls_aes_setkey_enc(&aes, keys.aes_key.data(), aes_key_size); | 247 | mbedtls_aes_setkey_enc(&aes, keys.aes_key.data(), aes_key_size); |
| 248 | memcpy(nonce_counter.data(), keys.aes_iv.data(), sizeof(keys.aes_iv)); | 248 | memcpy(nonce_counter.data(), keys.aes_iv.data(), sizeof(keys.aes_iv)); |
| 249 | 249 | ||
| 250 | constexpr std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START; | 250 | constexpr static std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START; |
| 251 | mbedtls_aes_crypt_ctr(&aes, encrypted_data_size, &nc_off, nonce_counter.data(), | 251 | mbedtls_aes_crypt_ctr(&aes, encrypted_data_size, &nc_off, nonce_counter.data(), |
| 252 | stream_block.data(), | 252 | stream_block.data(), |
| 253 | reinterpret_cast<const unsigned char*>(&in_data.settings), | 253 | reinterpret_cast<const unsigned char*>(&in_data.settings), |
| @@ -317,13 +317,13 @@ bool DecodeAmiibo(const EncryptedNTAG215File& encrypted_tag_data, NTAG215File& t | |||
| 317 | Cipher(data_keys, encoded_data, tag_data); | 317 | Cipher(data_keys, encoded_data, tag_data); |
| 318 | 318 | ||
| 319 | // Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC! | 319 | // Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC! |
| 320 | constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; | 320 | constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; |
| 321 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), | 321 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), |
| 322 | sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid), | 322 | sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid), |
| 323 | input_length, reinterpret_cast<unsigned char*>(&tag_data.hmac_tag)); | 323 | input_length, reinterpret_cast<unsigned char*>(&tag_data.hmac_tag)); |
| 324 | 324 | ||
| 325 | // Regenerate data HMAC | 325 | // Regenerate data HMAC |
| 326 | constexpr std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START; | 326 | constexpr static std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START; |
| 327 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), data_keys.hmac_key.data(), | 327 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), data_keys.hmac_key.data(), |
| 328 | sizeof(HmacKey), | 328 | sizeof(HmacKey), |
| 329 | reinterpret_cast<const unsigned char*>(&tag_data.write_counter), input_length2, | 329 | reinterpret_cast<const unsigned char*>(&tag_data.write_counter), input_length2, |
| @@ -357,8 +357,8 @@ bool EncodeAmiibo(const NTAG215File& tag_data, EncryptedNTAG215File& encrypted_t | |||
| 357 | NTAG215File encoded_tag_data{}; | 357 | NTAG215File encoded_tag_data{}; |
| 358 | 358 | ||
| 359 | // Generate tag HMAC | 359 | // Generate tag HMAC |
| 360 | constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; | 360 | constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; |
| 361 | constexpr std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START; | 361 | constexpr static std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START; |
| 362 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), | 362 | mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), |
| 363 | sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid), | 363 | sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid), |
| 364 | input_length, reinterpret_cast<unsigned char*>(&encoded_tag_data.hmac_tag)); | 364 | input_length, reinterpret_cast<unsigned char*>(&encoded_tag_data.hmac_tag)); |
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 5d32adf64..df4f60d59 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -512,7 +512,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx | |||
| 512 | }; | 512 | }; |
| 513 | static_assert(sizeof(Output) == 0x3, "Output has incorrect size."); | 513 | static_assert(sizeof(Output) == 0x3, "Output has incorrect size."); |
| 514 | 514 | ||
| 515 | constexpr Output out{}; | 515 | constexpr static Output out{}; |
| 516 | 516 | ||
| 517 | IPC::ResponseBuilder rb{ctx, 3}; | 517 | IPC::ResponseBuilder rb{ctx, 3}; |
| 518 | rb.Push(ResultSuccess); | 518 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp index aba51d280..1f0e05df6 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | namespace Service::Nvidia::NvCore { | 9 | namespace Service::Nvidia::NvCore { |
| 10 | 10 | ||
| 11 | SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} { | 11 | SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} { |
| 12 | constexpr u32 VBlank0SyncpointId{26}; | 12 | constexpr static u32 VBlank0SyncpointId{26}; |
| 13 | constexpr u32 VBlank1SyncpointId{27}; | 13 | constexpr static u32 VBlank1SyncpointId{27}; |
| 14 | 14 | ||
| 15 | // Reserve both vblank syncpoints as client managed as they use Continuous Mode | 15 | // Reserve both vblank syncpoints as client managed as they use Continuous Mode |
| 16 | // Refer to section 14.3.5.3 of the TRM for more information on Continuous Mode | 16 | // Refer to section 14.3.5.3 of the TRM for more information on Continuous Mode |
diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp index 0767e548d..3f41aa0d9 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp | |||
| @@ -45,7 +45,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer, | |||
| 45 | 45 | ||
| 46 | // If expected_present is specified, we may not want to return a buffer yet. | 46 | // If expected_present is specified, we may not want to return a buffer yet. |
| 47 | if (expected_present.count() != 0) { | 47 | if (expected_present.count() != 0) { |
| 48 | constexpr auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second | 48 | constexpr static auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second |
| 49 | 49 | ||
| 50 | // The expected_present argument indicates when the buffer is expected to be presented | 50 | // The expected_present argument indicates when the buffer is expected to be presented |
| 51 | // on-screen. | 51 | // on-screen. |
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 530e1be3b..fbae10e7d 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp | |||
| @@ -55,7 +55,7 @@ private: | |||
| 55 | LOG_WARNING(Service_OLSC, "(STUBBED) called"); | 55 | LOG_WARNING(Service_OLSC, "(STUBBED) called"); |
| 56 | 56 | ||
| 57 | // backup_setting is set to 0 since real value is unknown | 57 | // backup_setting is set to 0 since real value is unknown |
| 58 | constexpr u64 backup_setting = 0; | 58 | constexpr static u64 backup_setting = 0; |
| 59 | 59 | ||
| 60 | IPC::ResponseBuilder rb{ctx, 4}; | 60 | IPC::ResponseBuilder rb{ctx, 4}; |
| 61 | rb.Push(ResultSuccess); | 61 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 01040b32a..155d6a00b 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp | |||
| @@ -116,7 +116,7 @@ private: | |||
| 116 | void GetTransmissionStatus(Kernel::HLERequestContext& ctx) { | 116 | void GetTransmissionStatus(Kernel::HLERequestContext& ctx) { |
| 117 | LOG_WARNING(Service_PREPO, "(STUBBED) called"); | 117 | LOG_WARNING(Service_PREPO, "(STUBBED) called"); |
| 118 | 118 | ||
| 119 | constexpr s32 status = 0; | 119 | constexpr static s32 status = 0; |
| 120 | 120 | ||
| 121 | IPC::ResponseBuilder rb{ctx, 3}; | 121 | IPC::ResponseBuilder rb{ctx, 3}; |
| 122 | rb.Push(ResultSuccess); | 122 | rb.Push(ResultSuccess); |
| @@ -126,7 +126,7 @@ private: | |||
| 126 | void GetSystemSessionId(Kernel::HLERequestContext& ctx) { | 126 | void GetSystemSessionId(Kernel::HLERequestContext& ctx) { |
| 127 | LOG_WARNING(Service_PREPO, "(STUBBED) called"); | 127 | LOG_WARNING(Service_PREPO, "(STUBBED) called"); |
| 128 | 128 | ||
| 129 | constexpr u64 system_session_id = 0; | 129 | constexpr static u64 system_session_id = 0; |
| 130 | IPC::ResponseBuilder rb{ctx, 4}; | 130 | IPC::ResponseBuilder rb{ctx, 4}; |
| 131 | rb.Push(ResultSuccess); | 131 | rb.Push(ResultSuccess); |
| 132 | rb.Push(system_session_id); | 132 | rb.Push(system_session_id); |
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index e96eda7f3..831a51a67 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp | |||
| @@ -92,7 +92,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co | |||
| 92 | static_assert(sizeof(SerializedResponseHeader) == 0x18, | 92 | static_assert(sizeof(SerializedResponseHeader) == 0x18, |
| 93 | "Response header size must be 0x18 bytes"); | 93 | "Response header size must be 0x18 bytes"); |
| 94 | 94 | ||
| 95 | constexpr auto header_size = sizeof(SerializedResponseHeader); | 95 | constexpr static auto header_size = sizeof(SerializedResponseHeader); |
| 96 | const auto addr_size = | 96 | const auto addr_size = |
| 97 | current->ai_addr && current->ai_addrlen > 0 ? current->ai_addrlen : 4; | 97 | current->ai_addr && current->ai_addrlen > 0 ? current->ai_addrlen : 4; |
| 98 | const auto canonname_size = current->ai_canonname ? strlen(current->ai_canonname) + 1 : 1; | 98 | const auto canonname_size = current->ai_canonname ? strlen(current->ai_canonname) + 1 : 1; |
| @@ -103,7 +103,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co | |||
| 103 | // Header in network byte order | 103 | // Header in network byte order |
| 104 | SerializedResponseHeader header{}; | 104 | SerializedResponseHeader header{}; |
| 105 | 105 | ||
| 106 | constexpr auto HEADER_MAGIC = 0xBEEFCAFE; | 106 | constexpr static auto HEADER_MAGIC = 0xBEEFCAFE; |
| 107 | header.magic = htonl(HEADER_MAGIC); | 107 | header.magic = htonl(HEADER_MAGIC); |
| 108 | header.family = htonl(current->ai_family); | 108 | header.family = htonl(current->ai_family); |
| 109 | header.flags = htonl(current->ai_flags); | 109 | header.flags = htonl(current->ai_flags); |
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index dcf47083f..ceb491224 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -103,7 +103,7 @@ private: | |||
| 103 | const auto certificate_format = rp.PopEnum<CertificateFormat>(); | 103 | const auto certificate_format = rp.PopEnum<CertificateFormat>(); |
| 104 | [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0); | 104 | [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0); |
| 105 | 105 | ||
| 106 | constexpr u64 server_id = 0; | 106 | constexpr static u64 server_id = 0; |
| 107 | 107 | ||
| 108 | LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format); | 108 | LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format); |
| 109 | 109 | ||
| @@ -122,7 +122,7 @@ private: | |||
| 122 | return std::span<const u8>{}; | 122 | return std::span<const u8>{}; |
| 123 | }(); | 123 | }(); |
| 124 | 124 | ||
| 125 | constexpr u64 client_id = 0; | 125 | constexpr static u64 client_id = 0; |
| 126 | 126 | ||
| 127 | LOG_WARNING(Service_SSL, "(STUBBED) called"); | 127 | LOG_WARNING(Service_SSL, "(STUBBED) called"); |
| 128 | 128 | ||
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index f9ada7c93..7b94b33f7 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp | |||
| @@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) { | |||
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | static bool ParsePosixName(const char* name, TimeZoneRule& rule) { | 288 | static bool ParsePosixName(const char* name, TimeZoneRule& rule) { |
| 289 | constexpr char default_rule[]{",M4.1.0,M10.5.0"}; | 289 | constexpr static char default_rule[]{",M4.1.0,M10.5.0"}; |
| 290 | const char* std_name{name}; | 290 | const char* std_name{name}; |
| 291 | int std_len{}; | 291 | int std_len{}; |
| 292 | int offset{}; | 292 | int offset{}; |
| @@ -512,8 +512,8 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi | |||
| 512 | return {}; | 512 | return {}; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | constexpr s32 time_zone_max_leaps{50}; | 515 | constexpr static s32 time_zone_max_leaps{50}; |
| 516 | constexpr s32 time_zone_max_chars{50}; | 516 | constexpr static s32 time_zone_max_chars{50}; |
| 517 | if (!(0 <= header.leap_count && header.leap_count < time_zone_max_leaps && | 517 | if (!(0 <= header.leap_count && header.leap_count < time_zone_max_leaps && |
| 518 | 0 < header.type_count && header.type_count < s32(time_zone_rule.ttis.size()) && | 518 | 0 < header.type_count && header.type_count < s32(time_zone_rule.ttis.size()) && |
| 519 | 0 <= header.time_count && header.time_count < s32(time_zone_rule.ats.size()) && | 519 | 0 <= header.time_count && header.time_count < s32(time_zone_rule.ats.size()) && |
| @@ -610,7 +610,7 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi | |||
| 610 | if (bytes_read < 0) { | 610 | if (bytes_read < 0) { |
| 611 | return {}; | 611 | return {}; |
| 612 | } | 612 | } |
| 613 | constexpr s32 time_zone_name_max{255}; | 613 | constexpr static s32 time_zone_name_max{255}; |
| 614 | if (bytes_read > (time_zone_name_max + 1)) { | 614 | if (bytes_read > (time_zone_name_max + 1)) { |
| 615 | return {}; | 615 | return {}; |
| 616 | } | 616 | } |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 2fb631183..66c8fd38a 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -725,8 +725,8 @@ private: | |||
| 725 | 725 | ||
| 726 | // TODO: Figure out what these are | 726 | // TODO: Figure out what these are |
| 727 | 727 | ||
| 728 | constexpr s64 unknown_result_1 = 0; | 728 | constexpr static s64 unknown_result_1 = 0; |
| 729 | constexpr s64 unknown_result_2 = 0; | 729 | constexpr static s64 unknown_result_2 = 0; |
| 730 | 730 | ||
| 731 | IPC::ResponseBuilder rb{ctx, 6}; | 731 | IPC::ResponseBuilder rb{ctx, 6}; |
| 732 | rb.Push(unknown_result_1); | 732 | rb.Push(unknown_result_1); |
| @@ -740,8 +740,8 @@ private: | |||
| 740 | const auto height = rp.Pop<u64>(); | 740 | const auto height = rp.Pop<u64>(); |
| 741 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); | 741 | LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); |
| 742 | 742 | ||
| 743 | constexpr u64 base_size = 0x20000; | 743 | constexpr static u64 base_size = 0x20000; |
| 744 | constexpr u64 alignment = 0x1000; | 744 | constexpr static u64 alignment = 0x1000; |
| 745 | const auto texture_size = width * height * 4; | 745 | const auto texture_size = width * height * 4; |
| 746 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; | 746 | const auto out_size = (texture_size + base_size - 1) / base_size * base_size; |
| 747 | 747 | ||
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index f09c176f8..9cf361986 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -121,7 +121,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us | |||
| 121 | double PerfStats::GetLastFrameTimeScale() const { | 121 | double PerfStats::GetLastFrameTimeScale() const { |
| 122 | std::scoped_lock lock{object_mutex}; | 122 | std::scoped_lock lock{object_mutex}; |
| 123 | 123 | ||
| 124 | constexpr double FRAME_LENGTH = 1.0 / 60; | 124 | constexpr static double FRAME_LENGTH = 1.0 / 60; |
| 125 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; | 125 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; |
| 126 | } | 126 | } |
| 127 | 127 | ||
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 8d5f2be2f..3bcdd9a99 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() { | |||
| 34 | mbedtls_entropy_context entropy; | 34 | mbedtls_entropy_context entropy; |
| 35 | mbedtls_entropy_init(&entropy); | 35 | mbedtls_entropy_init(&entropy); |
| 36 | mbedtls_ctr_drbg_context ctr_drbg; | 36 | mbedtls_ctr_drbg_context ctr_drbg; |
| 37 | constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}}; | 37 | constexpr static std::array<char, 18> personalization{{"yuzu Telemetry ID"}}; |
| 38 | 38 | ||
| 39 | mbedtls_ctr_drbg_init(&ctr_drbg); | 39 | mbedtls_ctr_drbg_init(&ctr_drbg); |
| 40 | ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, | 40 | ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, |
| @@ -225,7 +225,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, | |||
| 225 | Telemetry::AppendOSInfo(field_collection); | 225 | Telemetry::AppendOSInfo(field_collection); |
| 226 | 226 | ||
| 227 | // Log user configuration information | 227 | // Log user configuration information |
| 228 | constexpr auto field_type = Telemetry::FieldType::UserConfig; | 228 | constexpr static auto field_type = Telemetry::FieldType::UserConfig; |
| 229 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue()); | 229 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue()); |
| 230 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); | 230 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); |
| 231 | AddField(field_type, "Renderer_Backend", | 231 | AddField(field_type, "Renderer_Backend", |
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index d09ff178b..a4faab15e 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp | |||
| @@ -223,8 +223,8 @@ void GCAdapter::AdapterScanThread(std::stop_token stop_token) { | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | bool GCAdapter::Setup() { | 225 | bool GCAdapter::Setup() { |
| 226 | constexpr u16 nintendo_vid = 0x057e; | 226 | constexpr static u16 nintendo_vid = 0x057e; |
| 227 | constexpr u16 gc_adapter_pid = 0x0337; | 227 | constexpr static u16 gc_adapter_pid = 0x0337; |
| 228 | usb_adapter_handle = | 228 | usb_adapter_handle = |
| 229 | std::make_unique<LibUSBDeviceHandle>(libusb_ctx->get(), nintendo_vid, gc_adapter_pid); | 229 | std::make_unique<LibUSBDeviceHandle>(libusb_ctx->get(), nintendo_vid, gc_adapter_pid); |
| 230 | if (!usb_adapter_handle->get()) { | 230 | if (!usb_adapter_handle->get()) { |
| @@ -346,7 +346,7 @@ void GCAdapter::UpdateVibrations() { | |||
| 346 | // Use 8 states to keep the switching between on/off fast enough for | 346 | // Use 8 states to keep the switching between on/off fast enough for |
| 347 | // a human to feel different vibration strenght | 347 | // a human to feel different vibration strenght |
| 348 | // More states == more rumble strengths == slower update time | 348 | // More states == more rumble strengths == slower update time |
| 349 | constexpr u8 vibration_states = 8; | 349 | constexpr static u8 vibration_states = 8; |
| 350 | 350 | ||
| 351 | vibration_counter = (vibration_counter + 1) % vibration_states; | 351 | vibration_counter = (vibration_counter + 1) % vibration_states; |
| 352 | 352 | ||
| @@ -363,7 +363,7 @@ void GCAdapter::SendVibrations() { | |||
| 363 | return; | 363 | return; |
| 364 | } | 364 | } |
| 365 | s32 size{}; | 365 | s32 size{}; |
| 366 | constexpr u8 rumble_command = 0x11; | 366 | constexpr static u8 rumble_command = 0x11; |
| 367 | const u8 p1 = pads[0].enable_vibration; | 367 | const u8 p1 = pads[0].enable_vibration; |
| 368 | const u8 p2 = pads[1].enable_vibration; | 368 | const u8 p2 = pads[1].enable_vibration; |
| 369 | const u8 p3 = pads[2].enable_vibration; | 369 | const u8 p3 = pads[2].enable_vibration; |
diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index afc33db57..a93bb5c25 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp | |||
| @@ -77,7 +77,7 @@ void Joycons::Setup() { | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void Joycons::ScanThread(std::stop_token stop_token) { | 79 | void Joycons::ScanThread(std::stop_token stop_token) { |
| 80 | constexpr u16 nintendo_vendor_id = 0x057e; | 80 | constexpr static u16 nintendo_vendor_id = 0x057e; |
| 81 | Common::SetCurrentThreadName("JoyconScanThread"); | 81 | Common::SetCurrentThreadName("JoyconScanThread"); |
| 82 | 82 | ||
| 83 | do { | 83 | do { |
| @@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int | |||
| 390 | void Joycons::OnRingConUpdate(f32 ring_data) { | 390 | void Joycons::OnRingConUpdate(f32 ring_data) { |
| 391 | // To simplify ring detection it will always be mapped to an empty identifier for all | 391 | // To simplify ring detection it will always be mapped to an empty identifier for all |
| 392 | // controllers | 392 | // controllers |
| 393 | constexpr PadIdentifier identifier = { | 393 | constexpr static PadIdentifier identifier = { |
| 394 | .guid = Common::UUID{}, | 394 | .guid = Common::UUID{}, |
| 395 | .port = 0, | 395 | .port = 0, |
| 396 | .pad = 0, | 396 | .pad = 0, |
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index faf9cbdc3..dfa93d58a 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp | |||
| @@ -37,7 +37,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) | |||
| 37 | 37 | ||
| 38 | void Mouse::UpdateThread(std::stop_token stop_token) { | 38 | void Mouse::UpdateThread(std::stop_token stop_token) { |
| 39 | Common::SetCurrentThreadName("Mouse"); | 39 | Common::SetCurrentThreadName("Mouse"); |
| 40 | constexpr int update_time = 10; | 40 | constexpr static int update_time = 10; |
| 41 | while (!stop_token.stop_requested()) { | 41 | while (!stop_token.stop_requested()) { |
| 42 | if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) { | 42 | if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) { |
| 43 | // Slow movement by 4% | 43 | // Slow movement by 4% |
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 88cacd615..53ebae2d6 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -63,7 +63,7 @@ public: | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | bool UpdateMotion(SDL_ControllerSensorEvent event) { | 65 | bool UpdateMotion(SDL_ControllerSensorEvent event) { |
| 66 | constexpr float gravity_constant = 9.80665f; | 66 | constexpr static float gravity_constant = 9.80665f; |
| 67 | std::scoped_lock lock{mutex}; | 67 | std::scoped_lock lock{mutex}; |
| 68 | const u64 time_difference = event.timestamp - last_motion_update; | 68 | const u64 time_difference = event.timestamp - last_motion_update; |
| 69 | last_motion_update = event.timestamp; | 69 | last_motion_update = event.timestamp; |
| @@ -109,7 +109,7 @@ public: | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | bool RumblePlay(const Common::Input::VibrationStatus vibration) { | 111 | bool RumblePlay(const Common::Input::VibrationStatus vibration) { |
| 112 | constexpr u32 rumble_max_duration_ms = 1000; | 112 | constexpr static u32 rumble_max_duration_ms = 1000; |
| 113 | if (sdl_controller) { | 113 | if (sdl_controller) { |
| 114 | return SDL_GameControllerRumble( | 114 | return SDL_GameControllerRumble( |
| 115 | sdl_controller.get(), static_cast<u16>(vibration.low_amplitude), | 115 | sdl_controller.get(), static_cast<u16>(vibration.low_amplitude), |
| @@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { | |||
| 616 | const auto joystick = | 616 | const auto joystick = |
| 617 | GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); | 617 | GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); |
| 618 | 618 | ||
| 619 | constexpr Common::Input::VibrationStatus test_vibration{ | 619 | constexpr static Common::Input::VibrationStatus test_vibration{ |
| 620 | .low_amplitude = 1, | 620 | .low_amplitude = 1, |
| 621 | .low_frequency = 160.0f, | 621 | .low_frequency = 160.0f, |
| 622 | .high_amplitude = 1, | 622 | .high_amplitude = 1, |
| @@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { | |||
| 624 | .type = Common::Input::VibrationAmplificationType::Exponential, | 624 | .type = Common::Input::VibrationAmplificationType::Exponential, |
| 625 | }; | 625 | }; |
| 626 | 626 | ||
| 627 | constexpr Common::Input::VibrationStatus zero_vibration{ | 627 | constexpr static Common::Input::VibrationStatus zero_vibration{ |
| 628 | .low_amplitude = 0, | 628 | .low_amplitude = 0, |
| 629 | .low_frequency = 160.0f, | 629 | .low_frequency = 160.0f, |
| 630 | .high_amplitude = 0, | 630 | .high_amplitude = 0, |
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index 808b21069..ae49f0478 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp | |||
| @@ -599,7 +599,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( | |||
| 599 | Status current_status{Status::Initialized}; | 599 | Status current_status{Status::Initialized}; |
| 600 | SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, | 600 | SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, |
| 601 | [&](Response::PadData data) { | 601 | [&](Response::PadData data) { |
| 602 | constexpr u16 CALIBRATION_THRESHOLD = 100; | 602 | constexpr static u16 CALIBRATION_THRESHOLD = 100; |
| 603 | 603 | ||
| 604 | if (current_status == Status::Initialized) { | 604 | if (current_status == Status::Initialized) { |
| 605 | // Receiving data means the communication is ready now | 605 | // Receiving data means the communication is ready now |
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index e65b6b845..6ab16cde6 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp | |||
| @@ -129,7 +129,7 @@ void JoyconDriver::InputThread(std::stop_token stop_token) { | |||
| 129 | input_thread_running = true; | 129 | input_thread_running = true; |
| 130 | 130 | ||
| 131 | // Max update rate is 5ms, ensure we are always able to read a bit faster | 131 | // Max update rate is 5ms, ensure we are always able to read a bit faster |
| 132 | constexpr int ThreadDelay = 2; | 132 | constexpr static int ThreadDelay = 2; |
| 133 | std::vector<u8> buffer(MaxBufferSize); | 133 | std::vector<u8> buffer(MaxBufferSize); |
| 134 | 134 | ||
| 135 | while (!stop_token.stop_requested()) { | 135 | while (!stop_token.stop_requested()) { |
| @@ -548,7 +548,7 @@ DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, | |||
| 548 | {0x2007, ControllerType::Right}, | 548 | {0x2007, ControllerType::Right}, |
| 549 | {0x2009, ControllerType::Pro}, | 549 | {0x2009, ControllerType::Pro}, |
| 550 | }; | 550 | }; |
| 551 | constexpr u16 nintendo_vendor_id = 0x057e; | 551 | constexpr static u16 nintendo_vendor_id = 0x057e; |
| 552 | 552 | ||
| 553 | controller_type = ControllerType::None; | 553 | controller_type = ControllerType::None; |
| 554 | if (device_info->vendor_id != nintendo_vendor_id) { | 554 | if (device_info->vendor_id != nintendo_vendor_id) { |
diff --git a/src/input_common/helpers/joycon_protocol/calibration.cpp b/src/input_common/helpers/joycon_protocol/calibration.cpp index d8f040f75..69e3379cf 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.cpp +++ b/src/input_common/helpers/joycon_protocol/calibration.cpp | |||
| @@ -129,7 +129,7 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati | |||
| 129 | 129 | ||
| 130 | DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration, | 130 | DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration, |
| 131 | s16 current_value) { | 131 | s16 current_value) { |
| 132 | constexpr s16 DefaultRingRange{800}; | 132 | constexpr static s16 DefaultRingRange{800}; |
| 133 | 133 | ||
| 134 | // TODO: Get default calibration form ring itself | 134 | // TODO: Get default calibration form ring itself |
| 135 | if (ring_data_max == 0 && ring_data_min == 0) { | 135 | if (ring_data_max == 0 && ring_data_min == 0) { |
| @@ -168,8 +168,8 @@ u16 CalibrationProtocol::GetYAxisCalibrationValue(std::span<u8> block) const { | |||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { | 170 | void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { |
| 171 | constexpr u16 DefaultStickCenter{0x800}; | 171 | constexpr static u16 DefaultStickCenter{0x800}; |
| 172 | constexpr u16 DefaultStickRange{0x6cc}; | 172 | constexpr static u16 DefaultStickRange{0x6cc}; |
| 173 | 173 | ||
| 174 | calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter); | 174 | calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter); |
| 175 | calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange); | 175 | calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange); |
| @@ -181,9 +181,9 @@ void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) | |||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) { | 183 | void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) { |
| 184 | constexpr s16 DefaultAccelerometerScale{0x4000}; | 184 | constexpr static s16 DefaultAccelerometerScale{0x4000}; |
| 185 | constexpr s16 DefaultGyroScale{0x3be7}; | 185 | constexpr static s16 DefaultGyroScale{0x3be7}; |
| 186 | constexpr s16 DefaultOffset{0}; | 186 | constexpr static s16 DefaultOffset{0}; |
| 187 | 187 | ||
| 188 | for (auto& sensor : calibration.accelerometer) { | 188 | for (auto& sensor : calibration.accelerometer) { |
| 189 | sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale); | 189 | sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale); |
diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.cpp b/src/input_common/helpers/joycon_protocol/common_protocol.cpp index 2b42a4555..95c3923b0 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.cpp +++ b/src/input_common/helpers/joycon_protocol/common_protocol.cpp | |||
| @@ -72,8 +72,8 @@ DriverResult JoyconCommonProtocol::SendRawData(std::span<const u8> buffer) { | |||
| 72 | 72 | ||
| 73 | DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc, | 73 | DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc, |
| 74 | SubCommandResponse& output) { | 74 | SubCommandResponse& output) { |
| 75 | constexpr int timeout_mili = 66; | 75 | constexpr static int timeout_mili = 66; |
| 76 | constexpr int MaxTries = 15; | 76 | constexpr static int MaxTries = 15; |
| 77 | int tries = 0; | 77 | int tries = 0; |
| 78 | 78 | ||
| 79 | do { | 79 | do { |
| @@ -157,8 +157,8 @@ DriverResult JoyconCommonProtocol::SendVibrationReport(std::span<const u8> buffe | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span<u8> output) { | 159 | DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span<u8> output) { |
| 160 | constexpr std::size_t HeaderSize = 5; | 160 | constexpr static std::size_t HeaderSize = 5; |
| 161 | constexpr std::size_t MaxTries = 10; | 161 | constexpr static std::size_t MaxTries = 10; |
| 162 | std::size_t tries = 0; | 162 | std::size_t tries = 0; |
| 163 | SubCommandResponse response{}; | 163 | SubCommandResponse response{}; |
| 164 | std::array<u8, sizeof(ReadSpiPacket)> buffer{}; | 164 | std::array<u8, sizeof(ReadSpiPacket)> buffer{}; |
| @@ -216,8 +216,8 @@ DriverResult JoyconCommonProtocol::ConfigureMCU(const MCUConfig& config) { | |||
| 216 | 216 | ||
| 217 | DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode, | 217 | DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode, |
| 218 | MCUCommandResponse& output) { | 218 | MCUCommandResponse& output) { |
| 219 | constexpr int TimeoutMili = 200; | 219 | constexpr static int TimeoutMili = 200; |
| 220 | constexpr int MaxTries = 9; | 220 | constexpr static int MaxTries = 9; |
| 221 | int tries = 0; | 221 | int tries = 0; |
| 222 | 222 | ||
| 223 | do { | 223 | do { |
| @@ -265,7 +265,7 @@ DriverResult JoyconCommonProtocol::SendMCUData(ReportMode report_mode, SubComman | |||
| 265 | 265 | ||
| 266 | DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) { | 266 | DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) { |
| 267 | MCUCommandResponse output{}; | 267 | MCUCommandResponse output{}; |
| 268 | constexpr std::size_t MaxTries{8}; | 268 | constexpr static std::size_t MaxTries{8}; |
| 269 | std::size_t tries{}; | 269 | std::size_t tries{}; |
| 270 | 270 | ||
| 271 | do { | 271 | do { |
diff --git a/src/input_common/helpers/joycon_protocol/irs.cpp b/src/input_common/helpers/joycon_protocol/irs.cpp index 731fd5981..5c07f698b 100644 --- a/src/input_common/helpers/joycon_protocol/irs.cpp +++ b/src/input_common/helpers/joycon_protocol/irs.cpp | |||
| @@ -131,7 +131,7 @@ DriverResult IrsProtocol::RequestImage(std::span<u8> buffer) { | |||
| 131 | 131 | ||
| 132 | DriverResult IrsProtocol::ConfigureIrs() { | 132 | DriverResult IrsProtocol::ConfigureIrs() { |
| 133 | LOG_DEBUG(Input, "Configure IRS"); | 133 | LOG_DEBUG(Input, "Configure IRS"); |
| 134 | constexpr std::size_t max_tries = 28; | 134 | constexpr static std::size_t max_tries = 28; |
| 135 | SubCommandResponse output{}; | 135 | SubCommandResponse output{}; |
| 136 | std::size_t tries = 0; | 136 | std::size_t tries = 0; |
| 137 | 137 | ||
| @@ -166,7 +166,7 @@ DriverResult IrsProtocol::ConfigureIrs() { | |||
| 166 | DriverResult IrsProtocol::WriteRegistersStep1() { | 166 | DriverResult IrsProtocol::WriteRegistersStep1() { |
| 167 | LOG_DEBUG(Input, "WriteRegistersStep1"); | 167 | LOG_DEBUG(Input, "WriteRegistersStep1"); |
| 168 | DriverResult result{DriverResult::Success}; | 168 | DriverResult result{DriverResult::Success}; |
| 169 | constexpr std::size_t max_tries = 28; | 169 | constexpr static std::size_t max_tries = 28; |
| 170 | SubCommandResponse output{}; | 170 | SubCommandResponse output{}; |
| 171 | std::size_t tries = 0; | 171 | std::size_t tries = 0; |
| 172 | 172 | ||
| @@ -226,7 +226,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() { | |||
| 226 | 226 | ||
| 227 | DriverResult IrsProtocol::WriteRegistersStep2() { | 227 | DriverResult IrsProtocol::WriteRegistersStep2() { |
| 228 | LOG_DEBUG(Input, "WriteRegistersStep2"); | 228 | LOG_DEBUG(Input, "WriteRegistersStep2"); |
| 229 | constexpr std::size_t max_tries = 28; | 229 | constexpr static std::size_t max_tries = 28; |
| 230 | SubCommandResponse output{}; | 230 | SubCommandResponse output{}; |
| 231 | std::size_t tries = 0; | 231 | std::size_t tries = 0; |
| 232 | 232 | ||
diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index eeba82986..6b8f38aec 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp | |||
| @@ -109,7 +109,7 @@ bool NfcProtocol::HasAmiibo() { | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | DriverResult NfcProtocol::WaitUntilNfcIsReady() { | 111 | DriverResult NfcProtocol::WaitUntilNfcIsReady() { |
| 112 | constexpr std::size_t timeout_limit = 10; | 112 | constexpr static std::size_t timeout_limit = 10; |
| 113 | MCUCommandResponse output{}; | 113 | MCUCommandResponse output{}; |
| 114 | std::size_t tries = 0; | 114 | std::size_t tries = 0; |
| 115 | 115 | ||
| @@ -131,7 +131,7 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() { | |||
| 131 | 131 | ||
| 132 | DriverResult NfcProtocol::StartPolling(TagFoundData& data) { | 132 | DriverResult NfcProtocol::StartPolling(TagFoundData& data) { |
| 133 | LOG_DEBUG(Input, "Start Polling for tag"); | 133 | LOG_DEBUG(Input, "Start Polling for tag"); |
| 134 | constexpr std::size_t timeout_limit = 7; | 134 | constexpr static std::size_t timeout_limit = 7; |
| 135 | MCUCommandResponse output{}; | 135 | MCUCommandResponse output{}; |
| 136 | std::size_t tries = 0; | 136 | std::size_t tries = 0; |
| 137 | 137 | ||
| @@ -155,7 +155,7 @@ DriverResult NfcProtocol::StartPolling(TagFoundData& data) { | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { | 157 | DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { |
| 158 | constexpr std::size_t timeout_limit = 10; | 158 | constexpr static std::size_t timeout_limit = 10; |
| 159 | MCUCommandResponse output{}; | 159 | MCUCommandResponse output{}; |
| 160 | std::size_t tries = 0; | 160 | std::size_t tries = 0; |
| 161 | 161 | ||
| @@ -224,7 +224,7 @@ DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { | |||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | DriverResult NfcProtocol::GetAmiiboData(std::vector<u8>& ntag_data) { | 226 | DriverResult NfcProtocol::GetAmiiboData(std::vector<u8>& ntag_data) { |
| 227 | constexpr std::size_t timeout_limit = 10; | 227 | constexpr static std::size_t timeout_limit = 10; |
| 228 | MCUCommandResponse output{}; | 228 | MCUCommandResponse output{}; |
| 229 | std::size_t tries = 0; | 229 | std::size_t tries = 0; |
| 230 | 230 | ||
diff --git a/src/input_common/helpers/joycon_protocol/ringcon.cpp b/src/input_common/helpers/joycon_protocol/ringcon.cpp index 190cef812..9056e64dc 100644 --- a/src/input_common/helpers/joycon_protocol/ringcon.cpp +++ b/src/input_common/helpers/joycon_protocol/ringcon.cpp | |||
| @@ -69,7 +69,7 @@ DriverResult RingConProtocol::StartRingconPolling() { | |||
| 69 | 69 | ||
| 70 | DriverResult RingConProtocol::IsRingConnected(bool& is_connected) { | 70 | DriverResult RingConProtocol::IsRingConnected(bool& is_connected) { |
| 71 | LOG_DEBUG(Input, "IsRingConnected"); | 71 | LOG_DEBUG(Input, "IsRingConnected"); |
| 72 | constexpr std::size_t max_tries = 28; | 72 | constexpr static std::size_t max_tries = 28; |
| 73 | SubCommandResponse output{}; | 73 | SubCommandResponse output{}; |
| 74 | std::size_t tries = 0; | 74 | std::size_t tries = 0; |
| 75 | is_connected = false; | 75 | is_connected = false; |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp index 49397c9b2..06599c1b0 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp | |||
| @@ -39,7 +39,7 @@ void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::strin | |||
| 39 | // which may be overwritten by the result of the addition | 39 | // which may be overwritten by the result of the addition |
| 40 | if (IR::Inst * overflow{inst.GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { | 40 | if (IR::Inst * overflow{inst.GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { |
| 41 | // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c | 41 | // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c |
| 42 | constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())}; | 42 | constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())}; |
| 43 | const auto sub_a{fmt::format("{}u-{}", s32_max, a)}; | 43 | const auto sub_a{fmt::format("{}u-{}", s32_max, a)}; |
| 44 | const auto positive_result{fmt::format("int({})>int({})", b, sub_a)}; | 44 | const auto positive_result{fmt::format("int({})>int({})", b, sub_a)}; |
| 45 | const auto negative_result{fmt::format("int({})<int({})", b, sub_a)}; | 45 | const auto negative_result{fmt::format("int({})<int({})", b, sub_a)}; |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp index 960bdea6f..f6492dffd 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp | |||
| @@ -42,7 +42,7 @@ Id EmitIAdd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) { | |||
| 42 | SetSignFlag(ctx, inst, result); | 42 | SetSignFlag(ctx, inst, result); |
| 43 | if (IR::Inst * overflow{inst->GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { | 43 | if (IR::Inst * overflow{inst->GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { |
| 44 | // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c | 44 | // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c |
| 45 | constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())}; | 45 | constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())}; |
| 46 | const Id is_positive{ctx.OpSGreaterThanEqual(ctx.U1, a, ctx.u32_zero_value)}; | 46 | const Id is_positive{ctx.OpSGreaterThanEqual(ctx.U1, a, ctx.u32_zero_value)}; |
| 47 | const Id sub_a{ctx.OpISub(ctx.U32[1], ctx.Const(s32_max), a)}; | 47 | const Id sub_a{ctx.OpISub(ctx.U32[1], ctx.Const(s32_max), a)}; |
| 48 | 48 | ||
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp index 7f3dccc52..15ad55a43 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp | |||
| @@ -48,7 +48,7 @@ void F2F(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a, bool abs) { | |||
| 48 | BitField<8, 2, FloatFormat> dst_size; | 48 | BitField<8, 2, FloatFormat> dst_size; |
| 49 | 49 | ||
| 50 | [[nodiscard]] RoundingOp RoundingOperation() const { | 50 | [[nodiscard]] RoundingOp RoundingOperation() const { |
| 51 | constexpr u64 rounding_mask = 0x0B; | 51 | constexpr static u64 rounding_mask = 0x0B; |
| 52 | return static_cast<RoundingOp>(rounding_op.Value() & rounding_mask); | 52 | return static_cast<RoundingOp>(rounding_op.Value() & rounding_mask); |
| 53 | } | 53 | } |
| 54 | } const f2f{insn}; | 54 | } const f2f{insn}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp index 85c18d942..429733187 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp | |||
| @@ -176,11 +176,11 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { | |||
| 176 | (f2i.src_format == SrcFormat::F64) != (f2i.dest_format == DestFormat::I64); | 176 | (f2i.src_format == SrcFormat::F64) != (f2i.dest_format == DestFormat::I64); |
| 177 | if (special_nan_cases) { | 177 | if (special_nan_cases) { |
| 178 | if (f2i.dest_format == DestFormat::I32) { | 178 | if (f2i.dest_format == DestFormat::I32) { |
| 179 | constexpr u32 nan_value = 0x8000'0000U; | 179 | constexpr static u32 nan_value = 0x8000'0000U; |
| 180 | handled_special_case = true; | 180 | handled_special_case = true; |
| 181 | result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(nan_value), result)}; | 181 | result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(nan_value), result)}; |
| 182 | } else if (f2i.dest_format == DestFormat::I64) { | 182 | } else if (f2i.dest_format == DestFormat::I64) { |
| 183 | constexpr u64 nan_value = 0x8000'0000'0000'0000ULL; | 183 | constexpr static u64 nan_value = 0x8000'0000'0000'0000ULL; |
| 184 | handled_special_case = true; | 184 | handled_special_case = true; |
| 185 | result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(nan_value), result)}; | 185 | result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(nan_value), result)}; |
| 186 | } | 186 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp index 3d9877359..3c8ef62e2 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp | |||
| @@ -19,7 +19,7 @@ enum class Half : u64 { | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | [[nodiscard]] IR::U32 IntegerHalf(IR::IREmitter& ir, const IR::U32& value, Half half) { | 21 | [[nodiscard]] IR::U32 IntegerHalf(IR::IREmitter& ir, const IR::U32& value, Half half) { |
| 22 | constexpr bool is_signed{false}; | 22 | constexpr static bool is_signed{false}; |
| 23 | switch (half) { | 23 | switch (half) { |
| 24 | case Half::All: | 24 | case Half::All: |
| 25 | return value; | 25 | return value; |
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index ecad7583f..c0b22d0ee 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp | |||
| @@ -76,7 +76,7 @@ void TestControl1::ExecuteThread(u32 id) { | |||
| 76 | * doing all the work required. | 76 | * doing all the work required. |
| 77 | */ | 77 | */ |
| 78 | TEST_CASE("Fibers::Setup", "[common]") { | 78 | TEST_CASE("Fibers::Setup", "[common]") { |
| 79 | constexpr std::size_t num_threads = 7; | 79 | constexpr static std::size_t num_threads = 7; |
| 80 | TestControl1 test_control{}; | 80 | TestControl1 test_control{}; |
| 81 | test_control.thread_fibers.resize(num_threads); | 81 | test_control.thread_fibers.resize(num_threads); |
| 82 | test_control.work_fibers.resize(num_threads); | 82 | test_control.work_fibers.resize(num_threads); |
diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp index 516ff1b30..8d3951ee6 100644 --- a/src/tests/input_common/calibration_configuration_job.cpp +++ b/src/tests/input_common/calibration_configuration_job.cpp | |||
| @@ -35,8 +35,8 @@ public: | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void Run(const std::vector<InputCommon::CemuhookUDP::Response::TouchPad> touch_movement_path) { | 37 | void Run(const std::vector<InputCommon::CemuhookUDP::Response::TouchPad> touch_movement_path) { |
| 38 | constexpr size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header); | 38 | constexpr static size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header); |
| 39 | constexpr size_t PadDataSize = | 39 | constexpr static size_t PadDataSize = |
| 40 | sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>); | 40 | sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>); |
| 41 | 41 | ||
| 42 | REQUIRE(touch_movement_path.size() > 0); | 42 | REQUIRE(touch_movement_path.size() > 0); |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 627917ab6..b650d0e59 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -890,8 +890,8 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 890 | buffer_id, | 890 | buffer_id, |
| 891 | }); | 891 | }); |
| 892 | // Align up to avoid cache conflicts | 892 | // Align up to avoid cache conflicts |
| 893 | constexpr u64 align = 8ULL; | 893 | constexpr static u64 align = 8ULL; |
| 894 | constexpr u64 mask = ~(align - 1ULL); | 894 | constexpr static u64 mask = ~(align - 1ULL); |
| 895 | total_size_bytes += (new_size + align - 1) & mask; | 895 | total_size_bytes += (new_size + align - 1) & mask; |
| 896 | largest_copy = std::max(largest_copy, new_size); | 896 | largest_copy = std::max(largest_copy, new_size); |
| 897 | }; | 897 | }; |
| @@ -1843,8 +1843,8 @@ void BufferCache<P>::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si | |||
| 1843 | .size = new_size, | 1843 | .size = new_size, |
| 1844 | }); | 1844 | }); |
| 1845 | // Align up to avoid cache conflicts | 1845 | // Align up to avoid cache conflicts |
| 1846 | constexpr u64 align = 256ULL; | 1846 | constexpr static u64 align = 256ULL; |
| 1847 | constexpr u64 mask = ~(align - 1ULL); | 1847 | constexpr static u64 mask = ~(align - 1ULL); |
| 1848 | total_size_bytes += (new_size + align - 1) & mask; | 1848 | total_size_bytes += (new_size + align - 1) & mask; |
| 1849 | largest_copy = std::max(largest_copy, new_size); | 1849 | largest_copy = std::max(largest_copy, new_size); |
| 1850 | }; | 1850 | }; |
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 551929824..72ad3ccc8 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp | |||
| @@ -75,7 +75,7 @@ bool DmaPusher::Step() { | |||
| 75 | 75 | ||
| 76 | // Push buffer non-empty, read a word | 76 | // Push buffer non-empty, read a word |
| 77 | command_headers.resize_destructive(command_list_header.size); | 77 | command_headers.resize_destructive(command_list_header.size); |
| 78 | constexpr u32 MacroRegistersStart = 0xE00; | 78 | constexpr static u32 MacroRegistersStart = 0xE00; |
| 79 | if (dma_state.method < MacroRegistersStart) { | 79 | if (dma_state.method < MacroRegistersStart) { |
| 80 | if (Settings::IsGPULevelHigh()) { | 80 | if (Settings::IsGPULevelHigh()) { |
| 81 | memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(), | 81 | memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(), |
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index a126c359c..40176821b 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -72,7 +72,7 @@ void Fermi2D::Blit() { | |||
| 72 | UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled"); | 72 | UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled"); |
| 73 | 73 | ||
| 74 | const auto& args = regs.pixels_from_memory; | 74 | const auto& args = regs.pixels_from_memory; |
| 75 | constexpr s64 null_derivate = 1ULL << 32; | 75 | constexpr static s64 null_derivate = 1ULL << 32; |
| 76 | Surface src = regs.src; | 76 | Surface src = regs.src; |
| 77 | const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); | 77 | const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); |
| 78 | const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 && | 78 | const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 && |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index ae9da6290..3c1af92c4 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -258,7 +258,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() { | |||
| 258 | size_t Maxwell3D::EstimateIndexBufferSize() { | 258 | size_t Maxwell3D::EstimateIndexBufferSize() { |
| 259 | GPUVAddr start_address = regs.index_buffer.StartAddress(); | 259 | GPUVAddr start_address = regs.index_buffer.StartAddress(); |
| 260 | GPUVAddr end_address = regs.index_buffer.EndAddress(); | 260 | GPUVAddr end_address = regs.index_buffer.EndAddress(); |
| 261 | constexpr std::array<size_t, 4> max_sizes = { | 261 | constexpr static std::array<size_t, 4> max_sizes = { |
| 262 | std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(), | 262 | std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(), |
| 263 | std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()}; | 263 | std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()}; |
| 264 | const size_t byte_size = regs.index_buffer.FormatSizeInBytes(); | 264 | const size_t byte_size = regs.index_buffer.FormatSizeInBytes(); |
diff --git a/src/video_core/engines/sw_blitter/converter.cpp b/src/video_core/engines/sw_blitter/converter.cpp index 2419b5632..11674c748 100644 --- a/src/video_core/engines/sw_blitter/converter.cpp +++ b/src/video_core/engines/sw_blitter/converter.cpp | |||
| @@ -694,16 +694,16 @@ private: | |||
| 694 | }; | 694 | }; |
| 695 | const auto force_to_fp16 = [](f32 base_value) { | 695 | const auto force_to_fp16 = [](f32 base_value) { |
| 696 | u32 tmp = Common::BitCast<u32>(base_value); | 696 | u32 tmp = Common::BitCast<u32>(base_value); |
| 697 | constexpr size_t fp32_mantissa_bits = 23; | 697 | constexpr static size_t fp32_mantissa_bits = 23; |
| 698 | constexpr size_t fp16_mantissa_bits = 10; | 698 | constexpr static size_t fp16_mantissa_bits = 10; |
| 699 | constexpr size_t mantissa_mask = | 699 | constexpr static size_t mantissa_mask = |
| 700 | ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); | 700 | ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); |
| 701 | tmp = tmp & static_cast<u32>(mantissa_mask); | 701 | tmp = tmp & static_cast<u32>(mantissa_mask); |
| 702 | // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM | 702 | // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM |
| 703 | return Common::BitCast<f32>(tmp); | 703 | return Common::BitCast<f32>(tmp); |
| 704 | }; | 704 | }; |
| 705 | const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { | 705 | const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { |
| 706 | constexpr size_t fp32_mantissa_bits = 23; | 706 | constexpr static size_t fp32_mantissa_bits = 23; |
| 707 | size_t shift_towards = fp32_mantissa_bits - mantissa; | 707 | size_t shift_towards = fp32_mantissa_bits - mantissa; |
| 708 | const u32 new_value = | 708 | const u32 new_value = |
| 709 | static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); | 709 | static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); |
| @@ -770,7 +770,7 @@ private: | |||
| 770 | component_mask[which_component]; | 770 | component_mask[which_component]; |
| 771 | }; | 771 | }; |
| 772 | const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { | 772 | const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { |
| 773 | constexpr size_t fp32_mantissa_bits = 23; | 773 | constexpr static size_t fp32_mantissa_bits = 23; |
| 774 | u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f)); | 774 | u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f)); |
| 775 | size_t shift_towards = fp32_mantissa_bits - mantissa; | 775 | size_t shift_towards = fp32_mantissa_bits - mantissa; |
| 776 | return tmp_value >> shift_towards; | 776 | return tmp_value >> shift_towards; |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 7024a19cf..caf241eac 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -194,8 +194,8 @@ struct GPU::Impl { | |||
| 194 | [[nodiscard]] u64 GetTicks() const { | 194 | [[nodiscard]] u64 GetTicks() const { |
| 195 | // This values were reversed engineered by fincs from NVN | 195 | // This values were reversed engineered by fincs from NVN |
| 196 | // The gpu clock is reported in units of 385/625 nanoseconds | 196 | // The gpu clock is reported in units of 385/625 nanoseconds |
| 197 | constexpr u64 gpu_ticks_num = 384; | 197 | constexpr static u64 gpu_ticks_num = 384; |
| 198 | constexpr u64 gpu_ticks_den = 625; | 198 | constexpr static u64 gpu_ticks_den = 625; |
| 199 | 199 | ||
| 200 | u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count(); | 200 | u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count(); |
| 201 | if (Settings::values.use_fast_gpu_time.GetValue()) { | 201 | if (Settings::values.use_fast_gpu_time.GetValue()) { |
diff --git a/src/video_core/host1x/codecs/vp9.cpp b/src/video_core/host1x/codecs/vp9.cpp index cf40c9012..bb691f7d8 100644 --- a/src/video_core/host1x/codecs/vp9.cpp +++ b/src/video_core/host1x/codecs/vp9.cpp | |||
| @@ -283,7 +283,7 @@ void VP9::EncodeTermSubExp(VpxRangeEncoder& writer, s32 value) { | |||
| 283 | } else { | 283 | } else { |
| 284 | value -= 64; | 284 | value -= 64; |
| 285 | 285 | ||
| 286 | constexpr s32 size = 8; | 286 | constexpr static s32 size = 8; |
| 287 | 287 | ||
| 288 | const s32 mask = (1 << size) - 191; | 288 | const s32 mask = (1 << size) - 191; |
| 289 | 289 | ||
| @@ -307,7 +307,7 @@ bool VP9::WriteLessThan(VpxRangeEncoder& writer, s32 value, s32 test) { | |||
| 307 | void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode, | 307 | void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode, |
| 308 | const std::array<u8, 1728>& new_prob, | 308 | const std::array<u8, 1728>& new_prob, |
| 309 | const std::array<u8, 1728>& old_prob) { | 309 | const std::array<u8, 1728>& old_prob) { |
| 310 | constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3; | 310 | constexpr static u32 block_bytes = 2 * 2 * 6 * 6 * 3; |
| 311 | 311 | ||
| 312 | const auto needs_update = [&](u32 base_index) { | 312 | const auto needs_update = [&](u32 base_index) { |
| 313 | return !std::equal(new_prob.begin() + base_index, | 313 | return !std::equal(new_prob.begin() + base_index, |
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 00ce53e3e..c9b482bbe 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h | |||
| @@ -281,7 +281,7 @@ public: | |||
| 281 | explicit HostCounterBase(std::shared_ptr<HostCounter> dependency_) | 281 | explicit HostCounterBase(std::shared_ptr<HostCounter> dependency_) |
| 282 | : dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} { | 282 | : dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} { |
| 283 | // Avoid nesting too many dependencies to avoid a stack overflow when these are deleted. | 283 | // Avoid nesting too many dependencies to avoid a stack overflow when these are deleted. |
| 284 | constexpr u64 depth_threshold = 96; | 284 | constexpr static u64 depth_threshold = 96; |
| 285 | if (depth > depth_threshold) { | 285 | if (depth > depth_threshold) { |
| 286 | depth = 0; | 286 | depth = 0; |
| 287 | base_result = dependency->Query(); | 287 | base_result = dependency->Query(); |
diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index 1a0cea9b7..e49b04975 100644 --- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp | |||
| @@ -162,7 +162,8 @@ void ComputePipeline::Configure() { | |||
| 162 | buffer_cache.UnbindComputeTextureBuffers(); | 162 | buffer_cache.UnbindComputeTextureBuffers(); |
| 163 | size_t texbuf_index{}; | 163 | size_t texbuf_index{}; |
| 164 | const auto add_buffer{[&](const auto& desc) { | 164 | const auto add_buffer{[&](const auto& desc) { |
| 165 | constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | 165 | constexpr static bool is_image = |
| 166 | std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | ||
| 166 | for (u32 i = 0; i < desc.count; ++i) { | 167 | for (u32 i = 0; i < desc.count; ++i) { |
| 167 | bool is_written{false}; | 168 | bool is_written{false}; |
| 168 | if constexpr (is_image) { | 169 | if constexpr (is_image) { |
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 22ed16ebf..a5e27de73 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -126,9 +126,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) { | |||
| 126 | const bool is_intel = vendor_name == "Intel"; | 126 | const bool is_intel = vendor_name == "Intel"; |
| 127 | 127 | ||
| 128 | #ifdef __unix__ | 128 | #ifdef __unix__ |
| 129 | constexpr bool is_linux = true; | 129 | constexpr static bool is_linux = true; |
| 130 | #else | 130 | #else |
| 131 | constexpr bool is_linux = false; | 131 | constexpr static bool is_linux = false; |
| 132 | #endif | 132 | #endif |
| 133 | 133 | ||
| 134 | bool disable_fast_buffer_sub_data = false; | 134 | bool disable_fast_buffer_sub_data = false; |
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 29491e762..c409d6ae7 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | |||
| @@ -385,7 +385,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 385 | const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { | 385 | const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { |
| 386 | size_t index{}; | 386 | size_t index{}; |
| 387 | const auto add_buffer{[&](const auto& desc) { | 387 | const auto add_buffer{[&](const auto& desc) { |
| 388 | constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | 388 | constexpr static bool is_image = |
| 389 | std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | ||
| 389 | for (u32 i = 0; i < desc.count; ++i) { | 390 | for (u32 i = 0; i < desc.count; ++i) { |
| 390 | bool is_written{false}; | 391 | bool is_written{false}; |
| 391 | if constexpr (is_image) { | 392 | if constexpr (is_image) { |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 2a74c1d05..5d25b8a7d 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -237,7 +237,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf | |||
| 237 | screen_info.display_texture = screen_info.texture.resource.handle; | 237 | screen_info.display_texture = screen_info.texture.resource.handle; |
| 238 | 238 | ||
| 239 | // TODO(Rodrigo): Read this from HLE | 239 | // TODO(Rodrigo): Read this from HLE |
| 240 | constexpr u32 block_height_log2 = 4; | 240 | constexpr static u32 block_height_log2 = 4; |
| 241 | const auto pixel_format{ | 241 | const auto pixel_format{ |
| 242 | VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)}; | 242 | VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)}; |
| 243 | const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)}; | 243 | const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)}; |
| @@ -375,7 +375,7 @@ void RendererOpenGL::AddTelemetryFields() { | |||
| 375 | LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor); | 375 | LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor); |
| 376 | LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); | 376 | LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); |
| 377 | 377 | ||
| 378 | constexpr auto user_system = Common::Telemetry::FieldType::UserSystem; | 378 | constexpr static auto user_system = Common::Telemetry::FieldType::UserSystem; |
| 379 | telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor)); | 379 | telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor)); |
| 380 | telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model)); | 380 | telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model)); |
| 381 | telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version)); | 381 | telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version)); |
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index cf2964a3f..334087119 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp | |||
| @@ -358,8 +358,9 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) { | |||
| 358 | 358 | ||
| 359 | void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, | 359 | void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, |
| 360 | VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { | 360 | VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { |
| 361 | constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | | 361 | constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | |
| 362 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT}; | 362 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | |
| 363 | VK_ACCESS_SHADER_READ_BIT}; | ||
| 363 | const VkImageMemoryBarrier barrier{ | 364 | const VkImageMemoryBarrier barrier{ |
| 364 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, | 365 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, |
| 365 | .pNext = nullptr, | 366 | .pNext = nullptr, |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 2f0cc27e8..34a86a407 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -175,7 +175,7 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, | |||
| 175 | const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr); | 175 | const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr); |
| 176 | 176 | ||
| 177 | // TODO(Rodrigo): Read this from HLE | 177 | // TODO(Rodrigo): Read this from HLE |
| 178 | constexpr u32 block_height_log2 = 4; | 178 | constexpr static u32 block_height_log2 = 4; |
| 179 | const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); | 179 | const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); |
| 180 | const u64 linear_size{GetSizeInBytes(framebuffer)}; | 180 | const u64 linear_size{GetSizeInBytes(framebuffer)}; |
| 181 | const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, | 181 | const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, |
| @@ -1482,7 +1482,7 @@ u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) | |||
| 1482 | 1482 | ||
| 1483 | u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer, | 1483 | u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer, |
| 1484 | std::size_t image_index) const { | 1484 | std::size_t image_index) const { |
| 1485 | constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData)); | 1485 | constexpr static auto first_image_offset = static_cast<u64>(sizeof(BufferData)); |
| 1486 | return first_image_offset + GetSizeInBytes(framebuffer) * image_index; | 1486 | return first_image_offset + GetSizeInBytes(framebuffer) * image_index; |
| 1487 | } | 1487 | } |
| 1488 | 1488 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 2a0f0dbf0..326260b41 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -172,7 +172,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, | |||
| 172 | buffer_cache.UnbindComputeTextureBuffers(); | 172 | buffer_cache.UnbindComputeTextureBuffers(); |
| 173 | size_t index{}; | 173 | size_t index{}; |
| 174 | const auto add_buffer{[&](const auto& desc) { | 174 | const auto add_buffer{[&](const auto& desc) { |
| 175 | constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | 175 | constexpr static bool is_image = |
| 176 | std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | ||
| 176 | for (u32 i = 0; i < desc.count; ++i) { | 177 | for (u32 i = 0; i < desc.count; ++i) { |
| 177 | bool is_written{false}; | 178 | bool is_written{false}; |
| 178 | if constexpr (is_image) { | 179 | if constexpr (is_image) { |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index baedc4424..bdab00597 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -398,7 +398,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 398 | const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { | 398 | const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { |
| 399 | size_t index{}; | 399 | size_t index{}; |
| 400 | const auto add_buffer{[&](const auto& desc) { | 400 | const auto add_buffer{[&](const auto& desc) { |
| 401 | constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | 401 | constexpr static bool is_image = |
| 402 | std::is_same_v<decltype(desc), const ImageBufferDescriptor&>; | ||
| 402 | for (u32 i = 0; i < desc.count; ++i) { | 403 | for (u32 i = 0; i < desc.count; ++i) { |
| 403 | bool is_written{false}; | 404 | bool is_written{false}; |
| 404 | if constexpr (is_image) { | 405 | if constexpr (is_image) { |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 719edbcfb..3d50f8edb 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -1109,9 +1109,9 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re | |||
| 1109 | if (!state_tracker.TouchDepthBiasEnable()) { | 1109 | if (!state_tracker.TouchDepthBiasEnable()) { |
| 1110 | return; | 1110 | return; |
| 1111 | } | 1111 | } |
| 1112 | constexpr size_t POINT = 0; | 1112 | constexpr static size_t POINT = 0; |
| 1113 | constexpr size_t LINE = 1; | 1113 | constexpr static size_t LINE = 1; |
| 1114 | constexpr size_t POLYGON = 2; | 1114 | constexpr static size_t POLYGON = 2; |
| 1115 | static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = { | 1115 | static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = { |
| 1116 | POINT, // Points | 1116 | POINT, // Points |
| 1117 | LINE, // Lines | 1117 | LINE, // Lines |
diff --git a/src/video_core/renderer_vulkan/vk_smaa.cpp b/src/video_core/renderer_vulkan/vk_smaa.cpp index 8eb735489..1cd354003 100644 --- a/src/video_core/renderer_vulkan/vk_smaa.cpp +++ b/src/video_core/renderer_vulkan/vk_smaa.cpp | |||
| @@ -55,8 +55,9 @@ std::pair<vk::Image, MemoryCommit> CreateWrappedImage(const Device& device, | |||
| 55 | 55 | ||
| 56 | void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, | 56 | void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, |
| 57 | VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { | 57 | VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { |
| 58 | constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | | 58 | constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | |
| 59 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT}; | 59 | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | |
| 60 | VK_ACCESS_SHADER_READ_BIT}; | ||
| 60 | const VkImageMemoryBarrier barrier{ | 61 | const VkImageMemoryBarrier barrier{ |
| 61 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, | 62 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, |
| 62 | .pNext = nullptr, | 63 | .pNext = nullptr, |
| @@ -152,7 +153,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) { | |||
| 152 | .finalLayout = VK_IMAGE_LAYOUT_GENERAL, | 153 | .finalLayout = VK_IMAGE_LAYOUT_GENERAL, |
| 153 | }; | 154 | }; |
| 154 | 155 | ||
| 155 | constexpr VkAttachmentReference color_attachment_ref{ | 156 | constexpr static VkAttachmentReference color_attachment_ref{ |
| 156 | .attachment = 0, | 157 | .attachment = 0, |
| 157 | .layout = VK_IMAGE_LAYOUT_GENERAL, | 158 | .layout = VK_IMAGE_LAYOUT_GENERAL, |
| 158 | }; | 159 | }; |
| @@ -170,7 +171,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) { | |||
| 170 | .pPreserveAttachments = nullptr, | 171 | .pPreserveAttachments = nullptr, |
| 171 | }; | 172 | }; |
| 172 | 173 | ||
| 173 | constexpr VkSubpassDependency dependency{ | 174 | constexpr static VkSubpassDependency dependency{ |
| 174 | .srcSubpass = VK_SUBPASS_EXTERNAL, | 175 | .srcSubpass = VK_SUBPASS_EXTERNAL, |
| 175 | .dstSubpass = 0, | 176 | .dstSubpass = 0, |
| 176 | .srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, | 177 | .srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, |
| @@ -328,7 +329,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 328 | }, | 329 | }, |
| 329 | }}; | 330 | }}; |
| 330 | 331 | ||
| 331 | constexpr VkPipelineVertexInputStateCreateInfo vertex_input_ci{ | 332 | constexpr static VkPipelineVertexInputStateCreateInfo vertex_input_ci{ |
| 332 | .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, | 333 | .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, |
| 333 | .pNext = nullptr, | 334 | .pNext = nullptr, |
| 334 | .flags = 0, | 335 | .flags = 0, |
| @@ -338,7 +339,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 338 | .pVertexAttributeDescriptions = nullptr, | 339 | .pVertexAttributeDescriptions = nullptr, |
| 339 | }; | 340 | }; |
| 340 | 341 | ||
| 341 | constexpr VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{ | 342 | constexpr static VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{ |
| 342 | .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, | 343 | .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, |
| 343 | .pNext = nullptr, | 344 | .pNext = nullptr, |
| 344 | .flags = 0, | 345 | .flags = 0, |
| @@ -346,7 +347,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 346 | .primitiveRestartEnable = VK_FALSE, | 347 | .primitiveRestartEnable = VK_FALSE, |
| 347 | }; | 348 | }; |
| 348 | 349 | ||
| 349 | constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{ | 350 | constexpr static VkPipelineViewportStateCreateInfo viewport_state_ci{ |
| 350 | .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, | 351 | .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, |
| 351 | .pNext = nullptr, | 352 | .pNext = nullptr, |
| 352 | .flags = 0, | 353 | .flags = 0, |
| @@ -356,7 +357,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 356 | .pScissors = nullptr, | 357 | .pScissors = nullptr, |
| 357 | }; | 358 | }; |
| 358 | 359 | ||
| 359 | constexpr VkPipelineRasterizationStateCreateInfo rasterization_ci{ | 360 | constexpr static VkPipelineRasterizationStateCreateInfo rasterization_ci{ |
| 360 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | 361 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, |
| 361 | .pNext = nullptr, | 362 | .pNext = nullptr, |
| 362 | .flags = 0, | 363 | .flags = 0, |
| @@ -372,7 +373,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 372 | .lineWidth = 1.0f, | 373 | .lineWidth = 1.0f, |
| 373 | }; | 374 | }; |
| 374 | 375 | ||
| 375 | constexpr VkPipelineMultisampleStateCreateInfo multisampling_ci{ | 376 | constexpr static VkPipelineMultisampleStateCreateInfo multisampling_ci{ |
| 376 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, | 377 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, |
| 377 | .pNext = nullptr, | 378 | .pNext = nullptr, |
| 378 | .flags = 0, | 379 | .flags = 0, |
| @@ -384,7 +385,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 384 | .alphaToOneEnable = VK_FALSE, | 385 | .alphaToOneEnable = VK_FALSE, |
| 385 | }; | 386 | }; |
| 386 | 387 | ||
| 387 | constexpr VkPipelineColorBlendAttachmentState color_blend_attachment{ | 388 | constexpr static VkPipelineColorBlendAttachmentState color_blend_attachment{ |
| 388 | .blendEnable = VK_FALSE, | 389 | .blendEnable = VK_FALSE, |
| 389 | .srcColorBlendFactor = VK_BLEND_FACTOR_ZERO, | 390 | .srcColorBlendFactor = VK_BLEND_FACTOR_ZERO, |
| 390 | .dstColorBlendFactor = VK_BLEND_FACTOR_ZERO, | 391 | .dstColorBlendFactor = VK_BLEND_FACTOR_ZERO, |
| @@ -407,7 +408,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp | |||
| 407 | .blendConstants = {0.0f, 0.0f, 0.0f, 0.0f}, | 408 | .blendConstants = {0.0f, 0.0f, 0.0f, 0.0f}, |
| 408 | }; | 409 | }; |
| 409 | 410 | ||
| 410 | constexpr std::array dynamic_states{ | 411 | constexpr static std::array dynamic_states{ |
| 411 | VK_DYNAMIC_STATE_VIEWPORT, | 412 | VK_DYNAMIC_STATE_VIEWPORT, |
| 412 | VK_DYNAMIC_STATE_SCISSOR, | 413 | VK_DYNAMIC_STATE_SCISSOR, |
| 413 | }; | 414 | }; |
| @@ -468,7 +469,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo> | |||
| 468 | } | 469 | } |
| 469 | 470 | ||
| 470 | void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) { | 471 | void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) { |
| 471 | constexpr std::array<VkImageSubresourceRange, 1> subresources{{{ | 472 | constexpr static std::array<VkImageSubresourceRange, 1> subresources{{{ |
| 472 | .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, | 473 | .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, |
| 473 | .baseMipLevel = 0, | 474 | .baseMipLevel = 0, |
| 474 | .levelCount = 1, | 475 | .levelCount = 1, |
| @@ -528,8 +529,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count, | |||
| 528 | } | 529 | } |
| 529 | 530 | ||
| 530 | void SMAA::CreateImages() { | 531 | void SMAA::CreateImages() { |
| 531 | constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; | 532 | constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; |
| 532 | constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; | 533 | constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; |
| 533 | 534 | ||
| 534 | std::tie(m_static_images[Area], m_static_buffer_commits[Area]) = | 535 | std::tie(m_static_images[Area], m_static_buffer_commits[Area]) = |
| 535 | CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM); | 536 | CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM); |
| @@ -586,12 +587,12 @@ void SMAA::CreateSampler() { | |||
| 586 | 587 | ||
| 587 | void SMAA::CreateShaders() { | 588 | void SMAA::CreateShaders() { |
| 588 | // These match the order of the SMAAStage enum | 589 | // These match the order of the SMAAStage enum |
| 589 | constexpr std::array vert_shader_sources{ | 590 | constexpr static std::array vert_shader_sources{ |
| 590 | ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV), | 591 | ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV), |
| 591 | ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV), | 592 | ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV), |
| 592 | ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV), | 593 | ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV), |
| 593 | }; | 594 | }; |
| 594 | constexpr std::array frag_shader_sources{ | 595 | constexpr static std::array frag_shader_sources{ |
| 595 | ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV), | 596 | ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV), |
| 596 | ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV), | 597 | ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV), |
| 597 | ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV), | 598 | ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV), |
| @@ -675,8 +676,8 @@ void SMAA::UploadImages(Scheduler& scheduler) { | |||
| 675 | return; | 676 | return; |
| 676 | } | 677 | } |
| 677 | 678 | ||
| 678 | constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; | 679 | constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; |
| 679 | constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; | 680 | constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; |
| 680 | 681 | ||
| 681 | UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent, | 682 | UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent, |
| 682 | VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes)); | 683 | VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes)); |
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp index 74ca77216..172b6ed95 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | |||
| @@ -299,7 +299,7 @@ void StagingBufferPool::ReleaseCache(MemoryUsage usage) { | |||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) { | 301 | void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) { |
| 302 | constexpr size_t deletions_per_tick = 16; | 302 | constexpr static size_t deletions_per_tick = 16; |
| 303 | auto& staging = cache[log2]; | 303 | auto& staging = cache[log2]; |
| 304 | auto& entries = staging.entries; | 304 | auto& entries = staging.entries; |
| 305 | const size_t old_size = entries.size(); | 305 | const size_t old_size = entries.size(); |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index b6810eef9..0b24a98eb 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -53,7 +53,7 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { | |||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) { | 55 | VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) { |
| 56 | constexpr auto undefined_size{std::numeric_limits<u32>::max()}; | 56 | constexpr static auto undefined_size{std::numeric_limits<u32>::max()}; |
| 57 | if (capabilities.currentExtent.width != undefined_size) { | 57 | if (capabilities.currentExtent.width != undefined_size) { |
| 58 | return capabilities.currentExtent; | 58 | return capabilities.currentExtent; |
| 59 | } | 59 | } |
diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp index c42594149..38c7e533d 100644 --- a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp +++ b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp | |||
| @@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) { | |||
| 48 | auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal); | 48 | auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal); |
| 49 | 49 | ||
| 50 | // Create the descriptor pool to contain our descriptor. | 50 | // Create the descriptor pool to contain our descriptor. |
| 51 | constexpr VkDescriptorPoolSize pool_size{ | 51 | constexpr static VkDescriptorPoolSize pool_size{ |
| 52 | .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, | 52 | .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 53 | .descriptorCount = 1, | 53 | .descriptorCount = 1, |
| 54 | }; | 54 | }; |
| @@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) { | |||
| 63 | }); | 63 | }); |
| 64 | 64 | ||
| 65 | // Create the descriptor set layout from the pool. | 65 | // Create the descriptor set layout from the pool. |
| 66 | constexpr VkDescriptorSetLayoutBinding layout_binding{ | 66 | constexpr static VkDescriptorSetLayoutBinding layout_binding{ |
| 67 | .binding = 0, | 67 | .binding = 0, |
| 68 | .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, | 68 | .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 69 | .descriptorCount = 1, | 69 | .descriptorCount = 1, |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 1a76d4178..e69855cad 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -371,7 +371,7 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { | |||
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) { | 373 | u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) { |
| 374 | constexpr u64 RGBA8_PIXEL_SIZE = 4; | 374 | constexpr static u64 RGBA8_PIXEL_SIZE = 4; |
| 375 | const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) * | 375 | const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) * |
| 376 | static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE; | 376 | static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE; |
| 377 | return (base_size * base_block_size) / BytesPerBlock(format); | 377 | return (base_size * base_block_size) / BytesPerBlock(format); |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 59120cd09..436f228b3 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) { | |||
| 29 | 29 | ||
| 30 | template <u32 mask, u32 incr_amount> | 30 | template <u32 mask, u32 incr_amount> |
| 31 | void incrpdep(u32& value) { | 31 | void incrpdep(u32& value) { |
| 32 | constexpr u32 swizzled_incr = pdep<mask>(incr_amount); | 32 | constexpr static u32 swizzled_incr = pdep<mask>(incr_amount); |
| 33 | value = ((value | ~mask) + swizzled_incr) & mask; | 33 | value = ((value | ~mask) + swizzled_incr) & mask; |
| 34 | } | 34 | } |
| 35 | 35 | ||
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 486d4dfaf..7efe83c9a 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp | |||
| @@ -495,9 +495,9 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffe | |||
| 495 | Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions, | 495 | Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions, |
| 496 | InstanceDispatch& dispatch) { | 496 | InstanceDispatch& dispatch) { |
| 497 | #ifdef __APPLE__ | 497 | #ifdef __APPLE__ |
| 498 | constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}; | 498 | constexpr static VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}; |
| 499 | #else | 499 | #else |
| 500 | constexpr VkFlags ci_flags{}; | 500 | constexpr static VkFlags ci_flags{}; |
| 501 | #endif | 501 | #endif |
| 502 | 502 | ||
| 503 | const VkApplicationInfo application_info{ | 503 | const VkApplicationInfo application_info{ |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d65991734..c2b144b78 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -720,7 +720,7 @@ void GRenderWindow::TouchEndEvent() { | |||
| 720 | 720 | ||
| 721 | void GRenderWindow::InitializeCamera() { | 721 | void GRenderWindow::InitializeCamera() { |
| 722 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | 722 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA |
| 723 | constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) | 723 | constexpr static auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) |
| 724 | if (!Settings::values.enable_ir_sensor) { | 724 | if (!Settings::values.enable_ir_sensor) { |
| 725 | return; | 725 | return; |
| 726 | } | 726 | } |
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index c287220fc..fa8afc2d9 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp | |||
| @@ -317,9 +317,9 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center) | |||
| 317 | 317 | ||
| 318 | // D-pad constants | 318 | // D-pad constants |
| 319 | const QPointF dpad_center = center + QPoint(9, 14); | 319 | const QPointF dpad_center = center + QPoint(9, 14); |
| 320 | constexpr int dpad_distance = 23; | 320 | constexpr static int dpad_distance = 23; |
| 321 | constexpr int dpad_radius = 11; | 321 | constexpr static int dpad_radius = 11; |
| 322 | constexpr float dpad_arrow_size = 1.2f; | 322 | constexpr static float dpad_arrow_size = 1.2f; |
| 323 | 323 | ||
| 324 | // D-pad buttons | 324 | // D-pad buttons |
| 325 | p.setPen(colors.outline); | 325 | p.setPen(colors.outline); |
| @@ -439,9 +439,9 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center | |||
| 439 | 439 | ||
| 440 | // Face buttons constants | 440 | // Face buttons constants |
| 441 | const QPointF face_center = center + QPoint(-9, -73); | 441 | const QPointF face_center = center + QPoint(-9, -73); |
| 442 | constexpr int face_distance = 23; | 442 | constexpr static int face_distance = 23; |
| 443 | constexpr int face_radius = 11; | 443 | constexpr static int face_radius = 11; |
| 444 | constexpr float text_size = 1.1f; | 444 | constexpr static float text_size = 1.1f; |
| 445 | 445 | ||
| 446 | // Face buttons | 446 | // Face buttons |
| 447 | p.setPen(colors.outline); | 447 | p.setPen(colors.outline); |
| @@ -559,9 +559,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) | |||
| 559 | 559 | ||
| 560 | // Face buttons constants | 560 | // Face buttons constants |
| 561 | const QPointF face_center = center + QPoint(65, -65); | 561 | const QPointF face_center = center + QPoint(65, -65); |
| 562 | constexpr int face_distance = 20; | 562 | constexpr static int face_distance = 20; |
| 563 | constexpr int face_radius = 10; | 563 | constexpr static int face_radius = 10; |
| 564 | constexpr float text_size = 1.0f; | 564 | constexpr static float text_size = 1.0f; |
| 565 | 565 | ||
| 566 | // Face buttons | 566 | // Face buttons |
| 567 | p.setPen(colors.outline); | 567 | p.setPen(colors.outline); |
| @@ -581,9 +581,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) | |||
| 581 | 581 | ||
| 582 | // D-pad constants | 582 | // D-pad constants |
| 583 | const QPointF dpad_center = center + QPoint(-65, 12); | 583 | const QPointF dpad_center = center + QPoint(-65, 12); |
| 584 | constexpr int dpad_distance = 20; | 584 | constexpr static int dpad_distance = 20; |
| 585 | constexpr int dpad_radius = 10; | 585 | constexpr static int dpad_radius = 10; |
| 586 | constexpr float dpad_arrow_size = 1.1f; | 586 | constexpr static float dpad_arrow_size = 1.1f; |
| 587 | 587 | ||
| 588 | // D-pad buttons | 588 | // D-pad buttons |
| 589 | p.setPen(colors.outline); | 589 | p.setPen(colors.outline); |
| @@ -651,9 +651,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 651 | 651 | ||
| 652 | // Face buttons constants | 652 | // Face buttons constants |
| 653 | const QPointF face_center = center + QPoint(171, -41); | 653 | const QPointF face_center = center + QPoint(171, -41); |
| 654 | constexpr float face_distance = 12.8f; | 654 | constexpr static float face_distance = 12.8f; |
| 655 | constexpr float face_radius = 6.4f; | 655 | constexpr static float face_radius = 6.4f; |
| 656 | constexpr float text_size = 0.6f; | 656 | constexpr static float text_size = 0.6f; |
| 657 | 657 | ||
| 658 | // Face buttons | 658 | // Face buttons |
| 659 | p.setPen(colors.outline); | 659 | p.setPen(colors.outline); |
| @@ -673,9 +673,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 673 | 673 | ||
| 674 | // D-pad constants | 674 | // D-pad constants |
| 675 | const QPointF dpad_center = center + QPoint(-171, 8); | 675 | const QPointF dpad_center = center + QPoint(-171, 8); |
| 676 | constexpr float dpad_distance = 12.8f; | 676 | constexpr static float dpad_distance = 12.8f; |
| 677 | constexpr float dpad_radius = 6.4f; | 677 | constexpr static float dpad_radius = 6.4f; |
| 678 | constexpr float dpad_arrow_size = 0.68f; | 678 | constexpr static float dpad_arrow_size = 0.68f; |
| 679 | 679 | ||
| 680 | // D-pad buttons | 680 | // D-pad buttons |
| 681 | p.setPen(colors.outline); | 681 | p.setPen(colors.outline); |
| @@ -754,9 +754,9 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) | |||
| 754 | 754 | ||
| 755 | // Face buttons constants | 755 | // Face buttons constants |
| 756 | const QPointF face_center = center + QPoint(105, -56); | 756 | const QPointF face_center = center + QPoint(105, -56); |
| 757 | constexpr int face_distance = 31; | 757 | constexpr static int face_distance = 31; |
| 758 | constexpr int face_radius = 15; | 758 | constexpr static int face_radius = 15; |
| 759 | constexpr float text_size = 1.5f; | 759 | constexpr static float text_size = 1.5f; |
| 760 | 760 | ||
| 761 | // Face buttons | 761 | // Face buttons |
| 762 | p.setPen(colors.outline); | 762 | p.setPen(colors.outline); |
| @@ -846,7 +846,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) { | |||
| 846 | using namespace Settings::NativeButton; | 846 | using namespace Settings::NativeButton; |
| 847 | 847 | ||
| 848 | // Face buttons constants | 848 | // Face buttons constants |
| 849 | constexpr float text_size = 1.1f; | 849 | constexpr static float text_size = 1.1f; |
| 850 | 850 | ||
| 851 | // Face buttons | 851 | // Face buttons |
| 852 | p.setPen(colors.outline); | 852 | p.setPen(colors.outline); |
| @@ -1497,7 +1497,7 @@ void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) { | |||
| 1497 | std::array<QPointF, pro_left_handle.size() / 2> qleft_handle; | 1497 | std::array<QPointF, pro_left_handle.size() / 2> qleft_handle; |
| 1498 | std::array<QPointF, pro_left_handle.size() / 2> qright_handle; | 1498 | std::array<QPointF, pro_left_handle.size() / 2> qright_handle; |
| 1499 | std::array<QPointF, pro_body.size()> qbody; | 1499 | std::array<QPointF, pro_body.size()> qbody; |
| 1500 | constexpr int radius1 = 32; | 1500 | constexpr static int radius1 = 32; |
| 1501 | 1501 | ||
| 1502 | for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { | 1502 | for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { |
| 1503 | const float left_x = pro_left_handle[point * 2 + 0]; | 1503 | const float left_x = pro_left_handle[point * 2 + 0]; |
| @@ -1539,7 +1539,7 @@ void PlayerControlPreview::DrawGCBody(QPainter& p, const QPointF center) { | |||
| 1539 | std::array<QPointF, gc_body.size()> qbody; | 1539 | std::array<QPointF, gc_body.size()> qbody; |
| 1540 | std::array<QPointF, 8> left_hex; | 1540 | std::array<QPointF, 8> left_hex; |
| 1541 | std::array<QPointF, 8> right_hex; | 1541 | std::array<QPointF, 8> right_hex; |
| 1542 | constexpr float angle = 2 * 3.1415f / 8; | 1542 | constexpr static float angle = 2 * 3.1415f / 8; |
| 1543 | 1543 | ||
| 1544 | for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) { | 1544 | for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) { |
| 1545 | const float body_x = gc_left_body[point * 2 + 0]; | 1545 | const float body_x = gc_left_body[point * 2 + 0]; |
| @@ -1676,9 +1676,9 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) { | |||
| 1676 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview; | 1676 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview; |
| 1677 | std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview; | 1677 | std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview; |
| 1678 | std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview; | 1678 | std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview; |
| 1679 | constexpr float size = 1.61f; | 1679 | constexpr static float size = 1.61f; |
| 1680 | constexpr float size2 = 0.9f; | 1680 | constexpr static float size2 = 0.9f; |
| 1681 | constexpr float offset = 209.3f; | 1681 | constexpr static float offset = 209.3f; |
| 1682 | 1682 | ||
| 1683 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { | 1683 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { |
| 1684 | const float body_x = left_joycon_body[point * 2 + 0]; | 1684 | const float body_x = left_joycon_body[point * 2 + 0]; |
| @@ -1767,10 +1767,10 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) { | |||
| 1767 | std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider; | 1767 | std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider; |
| 1768 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qleft_joycon_slider_topview; | 1768 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qleft_joycon_slider_topview; |
| 1769 | std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview; | 1769 | std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview; |
| 1770 | constexpr float size = 1.78f; | 1770 | constexpr static float size = 1.78f; |
| 1771 | constexpr float size2 = 1.1115f; | 1771 | constexpr static float size2 = 1.1115f; |
| 1772 | constexpr float offset = 312.39f; | 1772 | constexpr static float offset = 312.39f; |
| 1773 | constexpr float offset2 = 335; | 1773 | constexpr static float offset2 = 335; |
| 1774 | 1774 | ||
| 1775 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { | 1775 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { |
| 1776 | left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset, | 1776 | left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset, |
| @@ -1867,10 +1867,10 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) { | |||
| 1867 | std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider; | 1867 | std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider; |
| 1868 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview; | 1868 | std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview; |
| 1869 | std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview; | 1869 | std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview; |
| 1870 | constexpr float size = 1.78f; | 1870 | constexpr static float size = 1.78f; |
| 1871 | constexpr float size2 = 1.1115f; | 1871 | constexpr static float size2 = 1.1115f; |
| 1872 | constexpr float offset = 312.39f; | 1872 | constexpr static float offset = 312.39f; |
| 1873 | constexpr float offset2 = 335; | 1873 | constexpr static float offset2 = 335; |
| 1874 | 1874 | ||
| 1875 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { | 1875 | for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { |
| 1876 | right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset, | 1876 | right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset, |
| @@ -2068,8 +2068,8 @@ void PlayerControlPreview::DrawDualTriggers(QPainter& p, const QPointF center, | |||
| 2068 | const Common::Input::ButtonStatus& right_pressed) { | 2068 | const Common::Input::ButtonStatus& right_pressed) { |
| 2069 | std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger; | 2069 | std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger; |
| 2070 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; | 2070 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; |
| 2071 | constexpr float size = 1.62f; | 2071 | constexpr static float size = 1.62f; |
| 2072 | constexpr float offset = 210.6f; | 2072 | constexpr static float offset = 210.6f; |
| 2073 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { | 2073 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { |
| 2074 | const float left_trigger_x = left_joycon_trigger[point * 2 + 0]; | 2074 | const float left_trigger_x = left_joycon_trigger[point * 2 + 0]; |
| 2075 | const float left_trigger_y = left_joycon_trigger[point * 2 + 1]; | 2075 | const float left_trigger_y = left_joycon_trigger[point * 2 + 1]; |
| @@ -2097,7 +2097,7 @@ void PlayerControlPreview::DrawDualTriggersTopView( | |||
| 2097 | const Common::Input::ButtonStatus& right_pressed) { | 2097 | const Common::Input::ButtonStatus& right_pressed) { |
| 2098 | std::array<QPointF, left_joystick_L_topview.size() / 2> qleft_trigger; | 2098 | std::array<QPointF, left_joystick_L_topview.size() / 2> qleft_trigger; |
| 2099 | std::array<QPointF, left_joystick_L_topview.size() / 2> qright_trigger; | 2099 | std::array<QPointF, left_joystick_L_topview.size() / 2> qright_trigger; |
| 2100 | constexpr float size = 0.9f; | 2100 | constexpr static float size = 0.9f; |
| 2101 | 2101 | ||
| 2102 | for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { | 2102 | for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { |
| 2103 | const float top_view_x = left_joystick_L_topview[point * 2 + 0]; | 2103 | const float top_view_x = left_joystick_L_topview[point * 2 + 0]; |
| @@ -2134,7 +2134,7 @@ void PlayerControlPreview::DrawDualZTriggersTopView( | |||
| 2134 | const Common::Input::ButtonStatus& right_pressed) { | 2134 | const Common::Input::ButtonStatus& right_pressed) { |
| 2135 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qleft_trigger; | 2135 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qleft_trigger; |
| 2136 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qright_trigger; | 2136 | std::array<QPointF, left_joystick_ZL_topview.size() / 2> qright_trigger; |
| 2137 | constexpr float size = 0.9f; | 2137 | constexpr static float size = 0.9f; |
| 2138 | 2138 | ||
| 2139 | for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) { | 2139 | for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) { |
| 2140 | qleft_trigger[point] = | 2140 | qleft_trigger[point] = |
| @@ -2167,8 +2167,8 @@ void PlayerControlPreview::DrawDualZTriggersTopView( | |||
| 2167 | void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center, | 2167 | void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center, |
| 2168 | const Common::Input::ButtonStatus& left_pressed) { | 2168 | const Common::Input::ButtonStatus& left_pressed) { |
| 2169 | std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger; | 2169 | std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger; |
| 2170 | constexpr float size = 1.78f; | 2170 | constexpr static float size = 1.78f; |
| 2171 | constexpr float offset = 311.5f; | 2171 | constexpr static float offset = 311.5f; |
| 2172 | 2172 | ||
| 2173 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { | 2173 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { |
| 2174 | qleft_trigger[point] = center + QPointF(left_joycon_trigger[point * 2] * size + offset, | 2174 | qleft_trigger[point] = center + QPointF(left_joycon_trigger[point * 2] * size + offset, |
| @@ -2184,8 +2184,8 @@ void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center, | |||
| 2184 | void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center, | 2184 | void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center, |
| 2185 | const Common::Input::ButtonStatus& left_pressed) { | 2185 | const Common::Input::ButtonStatus& left_pressed) { |
| 2186 | std::array<QPointF, left_joycon_sideview_zl.size() / 2> qleft_trigger; | 2186 | std::array<QPointF, left_joycon_sideview_zl.size() / 2> qleft_trigger; |
| 2187 | constexpr float size = 1.1115f; | 2187 | constexpr static float size = 1.1115f; |
| 2188 | constexpr float offset2 = 335; | 2188 | constexpr static float offset2 = 335; |
| 2189 | 2189 | ||
| 2190 | for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { | 2190 | for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { |
| 2191 | qleft_trigger[point] = center + QPointF(left_joycon_sideview_zl[point * 2] * size + offset2, | 2191 | qleft_trigger[point] = center + QPointF(left_joycon_sideview_zl[point * 2] * size + offset2, |
| @@ -2241,8 +2241,8 @@ void PlayerControlPreview::DrawLeftZTriggersTopView( | |||
| 2241 | void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, | 2241 | void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, |
| 2242 | const Common::Input::ButtonStatus& right_pressed) { | 2242 | const Common::Input::ButtonStatus& right_pressed) { |
| 2243 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; | 2243 | std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger; |
| 2244 | constexpr float size = 1.78f; | 2244 | constexpr static float size = 1.78f; |
| 2245 | constexpr float offset = 311.5f; | 2245 | constexpr static float offset = 311.5f; |
| 2246 | 2246 | ||
| 2247 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { | 2247 | for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { |
| 2248 | qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset, | 2248 | qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset, |
| @@ -2258,8 +2258,8 @@ void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, | |||
| 2258 | void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center, | 2258 | void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center, |
| 2259 | const Common::Input::ButtonStatus& right_pressed) { | 2259 | const Common::Input::ButtonStatus& right_pressed) { |
| 2260 | std::array<QPointF, left_joycon_sideview_zl.size() / 2> qright_trigger; | 2260 | std::array<QPointF, left_joycon_sideview_zl.size() / 2> qright_trigger; |
| 2261 | constexpr float size = 1.1115f; | 2261 | constexpr static float size = 1.1115f; |
| 2262 | constexpr float offset2 = 335; | 2262 | constexpr static float offset2 = 335; |
| 2263 | 2263 | ||
| 2264 | for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { | 2264 | for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { |
| 2265 | qright_trigger[point] = | 2265 | qright_trigger[point] = |
| @@ -2433,7 +2433,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo | |||
| 2433 | 2433 | ||
| 2434 | void PlayerControlPreview::DrawJoystickProperties( | 2434 | void PlayerControlPreview::DrawJoystickProperties( |
| 2435 | QPainter& p, const QPointF center, const Common::Input::AnalogProperties& properties) { | 2435 | QPainter& p, const QPointF center, const Common::Input::AnalogProperties& properties) { |
| 2436 | constexpr float size = 45.0f; | 2436 | constexpr static float size = 45.0f; |
| 2437 | const float range = size * properties.range; | 2437 | const float range = size * properties.range; |
| 2438 | const float deadzone = size * properties.deadzone; | 2438 | const float deadzone = size * properties.deadzone; |
| 2439 | 2439 | ||
| @@ -2453,7 +2453,7 @@ void PlayerControlPreview::DrawJoystickProperties( | |||
| 2453 | 2453 | ||
| 2454 | void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center, | 2454 | void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center, |
| 2455 | const Common::Input::StickStatus& stick, bool raw) { | 2455 | const Common::Input::StickStatus& stick, bool raw) { |
| 2456 | constexpr float size = 45.0f; | 2456 | constexpr static float size = 45.0f; |
| 2457 | const float range = size * stick.x.properties.range; | 2457 | const float range = size * stick.x.properties.range; |
| 2458 | 2458 | ||
| 2459 | if (raw) { | 2459 | if (raw) { |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 22aa19c56..2e73c2719 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -476,8 +476,8 @@ void GameList::DonePopulating(const QStringList& watch_list) { | |||
| 476 | // Workaround: Add the watch paths in chunks to allow the gui to refresh | 476 | // Workaround: Add the watch paths in chunks to allow the gui to refresh |
| 477 | // This prevents the UI from stalling when a large number of watch paths are added | 477 | // This prevents the UI from stalling when a large number of watch paths are added |
| 478 | // Also artificially caps the watcher to a certain number of directories | 478 | // Also artificially caps the watcher to a certain number of directories |
| 479 | constexpr int LIMIT_WATCH_DIRECTORIES = 5000; | 479 | constexpr static int LIMIT_WATCH_DIRECTORIES = 5000; |
| 480 | constexpr int SLICE_SIZE = 25; | 480 | constexpr static int SLICE_SIZE = 25; |
| 481 | int len = std::min(static_cast<int>(watch_list.size()), LIMIT_WATCH_DIRECTORIES); | 481 | int len = std::min(static_cast<int>(watch_list.size()), LIMIT_WATCH_DIRECTORIES); |
| 482 | for (int i = 0; i < len; i += SLICE_SIZE) { | 482 | for (int i = 0; i < len; i += SLICE_SIZE) { |
| 483 | watcher->addPaths(watch_list.mid(i, i + SLICE_SIZE)); | 483 | watcher->addPaths(watch_list.mid(i, i + SLICE_SIZE)); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 62dfc526a..68abde028 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -219,7 +219,7 @@ static void LogRuntimes() { | |||
| 219 | #ifdef _MSC_VER | 219 | #ifdef _MSC_VER |
| 220 | // It is possible that the name of the dll will change. | 220 | // It is possible that the name of the dll will change. |
| 221 | // vcruntime140.dll is for 2015 and onwards | 221 | // vcruntime140.dll is for 2015 and onwards |
| 222 | constexpr char runtime_dll_name[] = "vcruntime140.dll"; | 222 | constexpr static char runtime_dll_name[] = "vcruntime140.dll"; |
| 223 | UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr); | 223 | UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr); |
| 224 | bool runtime_version_inspection_worked = false; | 224 | bool runtime_version_inspection_worked = false; |
| 225 | if (sz > 0) { | 225 | if (sz > 0) { |
| @@ -4490,8 +4490,8 @@ static void SetHighDPIAttributes() { | |||
| 4490 | 4490 | ||
| 4491 | // Recommended minimum width and height for proper window fit. | 4491 | // Recommended minimum width and height for proper window fit. |
| 4492 | // Any screen with a lower resolution than this will still have a scale of 1. | 4492 | // Any screen with a lower resolution than this will still have a scale of 1. |
| 4493 | constexpr float minimum_width = 1350.0f; | 4493 | constexpr static float minimum_width = 1350.0f; |
| 4494 | constexpr float minimum_height = 900.0f; | 4494 | constexpr static float minimum_height = 900.0f; |
| 4495 | 4495 | ||
| 4496 | const float width_ratio = std::max(1.0f, real_width / minimum_width); | 4496 | const float width_ratio = std::max(1.0f, real_width / minimum_width); |
| 4497 | const float height_ratio = std::max(1.0f, real_height / minimum_height); | 4497 | const float height_ratio = std::max(1.0f, real_height / minimum_height); |