diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 84359afa35..1a04c9a903 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -203,8 +203,10 @@ namespace Reporting it = crcResults.find(gamePath); } - if (crcThread.joinable()) + if (crcThread.joinable()) { + INFO_LOG(SYSTEM, "Finished CRC calculation"); crcThread.join(); + } return it->second; } diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index 736cde9511..9e79274d43 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -111,7 +111,8 @@ public: bool Ready(GameInfoFlags flags) { std::unique_lock guard(lock); - return (hasFlags & flags) != 0; + // Avoid the operator, we want to check all the bits. + return ((int)hasFlags & (int)flags) == (int)flags; } void MarkReadyNoLock(GameInfoFlags flags) { diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index bda3d29874..65090f47af 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -149,9 +149,10 @@ void GameScreen::CreateViews() { tvCRC_->SetVisibility(Reporting::HasCRC(gamePath_) ? V_VISIBLE : V_GONE); tvVerified_ = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("Click \"Calculate CRC\" to verify ISO"), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvVerified_->SetVisibility(UI::V_GONE); + tvVerified_->SetSquishy(true); if (info->badCHD) { auto e = GetI18NCategory(I18NCat::ERRORS); - infoLayout->Add(new NoticeView(NoticeLevel::ERROR, e->T("BadCHD", "Bad CHD file.\nCompress using \"chdman createdvd\" for good performance."), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); + infoLayout->Add(new NoticeView(NoticeLevel::ERROR, e->T("BadCHD", "Bad CHD file.\nCompress using \"chdman createdvd\" for good performance."), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetSquishy(true); } } else { tvTitle_ = nullptr; @@ -296,7 +297,7 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { tvTitle_->SetText(info->GetTitle()); } - if (info->gameSizeOnDisk) { + if (info->Ready(GameInfoFlags::SIZE | GameInfoFlags::UNCOMPRESSED_SIZE)) { char temp[256]; if (tvGameSize_) { snprintf(temp, sizeof(temp), "%s: %s", ga->T("Game"), NiceSizeFormat(info->gameSizeOnDisk).c_str()); @@ -350,7 +351,7 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { // Let's check the CRC in the game database, looking up the ID and also matching the crc. std::vector dbInfos; - if (tvVerified_ && !info->id_version.empty() && g_gameDB.GetGameInfos(info->id_version, &dbInfos)) { + if (tvVerified_ && info->Ready(GameInfoFlags::PARAM_SFO) && g_gameDB.GetGameInfos(info->id_version, &dbInfos)) { bool found = false; for (auto &dbInfo : dbInfos) { if (dbInfo.crc == crcVal) { @@ -365,21 +366,23 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { // Like the other messages below, disabled until we have a database we have confidence in. // tvVerified_->SetText(ga->T("CRC checksum does not match, bad or modified ISO")); // tvVerified_->SetLevel(NoticeLevel::ERROR); + tvVerified_->SetVisibility(UI::V_GONE); } - } else { + } else if (tvVerified_) { // tvVerified_->SetText(ga->T("Game ID unknown - not in the Redump database")); // tvVerified_->SetVisibility(UI::V_VISIBLE); // tvVerified_->SetLevel(NoticeLevel::WARN); + tvVerified_->SetVisibility(UI::V_GONE); } } else if (!isHomebrew_) { GameDBInfo dbInfo; if (tvVerified_) { std::vector dbInfos; - if (!info->id_version.empty() && !g_gameDB.GetGameInfos(info->id_version, &dbInfos)) { + if (info->Ready(GameInfoFlags::PARAM_SFO) && !g_gameDB.GetGameInfos(info->id_version, &dbInfos)) { // tvVerified_->SetText(ga->T("Game ID unknown - not in the ReDump database")); // tvVerified_->SetVisibility(UI::V_VISIBLE); // tvVerified_->SetLevel(NoticeLevel::WARN); - } else if (info->gameSizeUncompressed != 0) { // don't do this check if info still pending + } else if (info->Ready(GameInfoFlags::UNCOMPRESSED_SIZE) && info->gameSizeUncompressed != 0) { // don't do this check if info still pending bool found = false; for (auto &dbInfo : dbInfos) { // TODO: Doesn't take CSO/CHD into account. @@ -391,6 +394,7 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { // tvVerified_->SetText(ga->T("File size incorrect, bad or modified ISO")); // tvVerified_->SetVisibility(UI::V_VISIBLE); // tvVerified_->SetLevel(NoticeLevel::ERROR); + // INFO_LOG(LOADER, "File size %d not matching game DB", (int)info->gameSizeUncompressed); } else { tvVerified_->SetText(ga->T("Click \"Calculate CRC\" to verify ISO")); tvVerified_->SetVisibility(UI::V_VISIBLE); diff --git a/UI/OnScreenDisplay.cpp b/UI/OnScreenDisplay.cpp index 83ca7e6906..73773584e2 100644 --- a/UI/OnScreenDisplay.cpp +++ b/UI/OnScreenDisplay.cpp @@ -564,7 +564,9 @@ void NoticeView::GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec ApplyBoundsBySpec(bounds, horiz, vert); MeasureNotice(dc, level_, text_, detailsText_, iconName_, 0, &w, &h, &height1_); // Layout hack! Some weird problems with the layout that I can't figure out right now.. - w = 50.0; + if (squishy_) { + w = 50.0; + } } void NoticeView::Draw(UIContext &dc) { diff --git a/UI/OnScreenDisplay.h b/UI/OnScreenDisplay.h index 85159e0d50..f798b029d6 100644 --- a/UI/OnScreenDisplay.h +++ b/UI/OnScreenDisplay.h @@ -69,6 +69,9 @@ public: void SetLevel(NoticeLevel level) { level_ = level; } + void SetSquishy(bool squishy) { + squishy_ = squishy; + } void GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const override; void Draw(UIContext &dc) override; @@ -79,4 +82,5 @@ private: std::string iconName_; NoticeLevel level_; mutable float height1_ = 0.0f; + bool squishy_ = false; };