From 9697485039794ce98a14d976aea446c1a586b2c4 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Thu, 24 Oct 2024 13:22:13 +0100 Subject: [PATCH] Fixed duplication of `NvOptimusEnablement` if both frontends are enabled --- src/lime/main.cpp | 7 +++++++ src/lime_qt/lime_qt.cpp | 7 ------- src/lime_sdl/lime_sdl.cpp | 5 ----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/lime/main.cpp b/src/lime/main.cpp index 7c762f738..4a3b1e31b 100644 --- a/src/lime/main.cpp +++ b/src/lime/main.cpp @@ -7,6 +7,13 @@ #include "lime_sdl/lime_sdl.h" #endif +#ifdef _WIN32 +extern "C" { +// tells Nvidia drivers to use the dedicated GPU by default on laptops with switchable graphics +__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; +} +#endif + int main(int argc, char* argv[]) { #if ENABLE_QT bool no_gui = false; diff --git a/src/lime_qt/lime_qt.cpp b/src/lime_qt/lime_qt.cpp index b8905019e..abf40cafc 100644 --- a/src/lime_qt/lime_qt.cpp +++ b/src/lime_qt/lime_qt.cpp @@ -117,13 +117,6 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #endif -#ifdef _WIN32 -extern "C" { -// tells Nvidia drivers to use the dedicated GPU by default on laptops with switchable graphics -__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; -} -#endif - #ifdef HAVE_SDL2 #include #endif diff --git a/src/lime_sdl/lime_sdl.cpp b/src/lime_sdl/lime_sdl.cpp index 5fcf5ac66..bfcf0cf88 100644 --- a/src/lime_sdl/lime_sdl.cpp +++ b/src/lime_sdl/lime_sdl.cpp @@ -60,11 +60,6 @@ #include #include - -extern "C" { -// tells Nvidia drivers to use the dedicated GPU by default on laptops with switchable graphics -__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; -} #endif static void PrintHelp(const char* argv0) {