VERY experimental Nintendo Switch 2 emulator
C++
[wifi] conditionally enable (#90)
lizziefb459c75d93f
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 124a5ac80a..599388110f 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -50,6 +50,7 @@ option(ENABLE_QT_UPDATE_CHECKER "Enable update checker for the Qt frontend" OFF)CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)+option(ENABLE_WIFI_SCAN "Enable WiFi scanning" OFF)if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" OFF)diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex d830cc381d..8e167c51d9 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -1150,8 +1150,9 @@ add_library(core STATICtools/renderdoc.h)-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")+if (ENABLE_WIFI_SCAN)# find_package(libiw REQUIRED)+ target_compile_definitions(core PRIVATE -DENABLE_WIFI_SCAN)target_link_libraries(core PRIVATE iw)endif()diff --git a/src/core/internal_network/wifi_scanner.cpp b/src/core/internal_network/wifi_scanner.cppindex df9bc92910..f4b1738e69 100644--- a/src/core/internal_network/wifi_scanner.cpp+++ b/src/core/internal_network/wifi_scanner.cpp@@ -19,7 +19,7 @@ using namespace std::chrono_literals;#endifnamespace Network {-+#ifdef ENABLE_WIFI_SCAN#ifdef _WIN32static u8 QualityToPercent(DWORD q) {return static_cast<u8>(q);@@ -173,16 +173,20 @@ static std::vector<Network::ScanData> ScanWifiLinux(std::chrono::milliseconds dereturn out;}#endif /* linux */+#endifstd::vector<Network::ScanData> ScanWifiNetworks(std::chrono::milliseconds deadline) {-#ifdef _WIN32+#ifdef ENABLE_WIFI_SCAN+#if defined(_WIN32)return ScanWifiWin(deadline);#elif defined(__linux__) && !defined(ANDROID)return ScanWifiLinux(deadline);#else- std::this_thread::sleep_for(deadline);return {}; // unsupported host, pretend no results#endif+#else+ return {}; // disabled, pretend no results+#endif}} // namespace Network