From 8aa84d089e4233e17a6263cb0cf629331e63d051 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 26 Mar 2024 17:47:11 +0100 Subject: Compile fixes for MSYS2 UCRT64 Also added instructions for installing the dependencies on MSYS2. The selection of the default language is commented out for now. It will be fixed in another change. --- README.md | 12 ++++++++++++ src/client.cpp | 7 ++++--- src/gui/npcdialog.cpp | 2 +- src/gui/truetypefont.h | 4 ---- src/main.cpp | 4 ++-- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2b779725..852aeb2a 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,18 @@ Installing the dependencies on Fedora: SDL2_image-devel SDL2_mixer-devel SDL2_net-devel \ SDL2_ttf-devel +Installing the dependencies on Windows (using MSYS2 UCRT64): + + pacman -S mingw-w64-ucrt-x86_64-gcc \ + mingw-w64-ucrt-x86_64-cmake \ + mingw-w64-ucrt-x86_64-physfs \ + mingw-w64-ucrt-x86_64-curl \ + mingw-w64-ucrt-x86_64-SDL2_image \ + mingw-w64-ucrt-x86_64-SDL2_mixer \ + mingw-w64-ucrt-x86_64-SDL2_net \ + mingw-w64-ucrt-x86_64-SDL2_ttf \ + mingw-w64-ucrt-x86_64-libxml2 + Once the dependencies are installed, use CMake: cmake -B build . diff --git a/src/client.cpp b/src/client.cpp index 2a854bc0..63452112 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -80,8 +80,9 @@ #include #ifdef _WIN32 -#include #include "utils/specialfolder.h" +#include +#include #endif #include @@ -332,7 +333,7 @@ Client::Client(const Options &options): logger->log("Loading icon from file: %s", iconFile.c_str()); #ifdef _WIN32 static SDL_SysWMinfo pInfo; - SDL_GetWMInfo(&pInfo); + SDL_GetWindowWMInfo(mVideo.window(), &pInfo); // Attempt to load icon from .ico file HICON icon = (HICON) LoadImage(NULL, iconFile.c_str(), @@ -342,7 +343,7 @@ Client::Client(const Options &options): icon = LoadIcon(GetModuleHandle(NULL), "A"); if (icon) - SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); + SetClassLongPtr(pInfo.info.win.window, GCLP_HICON, (LONG_PTR) icon); #else mIcon = IMG_Load(iconFile.c_str()); if (mIcon) diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 8150a01a..90d3e37e 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -407,7 +407,7 @@ void NpcDialog::mouseClicked(gcn::MouseEvent &mouseEvent) { action(gcn::ActionEvent(mNextButton, mNextButton->getActionEventId())); } - if (mouseEvent.getSource() == mTextBox && isDoubleClick((int)(long)mTextBox)) + if (mouseEvent.getSource() == mTextBox && isDoubleClick((int)(intptr_t)mTextBox)) { if (mActionState == NPC_ACTION_NEXT || mActionState == NPC_ACTION_CLOSE) action(gcn::ActionEvent(mNextButton, diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index b3ebcc73..9aa308b1 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -25,11 +25,7 @@ #include -#ifdef __WIN32__ -#include -#else #include -#endif #include #include diff --git a/src/main.cpp b/src/main.cpp index b44f4d3a..9b29eba4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -179,14 +179,14 @@ static void parseOptions(int argc, char *argv[], Client::Options &options) } #ifdef _WIN32 -extern "C" char const *_nl_locale_name_default(void); +//extern "C" char const *_nl_locale_name_default(void); #endif static void initInternationalization() { #if ENABLE_NLS #ifdef _WIN32 - SetEnvironmentVariable("LANG", _nl_locale_name_default()); +// SetEnvironmentVariable("LANG", _nl_locale_name_default()); // mingw doesn't like LOCALEDIR to be defined for some reason bindtextdomain("mana", "translations/"); #else -- cgit v1.2.3-70-g09d2