mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Improved Windows support
Now works out of the box on Windows MSVC, prevents settings crash because of nonexistent Wine options, and also further improves use-cases where you might not have all the libraries required to build.
This commit is contained in:
parent
c176da0080
commit
5d0e8936ee
7 changed files with 76 additions and 41 deletions
|
@ -16,7 +16,6 @@ if(ENABLE_WATCHDOG)
|
||||||
pkg_search_module(LEPTONICA REQUIRED lept)
|
pkg_search_module(LEPTONICA REQUIRED lept)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/launchercore.cpp
|
src/launchercore.cpp
|
||||||
|
@ -37,12 +36,13 @@ set(SRC
|
||||||
src/headline.cpp
|
src/headline.cpp
|
||||||
include/config.h
|
include/config.h
|
||||||
include/gameinstaller.h
|
include/gameinstaller.h
|
||||||
src/gameinstaller.cpp)
|
src/gameinstaller.cpp
|
||||||
|
src/encryptedarg.cpp)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
if(NOT USE_OWN_LIBRARIES)
|
if(NOT USE_OWN_LIBRARIES)
|
||||||
find_package(Qt5Keychain)
|
find_package(Qt5Keychain QUIET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TARGET Qt5Keychain::Qt5Keychain)
|
if(TARGET Qt5Keychain::Qt5Keychain)
|
||||||
|
@ -71,7 +71,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT USE_OWN_LIBRARIES)
|
if(NOT USE_OWN_LIBRARIES)
|
||||||
find_package(QuaZip-Qt5)
|
find_package(QuaZip-Qt5 QUIET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TARGET QuaZip::QuaZip)
|
if(TARGET QuaZip::QuaZip)
|
||||||
|
@ -86,12 +86,40 @@ else()
|
||||||
GIT_REPOSITORY https://github.com/stachenov/quazip.git
|
GIT_REPOSITORY https://github.com/stachenov/quazip.git
|
||||||
GIT_TAG v1.2
|
GIT_TAG v1.2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(QUAZIP_USE_QT_ZLIB ON CACHE BOOL "" FORCE)
|
||||||
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(quazip)
|
FetchContent_MakeAvailable(quazip)
|
||||||
|
|
||||||
set(LIBRARIES QuaZip ${LIBRARIES})
|
set(LIBRARIES QuaZip ${LIBRARIES})
|
||||||
set(QUAZIP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/_deps/quazip-src/quazip)
|
set(QUAZIP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/_deps/quazip-src/quazip)
|
||||||
endif()
|
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)
|
add_subdirectory(external)
|
||||||
|
|
||||||
set(LIBRARIES
|
set(LIBRARIES
|
||||||
|
|
2
external/libxiv
vendored
2
external/libxiv
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit e9c72230482dd5ef437d5eaefe7907537ead349d
|
Subproject commit 29d3a1aabf2039cf4521121085f4faad2b5a2457
|
|
@ -4,41 +4,17 @@
|
||||||
#include "blowfish.h"
|
#include "blowfish.h"
|
||||||
|
|
||||||
// from xivdev
|
// from xivdev
|
||||||
char ChecksumTable[] = {
|
static char ChecksumTable[] = {
|
||||||
'f', 'X', '1', 'p', 'G', 't', 'd', 'S',
|
'f', 'X', '1', 'p', 'G', 't', 'd', 'S',
|
||||||
'5', 'C', 'A', 'P', '4', '_', 'V', 'L'
|
'5', 'C', 'A', 'P', '4', '_', 'V', 'L'
|
||||||
};
|
};
|
||||||
|
|
||||||
char GetChecksum(unsigned int key) {
|
inline char GetChecksum(unsigned int key) {
|
||||||
auto value = key & 0x000F0000;
|
auto value = key & 0x000F0000;
|
||||||
return ChecksumTable[value >> 16];
|
return ChecksumTable[value >> 16];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
uint32_t TickCount();
|
||||||
// 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
|
|
||||||
|
|
||||||
inline QString encryptGameArg(QString arg) {
|
inline QString encryptGameArg(QString arg) {
|
||||||
unsigned int rawTicks = TickCount();
|
unsigned int rawTicks = TickCount();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
|
|
||||||
|
|
36
src/encryptedarg.cpp
Normal file
36
src/encryptedarg.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#include "encryptedarg.h"
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <mach/mach_time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
#include <windows.h>
|
||||||
|
#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
|
|
@ -17,15 +17,7 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QRegularExpressionMatch>
|
#include <QRegularExpressionMatch>
|
||||||
|
#include <algorithm>
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <mach/mach_time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
|
|
|
@ -462,10 +462,12 @@ void SettingsWindow::reloadControls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
wineVersionCombo->setCurrentIndex(profile.wineVersion);
|
wineVersionCombo->setCurrentIndex(profile.wineVersion);
|
||||||
selectWineButton->setEnabled(profile.wineVersion == 1);
|
selectWineButton->setEnabled(profile.wineVersion == 1);
|
||||||
winePathLabel->setText(profile.winePath);
|
winePathLabel->setText(profile.winePath);
|
||||||
winePrefixDirectory->setText(profile.winePrefixPath);
|
winePrefixDirectory->setText(profile.winePrefixPath);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
useEsync->setChecked(profile.useEsync);
|
useEsync->setChecked(profile.useEsync);
|
||||||
|
|
Loading…
Add table
Reference in a new issue