From dca2abadf53fae55a566ecfcfcbdf65836157e21 Mon Sep 17 00:00:00 2001 From: Kaldaien Date: Sat, 28 Dec 2024 14:22:14 -0500 Subject: [PATCH] Fixed unintentional creation of empty NVIDIA driver profiles for games whose .exe exists in multiple profiles when checking whether ReBAR is enabled for a game during initialization --- CHANGELOG.txt | 8 +++++++- include/SpecialK/DLL_VERSION.H | 4 ++-- src/core.cpp | 14 +++++++------- src/nvapi.cpp | 7 ++++++- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aa026caad..2660f587a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,10 @@ -24.12.28.1 +24.12.28.2 +========== + + Fixed unintentional creation of empty NVIDIA driver profiles for + games whose .exe exists in multiple profiles when checking whether + ReBAR is enabled for a game during initialization. + +24.12.28.1 ========== + Added caching for calls to GetForegroundWindow (...) and GetWindowThreadProcessId (...) diff --git a/include/SpecialK/DLL_VERSION.H b/include/SpecialK/DLL_VERSION.H index 53ff12cf6..2b3795216 100644 --- a/include/SpecialK/DLL_VERSION.H +++ b/include/SpecialK/DLL_VERSION.H @@ -3,8 +3,8 @@ #define SK_YEAR 24 #define SK_MONTH 12 #define SK_DATE 28 -#define SK_REV_N 1 -#define SK_REV 1 +#define SK_REV_N 2 +#define SK_REV 2 #ifndef _A2 #define _A2(a) #a diff --git a/src/core.cpp b/src/core.cpp index c57e6b5d4..023f5aada 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -263,8 +263,13 @@ SK_LoadGPUVendorAPIs (void) dll_log->Log (L"[ NvAPI ] Initializing NVIDIA API (NvAPI)..."); + SK_NvAPI_SetAppName ( SK_GetFullyQualifiedApp () ); + SK_NvAPI_SetAppFriendlyName ( + app_cache_mgr->getAppNameFromID ( SK_Steam_GetAppID_NoAPI () ).c_str () + ); + nvapi_init = - sk::NVAPI::InitializeLibrary (SK_GetHostApp ()); + sk::NVAPI::InitializeLibrary (sk::NVAPI::app_name.c_str ()); dll_log->Log (L"[ NvAPI ] NvAPI Init { %s }", nvapi_init ? L"Success" : @@ -336,11 +341,6 @@ SK_LoadGPUVendorAPIs (void) } } - SK_NvAPI_SetAppName ( SK_GetFullyQualifiedApp () ); - SK_NvAPI_SetAppFriendlyName ( - app_cache_mgr->getAppNameFromID ( SK_Steam_GetAppID_NoAPI () ).c_str () - ); - if (! config.nvidia.bugs.snuffed_ansel) { #if 0 @@ -2954,7 +2954,7 @@ SK_ShutdownCore (const wchar_t* backend) config_name = L"SpecialK"; } - if (sk::NVAPI::app_name != L"ds3t.exe") + if (sk::NVAPI::app_name.find (L"ds3t.exe") != std::wstring::npos) { dll_log->LogEx (true, L"[ SpecialK ] Saving user preferences to" L" %10s.ini... ", config_name); diff --git a/src/nvapi.cpp b/src/nvapi.cpp index 53059c29d..e0aae2577 100644 --- a/src/nvapi.cpp +++ b/src/nvapi.cpp @@ -1733,7 +1733,7 @@ NVAPI::InitializeLibrary (const wchar_t* wszAppName) if (bLibInit != FALSE) return FALSE; - app_name = wszAppName; + SK_NvAPI_SetAppName (wszAppName); if ( app_cache_mgr->loadAppCacheForExe (SK_GetFullyQualifiedApp ()/*wszAppName*/)) friendly_name = app_cache_mgr->getAppNameFromPath (SK_GetFullyQualifiedApp ()/*wszAppName*/); @@ -4216,6 +4216,11 @@ __stdcall SK_NvAPI_SetAppName (const wchar_t* wszAppName) { app_name = wszAppName; + + // Replace backslashes with forward slashes as-per NV's docs + std::replace ( app_name.begin (), + app_name.end (), L'\\', + L'/' ); } void