yuzu-emu
/
yuzu
Archived
1
0
Fork 0

remove static from pointer sized or smaller types for aesthetics, change constexpr static to static constexpr for consistency

Signed-off-by: arades79 <scravers@protonmail.com>
This commit is contained in:
arades79 2023-02-14 11:13:47 -05:00
parent 26e44a3be4
commit 683019878f
102 changed files with 300 additions and 307 deletions

View File

@ -132,7 +132,7 @@ void AudioRenderer::CreateSinkStreams() {
}
void AudioRenderer::ThreadFunc() {
constexpr static char name[]{"AudioRenderer"};
static constexpr char name[]{"AudioRenderer"};
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
@ -144,7 +144,7 @@ void AudioRenderer::ThreadFunc() {
mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK);
constexpr static u64 max_process_time{2'304'000ULL};
constexpr u64 max_process_time{2'304'000ULL};
while (true) {
auto message{mailbox->ADSPWaitMessage()};

View File

@ -27,8 +27,8 @@ constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4};
template <typename T>
static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
const DecodeArg& req) {
constexpr static s32 min{std::numeric_limits<s16>::min()};
constexpr static s32 max{std::numeric_limits<s16>::max()};
constexpr s32 min{std::numeric_limits<s16>::min()};
constexpr s32 max{std::numeric_limits<s16>::max()};
if (req.buffer == 0 || req.buffer_size == 0) {
return 0;
@ -101,8 +101,8 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
*/
static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
const DecodeArg& req) {
constexpr static u32 SamplesPerFrame{14};
constexpr static u32 NibblesPerFrame{16};
constexpr u32 SamplesPerFrame{14};
constexpr u32 NibblesPerFrame{16};
if (req.buffer == 0 || req.buffer_size == 0) {
return 0;

View File

@ -20,8 +20,8 @@ namespace AudioCore::AudioRenderer {
void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
std::array<s16, 3>& b_, std::array<s16, 2>& a_,
VoiceState::BiquadFilterState& state, const u32 sample_count) {
constexpr static f64 min{std::numeric_limits<s32>::min()};
constexpr static f64 max{std::numeric_limits<s32>::max()};
constexpr f64 min{std::numeric_limits<s32>::min()};
constexpr f64 max{std::numeric_limits<s32>::max()};
std::array<f64, 3> b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(),
Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(),
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,
static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> input,
std::array<s16, 3>& b, std::array<s16, 2>& a,
VoiceState::BiquadFilterState& state, const u32 sample_count) {
constexpr static s64 min{std::numeric_limits<s32>::min()};
constexpr static s64 max{std::numeric_limits<s32>::max()};
constexpr s64 min{std::numeric_limits<s32>::min()};
constexpr s64 max{std::numeric_limits<s32>::max()};
for (u32 i = 0; i < sample_count; i++) {
const s64 in_sample{input[i]};

View File

@ -244,16 +244,16 @@ template <size_t NumChannels>
static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state,
std::span<std::span<const s32>> inputs,
std::span<std::span<s32>> outputs, const u32 sample_count) {
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
};
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3,
};
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5,
};

View File

@ -50,8 +50,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
std::vector<std::span<const s32>>& inputs,
std::vector<std::span<s32>>& outputs, const u32 sample_count,
LightLimiterInfo::StatisticsInternal* statistics) {
constexpr static s64 min{std::numeric_limits<s32>::min()};
constexpr static s64 max{std::numeric_limits<s32>::max()};
constexpr s64 min{std::numeric_limits<s32>::min()};
constexpr s64 max{std::numeric_limits<s32>::max()};
const auto recip_estimate = [](f64 a) -> f64 {
s32 q, s;

View File

@ -252,16 +252,16 @@ template <size_t NumChannels>
static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state,
std::vector<std::span<const s32>>& inputs,
std::vector<std::span<s32>>& outputs, const u32 sample_count) {
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
0, 0, 1, 1, 0, 1, 0, 0, 1, 1,
};
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
0, 0, 1, 1, 0, 1, 2, 2, 3, 3,
};
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
0, 0, 1, 1, 2, 2, 4, 4, 5, 5,
};

View File

@ -19,24 +19,24 @@ namespace AudioCore::AudioRenderer {
static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input,
const u32 target_sample_count, const u32 source_sample_count,
UpsamplerState* state) {
constexpr static u32 WindowSize = 10;
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
static constexpr u32 WindowSize = 10;
static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f,
-0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f,
};
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f,
-0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f,
};
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f,
-0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f,
};
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f,
-0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f,
};
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f,
-0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f,
};

View File

@ -21,8 +21,8 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro
}
void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
constexpr static s32 min{std::numeric_limits<s16>::min()};
constexpr static s32 max{std::numeric_limits<s16>::max()};
constexpr s32 min{std::numeric_limits<s16>::min()};
constexpr s32 max{std::numeric_limits<s16>::max()};
std::vector<s16> output(processor.sample_count);
for (u32 channel = 0; channel < input_count; channel++) {

View File

@ -20,8 +20,8 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor&
}
void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
constexpr static s32 min = std::numeric_limits<s16>::min();
constexpr static s32 max = std::numeric_limits<s16>::max();
constexpr s32 min = std::numeric_limits<s16>::min();
constexpr s32 max = std::numeric_limits<s16>::max();
auto stream{processor.GetOutputSinkStream()};
stream->SetSystemChannels(input_count);

View File

@ -94,7 +94,7 @@ bool SystemManager::Remove(System& system_) {
}
void SystemManager::ThreadFunc() {
constexpr static char name[]{"AudioRenderSystemManager"};
static constexpr char name[]{"AudioRenderSystemManager"};
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);

View File

@ -177,7 +177,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
switch (sample_format_) {
case SampleFormat::PcmInt16: {
constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)};
constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)};
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
@ -188,7 +188,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
} break;
case SampleFormat::PcmFloat: {
constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)};
constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)};
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");

View File

@ -24,8 +24,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
return;
}
constexpr static s32 min{std::numeric_limits<s16>::min()};
constexpr static s32 max{std::numeric_limits<s16>::max()};
constexpr s32 min{std::numeric_limits<s16>::min()};
constexpr s32 max{std::numeric_limits<s16>::max()};
auto yuzu_volume{Settings::Volume()};
if (yuzu_volume > 1.0f) {
@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
if (system_channels == 6 && device_channels == 2) {
// We're given 6 channels, but our device only outputs 2, so downmix.
constexpr static std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
static constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
for (u32 read_index = 0, write_index = 0; read_index < samples.size();
read_index += system_channels, write_index += device_channels) {
@ -106,8 +106,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
}
std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) {
constexpr static s32 min = std::numeric_limits<s16>::min();
constexpr static s32 max = std::numeric_limits<s16>::max();
constexpr s32 min = std::numeric_limits<s16>::min();
constexpr s32 max = std::numeric_limits<s16>::max();
auto samples{samples_buffer.Pop(num_samples)};
@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
// If we're paused or going to shut down, we don't want to consume buffers as coretiming is
// paused and we'll desync, so just play silence.
if (system.IsPaused() || system.IsShuttingDown()) {
constexpr static std::array<s16, 6> silence{};
static constexpr std::array<s16, 6> silence{};
for (size_t i = frames_written; i < num_frames; i++) {
std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
}

View File

@ -47,7 +47,7 @@ template <typename ContiguousContainer>
static_assert(std::is_same_v<typename ContiguousContainer::value_type, u8>,
"Underlying type within the contiguous container must be u8.");
constexpr static std::size_t pad_width = 2;
constexpr std::size_t pad_width = 2;
std::string out;
out.reserve(std::size(data) * pad_width);

View File

@ -223,7 +223,7 @@ public:
float GenerateRandomF32() {
// Floats have 24 bits of mantissa.
constexpr static u32 MantissaBits = 24;
constexpr u32 MantissaBits = 24;
return static_cast<float>(GenerateRandomU24()) * (1.0f / (1U << MantissaBits));
}
@ -234,9 +234,9 @@ public:
// Nintendo does not. They use (32 - 5) = 27 bits from the first rnd32()
// call, and (32 - 6) bits from the second. We'll do what they do, but
// There's not a clear reason why.
constexpr static u32 MantissaBits = 53;
constexpr static u32 Shift1st = (64 - MantissaBits) / 2;
constexpr static u32 Shift2nd = (64 - MantissaBits) - Shift1st;
constexpr u32 MantissaBits = 53;
constexpr u32 Shift1st = (64 - MantissaBits) / 2;
constexpr u32 Shift2nd = (64 - MantissaBits) - Shift1st;
const u32 first = (this->GenerateRandomU32() >> Shift1st);
const u32 second = (this->GenerateRandomU32() >> Shift2nd);

View File

@ -361,7 +361,7 @@ struct System::Impl {
// Log last frame performance stats if game was loded
if (perf_stats) {
const auto perf_results = GetAndResetPerfStats();
constexpr static auto performance = Common::Telemetry::FieldType::Performance;
constexpr auto performance = Common::Telemetry::FieldType::Performance;
telemetry_session->AddField(performance, "Shutdown_EmulationSpeed",
perf_results.emulation_speed * 100.0);

View File

@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() {
}
void CoreTiming::ThreadEntry(CoreTiming& instance) {
constexpr static char name[] = "HostTiming";
static constexpr char name[] = "HostTiming";
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);

View File

@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
return IPSFileType::Error;
}
constexpr static std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
static constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) {
return IPSFileType::IPS;
}
constexpr static std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
static constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) {
return IPSFileType::IPS32;
}
@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
}
static bool IsEOF(IPSFileType type, const std::vector<u8>& data) {
constexpr static std::array<u8, 3> eof{{'E', 'O', 'F'}};
static constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) {
return true;
}
constexpr static std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
static constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin());
}

View File

@ -97,7 +97,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) {
/*static*/ ProgramMetadata ProgramMetadata::GetDefault() {
// Allow use of cores 0~3 and thread priorities 1~63.
constexpr static u32 default_thread_info_capability = 0x30007F7;
constexpr u32 default_thread_info_capability = 0x30007F7;
ProgramMetadata result;

View File

@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo
}
static std::string GetCNMTName(TitleType type, u64 title_id) {
constexpr static std::array<const char*, 9> TITLE_TYPE_NAMES{
static constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
"SystemProgram",
"SystemData",
"SystemUpdate",

View File

@ -213,7 +213,7 @@ void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& cal
}
void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) {
constexpr static std::size_t KEYS_PER_BYTE = 8;
constexpr std::size_t KEYS_PER_BYTE = 8;
auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE];
const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE));
if (status) {

View File

@ -114,13 +114,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
}();
// Return (possibly) adjusted size.
constexpr static size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
}
size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() {
// Verify that our minimum is at least as large as Nintendo's.
constexpr static size_t MinimumSize = RequiredNonSecureSystemMemorySize;
constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize;
static_assert(MinimumSize >= 0x29C8000);
return MinimumSize;

View File

@ -129,7 +129,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd
}
size_t CalculateSlabHeapGapSize() {
constexpr static size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB;
constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB;
static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax);
return KernelSlabHeapGapSize;
}
@ -272,7 +272,7 @@ void KPageBufferSlabHeap::Initialize(Core::System& system) {
kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size));
// Allocate memory for the slab.
constexpr static auto AllocateOption = KMemoryManager::EncodeOption(
constexpr auto AllocateOption = KMemoryManager::EncodeOption(
KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront);
const PAddr slab_address =
kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption);

View File

@ -21,8 +21,8 @@ Result KCapabilities::InitializeForKIP(std::span<const u32> kern_caps, KPageTabl
m_program_type = 0;
// Initial processes may run on all cores.
constexpr static u64 VirtMask = Core::Hardware::VirtualCoreMask;
constexpr static u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask);
constexpr u64 VirtMask = Core::Hardware::VirtualCoreMask;
constexpr u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask);
m_core_mask = VirtMask;
m_phys_core_mask = PhysMask;
@ -170,7 +170,7 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) {
template <typename F>
Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) {
// Define the allowed memory regions.
constexpr static std::array<KMemoryRegionType, 4> MemoryRegions{
constexpr std::array<KMemoryRegionType, 4> MemoryRegions{
KMemoryRegionType_None,
KMemoryRegionType_KernelTraceBuffer,
KMemoryRegionType_OnMemoryBootImage,

View File

@ -121,7 +121,7 @@ public:
}
size_t GetSize(Pool pool) {
constexpr static Direction GetSizeDirection = Direction::FromFront;
constexpr Direction GetSizeDirection = Direction::FromFront;
size_t total = 0;
for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr;
manager = this->GetNextManager(manager, GetSizeDirection)) {
@ -142,7 +142,7 @@ public:
size_t GetFreeSize(Pool pool) {
KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]);
constexpr static Direction GetSizeDirection = Direction::FromFront;
constexpr Direction GetSizeDirection = Direction::FromFront;
size_t total = 0;
for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr;
manager = this->GetNextManager(manager, GetSizeDirection)) {
@ -154,7 +154,7 @@ public:
void DumpFreeList(Pool pool) {
KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]);
constexpr static Direction DumpDirection = Direction::FromFront;
constexpr Direction DumpDirection = Direction::FromFront;
for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr;
manager = this->GetNextManager(manager, DumpDirection)) {
manager->DumpFreeList();

View File

@ -68,7 +68,7 @@ PAddr KPageHeap::AllocateByRandom(s32 index, size_t num_pages, size_t align_page
const size_t align_shift = std::countr_zero(align_size);
// Decide on a block to allocate from.
constexpr static size_t MinimumPossibleAlignmentsForRandomAllocation = 4;
constexpr size_t MinimumPossibleAlignmentsForRandomAllocation = 4;
{
// By default, we'll want to look at all blocks larger than our current one.
s32 max_blocks = static_cast<s32>(m_num_blocks);

View File

@ -134,7 +134,7 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type
}
// Set code regions and determine remaining
constexpr static size_t RegionAlignment{2_MiB};
constexpr size_t RegionAlignment{2_MiB};
VAddr process_code_start{};
VAddr process_code_end{};
size_t stack_region_size{};
@ -2624,7 +2624,7 @@ Result KPageTable::SetMemoryAttribute(VAddr addr, size_t size, u32 mask, u32 att
KMemoryPermission old_perm;
KMemoryAttribute old_attr;
size_t num_allocator_blocks;
constexpr static auto AttributeTestMask =
constexpr auto AttributeTestMask =
~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared);
R_TRY(this->CheckMemoryState(
std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr),

View File

@ -254,7 +254,7 @@ struct KernelCore::Impl {
system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size);
// Reserve secure applet memory, introduced in firmware 5.0.0
constexpr static u64 secure_applet_memory_size{4_MiB};
constexpr u64 secure_applet_memory_size{4_MiB};
ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax,
secure_applet_memory_size));
}
@ -477,9 +477,9 @@ struct KernelCore::Impl {
const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
// Setup the containing kernel region.
constexpr static size_t KernelRegionSize = 1_GiB;
constexpr static size_t KernelRegionAlign = 1_GiB;
constexpr static VAddr kernel_region_start =
constexpr size_t KernelRegionSize = 1_GiB;
constexpr size_t KernelRegionAlign = 1_GiB;
constexpr VAddr kernel_region_start =
Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
size_t kernel_region_size = KernelRegionSize;
if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) {
@ -489,12 +489,11 @@ struct KernelCore::Impl {
kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel));
// Setup the code region.
constexpr static size_t CodeRegionAlign = PageSize;
constexpr static VAddr code_region_start =
constexpr size_t CodeRegionAlign = PageSize;
constexpr VAddr code_region_start =
Common::AlignDown(code_start_virt_addr, CodeRegionAlign);
constexpr static VAddr code_region_end =
Common::AlignUp(code_end_virt_addr, CodeRegionAlign);
constexpr static size_t code_region_size = code_region_end - code_region_start;
constexpr VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign);
constexpr size_t code_region_size = code_region_end - code_region_start;
ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert(
code_region_start, code_region_size, KMemoryRegionType_KernelCode));
@ -525,8 +524,8 @@ struct KernelCore::Impl {
}
// Decide on the actual size for the misc region.
constexpr static size_t MiscRegionAlign = KernelAslrAlignment;
constexpr static size_t MiscRegionMinimumSize = 32_MiB;
constexpr size_t MiscRegionAlign = KernelAslrAlignment;
constexpr size_t MiscRegionMinimumSize = 32_MiB;
const size_t misc_region_size = Common::AlignUp(
std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
ASSERT(misc_region_size > 0);
@ -542,8 +541,8 @@ struct KernelCore::Impl {
const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit();
// Setup the stack region.
constexpr static size_t StackRegionSize = 14_MiB;
constexpr static size_t StackRegionAlign = KernelAslrAlignment;
constexpr size_t StackRegionSize = 14_MiB;
constexpr size_t StackRegionAlign = KernelAslrAlignment;
const VAddr stack_region_start =
memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel);
@ -564,7 +563,7 @@ struct KernelCore::Impl {
const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size;
const PAddr slab_start_phys_addr = code_end_phys_addr;
const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size;
constexpr static size_t SlabRegionAlign = KernelAslrAlignment;
constexpr size_t SlabRegionAlign = KernelAslrAlignment;
const size_t slab_region_needed_size =
Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) -
Common::AlignDown(code_end_phys_addr, SlabRegionAlign);
@ -576,8 +575,8 @@ struct KernelCore::Impl {
slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
// Setup the temp region.
constexpr static size_t TempRegionSize = 128_MiB;
constexpr static size_t TempRegionAlign = KernelAslrAlignment;
constexpr size_t TempRegionSize = 128_MiB;
constexpr size_t TempRegionAlign = KernelAslrAlignment;
const VAddr temp_region_start =
memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel);
@ -657,7 +656,7 @@ struct KernelCore::Impl {
ASSERT(linear_extents.GetEndAddress() != 0);
// Setup the linear mapping region.
constexpr static size_t LinearRegionAlign = 1_GiB;
constexpr size_t LinearRegionAlign = 1_GiB;
const PAddr aligned_linear_phys_start =
Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
const size_t linear_region_size =
@ -738,11 +737,11 @@ struct KernelCore::Impl {
void InitializeHackSharedMemory() {
// Setup memory regions for emulated processes
// TODO(bunnei): These should not be hardcoded regions initialized within the kernel
constexpr static std::size_t hid_size{0x40000};
constexpr static std::size_t font_size{0x1100000};
constexpr static std::size_t irs_size{0x8000};
constexpr static std::size_t time_size{0x1000};
constexpr static std::size_t hidbus_size{0x1000};
constexpr std::size_t hid_size{0x40000};
constexpr std::size_t font_size{0x1100000};
constexpr std::size_t irs_size{0x8000};
constexpr std::size_t time_size{0x1000};
constexpr std::size_t hidbus_size{0x1000};
hid_shared_mem = KSharedMemory::Create(system.Kernel());
font_shared_mem = KSharedMemory::Create(system.Kernel());

View File

@ -306,7 +306,7 @@ Result ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_tab
}
Result ProcessCapabilities::HandleInterruptFlags(u32 flags) {
constexpr static u32 interrupt_ignore_value = 0x3FF;
constexpr u32 interrupt_ignore_value = 0x3FF;
const u32 interrupt0 = (flags >> 12) & 0x3FF;
const u32 interrupt1 = (flags >> 22) & 0x3FF;

View File

@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle,
thread_activity);
// Validate the activity.
constexpr static auto IsValidThreadActivity = [](ThreadActivity activity) {
static constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused;
};
R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue);

View File

@ -193,7 +193,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
return ResultSuccess;
case InfoType::ThreadTickCount: {
constexpr static u64 num_cpus = 4;
constexpr u64 num_cpus = 4;
if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) {
LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus,
info_sub_id);

View File

@ -132,7 +132,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
// Validate the attribute and mask.
constexpr static u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached);
constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached);
R_UNLESS((mask | attr) == mask, ResultInvalidCombination);
R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination);

View File

@ -871,7 +871,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont
// TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable
// way of confirming things like the TID, we're going to assume a non zero value for the time
// being.
constexpr static u64 tid{1};
constexpr u64 tid{1};
StoreSaveDataThumbnail(ctx, uuid, tid);
}

View File

@ -1086,7 +1086,7 @@ private:
// We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is
// actually used anywhere
constexpr static u64 handle = 0xdeadbeef;
constexpr u64 handle = 0xdeadbeef;
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
@ -1570,7 +1570,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
const auto& version = res.first->GetVersionString();
std::copy(version.begin(), version.end(), version_string.begin());
} else {
constexpr static char default_version[]{"1.0.0"};
static constexpr char default_version[]{"1.0.0"};
std::memcpy(version_string.data(), default_version, sizeof(default_version));
}
@ -1638,7 +1638,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
constexpr static bool gameplay_recording_supported = false;
constexpr bool gameplay_recording_supported = false;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);

View File

@ -1180,7 +1180,7 @@ void SoftwareKeyboard::ReplyChangedStringV2() {
.cursor_position{current_cursor_position},
};
constexpr static u8 flag = 0;
constexpr u8 flag = 0;
std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(),
current_text.size() * sizeof(char16_t));
@ -1204,7 +1204,7 @@ void SoftwareKeyboard::ReplyMovedCursorV2() {
.cursor_position{current_cursor_position},
};
constexpr static u8 flag = 0;
constexpr u8 flag = 0;
std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(),
current_text.size() * sizeof(char16_t));
@ -1232,7 +1232,7 @@ void SoftwareKeyboard::ReplyChangedStringUtf8V2() {
.cursor_position{current_cursor_position},
};
constexpr static u8 flag = 0;
constexpr u8 flag = 0;
std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size());
std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &changed_string_arg,
@ -1257,7 +1257,7 @@ void SoftwareKeyboard::ReplyMovedCursorUtf8V2() {
.cursor_position{current_cursor_position},
};
constexpr static u8 flag = 0;
constexpr u8 flag = 0;
std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size());
std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &moved_cursor_arg,

View File

@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode,
}
void Controller::SetFromCpuBoostMode(CpuBoostMode mode) {
constexpr static std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
static constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
PerformanceConfiguration::Config7,
PerformanceConfiguration::Config13,
PerformanceConfiguration::Config15,

View File

@ -77,7 +77,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) {
// This service function is currently hardcoded on the
// actual console to this value (as of 8.0.0).
constexpr static s32 target_min_volume = 0;
constexpr s32 target_min_volume = 0;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@ -89,7 +89,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) {
// This service function is currently hardcoded on the
// actual console to this value (as of 8.0.0).
constexpr static s32 target_max_volume = 15;
constexpr s32 target_max_volume = 15;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);

View File

@ -209,7 +209,7 @@ private:
std::size_t WorkerBufferSize(u32 channel_count) {
ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count");
constexpr static int num_streams = 1;
constexpr int num_streams = 1;
const int num_stereo_streams = channel_count == 2 ? 1 : 0;
return opus_multistream_decoder_get_size(num_streams, num_stereo_streams);
}

View File

@ -77,8 +77,8 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c
// TODO: Update this when we implement the album.
// Currently we do not have a method of accessing album entries, set this to 0 for now.
constexpr static u32 total_entries_1{};
constexpr static u32 total_entries_2{};
constexpr u32 total_entries_1{};
constexpr u32 total_entries_2{};
LOG_WARNING(
Service_Capture,

View File

@ -942,7 +942,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
const auto parameters = rp.PopRaw<Parameters>();
// Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData
constexpr static auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
LOG_WARNING(Service_FS,
"(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n"

View File

@ -439,15 +439,15 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
using btn = Core::HID::NpadButton;
pad_entry.npad_buttons.raw = btn::None;
if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) {
constexpr static btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR |
btn::R | btn::ZR | btn::Plus | btn::StickRLeft |
btn::StickRUp | btn::StickRRight | btn::StickRDown;
constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R |
btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp |
btn::StickRRight | btn::StickRDown;
pad_entry.npad_buttons.raw = button_state.raw & right_button_mask;
pad_entry.r_stick = stick_state.right;
}
if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) {
constexpr static btn left_button_mask =
constexpr btn left_button_mask =
btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL |
btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown;
pad_entry.npad_buttons.raw |= button_state.raw & left_button_mask;
@ -759,7 +759,7 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
}
Result Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) {
constexpr static std::size_t max_number_npad_ids = 0xa;
constexpr std::size_t max_number_npad_ids = 0xa;
const auto length = data.size();
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
const std::size_t elements = length / sizeof(u32);

View File

@ -670,7 +670,7 @@ ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_
}
Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) {
constexpr static u32 INVALID_INDEX{0xFFFFFFFF};
constexpr u32 INVALID_INDEX{0xFFFFFFFF};
index = INVALID_INDEX;

View File

@ -35,7 +35,7 @@ bool IsAmiiboValid(const EncryptedNTAG215File& ntag_file) {
LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", ntag_file.CFG1);
// Validate UUID
constexpr static u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3`
constexpr u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3`
if ((CT ^ ntag_file.uuid.uid[0] ^ ntag_file.uuid.uid[1] ^ ntag_file.uuid.uid[2]) !=
ntag_file.uuid.uid[3]) {
return false;
@ -247,7 +247,7 @@ void Cipher(const DerivedKeys& keys, const NTAG215File& in_data, NTAG215File& ou
mbedtls_aes_setkey_enc(&aes, keys.aes_key.data(), aes_key_size);
memcpy(nonce_counter.data(), keys.aes_iv.data(), sizeof(keys.aes_iv));
constexpr static std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START;
constexpr std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START;
mbedtls_aes_crypt_ctr(&aes, encrypted_data_size, &nc_off, nonce_counter.data(),
stream_block.data(),
reinterpret_cast<const unsigned char*>(&in_data.settings),
@ -317,13 +317,13 @@ bool DecodeAmiibo(const EncryptedNTAG215File& encrypted_tag_data, NTAG215File& t
Cipher(data_keys, encoded_data, tag_data);
// Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC!
constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(),
sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid),
input_length, reinterpret_cast<unsigned char*>(&tag_data.hmac_tag));
// Regenerate data HMAC
constexpr static std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START;
constexpr std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START;
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), data_keys.hmac_key.data(),
sizeof(HmacKey),
reinterpret_cast<const unsigned char*>(&tag_data.write_counter), input_length2,
@ -357,8 +357,8 @@ bool EncodeAmiibo(const NTAG215File& tag_data, EncryptedNTAG215File& encrypted_t
NTAG215File encoded_tag_data{};
// Generate tag HMAC
constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
constexpr static std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START;
constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
constexpr std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START;
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(),
sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid),
input_length, reinterpret_cast<unsigned char*>(&encoded_tag_data.hmac_tag));

View File

@ -512,7 +512,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx
};
static_assert(sizeof(Output) == 0x3, "Output has incorrect size.");
constexpr static Output out{};
constexpr Output out{};
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);

View File

@ -9,8 +9,8 @@
namespace Service::Nvidia::NvCore {
SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} {
constexpr static u32 VBlank0SyncpointId{26};
constexpr static u32 VBlank1SyncpointId{27};
constexpr u32 VBlank0SyncpointId{26};
constexpr u32 VBlank1SyncpointId{27};
// Reserve both vblank syncpoints as client managed as they use Continuous Mode
// Refer to section 14.3.5.3 of the TRM for more information on Continuous Mode

View File

@ -124,7 +124,7 @@ private:
//!< value
};
constexpr static std::size_t SyncpointCount{192};
static constexpr std::size_t SyncpointCount{192};
std::array<SyncpointInfo, SyncpointCount> syncpoints{};
std::mutex reservation_lock;

View File

@ -45,7 +45,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
// If expected_present is specified, we may not want to return a buffer yet.
if (expected_present.count() != 0) {
constexpr static auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second
constexpr auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second
// The expected_present argument indicates when the buffer is expected to be presented
// on-screen.

View File

@ -55,7 +55,7 @@ private:
LOG_WARNING(Service_OLSC, "(STUBBED) called");
// backup_setting is set to 0 since real value is unknown
constexpr static u64 backup_setting = 0;
constexpr u64 backup_setting = 0;
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);

View File

@ -116,7 +116,7 @@ private:
void GetTransmissionStatus(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_PREPO, "(STUBBED) called");
constexpr static s32 status = 0;
constexpr s32 status = 0;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@ -126,7 +126,7 @@ private:
void GetSystemSessionId(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_PREPO, "(STUBBED) called");
constexpr static u64 system_session_id = 0;
constexpr u64 system_session_id = 0;
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push(system_session_id);

View File

@ -92,7 +92,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co
static_assert(sizeof(SerializedResponseHeader) == 0x18,
"Response header size must be 0x18 bytes");
constexpr static auto header_size = sizeof(SerializedResponseHeader);
constexpr auto header_size = sizeof(SerializedResponseHeader);
const auto addr_size =
current->ai_addr && current->ai_addrlen > 0 ? current->ai_addrlen : 4;
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
// Header in network byte order
SerializedResponseHeader header{};
constexpr static auto HEADER_MAGIC = 0xBEEFCAFE;
constexpr auto HEADER_MAGIC = 0xBEEFCAFE;
header.magic = htonl(HEADER_MAGIC);
header.family = htonl(current->ai_family);
header.flags = htonl(current->ai_flags);

View File

@ -103,7 +103,7 @@ private:
const auto certificate_format = rp.PopEnum<CertificateFormat>();
[[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0);
constexpr static u64 server_id = 0;
constexpr u64 server_id = 0;
LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format);
@ -122,7 +122,7 @@ private:
return std::span<const u8>{};
}();
constexpr static u64 client_id = 0;
constexpr u64 client_id = 0;
LOG_WARNING(Service_SSL, "(STUBBED) called");

View File

@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) {
}
static bool ParsePosixName(const char* name, TimeZoneRule& rule) {
constexpr static char default_rule[]{",M4.1.0,M10.5.0"};
static constexpr char default_rule[]{",M4.1.0,M10.5.0"};
const char* std_name{name};
int std_len{};
int offset{};
@ -512,8 +512,8 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi
return {};
}
constexpr static s32 time_zone_max_leaps{50};
constexpr static s32 time_zone_max_chars{50};
constexpr s32 time_zone_max_leaps{50};
constexpr s32 time_zone_max_chars{50};
if (!(0 <= header.leap_count && header.leap_count < time_zone_max_leaps &&
0 < header.type_count && header.type_count < s32(time_zone_rule.ttis.size()) &&
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
if (bytes_read < 0) {
return {};
}
constexpr static s32 time_zone_name_max{255};
constexpr s32 time_zone_name_max{255};
if (bytes_read > (time_zone_name_max + 1)) {
return {};
}

View File

@ -725,8 +725,8 @@ private:
// TODO: Figure out what these are
constexpr static s64 unknown_result_1 = 0;
constexpr static s64 unknown_result_2 = 0;
constexpr s64 unknown_result_1 = 0;
constexpr s64 unknown_result_2 = 0;
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(unknown_result_1);
@ -740,8 +740,8 @@ private:
const auto height = rp.Pop<u64>();
LOG_DEBUG(Service_VI, "called width={}, height={}", width, height);
constexpr static u64 base_size = 0x20000;
constexpr static u64 alignment = 0x1000;
constexpr u64 base_size = 0x20000;
constexpr u64 alignment = 0x1000;
const auto texture_size = width * height * 4;
const auto out_size = (texture_size + base_size - 1) / base_size * base_size;

View File

@ -121,7 +121,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
double PerfStats::GetLastFrameTimeScale() const {
std::scoped_lock lock{object_mutex};
constexpr static double FRAME_LENGTH = 1.0 / 60;
constexpr double FRAME_LENGTH = 1.0 / 60;
return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
}

View File

@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() {
mbedtls_entropy_context entropy;
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_context ctr_drbg;
constexpr static std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
static constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
mbedtls_ctr_drbg_init(&ctr_drbg);
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
@ -225,7 +225,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
Telemetry::AppendOSInfo(field_collection);
// Log user configuration information
constexpr static auto field_type = Telemetry::FieldType::UserConfig;
constexpr auto field_type = Telemetry::FieldType::UserConfig;
AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue());
AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
AddField(field_type, "Renderer_Backend",

View File

@ -223,8 +223,8 @@ void GCAdapter::AdapterScanThread(std::stop_token stop_token) {
}
bool GCAdapter::Setup() {
constexpr static u16 nintendo_vid = 0x057e;
constexpr static u16 gc_adapter_pid = 0x0337;
constexpr u16 nintendo_vid = 0x057e;
constexpr u16 gc_adapter_pid = 0x0337;
usb_adapter_handle =
std::make_unique<LibUSBDeviceHandle>(libusb_ctx->get(), nintendo_vid, gc_adapter_pid);
if (!usb_adapter_handle->get()) {
@ -346,7 +346,7 @@ void GCAdapter::UpdateVibrations() {
// Use 8 states to keep the switching between on/off fast enough for
// a human to feel different vibration strenght
// More states == more rumble strengths == slower update time
constexpr static u8 vibration_states = 8;
constexpr u8 vibration_states = 8;
vibration_counter = (vibration_counter + 1) % vibration_states;
@ -363,7 +363,7 @@ void GCAdapter::SendVibrations() {
return;
}
s32 size{};
constexpr static u8 rumble_command = 0x11;
constexpr u8 rumble_command = 0x11;
const u8 p1 = pads[0].enable_vibration;
const u8 p2 = pads[1].enable_vibration;
const u8 p3 = pads[2].enable_vibration;

View File

@ -77,7 +77,7 @@ void Joycons::Setup() {
}
void Joycons::ScanThread(std::stop_token stop_token) {
constexpr static u16 nintendo_vendor_id = 0x057e;
constexpr u16 nintendo_vendor_id = 0x057e;
Common::SetCurrentThreadName("JoyconScanThread");
do {
@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int
void Joycons::OnRingConUpdate(f32 ring_data) {
// To simplify ring detection it will always be mapped to an empty identifier for all
// controllers
constexpr static PadIdentifier identifier = {
static constexpr PadIdentifier identifier = {
.guid = Common::UUID{},
.port = 0,
.pad = 0,

View File

@ -37,7 +37,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
void Mouse::UpdateThread(std::stop_token stop_token) {
Common::SetCurrentThreadName("Mouse");
constexpr static int update_time = 10;
constexpr int update_time = 10;
while (!stop_token.stop_requested()) {
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
// Slow movement by 4%

View File

@ -63,7 +63,7 @@ public:
}
bool UpdateMotion(SDL_ControllerSensorEvent event) {
constexpr static float gravity_constant = 9.80665f;
constexpr float gravity_constant = 9.80665f;
std::scoped_lock lock{mutex};
const u64 time_difference = event.timestamp - last_motion_update;
last_motion_update = event.timestamp;
@ -109,7 +109,7 @@ public:
}
bool RumblePlay(const Common::Input::VibrationStatus vibration) {
constexpr static u32 rumble_max_duration_ms = 1000;
constexpr u32 rumble_max_duration_ms = 1000;
if (sdl_controller) {
return SDL_GameControllerRumble(
sdl_controller.get(), static_cast<u16>(vibration.low_amplitude),
@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
const auto joystick =
GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
constexpr static Common::Input::VibrationStatus test_vibration{
static constexpr Common::Input::VibrationStatus test_vibration{
.low_amplitude = 1,
.low_frequency = 160.0f,
.high_amplitude = 1,
@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
.type = Common::Input::VibrationAmplificationType::Exponential,
};
constexpr static Common::Input::VibrationStatus zero_vibration{
static constexpr Common::Input::VibrationStatus zero_vibration{
.low_amplitude = 0,
.low_frequency = 160.0f,
.high_amplitude = 0,

View File

@ -599,7 +599,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
Status current_status{Status::Initialized};
SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {},
[&](Response::PadData data) {
constexpr static u16 CALIBRATION_THRESHOLD = 100;
constexpr u16 CALIBRATION_THRESHOLD = 100;
if (current_status == Status::Initialized) {
// Receiving data means the communication is ready now

View File

@ -129,7 +129,7 @@ void JoyconDriver::InputThread(std::stop_token stop_token) {
input_thread_running = true;
// Max update rate is 5ms, ensure we are always able to read a bit faster
constexpr static int ThreadDelay = 2;
constexpr int ThreadDelay = 2;
std::vector<u8> buffer(MaxBufferSize);
while (!stop_token.stop_requested()) {
@ -548,7 +548,7 @@ DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
{0x2007, ControllerType::Right},
{0x2009, ControllerType::Pro},
};
constexpr static u16 nintendo_vendor_id = 0x057e;
constexpr u16 nintendo_vendor_id = 0x057e;
controller_type = ControllerType::None;
if (device_info->vendor_id != nintendo_vendor_id) {

View File

@ -129,7 +129,7 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati
DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration,
s16 current_value) {
constexpr static s16 DefaultRingRange{800};
constexpr s16 DefaultRingRange{800};
// TODO: Get default calibration form ring itself
if (ring_data_max == 0 && ring_data_min == 0) {
@ -168,8 +168,8 @@ u16 CalibrationProtocol::GetYAxisCalibrationValue(std::span<u8> block) const {
}
void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) {
constexpr static u16 DefaultStickCenter{0x800};
constexpr static u16 DefaultStickRange{0x6cc};
constexpr u16 DefaultStickCenter{0x800};
constexpr u16 DefaultStickRange{0x6cc};
calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter);
calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange);
@ -181,9 +181,9 @@ void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration)
}
void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) {
constexpr static s16 DefaultAccelerometerScale{0x4000};
constexpr static s16 DefaultGyroScale{0x3be7};
constexpr static s16 DefaultOffset{0};
constexpr s16 DefaultAccelerometerScale{0x4000};
constexpr s16 DefaultGyroScale{0x3be7};
constexpr s16 DefaultOffset{0};
for (auto& sensor : calibration.accelerometer) {
sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale);

View File

@ -72,8 +72,8 @@ DriverResult JoyconCommonProtocol::SendRawData(std::span<const u8> buffer) {
DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc,
SubCommandResponse& output) {
constexpr static int timeout_mili = 66;
constexpr static int MaxTries = 15;
constexpr int timeout_mili = 66;
constexpr int MaxTries = 15;
int tries = 0;
do {
@ -157,8 +157,8 @@ DriverResult JoyconCommonProtocol::SendVibrationReport(std::span<const u8> buffe
}
DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span<u8> output) {
constexpr static std::size_t HeaderSize = 5;
constexpr static std::size_t MaxTries = 10;
constexpr std::size_t HeaderSize = 5;
constexpr std::size_t MaxTries = 10;
std::size_t tries = 0;
SubCommandResponse response{};
std::array<u8, sizeof(ReadSpiPacket)> buffer{};
@ -216,8 +216,8 @@ DriverResult JoyconCommonProtocol::ConfigureMCU(const MCUConfig& config) {
DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode,
MCUCommandResponse& output) {
constexpr static int TimeoutMili = 200;
constexpr static int MaxTries = 9;
constexpr int TimeoutMili = 200;
constexpr int MaxTries = 9;
int tries = 0;
do {
@ -265,7 +265,7 @@ DriverResult JoyconCommonProtocol::SendMCUData(ReportMode report_mode, SubComman
DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) {
MCUCommandResponse output{};
constexpr static std::size_t MaxTries{8};
constexpr std::size_t MaxTries{8};
std::size_t tries{};
do {

View File

@ -131,7 +131,7 @@ DriverResult IrsProtocol::RequestImage(std::span<u8> buffer) {
DriverResult IrsProtocol::ConfigureIrs() {
LOG_DEBUG(Input, "Configure IRS");
constexpr static std::size_t max_tries = 28;
constexpr std::size_t max_tries = 28;
SubCommandResponse output{};
std::size_t tries = 0;
@ -166,7 +166,7 @@ DriverResult IrsProtocol::ConfigureIrs() {
DriverResult IrsProtocol::WriteRegistersStep1() {
LOG_DEBUG(Input, "WriteRegistersStep1");
DriverResult result{DriverResult::Success};
constexpr static std::size_t max_tries = 28;
constexpr std::size_t max_tries = 28;
SubCommandResponse output{};
std::size_t tries = 0;
@ -226,7 +226,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() {
DriverResult IrsProtocol::WriteRegistersStep2() {
LOG_DEBUG(Input, "WriteRegistersStep2");
constexpr static std::size_t max_tries = 28;
constexpr std::size_t max_tries = 28;
SubCommandResponse output{};
std::size_t tries = 0;

View File

@ -109,7 +109,7 @@ bool NfcProtocol::HasAmiibo() {
}
DriverResult NfcProtocol::WaitUntilNfcIsReady() {
constexpr static std::size_t timeout_limit = 10;
constexpr std::size_t timeout_limit = 10;
MCUCommandResponse output{};
std::size_t tries = 0;
@ -131,7 +131,7 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() {
DriverResult NfcProtocol::StartPolling(TagFoundData& data) {
LOG_DEBUG(Input, "Start Polling for tag");
constexpr static std::size_t timeout_limit = 7;
constexpr std::size_t timeout_limit = 7;
MCUCommandResponse output{};
std::size_t tries = 0;
@ -155,7 +155,7 @@ DriverResult NfcProtocol::StartPolling(TagFoundData& data) {
}
DriverResult NfcProtocol::ReadTag(const TagFoundData& data) {
constexpr static std::size_t timeout_limit = 10;
constexpr std::size_t timeout_limit = 10;
MCUCommandResponse output{};
std::size_t tries = 0;
@ -224,7 +224,7 @@ DriverResult NfcProtocol::ReadTag(const TagFoundData& data) {
}
DriverResult NfcProtocol::GetAmiiboData(std::vector<u8>& ntag_data) {
constexpr static std::size_t timeout_limit = 10;
constexpr std::size_t timeout_limit = 10;
MCUCommandResponse output{};
std::size_t tries = 0;

View File

@ -69,7 +69,7 @@ DriverResult RingConProtocol::StartRingconPolling() {
DriverResult RingConProtocol::IsRingConnected(bool& is_connected) {
LOG_DEBUG(Input, "IsRingConnected");
constexpr static std::size_t max_tries = 28;
constexpr std::size_t max_tries = 28;
SubCommandResponse output{};
std::size_t tries = 0;
is_connected = false;

View File

@ -39,7 +39,7 @@ void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::strin
// which may be overwritten by the result of the addition
if (IR::Inst * overflow{inst.GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) {
// https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c
constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
const auto sub_a{fmt::format("{}u-{}", s32_max, a)};
const auto positive_result{fmt::format("int({})>int({})", b, sub_a)};
const auto negative_result{fmt::format("int({})<int({})", b, sub_a)};

View File

@ -42,7 +42,7 @@ Id EmitIAdd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
SetSignFlag(ctx, inst, result);
if (IR::Inst * overflow{inst->GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) {
// https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c
constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
const Id is_positive{ctx.OpSGreaterThanEqual(ctx.U1, a, ctx.u32_zero_value)};
const Id sub_a{ctx.OpISub(ctx.U32[1], ctx.Const(s32_max), a)};

View File

@ -48,7 +48,7 @@ void F2F(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a, bool abs) {
BitField<8, 2, FloatFormat> dst_size;
[[nodiscard]] RoundingOp RoundingOperation() const {
constexpr static u64 rounding_mask = 0x0B;
constexpr u64 rounding_mask = 0x0B;
return static_cast<RoundingOp>(rounding_op.Value() & rounding_mask);
}
} const f2f{insn};

View File

@ -176,11 +176,11 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) {
(f2i.src_format == SrcFormat::F64) != (f2i.dest_format == DestFormat::I64);
if (special_nan_cases) {
if (f2i.dest_format == DestFormat::I32) {
constexpr static u32 nan_value = 0x8000'0000U;
constexpr u32 nan_value = 0x8000'0000U;
handled_special_case = true;
result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(nan_value), result)};
} else if (f2i.dest_format == DestFormat::I64) {
constexpr static u64 nan_value = 0x8000'0000'0000'0000ULL;
constexpr u64 nan_value = 0x8000'0000'0000'0000ULL;
handled_special_case = true;
result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(nan_value), result)};
}

View File

@ -19,7 +19,7 @@ enum class Half : u64 {
};
[[nodiscard]] IR::U32 IntegerHalf(IR::IREmitter& ir, const IR::U32& value, Half half) {
constexpr static bool is_signed{false};
constexpr bool is_signed{false};
switch (half) {
case Half::All:
return value;

View File

@ -76,7 +76,7 @@ void TestControl1::ExecuteThread(u32 id) {
* doing all the work required.
*/
TEST_CASE("Fibers::Setup", "[common]") {
constexpr static std::size_t num_threads = 7;
constexpr std::size_t num_threads = 7;
TestControl1 test_control{};
test_control.thread_fibers.resize(num_threads);
test_control.work_fibers.resize(num_threads);

View File

@ -35,8 +35,8 @@ public:
}
void Run(const std::vector<InputCommon::CemuhookUDP::Response::TouchPad> touch_movement_path) {
constexpr static size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header);
constexpr static size_t PadDataSize =
constexpr size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header);
constexpr size_t PadDataSize =
sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>);
REQUIRE(touch_movement_path.size() > 0);

View File

@ -890,8 +890,8 @@ void BufferCache<P>::CommitAsyncFlushesHigh() {
buffer_id,
});
// Align up to avoid cache conflicts
constexpr static u64 align = 8ULL;
constexpr static u64 mask = ~(align - 1ULL);
constexpr u64 align = 8ULL;
constexpr u64 mask = ~(align - 1ULL);
total_size_bytes += (new_size + align - 1) & mask;
largest_copy = std::max(largest_copy, new_size);
};
@ -1843,8 +1843,8 @@ void BufferCache<P>::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si
.size = new_size,
});
// Align up to avoid cache conflicts
constexpr static u64 align = 256ULL;
constexpr static u64 mask = ~(align - 1ULL);
constexpr u64 align = 256ULL;
constexpr u64 mask = ~(align - 1ULL);
total_size_bytes += (new_size + align - 1) & mask;
largest_copy = std::max(largest_copy, new_size);
};

View File

@ -75,7 +75,7 @@ bool DmaPusher::Step() {
// Push buffer non-empty, read a word
command_headers.resize_destructive(command_list_header.size);
constexpr static u32 MacroRegistersStart = 0xE00;
constexpr u32 MacroRegistersStart = 0xE00;
if (dma_state.method < MacroRegistersStart) {
if (Settings::IsGPULevelHigh()) {
memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(),

View File

@ -72,7 +72,7 @@ void Fermi2D::Blit() {
UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled");
const auto& args = regs.pixels_from_memory;
constexpr static s64 null_derivate = 1ULL << 32;
constexpr s64 null_derivate = 1ULL << 32;
Surface src = regs.src;
const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 &&

View File

@ -258,7 +258,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
size_t Maxwell3D::EstimateIndexBufferSize() {
GPUVAddr start_address = regs.index_buffer.StartAddress();
GPUVAddr end_address = regs.index_buffer.EndAddress();
constexpr static std::array<size_t, 4> max_sizes = {
static constexpr std::array<size_t, 4> max_sizes = {
std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(),
std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
const size_t byte_size = regs.index_buffer.FormatSizeInBytes();

View File

@ -694,16 +694,16 @@ private:
};
const auto force_to_fp16 = [](f32 base_value) {
u32 tmp = Common::BitCast<u32>(base_value);
constexpr static size_t fp32_mantissa_bits = 23;
constexpr static size_t fp16_mantissa_bits = 10;
constexpr static size_t mantissa_mask =
constexpr size_t fp32_mantissa_bits = 23;
constexpr size_t fp16_mantissa_bits = 10;
constexpr size_t mantissa_mask =
~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL);
tmp = tmp & static_cast<u32>(mantissa_mask);
// TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM
return Common::BitCast<f32>(tmp);
};
const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) {
constexpr static size_t fp32_mantissa_bits = 23;
constexpr size_t fp32_mantissa_bits = 23;
size_t shift_towards = fp32_mantissa_bits - mantissa;
const u32 new_value =
static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31));
@ -770,7 +770,7 @@ private:
component_mask[which_component];
};
const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) {
constexpr static size_t fp32_mantissa_bits = 23;
constexpr size_t fp32_mantissa_bits = 23;
u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f));
size_t shift_towards = fp32_mantissa_bits - mantissa;
return tmp_value >> shift_towards;

View File

@ -194,8 +194,8 @@ struct GPU::Impl {
[[nodiscard]] u64 GetTicks() const {
// This values were reversed engineered by fincs from NVN
// The gpu clock is reported in units of 385/625 nanoseconds
constexpr static u64 gpu_ticks_num = 384;
constexpr static u64 gpu_ticks_den = 625;
constexpr u64 gpu_ticks_num = 384;
constexpr u64 gpu_ticks_den = 625;
u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count();
if (Settings::values.use_fast_gpu_time.GetValue()) {

View File

@ -283,7 +283,7 @@ void VP9::EncodeTermSubExp(VpxRangeEncoder& writer, s32 value) {
} else {
value -= 64;
constexpr static s32 size = 8;
constexpr s32 size = 8;
const s32 mask = (1 << size) - 191;
@ -307,7 +307,7 @@ bool VP9::WriteLessThan(VpxRangeEncoder& writer, s32 value, s32 test) {
void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode,
const std::array<u8, 1728>& new_prob,
const std::array<u8, 1728>& old_prob) {
constexpr static u32 block_bytes = 2 * 2 * 6 * 6 * 3;
constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3;
const auto needs_update = [&](u32 base_index) {
return !std::equal(new_prob.begin() + base_index,

View File

@ -216,7 +216,7 @@ private:
std::vector<u64> big_page_continous;
std::vector<std::pair<VAddr, std::size_t>> page_stash{};
constexpr static size_t continous_bits = 64;
static constexpr size_t continous_bits = 64;
const size_t unique_identifier;
std::unique_ptr<VideoCommon::InvalidationAccumulator> accumulator;

View File

@ -281,7 +281,7 @@ public:
explicit HostCounterBase(std::shared_ptr<HostCounter> dependency_)
: dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} {
// Avoid nesting too many dependencies to avoid a stack overflow when these are deleted.
constexpr static u64 depth_threshold = 96;
constexpr u64 depth_threshold = 96;
if (depth > depth_threshold) {
depth = 0;
base_result = dependency->Query();

View File

@ -162,8 +162,7 @@ void ComputePipeline::Configure() {
buffer_cache.UnbindComputeTextureBuffers();
size_t texbuf_index{};
const auto add_buffer{[&](const auto& desc) {
constexpr static bool is_image =
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
for (u32 i = 0; i < desc.count; ++i) {
bool is_written{false};
if constexpr (is_image) {

View File

@ -126,9 +126,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
const bool is_intel = vendor_name == "Intel";
#ifdef __unix__
constexpr static bool is_linux = true;
constexpr bool is_linux = true;
#else
constexpr static bool is_linux = false;
constexpr bool is_linux = false;
#endif
bool disable_fast_buffer_sub_data = false;

View File

@ -385,8 +385,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
size_t index{};
const auto add_buffer{[&](const auto& desc) {
constexpr static bool is_image =
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
for (u32 i = 0; i < desc.count; ++i) {
bool is_written{false};
if constexpr (is_image) {

View File

@ -237,7 +237,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
screen_info.display_texture = screen_info.texture.resource.handle;
// TODO(Rodrigo): Read this from HLE
constexpr static u32 block_height_log2 = 4;
constexpr u32 block_height_log2 = 4;
const auto pixel_format{
VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)};
const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)};
@ -375,7 +375,7 @@ void RendererOpenGL::AddTelemetryFields() {
LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
constexpr static auto user_system = Common::Telemetry::FieldType::UserSystem;
constexpr auto user_system = Common::Telemetry::FieldType::UserSystem;
telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor));
telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model));
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version));

View File

@ -358,9 +358,8 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_SHADER_READ_BIT};
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
const VkImageMemoryBarrier barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,

View File

@ -175,7 +175,7 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr);
// TODO(Rodrigo): Read this from HLE
constexpr static u32 block_height_log2 = 4;
constexpr u32 block_height_log2 = 4;
const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer);
const u64 linear_size{GetSizeInBytes(framebuffer)};
const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel,
@ -1482,7 +1482,7 @@ u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer)
u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer,
std::size_t image_index) const {
constexpr static auto first_image_offset = static_cast<u64>(sizeof(BufferData));
constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData));
return first_image_offset + GetSizeInBytes(framebuffer) * image_index;
}

View File

@ -172,8 +172,7 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute,
buffer_cache.UnbindComputeTextureBuffers();
size_t index{};
const auto add_buffer{[&](const auto& desc) {
constexpr static bool is_image =
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
for (u32 i = 0; i < desc.count; ++i) {
bool is_written{false};
if constexpr (is_image) {

View File

@ -398,8 +398,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
size_t index{};
const auto add_buffer{[&](const auto& desc) {
constexpr static bool is_image =
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
for (u32 i = 0; i < desc.count; ++i) {
bool is_written{false};
if constexpr (is_image) {

View File

@ -1109,9 +1109,9 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re
if (!state_tracker.TouchDepthBiasEnable()) {
return;
}
constexpr static size_t POINT = 0;
constexpr static size_t LINE = 1;
constexpr static size_t POLYGON = 2;
constexpr size_t POINT = 0;
constexpr size_t LINE = 1;
constexpr size_t POLYGON = 2;
static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = {
POINT, // Points
LINE, // Lines

View File

@ -55,9 +55,8 @@ std::pair<vk::Image, MemoryCommit> CreateWrappedImage(const Device& device,
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_SHADER_READ_BIT};
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
const VkImageMemoryBarrier barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
@ -153,7 +152,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
.finalLayout = VK_IMAGE_LAYOUT_GENERAL,
};
constexpr static VkAttachmentReference color_attachment_ref{
constexpr VkAttachmentReference color_attachment_ref{
.attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL,
};
@ -171,7 +170,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
.pPreserveAttachments = nullptr,
};
constexpr static VkSubpassDependency dependency{
constexpr VkSubpassDependency dependency{
.srcSubpass = VK_SUBPASS_EXTERNAL,
.dstSubpass = 0,
.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
@ -329,7 +328,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
},
}};
constexpr static VkPipelineVertexInputStateCreateInfo vertex_input_ci{
constexpr VkPipelineVertexInputStateCreateInfo vertex_input_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -339,7 +338,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.pVertexAttributeDescriptions = nullptr,
};
constexpr static VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
constexpr VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -347,7 +346,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.primitiveRestartEnable = VK_FALSE,
};
constexpr static VkPipelineViewportStateCreateInfo viewport_state_ci{
constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -357,7 +356,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.pScissors = nullptr,
};
constexpr static VkPipelineRasterizationStateCreateInfo rasterization_ci{
constexpr VkPipelineRasterizationStateCreateInfo rasterization_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -373,7 +372,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.lineWidth = 1.0f,
};
constexpr static VkPipelineMultisampleStateCreateInfo multisampling_ci{
constexpr VkPipelineMultisampleStateCreateInfo multisampling_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -385,7 +384,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.alphaToOneEnable = VK_FALSE,
};
constexpr static VkPipelineColorBlendAttachmentState color_blend_attachment{
constexpr VkPipelineColorBlendAttachmentState color_blend_attachment{
.blendEnable = VK_FALSE,
.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO,
.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO,
@ -408,7 +407,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
.blendConstants = {0.0f, 0.0f, 0.0f, 0.0f},
};
constexpr static std::array dynamic_states{
constexpr std::array dynamic_states{
VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR,
};
@ -469,7 +468,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo>
}
void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) {
constexpr static std::array<VkImageSubresourceRange, 1> subresources{{{
static constexpr std::array<VkImageSubresourceRange, 1> subresources{{{
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.levelCount = 1,
@ -529,8 +528,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count,
}
void SMAA::CreateImages() {
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
static constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
static constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
std::tie(m_static_images[Area], m_static_buffer_commits[Area]) =
CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM);
@ -587,12 +586,12 @@ void SMAA::CreateSampler() {
void SMAA::CreateShaders() {
// These match the order of the SMAAStage enum
constexpr static std::array vert_shader_sources{
static constexpr std::array vert_shader_sources{
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV),
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV),
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV),
};
constexpr static std::array frag_shader_sources{
static constexpr std::array frag_shader_sources{
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV),
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV),
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV),
@ -676,8 +675,8 @@ void SMAA::UploadImages(Scheduler& scheduler) {
return;
}
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
static constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
static constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent,
VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes));

View File

@ -299,7 +299,7 @@ void StagingBufferPool::ReleaseCache(MemoryUsage usage) {
}
void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) {
constexpr static size_t deletions_per_tick = 16;
constexpr size_t deletions_per_tick = 16;
auto& staging = cache[log2];
auto& entries = staging.entries;
const size_t old_size = entries.size();

View File

@ -53,7 +53,7 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) {
}
VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) {
constexpr static auto undefined_size{std::numeric_limits<u32>::max()};
constexpr auto undefined_size{std::numeric_limits<u32>::max()};
if (capabilities.currentExtent.width != undefined_size) {
return capabilities.currentExtent;
}

View File

@ -113,7 +113,7 @@ public:
std::optional<ASTCDecoderPass> astc_decoder_pass;
const Settings::ResolutionScalingInfo& resolution;
constexpr static size_t indexing_slots = 8 * sizeof(size_t);
static constexpr size_t indexing_slots = 8 * sizeof(size_t);
std::array<vk::Buffer, indexing_slots> buffers{};
std::array<std::unique_ptr<MemoryCommit>, indexing_slots> buffer_commits{};
};

View File

@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) {
auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal);
// Create the descriptor pool to contain our descriptor.
constexpr static VkDescriptorPoolSize pool_size{
static constexpr VkDescriptorPoolSize pool_size{
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
.descriptorCount = 1,
};
@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) {
});
// Create the descriptor set layout from the pool.
constexpr static VkDescriptorSetLayoutBinding layout_binding{
static constexpr VkDescriptorSetLayoutBinding layout_binding{
.binding = 0,
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
.descriptorCount = 1,

View File

@ -371,7 +371,7 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
}
u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) {
constexpr static u64 RGBA8_PIXEL_SIZE = 4;
constexpr u64 RGBA8_PIXEL_SIZE = 4;
const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) *
static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE;
return (base_size * base_block_size) / BytesPerBlock(format);

View File

@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) {
template <u32 mask, u32 incr_amount>
void incrpdep(u32& value) {
constexpr static u32 swizzled_incr = pdep<mask>(incr_amount);
static constexpr u32 swizzled_incr = pdep<mask>(incr_amount);
value = ((value | ~mask) + swizzled_incr) & mask;
}

View File

@ -495,9 +495,9 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffe
Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions,
InstanceDispatch& dispatch) {
#ifdef __APPLE__
constexpr static VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
#else
constexpr static VkFlags ci_flags{};
constexpr VkFlags ci_flags{};
#endif
const VkApplicationInfo application_info{

View File

@ -720,7 +720,7 @@ void GRenderWindow::TouchEndEvent() {
void GRenderWindow::InitializeCamera() {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
constexpr static auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz)
constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz)
if (!Settings::values.enable_ir_sensor) {
return;
}

View File

@ -317,9 +317,9 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center)
// D-pad constants
const QPointF dpad_center = center + QPoint(9, 14);
constexpr static int dpad_distance = 23;
constexpr static int dpad_radius = 11;
constexpr static float dpad_arrow_size = 1.2f;
constexpr int dpad_distance = 23;
constexpr int dpad_radius = 11;
constexpr float dpad_arrow_size = 1.2f;
// D-pad buttons
p.setPen(colors.outline);
@ -439,9 +439,9 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center
// Face buttons constants
const QPointF face_center = center + QPoint(-9, -73);
constexpr static int face_distance = 23;
constexpr static int face_radius = 11;
constexpr static float text_size = 1.1f;
constexpr int face_distance = 23;
constexpr int face_radius = 11;
constexpr float text_size = 1.1f;
// Face buttons
p.setPen(colors.outline);
@ -559,9 +559,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
// Face buttons constants
const QPointF face_center = center + QPoint(65, -65);
constexpr static int face_distance = 20;
constexpr static int face_radius = 10;
constexpr static float text_size = 1.0f;
constexpr int face_distance = 20;
constexpr int face_radius = 10;
constexpr float text_size = 1.0f;
// Face buttons
p.setPen(colors.outline);
@ -581,9 +581,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
// D-pad constants
const QPointF dpad_center = center + QPoint(-65, 12);
constexpr static int dpad_distance = 20;
constexpr static int dpad_radius = 10;
constexpr static float dpad_arrow_size = 1.1f;
constexpr int dpad_distance = 20;
constexpr int dpad_radius = 10;
constexpr float dpad_arrow_size = 1.1f;
// D-pad buttons
p.setPen(colors.outline);
@ -651,9 +651,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
// Face buttons constants
const QPointF face_center = center + QPoint(171, -41);
constexpr static float face_distance = 12.8f;
constexpr static float face_radius = 6.4f;
constexpr static float text_size = 0.6f;
constexpr float face_distance = 12.8f;
constexpr float face_radius = 6.4f;
constexpr float text_size = 0.6f;
// Face buttons
p.setPen(colors.outline);
@ -673,9 +673,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
// D-pad constants
const QPointF dpad_center = center + QPoint(-171, 8);
constexpr static float dpad_distance = 12.8f;
constexpr static float dpad_radius = 6.4f;
constexpr static float dpad_arrow_size = 0.68f;
constexpr float dpad_distance = 12.8f;
constexpr float dpad_radius = 6.4f;
constexpr float dpad_arrow_size = 0.68f;
// D-pad buttons
p.setPen(colors.outline);
@ -754,9 +754,9 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center)
// Face buttons constants
const QPointF face_center = center + QPoint(105, -56);
constexpr static int face_distance = 31;
constexpr static int face_radius = 15;
constexpr static float text_size = 1.5f;
constexpr int face_distance = 31;
constexpr int face_radius = 15;
constexpr float text_size = 1.5f;
// Face buttons
p.setPen(colors.outline);
@ -846,7 +846,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) {
using namespace Settings::NativeButton;
// Face buttons constants
constexpr static float text_size = 1.1f;
constexpr float text_size = 1.1f;
// Face buttons
p.setPen(colors.outline);
@ -1497,7 +1497,7 @@ void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) {
std::array<QPointF, pro_left_handle.size() / 2> qleft_handle;
std::array<QPointF, pro_left_handle.size() / 2> qright_handle;
std::array<QPointF, pro_body.size()> qbody;
constexpr static int radius1 = 32;
constexpr int radius1 = 32;
for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) {
const float left_x = pro_left_handle[point * 2 + 0];
@ -1539,7 +1539,7 @@ void PlayerControlPreview::DrawGCBody(QPainter& p, const QPointF center) {
std::array<QPointF, gc_body.size()> qbody;
std::array<QPointF, 8> left_hex;
std::array<QPointF, 8> right_hex;
constexpr static float angle = 2 * 3.1415f / 8;
constexpr float angle = 2 * 3.1415f / 8;
for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) {
const float body_x = gc_left_body[point * 2 + 0];
@ -1676,9 +1676,9 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) {
std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview;
std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview;
std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview;
constexpr static float size = 1.61f;
constexpr static float size2 = 0.9f;
constexpr static float offset = 209.3f;
constexpr float size = 1.61f;
constexpr float size2 = 0.9f;
constexpr float offset = 209.3f;
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
const float body_x = left_joycon_body[point * 2 + 0];
@ -1767,10 +1767,10 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) {
std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider;
std::array<QPointF, left_joycon_slider_topview.size() / 2> qleft_joycon_slider_topview;
std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview;
constexpr static float size = 1.78f;
constexpr static float size2 = 1.1115f;
constexpr static float offset = 312.39f;
constexpr static float offset2 = 335;
constexpr float size = 1.78f;
constexpr float size2 = 1.1115f;
constexpr float offset = 312.39f;
constexpr float offset2 = 335;
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset,
@ -1867,10 +1867,10 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) {
std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider;
std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview;
std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview;
constexpr static float size = 1.78f;
constexpr static float size2 = 1.1115f;
constexpr static float offset = 312.39f;
constexpr static float offset2 = 335;
constexpr float size = 1.78f;
constexpr float size2 = 1.1115f;
constexpr float offset = 312.39f;
constexpr float offset2 = 335;
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset,
@ -2068,8 +2068,8 @@ void PlayerControlPreview::DrawDualTriggers(QPainter& p, const QPointF center,
const Common::Input::ButtonStatus& right_pressed) {
std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger;
std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger;
constexpr static float size = 1.62f;
constexpr static float offset = 210.6f;
constexpr float size = 1.62f;
constexpr float offset = 210.6f;
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
const float left_trigger_x = left_joycon_trigger[point * 2 + 0];
const float left_trigger_y = left_joycon_trigger[point * 2 + 1];
@ -2097,7 +2097,7 @@ void PlayerControlPreview::DrawDualTriggersTopView(
const Common::Input::ButtonStatus& right_pressed) {
std::array<QPointF, left_joystick_L_topview.size() / 2> qleft_trigger;
std::array<QPointF, left_joystick_L_topview.size() / 2> qright_trigger;
constexpr static float size = 0.9f;
constexpr float size = 0.9f;
for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) {
const float top_view_x = left_joystick_L_topview[point * 2 + 0];
@ -2134,7 +2134,7 @@ void PlayerControlPreview::DrawDualZTriggersTopView(
const Common::Input::ButtonStatus& right_pressed) {
std::array<QPointF, left_joystick_ZL_topview.size() / 2> qleft_trigger;
std::array<QPointF, left_joystick_ZL_topview.size() / 2> qright_trigger;
constexpr static float size = 0.9f;
constexpr float size = 0.9f;
for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) {
qleft_trigger[point] =
@ -2167,8 +2167,8 @@ void PlayerControlPreview::DrawDualZTriggersTopView(
void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center,
const Common::Input::ButtonStatus& left_pressed) {
std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger;
constexpr static float size = 1.78f;
constexpr static float offset = 311.5f;
constexpr float size = 1.78f;
constexpr float offset = 311.5f;
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
qleft_trigger[point] = center + QPointF(left_joycon_trigger[point * 2] * size + offset,
@ -2184,8 +2184,8 @@ void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center,
void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center,
const Common::Input::ButtonStatus& left_pressed) {
std::array<QPointF, left_joycon_sideview_zl.size() / 2> qleft_trigger;
constexpr static float size = 1.1115f;
constexpr static float offset2 = 335;
constexpr float size = 1.1115f;
constexpr float offset2 = 335;
for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) {
qleft_trigger[point] = center + QPointF(left_joycon_sideview_zl[point * 2] * size + offset2,
@ -2241,8 +2241,8 @@ void PlayerControlPreview::DrawLeftZTriggersTopView(
void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center,
const Common::Input::ButtonStatus& right_pressed) {
std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger;
constexpr static float size = 1.78f;
constexpr static float offset = 311.5f;
constexpr float size = 1.78f;
constexpr float offset = 311.5f;
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset,
@ -2258,8 +2258,8 @@ void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center,
void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center,
const Common::Input::ButtonStatus& right_pressed) {
std::array<QPointF, left_joycon_sideview_zl.size() / 2> qright_trigger;
constexpr static float size = 1.1115f;
constexpr static float offset2 = 335;
constexpr float size = 1.1115f;
constexpr float offset2 = 335;
for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) {
qright_trigger[point] =
@ -2433,7 +2433,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo
void PlayerControlPreview::DrawJoystickProperties(
QPainter& p, const QPointF center, const Common::Input::AnalogProperties& properties) {
constexpr static float size = 45.0f;
constexpr float size = 45.0f;
const float range = size * properties.range;
const float deadzone = size * properties.deadzone;
@ -2453,7 +2453,7 @@ void PlayerControlPreview::DrawJoystickProperties(
void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center,
const Common::Input::StickStatus& stick, bool raw) {
constexpr static float size = 45.0f;
constexpr float size = 45.0f;
const float range = size * stick.x.properties.range;
if (raw) {

Some files were not shown because too many files have changed in this diff Show More