mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-28 09:07:11 +00:00
added specialk loading option
This commit is contained in:
@@ -323,6 +323,8 @@ bool Config::Reload(std::filesystem::path iniPath)
|
||||
{
|
||||
PluginPath = string_to_wstring(pluginsPathA.value());
|
||||
}
|
||||
|
||||
LoadSpecialK = readBool("Plugins", "LoadSpecialK");
|
||||
}
|
||||
|
||||
// DLSS Enabler
|
||||
@@ -608,6 +610,7 @@ bool Config::SaveIni()
|
||||
// Plugins
|
||||
{
|
||||
ini.SetValue("Plugins", "Path", Instance()->PluginPath.has_value() ? wstring_to_string(Instance()->PluginPath.value()).c_str() : "auto");
|
||||
ini.SetValue("Plugins", "LoadSpecialK", GetBoolValue(Instance()->LoadSpecialK).c_str());
|
||||
}
|
||||
|
||||
auto pathWStr = absoluteFileName.wstring();
|
||||
|
||||
@@ -151,6 +151,7 @@ public:
|
||||
|
||||
// plugins
|
||||
std::optional<std::wstring> PluginPath;
|
||||
std::optional<bool> LoadSpecialK;
|
||||
|
||||
// nvngx init parameters
|
||||
unsigned long long NVNGX_ApplicationId = 1337;
|
||||
|
||||
+16
-15
@@ -917,6 +917,12 @@ static VkResult hkvkEnumerateInstanceExtensionProperties(const char* pLayerName,
|
||||
|
||||
static void DetachHooks()
|
||||
{
|
||||
if (!isNvngxMode)
|
||||
{
|
||||
ImGuiOverlayDx::UnHookDx();
|
||||
ImGuiOverlayVk::UnHookVk();
|
||||
}
|
||||
|
||||
if (o_LoadLibraryA != nullptr || o_LoadLibraryW != nullptr || o_LoadLibraryExA != nullptr || o_LoadLibraryExW != nullptr)
|
||||
{
|
||||
DetourTransactionBegin();
|
||||
@@ -1026,12 +1032,6 @@ static void DetachHooks()
|
||||
|
||||
FreeLibrary(shared.dll);
|
||||
}
|
||||
|
||||
if (!isNvngxMode)
|
||||
{
|
||||
ImGuiOverlayDx::UnHookDx();
|
||||
ImGuiOverlayVk::UnHookVk();
|
||||
}
|
||||
}
|
||||
|
||||
static void AttachHooks()
|
||||
@@ -1497,7 +1497,7 @@ static void CheckWorkingMode()
|
||||
if (modeFound)
|
||||
{
|
||||
AttachHooks();
|
||||
|
||||
|
||||
Config::Instance()->OverlayMenu = (!isNvngxMode || isWorkingWithEnabler) && Config::Instance()->OverlayMenu.value_or(true);
|
||||
if (Config::Instance()->OverlayMenu.value())
|
||||
{
|
||||
@@ -1515,7 +1515,6 @@ static void CheckWorkingMode()
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
@@ -1525,13 +1524,14 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
|
||||
loadCount++;
|
||||
|
||||
dllModule = hModule;
|
||||
processId = GetCurrentProcessId();
|
||||
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
|
||||
loadCount++;
|
||||
|
||||
#ifdef VER_PRE_RELEASE
|
||||
// Enable file logging for pre builds
|
||||
Config::Instance()->LogToFile = true;
|
||||
@@ -1599,13 +1599,14 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
#ifdef _DEBUG
|
||||
LOG_TRACE("DLL_PROCESS_DETACH from module: {0:X}, count: {1}", (UINT64)hModule, loadCount);
|
||||
#endif
|
||||
DetachHooks();
|
||||
|
||||
if (skHandle != nullptr)
|
||||
FreeLibrary(skHandle);
|
||||
|
||||
spdlog::info("");
|
||||
spdlog::info("Unloading OptiScaler");
|
||||
CloseLogger();
|
||||
DetachHooks();
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -2036,6 +2036,9 @@ void ImGuiCommon::Init(HWND InHwnd)
|
||||
|
||||
_selectedScale = (int)((Config::Instance()->MenuScale.value_or(1.0f) - 1.0f) / 0.1f);
|
||||
_isInited = true;
|
||||
|
||||
if (Config::Instance()->LoadSpecialK.value_or(false))
|
||||
skHandle = LoadLibrary(L"SpecialK64.dll");
|
||||
}
|
||||
|
||||
void ImGuiCommon::Shutdown()
|
||||
|
||||
@@ -223,6 +223,11 @@ VulkanExtensionSpoofing=auto
|
||||
; Default is .\plugins
|
||||
Path=auto
|
||||
|
||||
; Loads SpecialK64.dll from game's exe folder
|
||||
; Please put a SpecialK.dxgi file next to SpecialK64.dll
|
||||
; to set SpecialK's working mode otherwise it will not be activated
|
||||
; true or false - Default (auto) is false
|
||||
LoadSpecialK=auto
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user