More selective streamline spoofing + enabled by default on Nvidia

This commit is contained in:
FakeMichau committed 2025-08-22 21:12:16 +02:00
1 parent 37cbea792e
commit 204d371c98
4 files changed
+71 -37

No files matched your search

+1 -1
View File
@@ -572,7 +572,7 @@ SpoofedGPUName=auto
; Enables GPU spoofing for Streamline even if Dxgi spoofing is disabled for the rest of the game
; Usually allows for using fakenvapi without spoofing the whole game, and sometimes DLSS/DLSSG
; true or false - Default (auto) is false on Nvidia, true on Intel/AMD
; true or false - Default (auto) is true
StreamlineSpoofing=auto
; Enables Nvidia GPU spoofing for DXGI
+3 -2
View File
@@ -1204,8 +1204,9 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
if (!Config::Instance()->DxgiSpoofing.has_value())
Config::Instance()->DxgiSpoofing.set_volatile_value(false);
if (!Config::Instance()->StreamlineSpoofing.has_value())
Config::Instance()->StreamlineSpoofing.set_volatile_value(false);
// StreamlineSpoofing is more selective on Nvidia now
// if (!Config::Instance()->StreamlineSpoofing.has_value())
// Config::Instance()->StreamlineSpoofing.set_volatile_value(false);
}
else
{
+65 -32
View File
@@ -11,6 +11,7 @@
#include <magic_enum.hpp>
#include <sl1_reflex.h>
#include "include/sl.param/parameters.h"
#include <nvapi/fakenvapi.h>
sl::RenderAPI StreamlineHooks::renderApi = sl::RenderAPI::eCount;
std::mutex StreamlineHooks::setConstantsMutex {};
@@ -313,32 +314,7 @@ struct SystemCapsSl15
bool hwSchedulingEnabled {};
};
bool StreamlineHooks::hkdlss_slOnPluginLoad(void* params, const char* loaderJSON, const char** pluginJSON)
{
LOG_FUNC();
// TODO: do it better than "static" and hoping for the best
static std::string config;
auto result = o_dlss_slOnPluginLoad(params, loaderJSON, pluginJSON);
if (Config::Instance()->VulkanExtensionSpoofing.value_or_default())
{
nlohmann::json configJson = nlohmann::json::parse(*pluginJSON);
configJson["external"]["vk"]["instance"]["extensions"].clear();
configJson["external"]["vk"]["device"]["extensions"].clear();
configJson["external"]["vk"]["device"]["1.2_features"].clear();
config = configJson.dump();
*pluginJSON = config.c_str();
}
return result;
}
void setSystemCapsArch(sl::param::IParameters* params, uint32_t arch)
void setSystemCapsArch(sl::param::IParameters* params, uint32_t arch, sl::Feature feature)
{
if (State::Instance().streamlineVersion.major > 1)
{
@@ -349,7 +325,35 @@ void setSystemCapsArch(sl::param::IParameters* params, uint32_t arch)
{
for (auto& adapter : caps->adapters)
{
if ((uint32_t) adapter.vendor != 0)
LOG_TRACE("vendor: {}, feature: {}, original arch: {:X}", (uint32_t) adapter.vendor, feature,
adapter.architecture);
if (adapter.vendor == VendorId::Nvidia && !fakenvapi::isUsingFakenvapi())
{
// Don't change arch for DLSS with turing and above
if (feature == sl::kFeatureDLSS)
{
if (adapter.architecture < NV_GPU_ARCHITECTURE_TU100)
adapter.architecture = arch;
break;
}
// Don't change arch for DLSSD with turing and above
if (feature == sl::kFeatureDLSS_RR)
{
if (adapter.architecture < NV_GPU_ARCHITECTURE_TU100)
adapter.architecture = arch;
break;
}
// Don't change arch for DLSSG with turing and above
if (feature == sl::kFeatureDLSS_G)
{
if (adapter.architecture < NV_GPU_ARCHITECTURE_AD100)
adapter.architecture = arch;
break;
}
}
else if ((uint32_t) adapter.vendor != 0)
{
adapter.vendor = VendorId::Nvidia;
adapter.architecture = arch;
@@ -381,6 +385,34 @@ void setSystemCapsArch(sl::param::IParameters* params, uint32_t arch)
}
}
bool StreamlineHooks::hkdlss_slOnPluginLoad(void* params, const char* loaderJSON, const char** pluginJSON)
{
LOG_FUNC();
// TODO: do it better than "static" and hoping for the best
static std::string config;
if (Config::Instance()->StreamlineSpoofing.value_or_default())
setSystemCapsArch((sl::param::IParameters*) params, UINT_MAX, sl::kFeatureDLSS);
auto result = o_dlss_slOnPluginLoad(params, loaderJSON, pluginJSON);
if (Config::Instance()->VulkanExtensionSpoofing.value_or_default())
{
nlohmann::json configJson = nlohmann::json::parse(*pluginJSON);
configJson["external"]["vk"]["instance"]["extensions"].clear();
configJson["external"]["vk"]["device"]["extensions"].clear();
configJson["external"]["vk"]["device"]["1.2_features"].clear();
config = configJson.dump();
*pluginJSON = config.c_str();
}
return result;
}
bool StreamlineHooks::hkdlssg_slOnPluginLoad(void* params, const char* loaderJSON, const char** pluginJSON)
{
LOG_FUNC();
@@ -389,16 +421,16 @@ bool StreamlineHooks::hkdlssg_slOnPluginLoad(void* params, const char* loaderJSO
static std::string config;
bool skipArchSpoof =
!(Config::Instance()->StreamlineSpoofing.value_or_default() &&
(Config::Instance()->FGInput == FGInput::Nukems || Config::Instance()->FGInput == FGInput::DLSSG));
Config::Instance()->StreamlineSpoofing.value_or_default() &&
!(Config::Instance()->FGInput == FGInput::Nukems || Config::Instance()->FGInput == FGInput::DLSSG);
if (skipArchSpoof)
setSystemCapsArch((sl::param::IParameters*) params, 0);
setSystemCapsArch((sl::param::IParameters*) params, 0, sl::kFeatureDLSS_G);
auto result = o_dlssg_slOnPluginLoad(params, loaderJSON, pluginJSON);
if (skipArchSpoof)
setSystemCapsArch((sl::param::IParameters*) params, UINT_MAX);
setSystemCapsArch((sl::param::IParameters*) params, UINT_MAX, sl::kFeatureDLSS_G);
nlohmann::json configJson = nlohmann::json::parse(*pluginJSON);
@@ -457,8 +489,9 @@ bool StreamlineHooks::hkcommon_slOnPluginLoad(void* params, const char* loaderJS
// *pluginJSON = config.c_str();
//}
// For the common plugin, spoof only architectures older than Turing (or not-Nvidia)
if (Config::Instance()->StreamlineSpoofing.value_or_default())
setSystemCapsArch((sl::param::IParameters*) params, UINT_MAX);
setSystemCapsArch((sl::param::IParameters*) params, UINT_MAX, sl::kFeatureDLSS);
return result;
}
+2 -2
View File
@@ -26,8 +26,8 @@ NvAPI_Status __stdcall NvApiHooks::hkNvAPI_GPU_GetArchInfo(NvPhysicalGpuHandle h
State::Instance().isPascalOrOlder = true;
// Check if values were volatile, override them if so
if (!Config::Instance()->StreamlineSpoofing.value_for_config().has_value())
Config::Instance()->StreamlineSpoofing.set_volatile_value(true);
// if (!Config::Instance()->StreamlineSpoofing.value_for_config().has_value())
// Config::Instance()->StreamlineSpoofing.set_volatile_value(true);
if (!Config::Instance()->DisableFlipMetering.value_for_config().has_value())
Config::Instance()->DisableFlipMetering.set_volatile_value(true);