From 81ae92385fbf8a49ff00aab2cfc1da5c1157e7b3 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Fri, 13 Dec 2024 21:18:57 +0300 Subject: [PATCH] added upscaler dll checks --- OptiScaler/Config.cpp | 37 +++++++++++++++++++++++++++++++ OptiScaler/Config.h | 5 +++++ OptiScaler/OptiScaler.vcxproj | 2 +- OptiScaler/dllmain.cpp | 8 ++++--- OptiScaler/imgui/imgui_common.cpp | 35 ++++++++++++++++++++++++----- OptiScaler/resource.h | 2 +- 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index 4f84f54d..64b5a188 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -970,6 +970,43 @@ bool Config::SaveFakenvapiIni() { return fakenvapiIni.SaveFile(FN_iniPath.wstring().c_str()) >= 0; } +void Config::CheckUpscalerFiles() +{ + nvngxExist = std::filesystem::exists(Util::ExePath().parent_path() / L"nvngx.dll"); + + if (!nvngxExist) + { + nvngxExist = GetModuleHandle(L"nvngx.dll") != nullptr; + + if(nvngxExist) + LOG_INFO("nvngx.dll found in memory"); + else + LOG_WARN("nvngx.dll not found!"); + + } + else + { + LOG_INFO("nvngx.dll found in game folder"); + } + + libxessExist = std::filesystem::exists(Util::ExePath().parent_path() / L"libxess.dll"); + + if (!libxessExist) + { + libxessExist = GetModuleHandle(L"libxess.dll") != nullptr; + + if (libxessExist) + LOG_INFO("libxess.dll found in memory"); + else + LOG_WARN("libxess.dll not found!"); + + } + else + { + LOG_INFO("libxess.dll found in game folder"); + } +} + std::optional Config::readString(std::string section, std::string key, bool lowercase) { std::string value = ini.GetValue(section.c_str(), key.c_str(), "auto"); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 10b525dd..232de9b7 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -276,6 +276,9 @@ public: bool IsShuttingDown = false; + bool nvngxExist = false; + bool libxessExist = false; + IFeature* CurrentFeature = nullptr; bool Reload(std::filesystem::path iniPath); @@ -285,6 +288,8 @@ public: bool ReloadFakenvapi(); bool SaveFakenvapiIni(); + void CheckUpscalerFiles(); + static Config* Instance(); private: diff --git a/OptiScaler/OptiScaler.vcxproj b/OptiScaler/OptiScaler.vcxproj index 71586055..b37f6d28 100644 --- a/OptiScaler/OptiScaler.vcxproj +++ b/OptiScaler/OptiScaler.vcxproj @@ -82,7 +82,7 @@ $(SolutionDir)external\vulkan\include;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\FidelityFX-SDK\ffx-api\include\ffx_api;$(SolutionDir)external\simpleini;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\spdlog\include;$(SolutionDir)external\freetype;$(IncludePath) $(ProjectDir)fsr2\lib;$(ProjectDir)fsr2_212\lib;$(ProjectDir)fsr31\lib;$(ProjectDir)vulkan;$(ProjectDir)d3dx;$(ProjectDir)detours;$(SolutionDir)external\xess\lib;$(SolutionDir)external\freetype;$(LibraryPath) dxgi - E:\Games\Deep Rock Galactic\FSD\Binaries\Win64\ + D:\Folders\Games\Deep Rock Galactic\FSD\Binaries\Win64\ .\x64\Debug .dll diff --git a/OptiScaler/dllmain.cpp b/OptiScaler/dllmain.cpp index 9739caee..a4ecba3a 100644 --- a/OptiScaler/dllmain.cpp +++ b/OptiScaler/dllmain.cpp @@ -90,9 +90,11 @@ inline std::vector dxgiNamesW = { L"dxgi.dll", L"dxgi", }; inline std::vector vkNames = { "vulkan-1.dll", "vulkan-1", }; inline std::vector vkNamesW = { L"vulkan-1.dll", L"vulkan-1", }; inline std::vector overlayNames = { "eosovh-win32-shipping.dll", "eosovh-win32-shipping", "eosovh-win64-shipping.dll", "eosovh-win64-shipping", - "gameoverlayrenderer64", "gameoverlayrenderer64.dll", "gameoverlayrenderer", "gameoverlayrenderer.dll" }; + "gameoverlayrenderer64", "gameoverlayrenderer64.dll", "gameoverlayrenderer", "gameoverlayrenderer.dll", + "socialclubd3d12renderer", "socialclubd3d12renderer.dll" }; inline std::vector overlayNamesW = { L"eosovh-win32-shipping.dll", L"eosovh-win32-shipping", L"eosovh-win64-shipping.dll", L"eosovh-win64-shipping", - L"gameoverlayrenderer64", L"gameoverlayrenderer64.dll", L"gameoverlayrenderer", L"gameoverlayrenderer.dll" }; + L"gameoverlayrenderer64", L"gameoverlayrenderer64.dll", L"gameoverlayrenderer", L"gameoverlayrenderer.dll", + L"socialclubd3d12renderer", L"socialclubd3d12renderer.dll" }; static int loadCount = 0; static bool dontCount = false; @@ -1892,6 +1894,7 @@ static void CheckWorkingMode() { Config::Instance()->WorkingAsNvngx = isNvngxMode && !isWorkingWithEnabler; Config::Instance()->OverlayMenu = (!isNvngxMode || isWorkingWithEnabler) && Config::Instance()->OverlayMenu.value_or(true); + Config::Instance()->CheckUpscalerFiles(); if (!isNvngxMode) { @@ -1944,7 +1947,6 @@ static void CheckWorkingMode() if ((!Config::Instance()->FGUseFGSwapChain.value_or(true) || !Config::Instance()->OverlayMenu.value_or(true)) && skHandle == nullptr && Config::Instance()->LoadSpecialK.value_or(false)) { - //std::this_thread::sleep_for(std::chrono::milliseconds(250)); auto skFile = Util::DllPath().parent_path() / L"SpecialK64.dll"; SetEnvironmentVariableW(L"RESHADE_DISABLE_GRAPHICS_HOOK", L"1"); skHandle = LoadLibrary(skFile.c_str()); diff --git a/OptiScaler/imgui/imgui_common.cpp b/OptiScaler/imgui/imgui_common.cpp index 15ba18ec..1c7525b4 100644 --- a/OptiScaler/imgui/imgui_common.cpp +++ b/OptiScaler/imgui/imgui_common.cpp @@ -342,10 +342,9 @@ LRESULT ImGuiCommon::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) _isVisible = !_isVisible; if (_isVisible) + { Config::Instance()->ReloadFakenvapi(); - if (_isVisible) - { if (pfn_ClipCursor_hooked) { _ssRatio = 0; @@ -835,9 +834,34 @@ void ImGuiCommon::RenderMenu() ImGui::Spacing(); ImGui::PushFont(_scaledOptiFont); ImGui::SetWindowFontScale(Config::Instance()->MenuScale.value() * 3); - ImGui::Text("Please select DLSS or XeSS as upscaler\nfrom game options and enter the game\nto enable upscaler settings."); - ImGui::PopFont(); - ImGui::SetWindowFontScale(Config::Instance()->MenuScale.value()); + + if (Config::Instance()->nvngxExist || Config::Instance()->libxessExist) + { + ImGui::Spacing(); + ImGui::Text("Please select %s%s%s as upscaler\nfrom game options and enter the game\nto enable upscaler settings.\n", + Config::Instance()->nvngxExist ? "DLSS" : "", + Config::Instance()->nvngxExist && Config::Instance()->libxessExist ? " or " : "", + Config::Instance()->libxessExist ? "XeSS" : ""); + + + ImGui::PopFont(); + ImGui::SetWindowFontScale(Config::Instance()->MenuScale.value()); + + ImGui::Spacing(); + ImGui::Text("nvngx.dll: %sExist", Config::Instance()->nvngxExist ? "" : "Not "); + ImGui::Text("libxess.dll: %sExist", Config::Instance()->libxessExist ? "" : "Not "); + ImGui::Spacing(); + } + else + { + ImGui::Spacing(); + ImGui::Text("Can't find nvngx.dll and libxess.dll\nUpscaling support will NOT work."); + ImGui::Spacing(); + + ImGui::PopFont(); + ImGui::SetWindowFontScale(Config::Instance()->MenuScale.value()); + } + } if (ImGui::BeginTable("main", 2, ImGuiTableFlags_SizingStretchSame)) @@ -2447,6 +2471,7 @@ void ImGuiCommon::RenderMenu() ImGui::End(); } } + ImGui::PopFont(); } } diff --git a/OptiScaler/resource.h b/OptiScaler/resource.h index 4b58f478..1c83d210 100644 --- a/OptiScaler/resource.h +++ b/OptiScaler/resource.h @@ -21,7 +21,7 @@ #define VER_MAJOR_VERSION 0 #define VER_MINOR_VERSION 7 #define VER_HOTFIX_VERSION 0 -#define VER_BUILD_NUMBER 75 +#define VER_BUILD_NUMBER 76 #define VER_PRE_RELEASE