diff --git a/Common/Data/Format/JSONReader.cpp b/Common/Data/Format/JSONReader.cpp index 7fbe1ab2d2..6e7af3634f 100644 --- a/Common/Data/Format/JSONReader.cpp +++ b/Common/Data/Format/JSONReader.cpp @@ -36,7 +36,7 @@ bool JsonReader::parse() { int JsonGet::numChildren() const { int count = 0; if (value_.getTag() == JSON_OBJECT || value_.getTag() == JSON_ARRAY) { - for (auto it : value_) { + for (const auto &it : value_) { (void)it; count++; } @@ -52,7 +52,7 @@ const JsonNode *JsonGet::get(const char *child_name) const { if (value_.getTag() != JSON_OBJECT) { return nullptr; } - for (auto it : value_) { + for (const auto &it : value_) { if (!strcmp(it->key, child_name)) { return it; } @@ -94,7 +94,7 @@ const char *JsonGet::getStringOr(const char *child_name, const char *default_val bool JsonGet::getStringVector(std::vector *vec) const { vec->clear(); if (value_.getTag() == JSON_ARRAY) { - for (auto it : value_) { + for (const auto &it : value_) { if (it->value.getTag() == JSON_STRING) { vec->push_back(it->value.toString()); } diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index 323976d9ad..803e22d2f1 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -198,7 +198,7 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC glAttachShader(program->program, step.create_program.shaders[j]->shader); } - for (auto iter : program->semantics_) { + for (const auto &iter : program->semantics_) { glBindAttribLocation(program->program, iter.location, iter.attrib); } @@ -304,7 +304,7 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC LineNumberString(code).c_str()); std::vector lines; SplitString(errorString, '\n', lines); - for (auto line : lines) { + for (const auto &line : lines) { ERROR_LOG(Log::G3D, "%.*s", (int)line.size(), line.data()); } if (errorCallback_) { diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 4f16a81b2f..5a117a6db3 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -507,7 +507,7 @@ void VulkanRenderManager::CompileThreadFunc() { } } - for (auto iter : map) { + for (const auto &iter : map) { auto &shaders = iter.first; auto &entries = iter.second; diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index 72fbe873e8..485fed453a 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -528,7 +528,7 @@ const UniformBufferDesc vsTexColBufDesc{ sizeof(VsTexColUB),{ ShaderModule *CreateShader(DrawContext *draw, ShaderStage stage, const std::vector &sources) { uint32_t supported = draw->GetSupportedShaderLanguages(); - for (auto iter : sources) { + for (const auto &iter : sources) { if ((uint32_t)iter.lang & supported) { return draw->CreateShaderModule(stage, iter.lang, (const uint8_t *)iter.src, strlen(iter.src)); } diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index 3be4e8281c..b5b8a5c425 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -160,7 +160,7 @@ std::shared_ptr RequestManager::AsyncPostWithCallback( } void RequestManager::Update() { - for (auto iter : newDownloads_) { + for (auto &iter : newDownloads_) { downloads_.push_back(iter); } newDownloads_.clear(); diff --git a/Core/FileLoaders/CachingFileLoader.cpp b/Core/FileLoaders/CachingFileLoader.cpp index 5a419502e6..d787c97576 100644 --- a/Core/FileLoaders/CachingFileLoader.cpp +++ b/Core/FileLoaders/CachingFileLoader.cpp @@ -116,7 +116,7 @@ void CachingFileLoader::ShutdownCache() { aheadThread_.join(); std::lock_guard guard(blocksMutex_); - for (auto block : blocks_) { + for (const auto &block : blocks_) { delete [] block.second.ptr; } blocks_.clear(); diff --git a/Core/FileLoaders/DiskCachingFileLoader.cpp b/Core/FileLoaders/DiskCachingFileLoader.cpp index 12b715072c..6a36add50d 100644 --- a/Core/FileLoaders/DiskCachingFileLoader.cpp +++ b/Core/FileLoaders/DiskCachingFileLoader.cpp @@ -129,7 +129,7 @@ std::vector DiskCachingFileLoader::GetCachedPathsInUse() { std::vector files; files.reserve(caches_.size()); - for (auto it : caches_) { + for (const auto &it : caches_) { files.push_back(it.first); } diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 910b1b7f8a..bc9464274a 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -646,7 +646,7 @@ void MetaFileSystem::DoState(PointerWrap &p) { int64_t MetaFileSystem::RecursiveSize(const std::string &dirPath) { u64 result = 0; auto allFiles = GetDirListing(dirPath); - for (auto file : allFiles) { + for (const auto &file : allFiles) { if (file.name == "." || file.name == "..") continue; if (file.type == FILETYPE_DIRECTORY) { diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 2a06454f79..2856a5232a 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -742,7 +742,7 @@ public: private: int FindExistingIndex(Font *font) const { // TODO: Should this also match for memory fonts, or only internal fonts? - for (auto it : fontMap) { + for (const auto &it : fontMap) { if (it.second->GetFont() != font || it.second->GetFontLib() != this) continue; for (size_t i = 0; i < fonts_.size(); i++) { diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index 49e17da3b0..bd880f3b9d 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -75,7 +75,7 @@ void __HeapInit() { } void __HeapShutdown() { - for (auto it : heapList) { + for (const auto &it : heapList) { delete it.second; } heapList.clear(); diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index f7f2954088..03ed76b41d 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -542,7 +542,7 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re ERROR_LOG_REPORT(Log::Loader, "HI16 and LO16 imports do not match at %08x for %08x (should be %08x)", relocAddress, state.lastHI16ExportAddress, exportAddress); } else { // Process each of the HI16. Usually there's only one. - for (auto &reloc : state.lastHI16Relocs) { + for (const auto &reloc : state.lastHI16Relocs) { if (!reverse) { full = (reloc.data << 16) + offsetLo + exportAddress; } else { diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 5c663066e1..a3c739d6b5 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -119,7 +119,7 @@ std::string InfraDNSConfig::ToString() const { } if (!fixedDNS.empty()) { w.C("Fixed DNS").endl(); - for (auto iter : fixedDNS) { + for (const auto &iter : fixedDNS) { w.F("%s -> %s", iter.first.c_str(), iter.second.c_str()).endl(); } } @@ -290,7 +290,7 @@ bool LoadDNSForGameID(std::string_view gameID, std::string_view jsonStr, InfraDN dns->connectAdHocForGrouping = game.getBool("connect_adhoc_for_grouping", dns->connectAdHocForGrouping); if (game.hasChild("domains", JSON_OBJECT)) { const JsonGet domains = game.getDict("domains"); - for (auto iter : domains.value_) { + for (const auto &iter : domains.value_) { std::string domain = std::string(iter->key); std::string ipAddr = std::string(iter->value.toString()); dns->fixedDNS[domain] = ipAddr; diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 40b92f2d4b..e8ff6905cd 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -594,7 +594,7 @@ bool Psmf::setStreamNum(u32 psmfStruct, int num, bool updateCached) { } bool Psmf::setStreamWithType(u32 psmfStruct, int type, int channel) { - for (auto iter : streamMap) { + for (const auto &iter : streamMap) { // Note: this does NOT support PSMF_AUDIO_STREAM. if (iter.second->type_ == type && iter.second->channel_ == channel) { return setStreamNum(psmfStruct, iter.first); @@ -604,7 +604,7 @@ bool Psmf::setStreamWithType(u32 psmfStruct, int type, int channel) { } bool Psmf::setStreamWithTypeNumber(u32 psmfStruct, int type, int n) { - for (auto iter : streamMap) { + for (const auto &iter : streamMap) { if (iter.second->matchesType(type)) { if (n != 0) { // Keep counting... @@ -797,7 +797,7 @@ static u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) { } int streamNum = 0; - for (auto it : psmf->streamMap) { + for (const auto &it : psmf->streamMap) { if (it.second->matchesType(streamType)) { streamNum++; } diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 59013aa7cb..96b54e5ab2 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -356,7 +356,7 @@ void MediaEngine::closeContext() av_free(m_pIOContext->buffer); if (m_pIOContext) av_free(m_pIOContext); - for (auto it : m_pCodecCtxs) { + for (const auto &it : m_pCodecCtxs) { #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100) avcodec_free_context(&it.second); #else @@ -365,7 +365,7 @@ void MediaEngine::closeContext() } m_pCodecCtxs.clear(); // These are streams allocated from avformat_new_stream. - for (auto it : m_codecsToClose) { + for (const auto &it : m_codecsToClose) { avcodec_close(it); } m_codecsToClose.clear(); diff --git a/Core/MIPS/x86/X64IRAsm.cpp b/Core/MIPS/x86/X64IRAsm.cpp index 883149dcd5..5cf4136930 100644 --- a/Core/MIPS/x86/X64IRAsm.cpp +++ b/Core/MIPS/x86/X64IRAsm.cpp @@ -303,7 +303,7 @@ void X64JitBackend::GenerateFixedCode(MIPSState *mipsState) { if (enableDisasm) { #if PPSSPP_ARCH(AMD64) std::vector lines = DisassembleX86(disasmStart, (int)(GetCodePtr() - disasmStart)); - for (auto s : lines) { + for (const auto &s : lines) { INFO_LOG(Log::JIT, "%s", s.c_str()); } #endif diff --git a/Core/System.cpp b/Core/System.cpp index 6a8f3ab1f0..fd976a4b23 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -589,7 +589,7 @@ BootState PSP_InitUpdate(std::string *error_string) { _dbg_assert_(g_bootState == BootState::Complete || g_bootState == BootState::Failed); // Since we load on a background thread, wait for startup to complete. - _dbg_assert_(g_loadingThread.joinable()); + _assert_msg_(g_loadingThread.joinable(), "bootstate: %d", (int)g_bootState); g_loadingThread.join(); if (g_bootState == BootState::Failed) { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 9066920672..fa00cb48a7 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -345,8 +345,10 @@ void EmuScreen::ProcessGameBoot(const Path &filename) { return; } - loadingViewColor_->Divert(0xFFFFFFFF, 0.75f); - loadingViewVisible_->Divert(UI::V_VISIBLE, 0.75f); + if (loadingViewColor_) + loadingViewColor_->Divert(0xFFFFFFFF, 0.75f); + if (loadingViewVisible_) + loadingViewVisible_->Divert(UI::V_VISIBLE, 0.75f); screenManager()->getDrawContext()->ResetStats(); @@ -431,8 +433,10 @@ void EmuScreen::bootComplete() { saveStateSlot_ = SaveState::GetCurrentSlot(); - loadingViewColor_->Divert(0x00FFFFFF, 0.2f); - loadingViewVisible_->Divert(UI::V_INVISIBLE, 0.2f); + if (loadingViewColor_) + loadingViewColor_->Divert(0x00FFFFFF, 0.2f); + if (loadingViewVisible_) + loadingViewVisible_->Divert(UI::V_INVISIBLE, 0.2f); std::string gameID = g_paramSFO.GetValueString("DISC_ID"); g_Config.TimeTracker().Start(gameID);