diff --git a/CMakeLists.txt b/CMakeLists.txt index 47c6711..99595a7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ if(ENABLE_WATCHDOG) pkg_search_module(LEPTONICA REQUIRED lept) endif() - set(SRC src/main.cpp src/launchercore.cpp @@ -37,12 +36,13 @@ set(SRC src/headline.cpp include/config.h include/gameinstaller.h - src/gameinstaller.cpp) + src/gameinstaller.cpp + src/encryptedarg.cpp) include(FetchContent) if(NOT USE_OWN_LIBRARIES) - find_package(Qt5Keychain) + find_package(Qt5Keychain QUIET) endif() if(TARGET Qt5Keychain::Qt5Keychain) @@ -71,7 +71,7 @@ else() endif() if(NOT USE_OWN_LIBRARIES) - find_package(QuaZip-Qt5) + find_package(QuaZip-Qt5 QUIET) endif() if(TARGET QuaZip::QuaZip) @@ -86,12 +86,40 @@ else() GIT_REPOSITORY https://github.com/stachenov/quazip.git GIT_TAG v1.2 ) + + set(QUAZIP_USE_QT_ZLIB ON CACHE BOOL "" FORCE) + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(quazip) set(LIBRARIES QuaZip ${LIBRARIES}) set(QUAZIP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/_deps/quazip-src/quazip) endif() +if(NOT USE_OWN_LIBRARIES) + find_package(fmt QUIET) +endif() + +if(TARGET fmt::fmt) + message("Using system library for fmt") + + set(LIBRARIES fmt::fmt ${LIBRARIES}) +else() + message("Using built-in fmt") + + FetchContent_Declare( + fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG master + ) + + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + + FetchContent_MakeAvailable(fmt) + + set(LIBRARIES fmt::fmt ${LIBRARIES}) +endif() + add_subdirectory(external) set(LIBRARIES diff --git a/external/libxiv b/external/libxiv index e9c7223..29d3a1a 160000 --- a/external/libxiv +++ b/external/libxiv @@ -1 +1 @@ -Subproject commit e9c72230482dd5ef437d5eaefe7907537ead349d +Subproject commit 29d3a1aabf2039cf4521121085f4faad2b5a2457 diff --git a/include/encryptedarg.h b/include/encryptedarg.h index 0e12037..acb88d1 100644 --- a/include/encryptedarg.h +++ b/include/encryptedarg.h @@ -4,41 +4,17 @@ #include "blowfish.h" // from xivdev -char ChecksumTable[] = { +static char ChecksumTable[] = { 'f', 'X', '1', 'p', 'G', 't', 'd', 'S', '5', 'C', 'A', 'P', '4', '_', 'V', 'L' }; -char GetChecksum(unsigned int key) { +inline char GetChecksum(unsigned int key) { auto value = key & 0x000F0000; return ChecksumTable[value >> 16]; } -#if defined(Q_OS_MAC) -// this is pretty much what wine does :-0 -inline uint32_t TickCount() { - struct mach_timebase_info convfact; - mach_timebase_info(&convfact); - - return (mach_absolute_time() * convfact.numer) / (convfact.denom * 1000000); -} -#endif - -#if defined(Q_OS_LINUX) -inline uint32_t TickCount() { - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - - return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); -} -#endif - -#if defined(Q_OS_WIN) -inline uint32_t TickCount() { - return GetTickCount(); -} -#endif +uint32_t TickCount(); inline QString encryptGameArg(QString arg) { unsigned int rawTicks = TickCount(); diff --git a/include/gameinstaller.h b/include/gameinstaller.h index 7329b7a..a1947e5 100644 --- a/include/gameinstaller.h +++ b/include/gameinstaller.h @@ -1,6 +1,7 @@ #pragma once #include +#include class LauncherCore; diff --git a/src/encryptedarg.cpp b/src/encryptedarg.cpp new file mode 100644 index 0000000..01a020f --- /dev/null +++ b/src/encryptedarg.cpp @@ -0,0 +1,36 @@ +#include "encryptedarg.h" + +#if defined(Q_OS_MAC) +#include +#include +#endif + +#if defined(Q_OS_WIN) +#include +#endif + +#if defined(Q_OS_MAC) +// this is pretty much what wine does :-0 +uint32_t TickCount() { + struct mach_timebase_info convfact; + mach_timebase_info(&convfact); + + return (mach_absolute_time() * convfact.numer) / (convfact.denom * 1000000); +} +#endif + +#if defined(Q_OS_LINUX) +uint32_t TickCount() { + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + + return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); +} +#endif + +#if defined(Q_OS_WIN) +uint32_t TickCount() { + return GetTickCount(); +} +#endif \ No newline at end of file diff --git a/src/launchercore.cpp b/src/launchercore.cpp index 8f74413..5c85270 100755 --- a/src/launchercore.cpp +++ b/src/launchercore.cpp @@ -17,15 +17,7 @@ #include #include #include - -#if defined(Q_OS_MAC) -#include -#include -#endif - -#if defined(Q_OS_WIN) -#include -#endif +#include #include "launchercore.h" #include "sapphirelauncher.h" diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index d6a5a25..7855599 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -462,10 +462,12 @@ void SettingsWindow::reloadControls() { } // wine +#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) wineVersionCombo->setCurrentIndex(profile.wineVersion); selectWineButton->setEnabled(profile.wineVersion == 1); winePathLabel->setText(profile.winePath); winePrefixDirectory->setText(profile.winePrefixPath); +#endif #if defined(Q_OS_LINUX) useEsync->setChecked(profile.useEsync);