Add Windows build support via MSYS2 and fix platform-specific code

Guard X11 display crash handler with __linux__, add Windows GlobalMemoryStatusEx
path in memory_monitor, guard warden cache paths with APPDATA on Windows, and
make pkg-config optional in CMakeLists with a find_library fallback. Add Windows
x86-64 CI job using MSYS2 MINGW64 to the build workflow.
This commit is contained in:
Kelsi 2026-02-18 17:38:08 -08:00
parent 02fd0166e9
commit cb01821d89
6 changed files with 125 additions and 16 deletions

View file

@ -2397,11 +2397,15 @@ bool GameHandler::loadWardenCRFile(const std::string& moduleHashHex) {
wardenCREntries_.clear();
// Look for .cr file in warden cache
std::string homeDir;
if (const char* h = std::getenv("HOME")) homeDir = h;
else homeDir = ".";
std::string crPath = homeDir + "/.local/share/wowee/warden_cache/" + moduleHashHex + ".cr";
std::string cacheBase;
#ifdef _WIN32
if (const char* h = std::getenv("APPDATA")) cacheBase = std::string(h) + "\\wowee\\warden_cache";
else cacheBase = ".\\warden_cache";
#else
if (const char* h = std::getenv("HOME")) cacheBase = std::string(h) + "/.local/share/wowee/warden_cache";
else cacheBase = "./warden_cache";
#endif
std::string crPath = cacheBase + "/" + moduleHashHex + ".cr";
std::ifstream crFile(crPath, std::ios::binary);
if (!crFile) {
@ -2581,10 +2585,15 @@ void GameHandler::handleWardenData(network::Packet& packet) {
// Cache raw module to disk
{
std::string homeDir;
if (const char* h = std::getenv("HOME")) homeDir = h;
else homeDir = ".";
std::string cacheDir = homeDir + "/.local/share/wowee/warden_cache";
#ifdef _WIN32
std::string cacheDir;
if (const char* h = std::getenv("APPDATA")) cacheDir = std::string(h) + "\\wowee\\warden_cache";
else cacheDir = ".\\warden_cache";
#else
std::string cacheDir;
if (const char* h = std::getenv("HOME")) cacheDir = std::string(h) + "/.local/share/wowee/warden_cache";
else cacheDir = "./warden_cache";
#endif
std::filesystem::create_directories(cacheDir);
std::string hashHex;