From d424dfe29b230fc444b6c8489cf7c65cebc6f01b Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 18 Feb 2023 10:57:03 +0100 Subject: [PATCH] Just force high perf gpu --- src/client/main.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/client/main.cpp b/src/client/main.cpp index dc49c219..7527ca7f 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -227,26 +227,12 @@ namespace const auto self = utils::nt::library::get_by_address(&trigger_high_performance_gpu_switch); const auto path = self.get_path().make_preferred().wstring(); - /*if (RegQueryValueExW(key, path.data(), nullptr, nullptr, nullptr, nullptr) != ERROR_FILE_NOT_FOUND) + if (RegQueryValueExW(key, path.data(), nullptr, nullptr, nullptr, nullptr) != ERROR_FILE_NOT_FOUND) { return; - }*/ - - auto preference = DXGI_GPU_PREFERENCE_UNSPECIFIED; - - CComPtr factory{}; - if (SUCCEEDED(CreateDXGIFactory1(__uuidof(IDXGIFactory6), reinterpret_cast(&factory)))) - { - CComPtr adapter{}; - if (SUCCEEDED( - factory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, __uuidof(IDXGIAdapter), - reinterpret_cast(&adapter))) && adapter) - { - preference = DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE; - } } - const std::wstring data = L"GpuPreference=" + std::to_wstring(preference) + L";"; + const std::wstring data = L"GpuPreference=2;"; RegSetValueExW(key, self.get_path().make_preferred().wstring().data(), 0, REG_SZ, reinterpret_cast(data.data()), static_cast((data.size() + 1u) * 2));