Skip to content

Commit

Permalink
Merge branch 'main' into 12.0-development
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Dec 2, 2023
2 parents 36783d3 + 30009db commit 8951635
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 88 deletions.
47 changes: 34 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ if(APPLE)
message(WARNING "Use the prebuilt .app or the xcode project in platform/xcode/ instead.")
endif()

if(MSVC)
if(MINGW)
message(WARNING "MinGW is not an officially supported build system for love.")
message(WARNING "Use megasource with Visual Studio instead.")
message(WARNING "Please see https://github.com/love2d/megasource")
endif()

if(MSVC OR MINGW)
set(LOVE_CONSOLE_EXE_NAME lovec)
endif()

Expand Down Expand Up @@ -178,7 +184,7 @@ Please see https://github.com/love2d/megasource
find_package(ModPlug REQUIRED)
find_package(OpenAL REQUIRED)
find_package(OpenGL REQUIRED)
find_package(SDL2 2.0.9 REQUIRED)
find_package(SDL2 2.0.9 REQUIRED CONFIG COMPONENTS SDL2main)
find_package(Theora REQUIRED)
find_package(Vorbis REQUIRED)
find_package(ZLIB REQUIRED)
Expand All @@ -188,7 +194,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}
${HARFBUZZ_INCLUDE_DIR}
${VORBIS_INCLUDE_DIR}
Expand All @@ -201,7 +207,7 @@ Please see https://github.com/love2d/megasource

set(LOVE_LINK_LIBRARIES
${OPENGL_gl_LIBRARY}
${SDL2_LIBRARY}
${SDL2_LIBRARIES}
${FREETYPE_LIBRARY}
${HARFBUZZ_LIBRARY}
${OPENAL_LIBRARY}
Expand Down Expand Up @@ -1298,6 +1304,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
Expand Down Expand Up @@ -1393,7 +1402,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
Expand Down Expand Up @@ -1530,7 +1539,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
Expand All @@ -1539,7 +1554,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
Expand Down Expand Up @@ -1950,17 +1965,23 @@ 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
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()

if(ANDROID)
Expand Down Expand Up @@ -1992,7 +2013,7 @@ if(NOT ANDROID)
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()
Expand Down Expand Up @@ -2021,7 +2042,7 @@ if(NOT ANDROID)
endif()
endif()

if (NOT MSVC)
if (NOT MSVC OR MINGW)
return()
endif()

Expand Down
17 changes: 17 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,28 @@ 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.
* 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.
* 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.
Expand Down
57 changes: 0 additions & 57 deletions platform/xcode/ios/luajit-iOS.sh

This file was deleted.

7 changes: 3 additions & 4 deletions src/common/android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,9 @@ void *getIOFromFD(int fd)

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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,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")))
Expand All @@ -114,8 +114,10 @@
#ifndef LOVE_WINDOWS_UWP
# define LOVE_LEGENDARY_CONSOLE_IO_HACK
#endif // LOVE_WINDOWS_UWP
#ifndef __MINGW32__
# define NOMINMAX
#endif
#endif

#if defined(LOVE_MACOS) || defined(LOVE_IOS)
# define LOVE_LEGENDARY_APP_ARGV_HACK
Expand Down
2 changes: 2 additions & 0 deletions src/common/ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)
[paths addObject:path.stringByDeletingLastPathComponent];
}

[paths sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

return paths;
}

Expand Down
2 changes: 1 addition & 1 deletion src/love.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static DoneAction runlove(int argc, char **argv, int &retval, love::Variant &res

// 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");
Expand Down
8 changes: 6 additions & 2 deletions src/modules/love/jitsetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 arm(64). 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")
Expand Down
10 changes: 0 additions & 10 deletions src/modules/love/love.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@

#ifdef LOVE_ANDROID
#include <SDL.h>
extern "C"
{
#include "luajit.h"
}
#endif // LOVE_ANDROID

#ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK
Expand Down Expand Up @@ -529,11 +525,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");
Expand All @@ -553,7 +544,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

Expand Down
2 changes: 2 additions & 0 deletions src/modules/physics/box2d/DistanceJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/modules/physics/box2d/DistanceJoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class DistanceJoint : public Joint
{
public:

static love::Type type;

/**
* Creates a DistanceJoint connecting body1 to body2.
**/
Expand Down
8 changes: 8 additions & 0 deletions src/modules/thread/LuaThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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
Expand Down Expand Up @@ -55,6 +56,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);
Expand Down

0 comments on commit 8951635

Please sign in to comment.