From 2aad15c865da4f0cce061c479100341430800f52 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 14 Oct 2023 16:42:31 -0300 Subject: [PATCH 01/14] Fix DistanceJoint type information --- src/modules/physics/box2d/DistanceJoint.cpp | 2 ++ src/modules/physics/box2d/DistanceJoint.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/modules/physics/box2d/DistanceJoint.cpp b/src/modules/physics/box2d/DistanceJoint.cpp index d85b9fa3c..0ed115b20 100644 --- a/src/modules/physics/box2d/DistanceJoint.cpp +++ b/src/modules/physics/box2d/DistanceJoint.cpp @@ -32,6 +32,8 @@ namespace physics namespace box2d { +love::Type DistanceJoint::type("DistanceJoint", &Joint::type); + DistanceJoint::DistanceJoint(Body *body1, Body *body2, float x1, float y1, float x2, float y2, bool collideConnected) : Joint(body1, body2) , joint(NULL) diff --git a/src/modules/physics/box2d/DistanceJoint.h b/src/modules/physics/box2d/DistanceJoint.h index 14060dee0..382efbbf6 100644 --- a/src/modules/physics/box2d/DistanceJoint.h +++ b/src/modules/physics/box2d/DistanceJoint.h @@ -39,6 +39,8 @@ class DistanceJoint : public Joint { public: + static love::Type type; + /** * Creates a DistanceJoint connecting body1 to body2. **/ From a3a6e29ef04713ffba0423e73da3910f4ca443d2 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Tue, 7 Nov 2023 20:27:42 -0400 Subject: [PATCH 02/14] Update changelog --- changes.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/changes.txt b/changes.txt index 406fb8d27..ffd39733a 100644 --- a/changes.txt +++ b/changes.txt @@ -3,11 +3,23 @@ LOVE 11.5 [Mysterious Mysteries] Released: N/A +* Fixed inconsistent and buggy behaviour of 'pairs' by updating LuaJIT. +* Fixed "unexpected alignment" errors when running love on some 32 bit Linux systems. +* Fixed running fused games on Windows when the executable has been code-signed. +* Fixed undefined behaviour in love.data.hash's implementation. +* Fixed writing files when a symlink exists in the save directory's path. * Fixed love.threaderror not being called if the error message is an empty string. * Fixed a race condition when a Thread is destroyed immediately after Thread:start. * Fixed unexpectedly slow first frames on macOS. +* Fixed love.joystick.setGamepadMapping when replacing an existing mapping. +* Fixed love.joystick.getGamepadMappingString. +* Fixed duplicate platform fields in love.joystick.saveGamepadMappings. +* Fixed DistanceJoint type information. * Fixed time drift in Source:tell after a Source loops. * Fixed audio not always pausing when the app is minimized on Android. +* Fixed RecordingDevice:start to return false instead of hard-crashing on iOS. +* Fixed identical frames in Ogg Theora videos being skipped. +* Fixed love.font.newBMFontRasterizer's single file parameter variant. * Fixed the original window size not always being restored when exiting fullscreen on Linux. * Fixed some cases of framerate hitches in Windows when vsync is enabled in windowed mode. * Fixed colors appearing over-saturated on P3 displays in macOS. From ae465f8e4b598401ce0a1dd6aaf402a4bfcb6e11 Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Wed, 15 Nov 2023 12:16:19 +0800 Subject: [PATCH 03/14] Insert Android-specific changelog. --- changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changes.txt b/changes.txt index ffd39733a..02f285430 100644 --- a/changes.txt +++ b/changes.txt @@ -3,6 +3,7 @@ LOVE 11.5 [Mysterious Mysteries] Released: N/A +* Added "LÖVE Loader" launcher on Android for easier loading of .love files. * Fixed inconsistent and buggy behaviour of 'pairs' by updating LuaJIT. * Fixed "unexpected alignment" errors when running love on some 32 bit Linux systems. * Fixed running fused games on Windows when the executable has been code-signed. From 81393b9aede340d59e2e403b2ec737c7210ad659 Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Wed, 15 Nov 2023 12:19:06 +0800 Subject: [PATCH 04/14] Android: Fixed invalid JNIEnv* pointer when starting up love.filesystem for 2nd time. --- src/common/android.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/android.cpp b/src/common/android.cpp index a0a1f4444..c10ef99dc 100644 --- a/src/common/android.cpp +++ b/src/common/android.cpp @@ -806,10 +806,9 @@ const char *getCRequirePath() const char *getArg0() { - static PHYSFS_AndroidInit androidInit = { - SDL_AndroidGetJNIEnv(), - SDL_AndroidGetActivity() - }; + static PHYSFS_AndroidInit androidInit = {nullptr, nullptr}; + androidInit.jnienv = SDL_AndroidGetJNIEnv(); + androidInit.context = SDL_AndroidGetActivity(); return (const char *) &androidInit; } From 99e7022d2d2227f66e210be4bad64f458f08f369 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 18 Nov 2023 13:44:41 -0400 Subject: [PATCH 05/14] iOS: alphabetically sort .love file list. Fixes #1984. --- changes.txt | 3 +++ src/common/ios.mm | 2 ++ 2 files changed, 5 insertions(+) diff --git a/changes.txt b/changes.txt index 02f285430..84a364eff 100644 --- a/changes.txt +++ b/changes.txt @@ -4,6 +4,9 @@ LOVE 11.5 [Mysterious Mysteries] Released: N/A * Added "LÖVE Loader" launcher on Android for easier loading of .love files. + +* Changed iOS game selector to alphabetically sort the list of .love files. + * Fixed inconsistent and buggy behaviour of 'pairs' by updating LuaJIT. * Fixed "unexpected alignment" errors when running love on some 32 bit Linux systems. * Fixed running fused games on Windows when the executable has been code-signed. diff --git a/src/common/ios.mm b/src/common/ios.mm index 4a89e9e4d..398d34962 100644 --- a/src/common/ios.mm +++ b/src/common/ios.mm @@ -150,6 +150,8 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *) [paths addObject:path.stringByDeletingLastPathComponent]; } + [paths sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; + return paths; } From 11d4bdd1a334c4724c42536757bbf65d6fe75eae Mon Sep 17 00:00:00 2001 From: Sewbacca Date: Sun, 26 Nov 2023 15:00:34 +0100 Subject: [PATCH 06/14] Add support for MinGW --- CMakeLists.txt | 37 +++++++++++++++++++++++-------------- extra/windows/love.rc | Bin 3632 -> 1741 bytes src/common/config.h | 4 +++- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae1bf6bdd..9eddd07cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ if(APPLE) message(WARNING "Use the prebuilt .app or the xcode project in platform/xcode/ instead.") endif() -if(MSVC) +if(MSVC OR MINGW) set(LOVE_CONSOLE_EXE_NAME lovec) endif() @@ -179,7 +179,7 @@ if(MEGA) else() if(MSVC) message(FATAL_ERROR " -It is currently only possible to build with megasource on Windows. +It is currently only possible to build with megasource or (experimental) mingw on Windows. Please see https://github.com/love2d/megasource ") endif() @@ -188,7 +188,7 @@ Please see https://github.com/love2d/megasource find_package(ModPlug REQUIRED) find_package(OpenAL REQUIRED) find_package(OpenGL REQUIRED) - find_package(SDL2 REQUIRED) + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) find_package(Theora REQUIRED) find_package(Vorbis REQUIRED) find_package(ZLIB REQUIRED) @@ -198,7 +198,7 @@ Please see https://github.com/love2d/megasource add_definitions(-D HAS_SOCKLEN_T) set(LOVE_INCLUDE_DIRS - ${SDL2_INCLUDE_DIR} + ${SDL2_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${VORBIS_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR} @@ -210,7 +210,7 @@ Please see https://github.com/love2d/megasource set(LOVE_LINK_LIBRARIES ${OPENGL_gl_LIBRARY} - ${SDL2_LIBRARY} + ${SDL2_LIBRARIES} ${FREETYPE_LIBRARY} ${OPENAL_LIBRARY} ${MODPLUG_LIBRARY} @@ -1316,6 +1316,9 @@ set(LOVE_SRC_3P_ENET add_library(love_3p_enet ${LOVE_SRC_3P_ENET}) target_link_libraries(love_3p_enet ${LOVE_LUA_LIBRARY}) target_include_directories(love_3p_enet PUBLIC src/libraries/enet/libenet/include) +if(MINGW) + target_link_libraries(love_3p_enet winmm.a) +endif() # # GLAD @@ -1411,7 +1414,7 @@ set(LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT src/libraries/glslang/glslang/OSDependent/osinclude.h ) -if(MSVC) +if(MSVC OR MINGW) set(LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT ${LOVE_SRC_3P_GLSLANG_GLSLANG_OSDEPENDENT} src/libraries/glslang/glslang/OSDependent/Windows/main.cpp @@ -1511,7 +1514,13 @@ set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET set(LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET) -if(MSVC) +if(MINGW) + set(WIN32_LIB_EXT .a) +else() + set(WIN32_LIB_EXT .lib) +endif() + +if(MSVC OR MINGW) set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET ${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET} src/libraries/luasocket/libluasocket/wsocket.c @@ -1520,7 +1529,7 @@ if(MSVC) set(LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET ${LOVE_LINK_L3P_LUASOCKET_LIBLUASOCKET} - ws2_32.lib + ws2_32${WIN32_LIB_EXT} ) else() set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET @@ -1757,11 +1766,11 @@ link_directories(${LOVE_LINK_DIRS}) set(LOVE_RC) -if(MSVC) +if(MSVC OR MINGW) set(LOVE_LINK_LIBRARIES ${LOVE_LINK_LIBRARIES} - ws2_32.lib - winmm.lib - dwmapi.lib + ws2_32${WIN32_LIB_EXT} + winmm${WIN32_LIB_EXT} + dwmapi${WIN32_LIB_EXT} ) set(LOVE_RC @@ -1790,7 +1799,7 @@ add_executable(${LOVE_EXE_NAME} WIN32 src/love.cpp ${LOVE_RC}) target_link_libraries(${LOVE_EXE_NAME} ${LOVE_LIB_NAME}) set_target_properties(${LOVE_EXE_NAME} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON) -if(MSVC) +if(MSVC OR MINGW) add_executable(${LOVE_CONSOLE_EXE_NAME} src/love.cpp ${LOVE_RC}) target_link_libraries(${LOVE_CONSOLE_EXE_NAME} ${LOVE_LIB_NAME}) endif() @@ -1818,7 +1827,7 @@ if(LOVE_MOVE_DLLS) endforeach() endif() -if (NOT MSVC) +if (NOT MSVC OR MINGW) return() endif() diff --git a/extra/windows/love.rc b/extra/windows/love.rc index edbf420cb303947dabab2dba30038be450e77e8a..97056578561a154914f58d7378a2a9fb4c2bff5f 100644 GIT binary patch literal 1741 zcma)6;cnV65dPgf#VttPTD6eSQfYrCQ3zGmlpvDQ^%pY40c(kk9Me)weW1P2o@Zw# zKxnIJC`iej@4N55J74Sc)Phs!3;tO_D&&GHPy!0_L_sZC0V&HUFb)}0Dx>F=Cya2o zj|b=ORTD#7meojT$~c869{a-^fAIKaa{`Uc&K`%QN1N+sEUQ&!e^^ouB}j4xK{)ZI z*Y|$V2h6`NXab}_G8Fl(rCOGho~SIC;K0}Uj7nVt;dl_)<3VHzA~mlAZ(ri>~D%orz<(V_{yf_z;lm{BBS@EHovxS|V0ozYA@!&RqqQAyok zDMy`Z6758;speP>-KNyqx5juU-Z=8Z;k4`l*sj~`*oOdj-S6QTT=$LDAELE$XdHVJ zU&DceX;`}L9}dba6Hj#N{TPMgID+G2_*C__1{2SKIz`v~{L zi0){#6Z4mKbRC4fTd*T@OZC0=d5Ur$p=;|y>R+A9nS)kiKALocd+fSC-KWJ|vX#QE zV4nfh8V+_jd50GOA?o4PlF*_0_rZ-ZV{Yu_cKU{+j~F&c8+JQx??2hrw$IZO`HJwD zA<5}BkFBQ>9)!#i+`>6-23-L7eBRVWZW#u2L9(7$y-2oLDidt)KH)dC9p~!2?X)kz z;PvSf?v7QCD+yvs@;cN=iex=k??`-brmo3Hg6#SExUwWCSq;^$1BS>OYs++_cv-$_ pkiN87=BtIzZUQDmzG;8e=2#M5WJV#Bz}et5oPpc!v~~Ea^%o*o?O^}_ literal 3632 zcmb_e+iuf95S`Z|@efNXaT9IR8xk)_p&=-cwo#k5@Kgmzi$yM#n^G#o2k}FE4sgzl z*Xwni1PNp%w%2nxGjnEkfB#yO$GGmw9dWojY05;#@<66|KErb==Q7Z@Dc+o1N?*QU z#bND}BzUJ>B12tEpzH9Q;OkV^RA=Ua zyp&UUAxFT~LEc=JjVt7203C;jnH}bd`C>M&kWaoBbH;3@kW4i54j!*$B=2>VxU4SB zp4nt&yiLokgXURbwFO(O$8pK>CG=8!8>6PHkniOcv^w^&b`Dz;^>hInefa zK=lE#BV4R^jJ%8~g`EpXGfpxol^bXnr$+GeS^b!ufo3jI^j;>>DvY6#AXd}0yb=RB zW9a&j2>7nE8ibk{r+p+2d1gNPnwJ64F)wY{aEOXpd}1wFO;?B@$-02rQ+#Kaq?zmx zh_3PcRJL(#Rxo{8qhLkJ^=dvbigGtp^RAxtf$y|4eW(6>8)WbSdZi6E?}5w34slXL zkFFyh+jyF9XIC2X8a56P33V1pvztwNdx7i$5FP`c$LPdjH4kJ$xjSw8ya#tDTA@=| zcq?7?*Ml7=_i;J7m*t-Ivu+K!?ZD%U1;|W>@w!YhWZzZ-#@kh%?V$zV9i1#q{2$5= z?AH)Y0v2}Ur%s*fdIZfq)MFRgrfGRtMZ7~?UUz_J&Z(+e1xrN?|K@#wX+6liGiPl? zM%K9*7i0Fw6HK8=0lDobG0SN)<}+E=f)7UMBZ?(r-=Y42&+)9^1!`k%yk2H${59+l zMAAi<>|?h$Lj1iFVvpzlBC(F~8EAn;4eX_dU`PZ1ZwmR3CAo`wMCE%O)vW8amESwL z^cwb3R)ZE!k+B~BPc(N;tes$WQ#LZ@v4`jNhsWK+&fir|m$5k5y1f=wJero`Xd?bj z-m#$v{>BeEHv5YGG=R37`zbT_n|@islwqxRvV!NFEk#Wdw7QAX>BwI zR~I;VLc0R~>0e~SGo6`@`4U^2#hOsNMSQ8M9rMidT&npW&cIun6YqYOcdOtK{bQ$b z)-&+H&l}E1+pT?p_Q%yhIHHvy7FT=Qcmc(RDCj L8$a`HIPCuqn$Yt` diff --git a/src/common/config.h b/src/common/config.h index 86aaedb5f..94848e32c 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -104,7 +104,7 @@ #endif // DLL-stuff. -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) # define LOVE_EXPORT __declspec(dllexport) #elif defined(__GNUC__) || defined(__clang__) # define LOVE_EXPORT __attribute__((visibility("default"))) @@ -116,8 +116,10 @@ #ifndef LOVE_WINDOWS_UWP # define LOVE_LEGENDARY_CONSOLE_IO_HACK #endif // LOVE_WINDOWS_UWP +#ifndef __MINGW32__ # define NOMINMAX #endif +#endif #if defined(LOVE_MACOSX) || defined(LOVE_IOS) # define LOVE_LEGENDARY_APP_ARGV_HACK From 788e58b315717a88975e5d251d7ff5cef9d72aac Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Mon, 27 Nov 2023 00:01:43 +0800 Subject: [PATCH 07/14] Revert love.rc changes from #1985. --- extra/windows/love.rc | Bin 1741 -> 3632 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/extra/windows/love.rc b/extra/windows/love.rc index 97056578561a154914f58d7378a2a9fb4c2bff5f..edbf420cb303947dabab2dba30038be450e77e8a 100644 GIT binary patch literal 3632 zcmb_e+iuf95S`Z|@efNXaT9IR8xk)_p&=-cwo#k5@Kgmzi$yM#n^G#o2k}FE4sgzl z*Xwni1PNp%w%2nxGjnEkfB#yO$GGmw9dWojY05;#@<66|KErb==Q7Z@Dc+o1N?*QU z#bND}BzUJ>B12tEpzH9Q;OkV^RA=Ua zyp&UUAxFT~LEc=JjVt7203C;jnH}bd`C>M&kWaoBbH;3@kW4i54j!*$B=2>VxU4SB zp4nt&yiLokgXURbwFO(O$8pK>CG=8!8>6PHkniOcv^w^&b`Dz;^>hInefa zK=lE#BV4R^jJ%8~g`EpXGfpxol^bXnr$+GeS^b!ufo3jI^j;>>DvY6#AXd}0yb=RB zW9a&j2>7nE8ibk{r+p+2d1gNPnwJ64F)wY{aEOXpd}1wFO;?B@$-02rQ+#Kaq?zmx zh_3PcRJL(#Rxo{8qhLkJ^=dvbigGtp^RAxtf$y|4eW(6>8)WbSdZi6E?}5w34slXL zkFFyh+jyF9XIC2X8a56P33V1pvztwNdx7i$5FP`c$LPdjH4kJ$xjSw8ya#tDTA@=| zcq?7?*Ml7=_i;J7m*t-Ivu+K!?ZD%U1;|W>@w!YhWZzZ-#@kh%?V$zV9i1#q{2$5= z?AH)Y0v2}Ur%s*fdIZfq)MFRgrfGRtMZ7~?UUz_J&Z(+e1xrN?|K@#wX+6liGiPl? zM%K9*7i0Fw6HK8=0lDobG0SN)<}+E=f)7UMBZ?(r-=Y42&+)9^1!`k%yk2H${59+l zMAAi<>|?h$Lj1iFVvpzlBC(F~8EAn;4eX_dU`PZ1ZwmR3CAo`wMCE%O)vW8amESwL z^cwb3R)ZE!k+B~BPc(N;tes$WQ#LZ@v4`jNhsWK+&fir|m$5k5y1f=wJero`Xd?bj z-m#$v{>BeEHv5YGG=R37`zbT_n|@islwqxRvV!NFEk#Wdw7QAX>BwI zR~I;VLc0R~>0e~SGo6`@`4U^2#hOsNMSQ8M9rMidT&npW&cIun6YqYOcdOtK{bQ$b z)-&+H&l}E1+pT?p_Q%yhIHHvy7FT=Qcmc(RDCj L8$a`HIPCuqn$Yt` literal 1741 zcma)6;cnV65dPgf#VttPTD6eSQfYrCQ3zGmlpvDQ^%pY40c(kk9Me)weW1P2o@Zw# zKxnIJC`iej@4N55J74Sc)Phs!3;tO_D&&GHPy!0_L_sZC0V&HUFb)}0Dx>F=Cya2o zj|b=ORTD#7meojT$~c869{a-^fAIKaa{`Uc&K`%QN1N+sEUQ&!e^^ouB}j4xK{)ZI z*Y|$V2h6`NXab}_G8Fl(rCOGho~SIC;K0}Uj7nVt;dl_)<3VHzA~mlAZ(ri>~D%orz<(V_{yf_z;lm{BBS@EHovxS|V0ozYA@!&RqqQAyok zDMy`Z6758;speP>-KNyqx5juU-Z=8Z;k4`l*sj~`*oOdj-S6QTT=$LDAELE$XdHVJ zU&DceX;`}L9}dba6Hj#N{TPMgID+G2_*C__1{2SKIz`v~{L zi0){#6Z4mKbRC4fTd*T@OZC0=d5Ur$p=;|y>R+A9nS)kiKALocd+fSC-KWJ|vX#QE zV4nfh8V+_jd50GOA?o4PlF*_0_rZ-ZV{Yu_cKU{+j~F&c8+JQx??2hrw$IZO`HJwD zA<5}BkFBQ>9)!#i+`>6-23-L7eBRVWZW#u2L9(7$y-2oLDidt)KH)dC9p~!2?X)kz z;PvSf?v7QCD+yvs@;cN=iex=k??`-brmo3Hg6#SExUwWCSq;^$1BS>OYs++_cv-$_ pkiN87=BtIzZUQDmzG;8e=2#M5WJV#Bz}et5oPpc!v~~Ea^%o*o?O^}_ From aa0a0bdf7a4f7ca3b92d418adad642330a6d7f16 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 26 Nov 2023 14:23:49 -0400 Subject: [PATCH 08/14] iOS: remove LuaJIT build script. It's been moved to the love-apple-dependencies repository. --- platform/xcode/ios/luajit-iOS.sh | 57 -------------------------------- 1 file changed, 57 deletions(-) delete mode 100755 platform/xcode/ios/luajit-iOS.sh diff --git a/platform/xcode/ios/luajit-iOS.sh b/platform/xcode/ios/luajit-iOS.sh deleted file mode 100755 index 0533b4138..000000000 --- a/platform/xcode/ios/luajit-iOS.sh +++ /dev/null @@ -1,57 +0,0 @@ -mkdir -p include/luajit -mkdir -p libraries/luajit - -if [ ! -d luajit-git ]; then - git clone https://github.com/LuaJIT/LuaJIT.git luajit-git -fi -cd luajit-git -git pull --no-rebase -git checkout v2.1 - -export MACOSX_DEPLOYMENT_TARGET=10.7 - -# iOS device binaries -# LuaJIT does not support building for armv7 on modern macOS versions. - -ISDKP=$(xcrun --sdk iphoneos --show-sdk-path) -ICC=$(xcrun --sdk iphoneos --find clang) - -ISDKF="-arch arm64 -isysroot $ISDKP -mios-version-min=8.0" -make clean TARGET_SYS=iOS -make -j8 CC="clang" CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_arm64_device.a - - -# iOS simulator binaries - -ISDKP=$(xcrun --sdk iphonesimulator --show-sdk-path) -ICC=$(xcrun --sdk iphonesimulator --find clang) - -ISDKF="-arch x86_64 -isysroot $ISDKP -mios-simulator-version-min=8.0" -make clean TARGET_SYS=iOS -make -j8 CC="clang" CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_x86_64_sim.a - -ISDKF="-arch arm64 -isysroot $ISDKP -mios-simulator-version-min=8.0" -make clean TARGET_SYS=iOS -make -j8 CC="clang" CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS -cp src/libluajit.a ../libraries/luajit/libluajit_arm64_sim.a - - -# copy includes -cp src/lua.hpp ../include/luajit - -cp src/lauxlib.h ../include/luajit -cp src/lua.h ../include/luajit -cp src/luaconf.h ../include/luajit -cp src/lualib.h ../include/luajit -cp src/luajit.h ../include/luajit - -# combine lib -cd ../libraries/luajit -lipo -create -output libluajit_device.a libluajit_arm64_device.a -lipo -create -output libluajit_sim.a libluajit_x86_64_sim.a libluajit_arm64_sim.a - -# create xcframework with all platforms -rm -rf Lua.xcframework -xcodebuild -create-xcframework -library libluajit_device.a -headers ../../include/luajit -library libluajit_sim.a -headers ../../include/luajit -output Lua.xcframework From d21c9cb6dec0afe64660a1e4edc4354aa716ac74 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 26 Nov 2023 17:11:34 -0400 Subject: [PATCH 09/14] macOS/arm64: turn off JIT compilation by default. --- changes.txt | 1 + src/modules/love/jitsetup.lua | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/changes.txt b/changes.txt index 84a364eff..1807c43c9 100644 --- a/changes.txt +++ b/changes.txt @@ -6,6 +6,7 @@ Released: N/A * Added "LÖVE Loader" launcher on Android for easier loading of .love files. * Changed iOS game selector to alphabetically sort the list of .love files. +* Changed JIT compilation on macOS arm64 (Apple Silicon) to be off by default, since performance and available JIT memory isn't reliable. * Fixed inconsistent and buggy behaviour of 'pairs' by updating LuaJIT. * Fixed "unexpected alignment" errors when running love on some 32 bit Linux systems. diff --git a/src/modules/love/jitsetup.lua b/src/modules/love/jitsetup.lua index 39e85c18a..239f9f850 100644 --- a/src/modules/love/jitsetup.lua +++ b/src/modules/love/jitsetup.lua @@ -62,6 +62,10 @@ if jit.arch == "arm64" then jit.opt.start("sizemcode=128") for i=1, 100 do end + + -- Actually just turn the whole thing off for arm64. It's very hard to get + -- reliable performance in non-trivial games even with the above workaround. + jit.off() else -- Somewhat arbitrary value (>= the default). jit.opt.start("sizemcode=128") From da3fdba7f42dfcc1657658398f004a9a3e3f984c Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Mon, 27 Nov 2023 11:35:37 +0800 Subject: [PATCH 10/14] Android: Remove calls to luaJIT_setmode. Turning off JIT is now done in jitsetup.lua. --- src/modules/love/love.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 453f76e40..ef6f9700c 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -43,10 +43,6 @@ #ifdef LOVE_ANDROID #include -extern "C" -{ -#include "luajit.h" -} #endif // LOVE_ANDROID #ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK @@ -438,7 +434,6 @@ int luaopen_love(lua_State *L) lua_setfield(L, -2, "_version_codename"); #ifdef LOVE_ANDROID - luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF); lua_register(L, "print", w_print_sdl_log); #endif From f4f3105ccd5b19b524d1dd58495f49b02b9e623c Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Mon, 27 Nov 2023 12:13:56 +0800 Subject: [PATCH 11/14] Call love.jitsetup during thread initialization too. --- src/modules/thread/LuaThread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/thread/LuaThread.cpp b/src/modules/thread/LuaThread.cpp index 315f74b1b..79bc4d0c0 100644 --- a/src/modules/thread/LuaThread.cpp +++ b/src/modules/thread/LuaThread.cpp @@ -24,6 +24,7 @@ #ifdef LOVE_BUILD_STANDALONE extern "C" int luaopen_love(lua_State * L); +extern "C" int luaopen_love_jitsetup(lua_State * L); #endif // LOVE_BUILD_STANDALONE namespace love @@ -54,6 +55,13 @@ void LuaThread::threadFunction() luaL_openlibs(L); #ifdef LOVE_BUILD_STANDALONE + // Call LuaJIT-specific setup again. While it's quite late to call it at + // this point, it still needed to turn off JIT compilation (if necessary) + // for this thread. + luax_preload(L, luaopen_love_jitsetup, "love.jitsetup"); + luax_require(L, "love.jitsetup"); + lua_pop(L, 1); + luax_preload(L, luaopen_love, "love"); luax_require(L, "love"); lua_pop(L, 1); From 6a298a74c22548d1a7e259a5f9363c971362bf1f Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Mon, 27 Nov 2023 12:47:23 +0800 Subject: [PATCH 12/14] jitsetup: Also disable JIT on ARM32 platform. --- src/modules/love/jitsetup.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/love/jitsetup.lua b/src/modules/love/jitsetup.lua index 239f9f850..296ba6c22 100644 --- a/src/modules/love/jitsetup.lua +++ b/src/modules/love/jitsetup.lua @@ -33,9 +33,9 @@ jit.opt.start("maxtrace=2000", "maxrecord=8000") -- and higher than the default (512) because that's already too low. jit.opt.start("maxmcode=16384") -if jit.arch == "arm64" then +if jit.arch == "arm64" or jit.arch == "arm" then -- https://github.com/LuaJIT/LuaJIT/issues/285 - -- LuaJIT 2.1 on arm64 currently (as of commit b4b2dce) can only use memory + -- LuaJIT 2.1 on arm(64) currently (as of commit b4b2dce) can only use memory -- for JIT compilation within a certain short range. Other libraries such as -- SDL can take all the usable space in that range and cause attempts at JIT -- compilation to both fail and take a long time. @@ -63,7 +63,7 @@ if jit.arch == "arm64" then jit.opt.start("sizemcode=128") for i=1, 100 do end - -- Actually just turn the whole thing off for arm64. It's very hard to get + -- Actually just turn the whole thing off for arm(64). It's very hard to get -- reliable performance in non-trivial games even with the above workaround. jit.off() else From 696007ee399821bdedd9846a9b9135c451b297dd Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Mon, 27 Nov 2023 23:14:36 -0400 Subject: [PATCH 13/14] Don't unconditionally run love.jitsetup when love is used as a library --- src/love.cpp | 2 +- src/modules/love/love.cpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/love.cpp b/src/love.cpp index 5a54c74d9..97673a33a 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -165,7 +165,7 @@ static DoneAction runlove(int argc, char **argv, int &retval) // LuaJIT-specific setup needs to be done as early as possible - before // get_app_arguments because that loads external library code. This is also - // loaded inside require("love"). Note that it doesn't use the love table. + // loaded inside love's Lua threads. Note that it doesn't use the love table. love_preload(L, luaopen_love_jitsetup, "love.jitsetup"); lua_getglobal(L, "require"); lua_pushstring(L, "love.jitsetup"); diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index ef6f9700c..0202a8526 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -410,11 +410,6 @@ int luaopen_love(lua_State *L) for (int i = 0; modules[i].name != nullptr; i++) love::luax_preload(L, modules[i].func, modules[i].name); - // jitsetup is also loaded in the love executable runlove function. It's - // needed here too for threads. Note that it doesn't use the love table. - love::luax_require(L, "love.jitsetup"); - lua_pop(L, 1); - love::luax_insistpinnedthread(L); love::luax_insistglobal(L, "love"); From 76fcc5bc3d1b7e60955782766ec982286c7ab4c2 Mon Sep 17 00:00:00 2001 From: Sewbacca Date: Tue, 28 Nov 2023 16:11:07 +0100 Subject: [PATCH 14/14] MinGW: Support utf-16 encoded love.rc --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eddd07cb..dfb44de92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1777,6 +1777,12 @@ if(MSVC OR MINGW) extra/windows/love.rc extra/windows/love.ico ) + + if(MINGW) + # UTF-16 flags passed to windres. windres invokes gcc as preprocessor + # -> gcc outputs utf8, so windres must read-in codepage 65001 (utf8) + set(CMAKE_RC_FLAGS ${CMAKE_RC_FLAGS} "-c 65001 --preprocessor-arg=-finput-charset=UTF-16LE") + endif() endif() add_library(${LOVE_LIB_NAME} SHARED ${LOVE_LIB_SRC} ${LOVE_RC})