diff --git a/src/common/config.h b/src/common/config.h index fae5daf25..d520331bd 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -24,6 +24,11 @@ // Platform stuff. #if defined(WIN32) || defined(_WIN32) # define LOVE_WINDOWS 1 +#if WINAPI_FAMILY==WINAPI_FAMILY_APP +# define LOVE_WINDOWS_UWP 1 +# define LOVE_NO_MODPLUG 1 +# define LOVE_NO_MPG123 1 +#endif #endif #if defined(linux) || defined(__linux) || defined(__linux__) # define LOVE_LINUX 1 @@ -76,7 +81,9 @@ #endif #if defined(LOVE_WINDOWS) +#ifndef LOVE_WINDOWS_UWP # define LOVE_LEGENDARY_CONSOLE_IO_HACK +#endif // LOVE_WINDOWS_UWP # define NOMINMAX #endif diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index 85dfc274d..9c4a1edff 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -519,7 +519,9 @@ std::string Filesystem::getAppdataDirectory() { if (appdata.empty()) { -#ifdef LOVE_WINDOWS +#ifdef LOVE_WINDOWS_UWP + appdata = getUserDirectory(); +#elif LOVE_WINDOWS wchar_t *w_appdata = _wgetenv(L"APPDATA"); appdata = to_utf8(w_appdata); replace_char(appdata, '\\', '/'); diff --git a/src/modules/filesystem/physfs/Filesystem.h b/src/modules/filesystem/physfs/Filesystem.h index 5d279da49..fcb207d1e 100644 --- a/src/modules/filesystem/physfs/Filesystem.h +++ b/src/modules/filesystem/physfs/Filesystem.h @@ -62,7 +62,7 @@ public: bool mount(const char *archive, const char *mountpoint, bool appendToPath = false); bool unmount(const char *archive); - File *newFile(const char *filename) const; + love::filesystem::File *newFile(const char *filename) const; FileData *newFileData(void *data, unsigned int size, const char *filename) const; FileData *newFileData(const char *b64, const char *filename) const; diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 5aef38064..f18b944b5 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -307,7 +307,9 @@ int luaopen_love(lua_State *L) lua_pushcfunction(L, w_love_isVersionCompatible); lua_setfield(L, -2, "isVersionCompatible"); -#ifdef LOVE_WINDOWS +#ifdef LOVE_WINDOWS_UWP + lua_pushstring(L, "Universal Windows Platform"); +#elif LOVE_WINDOWS lua_pushstring(L, "Windows"); #elif defined(LOVE_MACOSX) lua_pushstring(L, "OS X"); diff --git a/src/modules/sound/lullaby/Mpg123Decoder.cpp b/src/modules/sound/lullaby/Mpg123Decoder.cpp index 96f5d2ef1..5a6845ddd 100644 --- a/src/modules/sound/lullaby/Mpg123Decoder.cpp +++ b/src/modules/sound/lullaby/Mpg123Decoder.cpp @@ -24,6 +24,8 @@ #include +#ifndef LOVE_NO_MPG123 + namespace love { namespace sound @@ -286,3 +288,5 @@ double Mpg123Decoder::getDuration() } // lullaby } // sound } // love + +#endif // LOVE_NO_MPG123 \ No newline at end of file diff --git a/src/modules/sound/lullaby/Mpg123Decoder.h b/src/modules/sound/lullaby/Mpg123Decoder.h index 81fa1d24c..c30b1f203 100644 --- a/src/modules/sound/lullaby/Mpg123Decoder.h +++ b/src/modules/sound/lullaby/Mpg123Decoder.h @@ -25,6 +25,8 @@ #include "common/Data.h" #include "Decoder.h" +#ifndef LOVE_NO_MPG123 + // libmpg123 #ifdef LOVE_APPLE_USE_FRAMEWORKS #include @@ -88,4 +90,6 @@ private: } // sound } // love +#endif // LOVE_NO_MPG123 + #endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H diff --git a/src/modules/sound/lullaby/Sound.cpp b/src/modules/sound/lullaby/Sound.cpp index e2a8866d8..b161cbe31 100644 --- a/src/modules/sound/lullaby/Sound.cpp +++ b/src/modules/sound/lullaby/Sound.cpp @@ -30,9 +30,9 @@ #include "WaveDecoder.h" //#include "FLACDecoder.h" -#ifndef LOVE_NOMPG123 +#ifndef LOVE_NO_MPG123 # include "Mpg123Decoder.h" -#endif // LOVE_NOMPG123 +#endif // LOVE_NO_MPG123 #ifdef LOVE_SUPPORT_COREAUDIO # include "CoreAudioDecoder.h" @@ -51,9 +51,9 @@ Sound::Sound() Sound::~Sound() { -#ifndef LOVE_NOMPG123 +#ifndef LOVE_NO_MPG123 Mpg123Decoder::quit(); -#endif // LOVE_NOMPG123 +#endif // LOVE_NO_MPG123 } const char *Sound::getName() const @@ -75,10 +75,10 @@ sound::Decoder *Sound::newDecoder(love::filesystem::FileData *data, int bufferSi else if (ModPlugDecoder::accepts(ext)) decoder = new ModPlugDecoder(data, ext, bufferSize); #endif // LOVE_NO_MODPLUG -#ifndef LOVE_NOMPG123 +#ifndef LOVE_NO_MPG123 else if (Mpg123Decoder::accepts(ext)) decoder = new Mpg123Decoder(data, ext, bufferSize); -#endif // LOVE_NOMPG123 +#endif // LOVE_NO_MPG123 else if (VorbisDecoder::accepts(ext)) decoder = new VorbisDecoder(data, ext, bufferSize); #ifdef LOVE_SUPPORT_GME diff --git a/src/modules/system/System.cpp b/src/modules/system/System.cpp index aa15571ea..00c5ff1b6 100755 --- a/src/modules/system/System.cpp +++ b/src/modules/system/System.cpp @@ -147,12 +147,18 @@ bool System::openURL(const std::string &url) const // Unicode-aware WinAPI functions don't accept UTF-8, so we need to convert. std::wstring wurl = to_widestr(url); - HINSTANCE result = ShellExecuteW(nullptr, - L"open", - wurl.c_str(), - nullptr, - nullptr, - SW_SHOW); + HINSTANCE result = 0; + + #if !defined(LOVE_WINDOWS_UWP) + + result = ShellExecuteW(nullptr, + L"open", + wurl.c_str(), + nullptr, + nullptr, + SW_SHOW); + + #endif // LOVE_WINDOWS_UWP return (int) result > 32; diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 2b66608ee..dca71fd18 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -229,7 +229,14 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla }; // OpenGL ES 3+ contexts are only properly supported in SDL 2.0.4+. - if (hasSDL203orEarlier) + bool removeES3 = hasSDL203orEarlier; + + // While UWP SDL is above 2.0.4, it still doesn't support OpenGL ES 3+ +#ifdef LOVE_WINDOWS_UWP + removeES3 = true; +#endif + + if (removeES3) { auto it = attribslist.begin(); while (it != attribslist.end()) @@ -1019,7 +1026,7 @@ int Window::showMessageBox(const MessageBoxData &data) void Window::requestAttention(bool continuous) { -#if defined(LOVE_WINDOWS) +#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP) if (hasFocus()) return;