diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index a67424c9..12d173aa 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -415,8 +415,6 @@ bool Config::Reload(std::filesystem::path iniPath) if (AnisotropyOverride.has_value() && (AnisotropyOverride.value() > 16 || AnisotropyOverride.value() < 1)) AnisotropyOverride.reset(); - CheckForUpdate.set_from_config(readBool("Hotfix", "CheckForUpdate")); - DisableOverlays.set_from_config(readBool("Hotfix", "DisableOverlays")); AnisotropySkipPointFilter.set_from_config(readBool("Anisotropy", "SkipPointFilter")); AnisotropyModifyComp.set_from_config(readBool("Anisotropy", "AFModifyComparison")); @@ -442,6 +440,7 @@ bool Config::Reload(std::filesystem::path iniPath) // Hotfixes { + CheckForUpdate.set_from_config(readBool("Hotfix", "CheckForUpdate")); DisableOverlays.set_from_config(readBool("Hotfix", "DisableOverlays")); RoundInternalResolution.set_from_config(readInt("Hotfix", "RoundInternalResolution")); @@ -935,12 +934,6 @@ bool Config::SaveIni() ini.SetValue("Anisotropy", "SkipPointFilter", GetBoolValue(Instance()->AnisotropySkipPointFilter.value_for_config()).c_str()); } - ini.SetValue("Hotfix", "CheckForUpdate", - Instance()->CheckForUpdate.has_value() ? (Instance()->CheckForUpdate.value() ? "true" : "false") - : "auto"); - ini.SetValue("Hotfix", "DisableOverlays", - Instance()->DisableOverlays.has_value() ? (Instance()->DisableOverlays.value() ? "true" : "false") - : "auto"); // Mipmap { @@ -956,6 +949,9 @@ bool Config::SaveIni() // Hotfixes { + ini.SetValue("Hotfix", "CheckForUpdate", + Instance()->CheckForUpdate.has_value() ? (Instance()->CheckForUpdate.value() ? "true" : "false") + : "auto"); ini.SetValue("Hotfix", "DisableOverlays", Instance()->DisableOverlays.has_value() ? (Instance()->DisableOverlays.value() ? "true" : "false") : "auto"); diff --git a/OptiScaler/dllmain.cpp b/OptiScaler/dllmain.cpp index b9408c18..002dee8b 100644 --- a/OptiScaler/dllmain.cpp +++ b/OptiScaler/dllmain.cpp @@ -1160,16 +1160,12 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv spdlog::info("Config parameters:"); for (const std::string& l : Config::Instance()->GetConfigLog()) spdlog::info(l); + #ifdef VER_PRE_RELEASE spdlog::info("Pre-release build, disabling update checks"); Config::Instance()->CheckForUpdate.set_volatile_value(false); #endif - // OptiFG & Overlay Checks - if (Config::Instance()->FGType.value_or_default() == FGType::OptiFG && - !Config::Instance()->DisableOverlays.has_value()) - Config::Instance()->DisableOverlays.set_volatile_value(true); - // Initial state of FG State::Instance().activeFgInput = Config::Instance()->FGInput.value_or_default(); State::Instance().activeFgOutput = Config::Instance()->FGOutput.value_or_default(); diff --git a/OptiScaler/menu/menu_common.cpp b/OptiScaler/menu/menu_common.cpp index f6478dd8..6874c019 100644 --- a/OptiScaler/menu/menu_common.cpp +++ b/OptiScaler/menu/menu_common.cpp @@ -1435,6 +1435,7 @@ bool MenuCommon::RenderMenu() inputFpsCycle = false; } + // Version check bool frameTimesCalculated = false; const double splashTime = 7000.0; const double fadeTime = 1000.0; @@ -1475,32 +1476,40 @@ bool MenuCommon::RenderMenu() } } - if (!_isUWP) + if (splashLimit < 1.0f) { - ImGui_ImplWin32_NewFrame(); - } - else if (!newFrame) - { - ImVec2 displaySize { State::Instance().screenWidth, State::Instance().screenHeight }; - ImGui_ImplUwp_NewFrame(displaySize); + splashStart = now + 100.0; + splashLimit = splashStart + splashTime; + + std::srand(static_cast(std::time(nullptr))); + splashMessage = splashText[std::rand() % splashText.size()]; } - MenuHdrCheck(io); - MenuSizeCheck(io); - ImGui::NewFrame(); + // New frame check + if ((!Config::Instance()->DisableSplash.value_or_default() && now > splashStart && now < splashLimit) || + (updateNoticeVisible && now < updateNoticeLimit) || Config::Instance()->ShowFps.value_or_default() || + _isVisible) + { + if (!_isUWP) + { + ImGui_ImplWin32_NewFrame(); + } + else + { + ImVec2 displaySize { State::Instance().screenWidth, State::Instance().screenHeight }; + ImGui_ImplUwp_NewFrame(displaySize); + } + + MenuHdrCheck(io); + MenuSizeCheck(io); + ImGui::NewFrame(); + + newFrame = true; + } // Splash screen if (!Config::Instance()->DisableSplash.value_or_default()) { - if (splashLimit < 1.0f) - { - splashStart = now + 100.0; - splashLimit = splashStart + splashTime; - - std::srand(static_cast(std::time(nullptr))); - splashMessage = splashText[std::rand() % splashText.size()]; - } - if (now > splashStart && now < splashLimit) { @@ -1535,7 +1544,9 @@ bool MenuCommon::RenderMenu() else ImGui::SetWindowFontScale(splashScale); - ImGui::Text("OptiScaler"); + ImGui::Text( + "OptiScaler - %s for menu", + Keybind::KeyNameFromVirtualKeyCode(Config::Instance()->ShortcutKey.value_or_default()).c_str()); ImGui::TextColored(toneMapColor(ImVec4(1.0, 1.0, 1.0, 0.7)), splashMessage.c_str()); splashSize = ImGui::GetWindowSize(); @@ -1965,13 +1976,11 @@ bool MenuCommon::RenderMenu() } } - if (!_isVisible) - return false; - - // Check for gpu support - CheckForGPU(); - + if (_isVisible) { + // Check for gpu support + CheckForGPU(); + // Overlay font if (Config::Instance()->UseHQFont.value_or_default()) ImGui::PushFontSize(std::round(Config::Instance()->MenuScale.value_or_default() * fontSize)); @@ -5228,11 +5237,12 @@ bool MenuCommon::RenderMenu() if (Config::Instance()->UseHQFont.value_or_default()) ImGui::PopFontSize(); + } + if (newFrame) ImGui::EndFrame(); - return true; - } + return newFrame; } void MenuCommon::Init(HWND InHwnd, bool isUWP)