Skip to content

Commit

Permalink
Fixed unintentional creation of empty NVIDIA driver profiles for game…
Browse files Browse the repository at this point in the history
…s whose .exe exists in multiple profiles when checking whether ReBAR is enabled for a game during initialization
  • Loading branch information
Kaldaien committed Dec 28, 2024
1 parent 3cf50d0 commit dca2aba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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 (...)
Expand Down
4 changes: 2 additions & 2 deletions include/SpecialK/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" :
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/nvapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*/);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dca2aba

Please sign in to comment.