From b1fa6b467183acc0423c5a59afe3c3fb0404beba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 6 Feb 2026 14:30:47 +0100 Subject: [PATCH] Remove some uses of textScale --- Common/File/VFS/ZipFileReader.cpp | 4 ++-- Common/File/VFS/ZipFileReader.h | 2 +- Common/UI/Notice.cpp | 8 +++----- Core/System.cpp | 3 ++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Common/File/VFS/ZipFileReader.cpp b/Common/File/VFS/ZipFileReader.cpp index 6f4968a388..18054625f3 100644 --- a/Common/File/VFS/ZipFileReader.cpp +++ b/Common/File/VFS/ZipFileReader.cpp @@ -136,10 +136,10 @@ zip_int64_t ZipContainer::SourceCallback(void *userdata, void *data, zip_uint64_ } } -ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath, bool logErrors) { +ZipFileReader *ZipFileReader::Create(const Path &zipFile, std::string_view inZipPath, bool logErrors) { // The inZipPath is supposed to be a folder, and internally in this class, we suffix // folder paths with '/', matching how the zip library works. - std::string path = inZipPath; + std::string path(inZipPath); if (!path.empty() && path.back() != '/') { path.push_back('/'); } diff --git a/Common/File/VFS/ZipFileReader.h b/Common/File/VFS/ZipFileReader.h index 4c4e5b48fc..c2779d6a3b 100644 --- a/Common/File/VFS/ZipFileReader.h +++ b/Common/File/VFS/ZipFileReader.h @@ -39,7 +39,7 @@ private: class ZipFileReader : public VFSBackend { public: - static ZipFileReader *Create(const Path &zipFile, const char *inZipPath, bool logErrors = true); + static ZipFileReader *Create(const Path &zipFile, std::string_view inZipPath, bool logErrors = true); ~ZipFileReader(); bool IsValid() const { return zip_file_ != nullptr; } diff --git a/Common/UI/Notice.cpp b/Common/UI/Notice.cpp index ca7cb0d514..9b26fe0b12 100644 --- a/Common/UI/Notice.cpp +++ b/Common/UI/Notice.cpp @@ -5,8 +5,6 @@ #include "Common/StringUtils.h" #include "Common/System/OSD.h" -static const float extraTextScale = 0.7f; - uint32_t GetNoticeBackgroundColor(NoticeLevel type) { // Colors from Infima switch (type) { @@ -79,7 +77,7 @@ void MeasureNotice(const UIContext &dc, NoticeLevel level, std::string_view text float width2 = 0.0f, height2 = 0.0f; if (!details.empty()) { - dc.MeasureTextRect(dc.GetTheme().uiFont, extraTextScale, extraTextScale, details, availableWidth, &width2, &height2, align | FLAG_WRAP_TEXT); + dc.MeasureTextRect(dc.GetTheme().uiFontSmall, 1.0f, 1.0f, details, availableWidth, &width2, &height2, align | FLAG_WRAP_TEXT); *width = std::max(*width, width2); } @@ -159,8 +157,8 @@ void RenderNotice(UIContext &dc, Bounds bounds, float height1, NoticeLevel level UI::Drawable backgroundDark = UI::Drawable(colorAlpha(darkenColor(GetNoticeBackgroundColor(level)), alpha)); dc.FillRect(backgroundDark, bottomTextBounds); } - dc.SetFontScale(extraTextScale, extraTextScale); + dc.SetFontStyle(dc.GetTheme().uiFontSmall); dc.DrawTextRect(details, bottomTextBounds.Inset(1.0f, 1.0f), foreGround, (align & FLAG_DYNAMIC_ASCII) | ALIGN_LEFT | FLAG_WRAP_TEXT); } - dc.SetFontScale(1.0f, 1.0f); + dc.SetFontStyle(dc.GetTheme().uiFont); } diff --git a/Core/System.cpp b/Core/System.cpp index 0884eae014..58be4adb24 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -58,6 +58,7 @@ #include "Core/HW/Display.h" #include "Core/Config.h" #include "Core/Core.h" +#include "Core/Util/PathUtil.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" #include "Core/FileLoaders/RamCachingFileLoader.h" @@ -300,7 +301,7 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin // TODO: Better would be to check that it was loaded successfully. if (!File::Exists(g_CoreParameter.fileToStart / INDEX_FILENAME)) { auto sc = GetI18NCategory(I18NCat::SCREEN); - g_OSD.Show(OSDType::MESSAGE_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), g_CoreParameter.fileToStart.ToVisualString(), 7.0f); + g_OSD.Show(OSDType::MESSAGE_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), GetFriendlyPath(g_CoreParameter.fileToStart), 7.0f); } else { INFO_LOG(Log::Loader, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str()); }