forked from eden-emu/eden
Add ENABLE_WIFI_SCAN option. Use libzip instead of QuaZip.
This commit is contained in:
parent
8cd0d78269
commit
772352f047
10 changed files with 617 additions and 673 deletions
|
@ -1,80 +0,0 @@
|
|||
diff --git a/quazip/quazipdir.cpp b/quazip/quazipdir.cpp
|
||||
index d43f1c1..eb24bf1 100644
|
||||
--- a/quazip/quazipdir.cpp
|
||||
+++ b/quazip/quazipdir.cpp
|
||||
@@ -293,8 +293,8 @@ bool QuaZipDirComparator::operator()(const QuaZipFileInfo64 &info1,
|
||||
}
|
||||
|
||||
template<typename TFileInfoList>
|
||||
-bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters,
|
||||
- QDir::Filters filter, QDir::SortFlags sort, TFileInfoList &result) const
|
||||
+bool QuaZipDirPrivate::entryInfoList(QStringList _nameFilters,
|
||||
+ QDir::Filters _filter, QDir::SortFlags sort, TFileInfoList &result) const
|
||||
{
|
||||
QString basePath = simplePath();
|
||||
if (!basePath.isEmpty())
|
||||
@@ -305,12 +305,12 @@ bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters,
|
||||
if (!zip->goToFirstFile()) {
|
||||
return zip->getZipError() == UNZ_OK;
|
||||
}
|
||||
- QDir::Filters fltr = filter;
|
||||
+ QDir::Filters fltr = _filter;
|
||||
if (fltr == QDir::NoFilter)
|
||||
fltr = this->filter;
|
||||
if (fltr == QDir::NoFilter)
|
||||
fltr = QDir::AllEntries;
|
||||
- QStringList nmfltr = nameFilters;
|
||||
+ QStringList nmfltr = _nameFilters;
|
||||
if (nmfltr.isEmpty())
|
||||
nmfltr = this->nameFilters;
|
||||
QSet<QString> dirsFound;
|
||||
diff --git a/quazip/quazipfile.cpp b/quazip/quazipfile.cpp
|
||||
index 4a5f2f9..f7865f5 100644
|
||||
--- a/quazip/quazipfile.cpp
|
||||
+++ b/quazip/quazipfile.cpp
|
||||
@@ -241,14 +241,14 @@ void QuaZipFile::setFileName(const QString& fileName, QuaZip::CaseSensitivity cs
|
||||
p->caseSensitivity=cs;
|
||||
}
|
||||
|
||||
-void QuaZipFilePrivate::setZipError(int zipError) const
|
||||
+void QuaZipFilePrivate::setZipError(int _zipError) const
|
||||
{
|
||||
QuaZipFilePrivate *fakeThis = const_cast<QuaZipFilePrivate*>(this); // non-const
|
||||
- fakeThis->zipError=zipError;
|
||||
- if(zipError==UNZ_OK)
|
||||
+ fakeThis->zipError = _zipError;
|
||||
+ if(_zipError == UNZ_OK)
|
||||
q->setErrorString(QString());
|
||||
else
|
||||
- q->setErrorString(QuaZipFile::tr("ZIP/UNZIP API error %1").arg(zipError));
|
||||
+ q->setErrorString(QuaZipFile::tr("ZIP/UNZIP API error %1").arg(_zipError));
|
||||
}
|
||||
|
||||
bool QuaZipFile::open(OpenMode mode)
|
||||
diff --git a/quazip/unzip.c b/quazip/unzip.c
|
||||
index a39365d..ee7b487 100644
|
||||
--- a/quazip/unzip.c
|
||||
+++ b/quazip/unzip.c
|
||||
@@ -1054,7 +1054,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
/* ZIP64 extra fields */
|
||||
if (headerId == 0x0001)
|
||||
{
|
||||
- uLong uL;
|
||||
+ uLong _uL;
|
||||
|
||||
if(file_info.uncompressed_size == (ZPOS64_T)0xFFFFFFFFu)
|
||||
{
|
||||
@@ -1078,7 +1078,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
if(file_info.disk_num_start == 0xFFFFFFFFu)
|
||||
{
|
||||
/* Disk Start Number */
|
||||
- if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
||||
+ if (unz64local_getLong(&s->z_filefunc, s->filestream, &_uL) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
|
||||
@@ -2151,3 +2151,4 @@ int ZEXPORT unzClearFlags(unzFile file, unsigned flags)
|
||||
s->flags &= ~flags;
|
||||
return UNZ_OK;
|
||||
}
|
||||
+
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/cmake/clone-repo.cmake b/cmake/clone-repo.cmake
|
||||
index 2ffb4b2..77974dc 100644
|
||||
--- a/cmake/clone-repo.cmake
|
||||
+++ b/cmake/clone-repo.cmake
|
||||
@@ -26,7 +26,7 @@ macro(clone_repo name url)
|
||||
FetchContent_GetProperties(${name} POPULATED ${name_lower}_POPULATED)
|
||||
|
||||
if(NOT ${name_lower}_POPULATED)
|
||||
- FetchContent_Populate(${name})
|
||||
+ FetchContent_MakeAvailable(${name})
|
||||
endif()
|
||||
|
||||
set(${name_upper}_SOURCE_DIR ${${name_lower}_SOURCE_DIR})
|
|
@ -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)
|
||||
|
@ -416,6 +417,10 @@ if (UNIX AND NOT APPLE)
|
|||
find_package(gamemode 1.7 MODULE)
|
||||
endif()
|
||||
|
||||
if (ENABLE_QT)
|
||||
find_package(libzip CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package
|
||||
if (ENABLE_SDL2)
|
||||
if (YUZU_USE_BUNDLED_SDL2)
|
||||
|
@ -458,19 +463,22 @@ if (ENABLE_QT)
|
|||
if (YUZU_USE_BUNDLED_QT)
|
||||
download_qt(6.8.3)
|
||||
else()
|
||||
message(STATUS "Using system Qt")
|
||||
if (NOT Qt6_DIR)
|
||||
set(Qt6_DIR "" CACHE PATH "Additional path to search for Qt6 libraries like C:/Qt/6.8.3/msvc2022_64/lib/cmake/Qt6")
|
||||
endif()
|
||||
list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}")
|
||||
endif()
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent)
|
||||
|
||||
if (Qt6_FOUND)
|
||||
message(STATUS "Found Qt6: ${Qt6_DIR}")
|
||||
endif()
|
||||
|
||||
# QT6 Multimedia pulls in unneeded audio systems (ALSA, Pulseaudio) for FreeBSD
|
||||
# ALSA is the default sound system on Linux, but FreeBSD uses OSS which works well enough
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent)
|
||||
else()
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent)
|
||||
if (YUZU_USE_QT_MULTIMEDIA)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
|
@ -91,11 +91,11 @@ function(determine_qt_parameters target host_out type_out arch_out arch_path_out
|
|||
set(type "desktop")
|
||||
set(arch "clang_64")
|
||||
set(arch_path "macos")
|
||||
else()
|
||||
elseif (LINUX)
|
||||
set(host "linux")
|
||||
set(type "desktop")
|
||||
set(arch "gcc_64")
|
||||
set(arch_path "linux")
|
||||
set(arch "linux_gcc_64")
|
||||
set(arch_path "gcc_64")
|
||||
endif()
|
||||
|
||||
set(${host_out} "${host}" PARENT_SCOPE)
|
||||
|
@ -129,16 +129,29 @@ function(download_qt_configuration prefix_out target host type arch arch_path ba
|
|||
|
||||
set(install_args -c "${CURRENT_MODULE_DIR}/aqt_config.ini")
|
||||
if (tool)
|
||||
set(prefix "${base_path}/Tools")
|
||||
set(prefix "${base_path}/tools")
|
||||
set(install_args ${install_args} install-tool --outputdir ${base_path} ${host} desktop ${target})
|
||||
else()
|
||||
set(prefix "${base_path}/${target}/${arch_path}")
|
||||
set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} -m qt3d qt5compat qtactiveqt qtcharts qtconnectivity qtdatavis3d qtgraphs qtgrpc qthttpserver qtimageformats qtlanguageserver qtlocation qtlottie qtmultimedia qtnetworkauth qtpdf qtpositioning qtquick3d qtquick3dphysics qtquickeffectmaker qtquicktimeline qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtshadertools qtspeech qtvirtualkeyboard qtwebchannel qtwebengine qtwebsockets qtwebview)
|
||||
set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} -m qt_base)
|
||||
|
||||
if (YUZU_USE_QT_MULTIMEDIA)
|
||||
set(install_args ${install_args} qtmultimedia)
|
||||
endif()
|
||||
|
||||
if (YUZU_USE_QT_WEB_ENGINE)
|
||||
set(install_args ${install_args} qtpositioning qtwebchannel qtwebengine)
|
||||
endif()
|
||||
|
||||
if (NOT ${YUZU_QT_MIRROR} STREQUAL "")
|
||||
message(STATUS "Using Qt mirror ${YUZU_QT_MIRROR}")
|
||||
set(install_args ${install_args} -b ${YUZU_QT_MIRROR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS "${prefix}")
|
||||
message(STATUS "Downloading Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path}")
|
||||
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.2.1")
|
||||
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.3.0")
|
||||
if (WIN32)
|
||||
set(aqt_path "${base_path}/aqt.exe")
|
||||
if (NOT EXISTS "${aqt_path}")
|
||||
|
@ -158,14 +171,28 @@ function(download_qt_configuration prefix_out target host type arch arch_path ba
|
|||
execute_process(COMMAND chmod +x ${aqt_path})
|
||||
execute_process(COMMAND ${aqt_path} ${install_args}
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
else()
|
||||
elseif (LINUX)
|
||||
set(aqt_install_path "${base_path}/aqt")
|
||||
file(MAKE_DIRECTORY "${aqt_install_path}")
|
||||
|
||||
execute_process(COMMAND python3 -m pip install --target=${aqt_install_path} aqtinstall
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${aqt_install_path} python3 -m aqt ${install_args}
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -m venv .venv
|
||||
WORKING_DIRECTORY ${base_path}
|
||||
)
|
||||
set(ENV{VIRTUAL_ENV} "${base_path}/.venv")
|
||||
set(Python3_FIND_VIRTUALENV FIRST)
|
||||
unset(Python3_EXECUTABLE)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -m pip install aqtinstall
|
||||
WORKING_DIRECTORY ${base_path}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -m aqt ${install_args}
|
||||
WORKING_DIRECTORY ${base_path}
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Downloaded Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path} to ${prefix}")
|
||||
|
|
|
@ -1150,18 +1150,19 @@ add_library(core STATIC
|
|||
tools/renderdoc.h
|
||||
)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ENABLE_WIFI_SCAN)
|
||||
# find_package(libiw REQUIRED)
|
||||
target_compile_definitions(core PRIVATE -DENABLE_WIFI_SCAN)
|
||||
target_link_libraries(core PRIVATE iw)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_compile_definitions(core PRIVATE _WIN32_WINNT=0x0A00 WINVER=0x0A00)
|
||||
|
||||
if(TARGET iw)
|
||||
target_link_libraries(core PRIVATE iw)
|
||||
message(STATUS "Linking 'core' with iw on Linux.")
|
||||
endif()
|
||||
# if(TARGET iw)
|
||||
# target_link_libraries(core PRIVATE iw)
|
||||
# message(STATUS "Linking 'core' with iw on Linux.")
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
|
|
|
@ -20,6 +20,7 @@ using namespace std::chrono_literals;
|
|||
|
||||
namespace Network {
|
||||
|
||||
#ifdef ENABLE_WIFI_SCAN
|
||||
#ifdef _WIN32
|
||||
static u8 QualityToPercent(DWORD q) {
|
||||
return static_cast<u8>(q);
|
||||
|
@ -95,8 +96,7 @@ static u8 QualityToPercent(const iwrange& r, const wireless_scan* ws) {
|
|||
return static_cast<u8>(std::clamp(100 * lvl / max, 0, 100));
|
||||
}
|
||||
|
||||
static int wifi_callback(int skfd, char* ifname, char* args[], int count)
|
||||
{
|
||||
static int wifi_callback(int skfd, char* ifname, char* args[], int count) {
|
||||
iwrange range;
|
||||
|
||||
int res = iw_get_range_info(skfd, ifname, &range);
|
||||
|
@ -123,7 +123,7 @@ static std::vector<Network::ScanData> ScanWifiLinux(std::chrono::milliseconds de
|
|||
}
|
||||
|
||||
char ifname[IFNAMSIZ] = {0};
|
||||
char *args[1] = {ifname};
|
||||
char* args[1] = {ifname};
|
||||
|
||||
iw_enum_devices(sock, &wifi_callback, args, 0);
|
||||
|
||||
|
@ -173,16 +173,20 @@ static std::vector<Network::ScanData> ScanWifiLinux(std::chrono::milliseconds de
|
|||
return out;
|
||||
}
|
||||
#endif /* linux */
|
||||
#endif
|
||||
|
||||
std::vector<Network::ScanData> ScanWifiNetworks(std::chrono::milliseconds deadline) {
|
||||
#ifdef ENABLE_WIFI_SCAN
|
||||
#ifdef _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 {};
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Network
|
||||
|
|
|
@ -19,4 +19,4 @@ struct ScanData {
|
|||
static_assert(sizeof(ScanData) <= 0x2C, "ScanData layout changed – update conversions!");
|
||||
|
||||
std::vector<Network::ScanData> ScanWifiNetworks(std::chrono::milliseconds deadline);
|
||||
}
|
||||
} // namespace Network
|
||||
|
|
|
@ -494,8 +494,6 @@ if (YUZU_ROOM)
|
|||
target_link_libraries(yuzu PRIVATE yuzu-room)
|
||||
endif()
|
||||
|
||||
# Extra deps
|
||||
add_subdirectory(externals)
|
||||
target_link_libraries(yuzu PRIVATE QuaZip::QuaZip)
|
||||
target_link_libraries(yuzu PRIVATE libzip::zip)
|
||||
|
||||
create_target_directory_groups(yuzu)
|
||||
|
|
31
src/yuzu/externals/CMakeLists.txt
vendored
31
src/yuzu/externals/CMakeLists.txt
vendored
|
@ -1,31 +0,0 @@
|
|||
# Disable tests in all externals supporting the standard option name
|
||||
set(BUILD_TESTING OFF)
|
||||
|
||||
# Build only static externals
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
# QuaZip
|
||||
set(QUAZIP_QT_MAJOR_VERSION 6)
|
||||
set(QUAZIP_BZIP2 OFF)
|
||||
|
||||
include(CPM)
|
||||
set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm)
|
||||
set(CPM_USE_LOCAL_PACKAGES ON)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME QuaZip-Qt6
|
||||
VERSION 1.3
|
||||
GIT_REPOSITORY "https://github.com/stachenov/quazip.git"
|
||||
GIT_TAG v1.5
|
||||
PATCHES
|
||||
${CMAKE_SOURCE_DIR}/.ci/patch/0001-quazip-strict.patch
|
||||
${CMAKE_SOURCE_DIR}/.ci/patch/0002-quazip-fetchcontent.patch
|
||||
)
|
||||
|
||||
if (NOT MSVC AND NOT "QuaZip-Qt6" IN_LIST CPM_PACKAGES)
|
||||
message(STATUS "QUAZIP DIR: ${CPM_PACKAGES}")
|
||||
target_compile_options(QuaZip PRIVATE
|
||||
-Wno-error=shadow
|
||||
-Wno-error=missing-declarations
|
||||
)
|
||||
endif()
|
1070
src/yuzu/main.cpp
1070
src/yuzu/main.cpp
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue