diff options
Diffstat (limited to 'src/core')
40 files changed, 97 insertions, 98 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 7ba13ab51..47292cd78 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -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); diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 5214e88b8..3a63b52e3 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -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); diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp index 0a86e8b0a..efdf18cee 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) { 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()); } diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index cb172f574..f00479bd3 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) { /*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; diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 0f1f76949..a6960170c 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 } 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", diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index e380da3a4..836f32c0f 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 } 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) { 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 49098d2c9..c10b7bf30 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() { }(); // 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; diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index 951326a85..571acf4b2 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 } 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); diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 374bc2c06..2907cc6e3 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 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, diff --git a/src/core/hle/kernel/k_memory_manager.h b/src/core/hle/kernel/k_memory_manager.h index d13549b5e..401d4e644 100644 --- a/src/core/hle/kernel/k_memory_manager.h +++ b/src/core/hle/kernel/k_memory_manager.h @@ -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(); diff --git a/src/core/hle/kernel/k_page_heap.cpp b/src/core/hle/kernel/k_page_heap.cpp index ffebf0a35..7b02c7d8b 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 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); diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index d3e0334ed..2e13d5d0d 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 } // 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), diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index e9270c6f3..5b72eaaa1 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -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()); diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index de322cbf9..773319ad8 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 } 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; diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp index 0fd1b3d4c..baafefaeb 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, 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); diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index c30ba0295..ad56e2fe6 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 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); diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 7045c5e69..21f818da6 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 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); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 5b87bb18c..6d1084fd1 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 // 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); } diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 01f03effe..8d5c8a3a3 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -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); 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 962371a99..c18236045 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() { .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, diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp index 7236f586d..227fdd0cf 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, } 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, diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 654d2c493..5abf22ba4 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) { // 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); diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index fe975157c..e01f87356 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -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); } diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index 1c2694645..5fbba8673 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 // 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, diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index f95ad9253..447d624e1 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( 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" diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index d5dcd5567..ba6f04d8d 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -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); diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index a1b187b63..3a2fe938f 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_ } Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) { - constexpr static u32 INVALID_INDEX{0xFFFFFFFF}; + constexpr u32 INVALID_INDEX{0xFFFFFFFF}; index = INVALID_INDEX; diff --git a/src/core/hle/service/nfp/amiibo_crypto.cpp b/src/core/hle/service/nfp/amiibo_crypto.cpp index 0d9c3d0f6..ffb2f959c 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) { 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)); diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index df4f60d59..5d32adf64 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 }; static_assert(sizeof(Output) == 0x3, "Output has incorrect size."); - constexpr static Output out{}; + constexpr Output out{}; IPC::ResponseBuilder rb{ctx, 3}; 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 1f0e05df6..aba51d280 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 @@ 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 diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.h b/src/core/hle/service/nvdrv/core/syncpoint_manager.h index 4f2cefae5..7728ff596 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.h +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.h @@ -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; diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp index 3f41aa0d9..0767e548d 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, // 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. diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index fbae10e7d..530e1be3b 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -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); diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 155d6a00b..01040b32a 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -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); diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index 831a51a67..e96eda7f3 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 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); diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index ceb491224..dcf47083f 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -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"); diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index 7b94b33f7..973f7837a 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) { } 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 {}; } diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 66c8fd38a..2fb631183 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -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; diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 9cf361986..f09c176f8 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 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; } diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 3bcdd9a99..9178b00ca 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -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", |