diff --git a/src/Features/UnifiedWater/WaterCache.cpp b/src/Features/UnifiedWater/WaterCache.cpp index a4963b3e50..2da8f1cbc6 100644 --- a/src/Features/UnifiedWater/WaterCache.cpp +++ b/src/Features/UnifiedWater/WaterCache.cpp @@ -216,7 +216,7 @@ bool WaterCache::GenerateCaches() const unsigned hw = std::max(1u, std::thread::hardware_concurrency()); const unsigned threads = std::max(1u, hw > 4 ? hw - 4 : (hw * 3) / 4); - async.pool = std::make_unique(threads); + async.pool = std::make_unique>(threads); async.failed.store(false); buildProgress.Start(static_cast(worldSpaces.size())); @@ -232,7 +232,7 @@ bool WaterCache::GenerateCaches() continue; } - async.pool->push_task([this, worldSpace, editorID] { + async.pool->detach_task([this, worldSpace, editorID] { DiskCache cache = {}; const auto name = std::format("{}_cache.wc", editorID); const auto success = BuildDiskCache(worldSpace, cache) && TryWriteCacheToFile(name, cache.header, cache.instructions); @@ -257,7 +257,7 @@ bool WaterCache::GenerateCaches() } if (async.pool) - async.pool->wait_for_tasks(); + async.pool->wait(); buildProgress.Stop(); async.running.store(false); diff --git a/src/Features/UnifiedWater/WaterCache.h b/src/Features/UnifiedWater/WaterCache.h index 5d776bef68..1033cd1614 100644 --- a/src/Features/UnifiedWater/WaterCache.h +++ b/src/Features/UnifiedWater/WaterCache.h @@ -100,7 +100,7 @@ class WaterCache struct AsyncBuild { - std::unique_ptr pool; + std::unique_ptr> pool; std::jthread monitor; std::atomic running{ false }; std::atomic failed{ false }; diff --git a/src/Features/VR/SettingsUI.cpp b/src/Features/VR/SettingsUI.cpp index 5be4fc156c..654ac2cb10 100644 --- a/src/Features/VR/SettingsUI.cpp +++ b/src/Features/VR/SettingsUI.cpp @@ -581,7 +581,7 @@ namespace char selectableId[64]; snprintf(selectableId, sizeof(selectableId), "##combo_row_%zu", row); bool rowSelected = (row == static_cast(selectedComboIndex)); - if (ImGui::Selectable(selectableId, rowSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap, ImVec2(0, 0))) { + if (ImGui::Selectable(selectableId, rowSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap, ImVec2(0, 0))) { selectedComboIndex = static_cast(row); } ImGui::SameLine(0, 0); @@ -1097,13 +1097,13 @@ void VR::DrawSettings() } } - if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))) { + if (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)) { ApplyRecordedCombo(); ResetComboRecording(); ImGui::CloseCurrentPopup(); } - if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) { + if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { ResetComboRecording(); ImGui::CloseCurrentPopup(); } diff --git a/src/Menu.cpp b/src/Menu.cpp index 515cb13e1c..8d58a825ef 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -111,7 +111,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( LogSliderDeadzone, TabRounding, TabBorderSize, - TabMinWidthForCloseButton, + TabCloseButtonMinWidthUnselected, TabBarBorderSize, TableAngledHeadersAngle, ColorButtonPosition, @@ -183,6 +183,17 @@ static void SanitizeFontRolesJson(json& themeJson) } } +// Remove FullPalette from theme JSON if its size doesn't match ImGuiCol_COUNT. +// Prevents out_of_range exceptions when loading palettes saved with a different imgui version. +static void SanitizeFullPaletteJson(json& themeJson) +{ + if (!themeJson.contains("FullPalette") || !themeJson["FullPalette"].is_array()) + return; + + if (themeJson["FullPalette"].size() != static_cast(ImGuiCol_COUNT)) + themeJson.erase("FullPalette"); +} + std::optional Menu::ResolveFontRole(std::string_view key) { for (size_t i = 0; i < FontRoleDescriptors.size(); ++i) { @@ -243,6 +254,8 @@ void Menu::Load(json& o_json) // Store current Theme state before loading config auto currentTheme = settings.Theme; + if (o_json.contains("Theme") && o_json["Theme"].is_object()) + SanitizeFullPaletteJson(o_json["Theme"]); settings = o_json; // Restore Theme - don't load it from config, only from theme preset files @@ -291,6 +304,7 @@ void Menu::Load(json& o_json) if (o_json.contains("Theme") && o_json["Theme"].is_object() && settings.SelectedThemePreset.empty()) { bool hasFontRoles = o_json["Theme"].contains("FontRoles"); SanitizeFontRolesJson(o_json["Theme"]); + SanitizeFullPaletteJson(o_json["Theme"]); settings.Theme = o_json["Theme"]; MenuFonts::NormalizeFontRoles(settings.Theme, hasFontRoles); @@ -356,6 +370,7 @@ void Menu::LoadTheme(json& o_json) if (o_json["Theme"].is_object()) { bool hasFontRoles = o_json["Theme"].contains("FontRoles"); SanitizeFontRolesJson(o_json["Theme"]); + SanitizeFullPaletteJson(o_json["Theme"]); settings.Theme = o_json["Theme"]; MenuFonts::NormalizeFontRoles(settings.Theme, hasFontRoles); @@ -414,6 +429,9 @@ bool Menu::LoadThemePreset(const std::string& themeName) ThemeSettings defaultTheme; // For fallback values bool hasFontRoles = themeSettings.contains("FontRoles"); + SanitizeFontRolesJson(themeSettings); + SanitizeFullPaletteJson(themeSettings); + try { // Attempt to load theme with protection against malformed data try { @@ -680,7 +698,7 @@ void Menu::DrawSettings() // Apply theme styling with universal contrast enhancement ThemeManager::SetupImGuiStyle(*this); - ImGui::DockSpaceOverViewport(NULL, ImGuiDockNodeFlags_PassthruCentralNode); + ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode); ImGui::SetNextWindowPos(Util::GetNativeViewportSizeScaled(0.5f), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f)); ImGui::SetNextWindowSize(Util::GetNativeViewportSizeScaled(0.8f), ImGuiCond_FirstUseEver); @@ -870,7 +888,7 @@ void Menu::DrawOverlay() { // Only process reloads when ImGui is NOT in an active frame ImGuiContext* ctx = ImGui::GetCurrentContext(); - bool canReload = ctx && !ctx->WithinFrameScope && !ctx->WithinEndChild; + bool canReload = ctx && !ctx->WithinFrameScope && ctx->WithinEndChildID == 0; // Process deferred font reload BEFORE any ImGui operations // This is the safest place to do font atlas modifications diff --git a/src/Menu.h b/src/Menu.h index 3ef3d6d927..1a7e25e2ca 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -317,62 +317,72 @@ class Menu }(); // Theme by @Maksasj, edited by FiveLimbedCat // url: https://github.com/ocornut/imgui/issues/707#issuecomment-1494706165 + // Entries ordered to match imgui 1.92+ ImGuiCol_ enum (62 entries). + // 7 new slots were inserted in the middle of the 1.90 enum; all subsequent + // indices shifted — corrected here to prevent colour mismatches. std::array FullPalette = { - ImVec4(0.9f, 0.9f, 0.9f, 0.9f), - ImVec4(0.6f, 0.6f, 0.6f, 1.0f), - ImVec4(0.1f, 0.1f, 0.15f, 1.0f), - ImVec4(0.0f, 0.0f, 0.0f, 0.0f), - ImVec4(0.05f, 0.05f, 0.1f, 0.85f), - ImVec4(0.7f, 0.7f, 0.7f, 0.65f), - ImVec4(0.0f, 0.0f, 0.0f, 0.0f), - ImVec4(0.0f, 0.0f, 0.0f, 1.0f), - ImVec4(0.9f, 0.8f, 0.8f, 0.4f), - ImVec4(0.9f, 0.65f, 0.65f, 0.45f), - ImVec4(0.0f, 0.0f, 0.0f, 0.83f), - ImVec4(0.0f, 0.0f, 0.0f, 0.87f), - ImVec4(0.4f, 0.4f, 0.8f, 0.2f), - ImVec4(0.01f, 0.01f, 0.02f, 0.8f), - ImVec4(0.2f, 0.25f, 0.3f, 0.6f), - ImVec4(0.55f, 0.53f, 0.55f, 0.51f), - ImVec4(0.56f, 0.56f, 0.56f, 1.0f), - ImVec4(0.56f, 0.56f, 0.56f, 0.91f), - ImVec4(0.9f, 0.9f, 0.9f, 0.83f), - ImVec4(0.7f, 0.7f, 0.7f, 0.62f), - ImVec4(0.3f, 0.3f, 0.3f, 0.84f), - ImVec4(0.48f, 0.72f, 0.89f, 0.49f), - ImVec4(0.5f, 0.69f, 0.99f, 0.68f), - ImVec4(0.8f, 0.5f, 0.5f, 1.0f), - ImVec4(0.3f, 0.69f, 1.0f, 0.53f), - ImVec4(0.44f, 0.61f, 0.86f, 1.0f), - ImVec4(0.38f, 0.62f, 0.83f, 1.0f), - ImVec4(0.5f, 0.5f, 0.5f, 1.0f), - ImVec4(0.7f, 0.6f, 0.6f, 1.0f), - ImVec4(0.9f, 0.7f, 0.7f, 1.0f), - ImVec4(1.0f, 1.0f, 1.0f, 0.85f), - ImVec4(1.0f, 1.0f, 1.0f, 0.6f), - ImVec4(1.0f, 1.0f, 1.0f, 0.9f), - ImVec4(0.4f, 0.52f, 0.67f, 0.84f), // Tab - ImVec4(0.0f, 0.46f, 1.0f, 0.8f), // TabHovered - ImVec4(0.2f, 0.41f, 0.68f, 1.0f), // TabActive - ImVec4(0.07f, 0.1f, 0.15f, 0.97f), // TabUnfocused - ImVec4(0.13f, 0.26f, 0.42f, 1.0f), // TabUnfocusedActive - ImVec4(0.7f, 0.6f, 0.6f, 0.5f), // DockingPreview - ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // DockingEmptyBg - ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // PlotLines - ImVec4(0.0f, 0.87f, 1.0f, 1.0f), - ImVec4(0.22f, 0.26f, 0.7f, 1.0f), - ImVec4(0.8f, 0.26f, 0.26f, 1.0f), - ImVec4(0.48f, 0.72f, 0.89f, 0.49f), - ImVec4(0.3f, 0.3f, 0.35f, 1.0f), - ImVec4(0.23f, 0.23f, 0.25f, 1.0f), - ImVec4(0.0f, 0.0f, 0.0f, 0.0f), - ImVec4(1.0f, 1.0f, 1.0f, 0.06f), - ImVec4(0.0f, 0.0f, 1.0f, 0.35f), // TextSelectedBg - ImVec4(0.8f, 0.5f, 0.5f, 1.0f), - ImVec4(0.44f, 0.61f, 0.86f, 1.0f), - ImVec4(0.3f, 0.3f, 0.3f, 0.56f), - ImVec4(0.2f, 0.2f, 0.2f, 0.35f), - ImVec4(0.2f, 0.2f, 0.2f, 0.35f), + ImVec4(0.9f, 0.9f, 0.9f, 0.9f), // [0] Text + ImVec4(0.6f, 0.6f, 0.6f, 1.0f), // [1] TextDisabled + ImVec4(0.1f, 0.1f, 0.15f, 1.0f), // [2] WindowBg + ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [3] ChildBg + ImVec4(0.05f, 0.05f, 0.1f, 0.85f), // [4] PopupBg + ImVec4(0.7f, 0.7f, 0.7f, 0.65f), // [5] Border + ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [6] BorderShadow + ImVec4(0.0f, 0.0f, 0.0f, 1.0f), // [7] FrameBg + ImVec4(0.9f, 0.8f, 0.8f, 0.4f), // [8] FrameBgHovered + ImVec4(0.9f, 0.65f, 0.65f, 0.45f), // [9] FrameBgActive + ImVec4(0.0f, 0.0f, 0.0f, 0.83f), // [10] TitleBg + ImVec4(0.0f, 0.0f, 0.0f, 0.87f), // [11] TitleBgActive + ImVec4(0.4f, 0.4f, 0.8f, 0.2f), // [12] TitleBgCollapsed + ImVec4(0.01f, 0.01f, 0.02f, 0.8f), // [13] MenuBarBg + ImVec4(0.2f, 0.25f, 0.3f, 0.6f), // [14] ScrollbarBg + ImVec4(0.55f, 0.53f, 0.55f, 0.51f), // [15] ScrollbarGrab + ImVec4(0.56f, 0.56f, 0.56f, 1.0f), // [16] ScrollbarGrabHovered + ImVec4(0.56f, 0.56f, 0.56f, 0.91f), // [17] ScrollbarGrabActive + ImVec4(0.9f, 0.9f, 0.9f, 0.83f), // [18] CheckMark + ImVec4(0.7f, 0.7f, 0.7f, 0.62f), // [19] SliderGrab + ImVec4(0.3f, 0.3f, 0.3f, 0.84f), // [20] SliderGrabActive + ImVec4(0.48f, 0.72f, 0.89f, 0.49f), // [21] Button + ImVec4(0.5f, 0.69f, 0.99f, 0.68f), // [22] ButtonHovered + ImVec4(0.8f, 0.5f, 0.5f, 1.0f), // [23] ButtonActive + ImVec4(0.3f, 0.69f, 1.0f, 0.53f), // [24] Header + ImVec4(0.44f, 0.61f, 0.86f, 1.0f), // [25] HeaderHovered + ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [26] HeaderActive + ImVec4(0.5f, 0.5f, 0.5f, 1.0f), // [27] Separator + ImVec4(0.7f, 0.6f, 0.6f, 1.0f), // [28] SeparatorHovered + ImVec4(0.9f, 0.7f, 0.7f, 1.0f), // [29] SeparatorActive + ImVec4(1.0f, 1.0f, 1.0f, 0.85f), // [30] ResizeGrip + ImVec4(1.0f, 1.0f, 1.0f, 0.6f), // [31] ResizeGripHovered + ImVec4(1.0f, 1.0f, 1.0f, 0.9f), // [32] ResizeGripActive + ImVec4(0.9f, 0.9f, 0.9f, 1.0f), // [33] InputTextCursor (new in 1.92) + ImVec4(0.0f, 0.46f, 1.0f, 0.8f), // [34] TabHovered + ImVec4(0.4f, 0.52f, 0.67f, 0.84f), // [35] Tab + ImVec4(0.2f, 0.41f, 0.68f, 1.0f), // [36] TabSelected + ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [37] TabSelectedOverline (new in 1.91) + ImVec4(0.07f, 0.1f, 0.15f, 0.97f), // [38] TabDimmed + ImVec4(0.13f, 0.26f, 0.42f, 1.0f), // [39] TabDimmedSelected + ImVec4(0.5f, 0.5f, 0.5f, 0.0f), // [40] TabDimmedSelectedOverline (new in 1.91) + ImVec4(0.7f, 0.6f, 0.6f, 0.5f), // [41] DockingPreview + ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [42] DockingEmptyBg + ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // [43] PlotLines + ImVec4(0.0f, 0.87f, 1.0f, 1.0f), // [44] PlotLinesHovered + ImVec4(0.22f, 0.26f, 0.7f, 1.0f), // [45] PlotHistogram + ImVec4(0.8f, 0.26f, 0.26f, 1.0f), // [46] PlotHistogramHovered + ImVec4(0.48f, 0.72f, 0.89f, 0.49f), // [47] TableHeaderBg + ImVec4(0.3f, 0.3f, 0.35f, 1.0f), // [48] TableBorderStrong + ImVec4(0.23f, 0.23f, 0.25f, 1.0f), // [49] TableBorderLight + ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [50] TableRowBg (transparent) + ImVec4(1.0f, 1.0f, 1.0f, 0.06f), // [51] TableRowBgAlt (subtle tint) + ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [52] TextLink (new in 1.92) + ImVec4(0.0f, 0.0f, 1.0f, 0.35f), // [53] TextSelectedBg + ImVec4(0.7f, 0.7f, 0.7f, 0.65f), // [54] TreeLines (new in 1.92) + ImVec4(0.8f, 0.5f, 0.5f, 1.0f), // [55] DragDropTarget + ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [56] DragDropTargetBg (new in 1.92) + ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // [57] UnsavedMarker (new in 1.92) + ImVec4(0.44f, 0.61f, 0.86f, 1.0f), // [58] NavCursor + ImVec4(0.3f, 0.3f, 0.3f, 0.56f), // [59] NavWindowingHighlight + ImVec4(0.2f, 0.2f, 0.2f, 0.35f), // [60] NavWindowingDimBg + ImVec4(0.2f, 0.2f, 0.2f, 0.35f), // [61] ModalWindowDimBg }; }; diff --git a/src/Menu/AdvancedSettingsRenderer.cpp b/src/Menu/AdvancedSettingsRenderer.cpp index 55f4bc2f0b..f985f6f680 100644 --- a/src/Menu/AdvancedSettingsRenderer.cpp +++ b/src/Menu/AdvancedSettingsRenderer.cpp @@ -111,8 +111,8 @@ void AdvancedSettingsRenderer::RenderLoggingSection() globals::state->SetDefines(shaderDefines); } if (ImGui::IsItemDeactivatedAfterEdit() || (ImGui::IsItemActive() && - (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)) || - ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))))) { + (ImGui::IsKeyPressed(ImGuiKey_Enter) || + ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)))) { globals::state->SetDefines(shaderDefines); shaderCache->Clear(); } diff --git a/src/Menu/Fonts.cpp b/src/Menu/Fonts.cpp index 32ce72047d..b745c7f2f8 100644 --- a/src/Menu/Fonts.cpp +++ b/src/Menu/Fonts.cpp @@ -129,7 +129,7 @@ namespace MenuFonts if (menuInstance) { font_ = menuInstance->GetFont(role); if (font_) { - ImGui::PushFont(font_); + ImGui::PushFont(font_, 0.0f); } } } @@ -148,7 +148,7 @@ namespace MenuFonts ImFont* bodyFont = globals::menu->GetFont(FontRole::Body); if (tabFont && bodyFont) { - float fontScale = tabFont->FontSize / bodyFont->FontSize; + float fontScale = tabFont->LegacySize / bodyFont->LegacySize; // Only scale if the tab font is noticeably larger if (fontScale > 1.05f) { diff --git a/src/Menu/HomePageRenderer.cpp b/src/Menu/HomePageRenderer.cpp index 35d8a9b550..c92e3b3012 100644 --- a/src/Menu/HomePageRenderer.cpp +++ b/src/Menu/HomePageRenderer.cpp @@ -60,7 +60,7 @@ void HomePageRenderer::RenderWelcomeSection() // Only push font if we have a valid one, otherwise use default scaled if (titleFont) { - ImGui::PushFont(titleFont); + ImGui::PushFont(titleFont, 0.0f); } ImVec2 windowSize = ImGui::GetWindowSize(); diff --git a/src/Menu/MenuHeaderRenderer.cpp b/src/Menu/MenuHeaderRenderer.cpp index 5b8318361e..dc1425179d 100644 --- a/src/Menu/MenuHeaderRenderer.cpp +++ b/src/Menu/MenuHeaderRenderer.cpp @@ -25,7 +25,7 @@ namespace font_ = menuInstance->GetFont(role); if (font_) { - ImGui::PushFont(font_); + ImGui::PushFont(font_, 0.0f); fontPushed_ = true; } else { logger::warn("RoleFontGuard: Failed to retrieve font for role {}", static_cast(role)); diff --git a/src/Menu/SettingsTabRenderer.cpp b/src/Menu/SettingsTabRenderer.cpp index 638122b1bc..7e6be77684 100644 --- a/src/Menu/SettingsTabRenderer.cpp +++ b/src/Menu/SettingsTabRenderer.cpp @@ -948,8 +948,7 @@ void SettingsTabRenderer::RenderStylingTab() if (ImGui::SliderFloat("Global Scale", &themeSettings.GlobalScale, -1.f, 1.f, "%.2f")) { float trueScale = exp2(themeSettings.GlobalScale); - auto& io = ImGui::GetIO(); - io.FontGlobalScale = trueScale; + ImGui::GetStyle().FontScaleMain = trueScale; } SeparatorTextWithFont("Layout", Menu::FontRole::Subheading); diff --git a/src/Menu/ThemeManager.cpp b/src/Menu/ThemeManager.cpp index 2266482ceb..34b093375a 100644 --- a/src/Menu/ThemeManager.cpp +++ b/src/Menu/ThemeManager.cpp @@ -100,7 +100,7 @@ void ThemeManager::SetupImGuiStyle(const Menu& menu) auto& io = ImGui::GetIO(); if (io.FontDefault) { constexpr float kBaselineFontSize = Constants::DEFAULT_SCREEN_HEIGHT * Constants::DEFAULT_FONT_RATIO; - fontScale = io.FontDefault->FontSize / kBaselineFontSize; + fontScale = io.FontDefault->LegacySize / kBaselineFontSize; } const float scaleFactor = fontScale * exp2(globalScale); styleCopy.ScaleAllSizes(scaleFactor); @@ -449,7 +449,7 @@ bool ThemeManager::ReloadFont(const Menu& menu, float& cachedFontSize) } // Verify font texture was created successfully - if (!io.Fonts->TexID) { + if (!io.Fonts->TexIsBuilt) { logger::error("ReloadFont: Font texture not created"); return false; } @@ -461,7 +461,7 @@ bool ThemeManager::ReloadFont(const Menu& menu, float& cachedFontSize) globalScale = Constants::DEFAULT_GLOBAL_SCALE; // Ensure built-in themes stay at 0.0 } - io.FontGlobalScale = exp2(globalScale); + ImGui::GetStyle().FontScaleMain = exp2(globalScale); cachedFontSize = fontSize; // Also update cached font name in the menu instance diff --git a/src/ShaderCache.cpp b/src/ShaderCache.cpp index 4fa63bc53c..1b3f3edd3d 100644 --- a/src/ShaderCache.cpp +++ b/src/ShaderCache.cpp @@ -1926,7 +1926,7 @@ namespace SIE { Clear(); StopFileWatcher(); - if (!compilationPool.wait_for_tasks_duration(std::chrono::milliseconds(1000))) { + if (!compilationPool.wait_for(std::chrono::milliseconds(1000))) { logger::info("Tasks still running despite request to stop; killing thread {}!", GetThreadId(managementThread)); WaitForSingleObject(managementThread, 1000); TerminateThread(managementThread, 0); @@ -2312,7 +2312,7 @@ namespace SIE { dependencyTracker = std::make_unique(); logger::debug("ShaderCache initialized with {} compiler threads", (int)compilationThreadCount); - compilationPool.push_task(&ShaderCache::ManageCompilationSet, this, ssource.get_token()); + compilationPool.detach_task([this, token = ssource.get_token()] { ManageCompilationSet(token); }); } bool ShaderCache::UseFileWatcher() const @@ -2346,7 +2346,7 @@ namespace SIE pathStr += std::format("{}; ", path); } logger::debug("ShaderCache watching for changes in {}", pathStr); - compilationPool.push_task(&SIE::UpdateListener::processQueue, listener); + compilationPool.detach_task([this] { listener->processQueue(); }); } else { logger::debug("ShaderCache already enabled"); } @@ -2720,7 +2720,7 @@ namespace SIE const auto& task = compilationSet.WaitTake(stoken); if (!task.has_value()) break; // exit because thread told to end - compilationPool.push_task(&ShaderCache::ProcessCompilationSet, this, stoken, task.value()); + compilationPool.detach_task([this, stoken, t = task.value()] { ProcessCompilationSet(stoken, t); }); } } diff --git a/src/ShaderCache.h b/src/ShaderCache.h index e73ccb7ac1..89bcedf92d 100644 --- a/src/ShaderCache.h +++ b/src/ShaderCache.h @@ -447,7 +447,7 @@ namespace SIE int32_t compilationThreadCount = std::max({ static_cast(std::thread::hardware_concurrency()) - 4, static_cast(std::thread::hardware_concurrency()) * 3 / 4, 1 }); int32_t backgroundCompilationThreadCount = std::max(static_cast(std::thread::hardware_concurrency()) / 2, 1); - BS::thread_pool compilationPool{}; + BS::thread_pool<> compilationPool{}; bool backgroundCompilation = false; bool menuLoaded = false; diff --git a/src/Utils/UI.cpp b/src/Utils/UI.cpp index 39bf3e4495..47c576ef59 100644 --- a/src/Utils/UI.cpp +++ b/src/Utils/UI.cpp @@ -98,7 +98,7 @@ namespace Util if (auto* menu = globals::menu) { if (auto* subtextFont = menu->GetFont(Menu::FontRole::Subtext)) { previousFont = ImGui::GetFont(); - ImGui::PushFont(subtextFont); + ImGui::PushFont(subtextFont, 0.0f); } } } diff --git a/src/WeatherEditor/EditorWindow.cpp b/src/WeatherEditor/EditorWindow.cpp index b719034cae..83b7cef12f 100644 --- a/src/WeatherEditor/EditorWindow.cpp +++ b/src/WeatherEditor/EditorWindow.cpp @@ -208,7 +208,7 @@ void EditorWindow::ShowObjectsWindow() // Right column: Objects ImGui::TableSetColumnIndex(1); - if (ImGui::BeginChild("##ObjectsContent", { 0, 0 }, ImGuiChildFlags_Border, kStickyHeaderFlags)) { + if (ImGui::BeginChild("##ObjectsContent", { 0, 0 }, ImGuiChildFlags_Borders, kStickyHeaderFlags)) { // Interior Only category has its own panel if (m_selectedCategory == "Interior Only") { InteriorOnlyPanel::Draw(); @@ -873,8 +873,8 @@ void EditorWindow::RenderUI() { // Apply editor UI scale ImGuiIO& io = ImGui::GetIO(); - float previousScale = io.FontGlobalScale; - io.FontGlobalScale = settings.editorUIScale; + float previousScale = ImGui::GetStyle().FontScaleMain; + ImGui::GetStyle().FontScaleMain = settings.editorUIScale; if (settings.showViewport) { // Dim the game scene using the theme's modal dim background color @@ -1228,7 +1228,7 @@ void EditorWindow::RenderUI() } // Toggle-style icon button helper (active: SuccessColor bg, inactive: transparent) - auto DrawToggleIconButton = [&](const char* id, ImTextureID texture, bool isActive, float posX) -> bool { + auto DrawToggleIconButton = [&](const char* id, ImTextureRef texture, bool isActive, float posX) -> bool { ImGui::SetCursorScreenPos(ImVec2(posX, cursorY)); ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(kIconButtonPadding, kIconButtonPadding)); @@ -1301,7 +1301,7 @@ void EditorWindow::RenderUI() } // Establish a viewport-wide DockSpace so all editor windows are snappable and dockable - ImGui::DockSpaceOverViewport(nullptr, ImGuiDockNodeFlags_PassthruCentralNode); + ImGui::DockSpaceOverViewport(0, nullptr, ImGuiDockNodeFlags_PassthruCentralNode); auto width = ImGui::GetIO().DisplaySize.x; auto height = ImGui::GetIO().DisplaySize.y; @@ -1352,7 +1352,7 @@ void EditorWindow::RenderUI() RenderNotifications(); // Restore previous font scale - io.FontGlobalScale = previousScale; + ImGui::GetStyle().FontScaleMain = previousScale; } void EditorWindow::OpenWeatherFeatureSetting(RE::TESWeather* weather, const std::string& featureName, const std::string& settingName) diff --git a/src/WeatherEditor/Weather/WeatherWidget.cpp b/src/WeatherEditor/Weather/WeatherWidget.cpp index bb054ccdbc..bfaee13f75 100644 --- a/src/WeatherEditor/Weather/WeatherWidget.cpp +++ b/src/WeatherEditor/Weather/WeatherWidget.cpp @@ -81,7 +81,7 @@ void WeatherWidget::DrawWidget() const auto& result = searchResults[i]; std::string label = std::format("{} ({})", result.displayName, result.tabName); - if (ImGui::Selectable(label.c_str(), false, ImGuiSelectableFlags_DontClosePopups)) { + if (ImGui::Selectable(label.c_str(), false, ImGuiSelectableFlags_NoAutoClosePopups)) { NavigateToSetting(result); searchBuffer[0] = '\0'; searchResults.clear(); @@ -1046,7 +1046,7 @@ void WeatherWidget::DrawCloudSettings() const float headerHeight = ImGui::GetFrameHeight(); const float badgePadding = ImGui::GetStyle().FramePadding.x; const ImVec2 badgePos = { - ImGui::GetWindowPos().x + ImGui::GetContentRegionMax().x - badgeSize.x - badgePadding, + ImGui::GetWindowPos().x + ImGui::GetWindowSize().x - ImGui::GetStyle().WindowPadding.x - badgeSize.x - badgePadding, headerScreenY + (headerHeight - badgeSize.y) * 0.5f }; ImGui::GetWindowDrawList()->AddText(badgePos, ImGui::GetColorU32(ImGuiCol_CheckMark), kEnabledBadge); @@ -1085,7 +1085,7 @@ void WeatherWidget::DrawCloudSettings() if (texture) { float textureSize = 128.0f * scale; float groupEndX = ImGui::GetItemRectMax().x; - float availRight = ImGui::GetContentRegionMax().x + ImGui::GetWindowPos().x - groupEndX; + float availRight = ImGui::GetWindowPos().x + ImGui::GetWindowSize().x - ImGui::GetStyle().WindowPadding.x - groupEndX; float offset = std::max(20.0f * scale, (availRight - textureSize) * 0.5f); ImGui::SameLine(0.0f, offset); ImGui::BeginGroup(); diff --git a/vcpkg.json b/vcpkg.json index fcf47c7ba7..6a8d6f35c9 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -34,7 +34,12 @@ "overrides": [ { "name": "bshoshany-thread-pool", - "version": "3.5.0" + "version": "5.1.0" + }, + { + "name": "detours", + "version": "4.0.1", + "port-version": 8 }, { "name": "eabase", @@ -46,7 +51,7 @@ }, { "name": "imgui", - "version": "1.90" + "version": "1.92.6" }, { "name": "tracy", @@ -54,8 +59,8 @@ }, { "name": "directx-headers", - "version": "1.606.4" + "version": "1.614.1" } ], - "builtin-baseline": "7a6bb52bfd8eba088f8bf5cae70ca8d81503e42e" + "builtin-baseline": "dddca6fa87f177e0678e2545c4b4636a44aa05bd" }