mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-09-02 11:35:39 +00:00
stash 3
This commit is contained in:
@@ -87,125 +87,6 @@ static HMODULE LoadNvgxDlss(std::wstring originalPath)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void DetachHooks()
|
||||
{
|
||||
if (!isNvngxMode)
|
||||
{
|
||||
ImGuiOverlayDx::UnHookDx();
|
||||
ImGuiOverlayVk::UnHookVk();
|
||||
}
|
||||
|
||||
if (o_LoadLibraryA != nullptr || o_LoadLibraryW != nullptr || o_LoadLibraryExA != nullptr || o_LoadLibraryExW != nullptr)
|
||||
{
|
||||
DetourTransactionBegin();
|
||||
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
if (o_FreeLibrary)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_FreeLibrary, hkFreeLibrary);
|
||||
o_FreeLibrary = nullptr;
|
||||
}
|
||||
|
||||
if (o_LoadLibraryA)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_LoadLibraryA, hkLoadLibraryA);
|
||||
o_LoadLibraryA = nullptr;
|
||||
}
|
||||
|
||||
if (o_LoadLibraryW)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_LoadLibraryW, hkLoadLibraryW);
|
||||
o_LoadLibraryW = nullptr;
|
||||
}
|
||||
|
||||
if (o_LoadLibraryExA)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_LoadLibraryExA, hkLoadLibraryExA);
|
||||
o_LoadLibraryExA = nullptr;
|
||||
}
|
||||
|
||||
if (o_LoadLibraryExW)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_LoadLibraryExW, hkLoadLibraryExW);
|
||||
o_LoadLibraryExW = nullptr;
|
||||
}
|
||||
|
||||
if (o_GetProcAddress)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_GetProcAddress, hkGetProcAddress);
|
||||
o_GetProcAddress = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkGetPhysicalDeviceProperties)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkGetPhysicalDeviceProperties, hkvkGetPhysicalDeviceProperties);
|
||||
o_vkGetPhysicalDeviceProperties = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkGetPhysicalDeviceProperties2)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkGetPhysicalDeviceProperties2, hkvkGetPhysicalDeviceProperties2);
|
||||
o_vkGetPhysicalDeviceProperties2 = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkGetPhysicalDeviceProperties2KHR)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkGetPhysicalDeviceProperties2KHR, hkvkGetPhysicalDeviceProperties2KHR);
|
||||
o_vkGetPhysicalDeviceProperties2KHR = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkEnumerateInstanceExtensionProperties)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkEnumerateInstanceExtensionProperties, hkvkEnumerateInstanceExtensionProperties);
|
||||
o_vkEnumerateInstanceExtensionProperties = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkEnumerateDeviceExtensionProperties)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkEnumerateDeviceExtensionProperties, hkvkEnumerateDeviceExtensionProperties);
|
||||
o_vkEnumerateDeviceExtensionProperties = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkCreateDevice)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkCreateDevice, hkvkCreateDevice);
|
||||
o_vkCreateDevice = nullptr;
|
||||
}
|
||||
|
||||
if (o_vkCreateInstance)
|
||||
{
|
||||
DetourDetach(&(PVOID&)o_vkCreateInstance, hkvkCreateInstance);
|
||||
o_vkCreateInstance = nullptr;
|
||||
}
|
||||
|
||||
//if (!Config::Instance()->IsDxgiMode && Config::Instance()->DxgiSpoofing.value_or(true))
|
||||
//{
|
||||
// if (dxgi.CreateDxgiFactory != nullptr)
|
||||
// {
|
||||
// DetourDetach(&(PVOID&)dxgi.CreateDxgiFactory, _CreateDXGIFactory);
|
||||
// dxgi.CreateDxgiFactory = nullptr;
|
||||
// }
|
||||
|
||||
// if (dxgi.CreateDxgiFactory1 != nullptr)
|
||||
// {
|
||||
// DetourDetach(&(PVOID&)dxgi.CreateDxgiFactory1, _CreateDXGIFactory1);
|
||||
// dxgi.CreateDxgiFactory1 = nullptr;
|
||||
// }
|
||||
|
||||
// if (dxgi.CreateDxgiFactory2 != nullptr)
|
||||
// {
|
||||
// DetourDetach(&(PVOID&)dxgi.CreateDxgiFactory2, _CreateDXGIFactory2);
|
||||
// dxgi.CreateDxgiFactory2 = nullptr;
|
||||
// }
|
||||
//}
|
||||
|
||||
DetourTransactionCommit();
|
||||
|
||||
//FreeLibrary(shared.dll);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
|
||||
+39
-1
@@ -35,6 +35,20 @@ inline DWORD processId;
|
||||
#define LOG_DEBUG(msg, ...) \
|
||||
spdlog::debug(__FUNCTION__ " " msg, ##__VA_ARGS__)
|
||||
|
||||
#ifdef DETAILED_DEBUG_LOGS
|
||||
#define LOG_DEBUG_ONLY(msg, ...) \
|
||||
spdlog::debug(__FUNCTION__ " " msg, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_DEBUG_ONLY(msg, ...)
|
||||
#endif
|
||||
|
||||
#ifdef LOG_ASYNC
|
||||
#define LOG_DEBUG_ASYNC(msg, ...) \
|
||||
spdlog::debug(__FUNCTION__ " " msg, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG_DEBUG_ASYNC(msg, ...)
|
||||
#endif
|
||||
|
||||
#define LOG_INFO(msg, ...) \
|
||||
spdlog::info(__FUNCTION__ " " msg, ##__VA_ARGS__)
|
||||
|
||||
@@ -48,7 +62,31 @@ inline DWORD processId;
|
||||
spdlog::trace(__FUNCTION__)
|
||||
|
||||
#define LOG_FUNC_RESULT(result) \
|
||||
spdlog::trace(__FUNCTION__ " result: {0:X}" , (UINT)result)
|
||||
spdlog::trace(__FUNCTION__ " result: {0:X}" , (UINT64)result)
|
||||
|
||||
typedef struct _feature_version
|
||||
{
|
||||
unsigned int major;
|
||||
unsigned int minor;
|
||||
unsigned int patch;
|
||||
} feature_version;
|
||||
|
||||
inline static bool isVersionOrBetter(const feature_version& current, const feature_version& required) {
|
||||
if (current.major > required.major) {
|
||||
return true;
|
||||
}
|
||||
if (current.major == required.major) {
|
||||
if (current.minor > required.minor) {
|
||||
return true;
|
||||
}
|
||||
if (current.minor == required.minor) {
|
||||
if (current.patch >= required.patch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline static std::string wstring_to_string(const std::wstring& wide_str)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user