From e1d491b7c522688b43dc1a2fbeb2530c8960be2a Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Thu, 13 Aug 2020 00:26:17 -0400 Subject: [PATCH 1/5] Update boot.lua Removing the alpha variable allows anyone who overwrote the setColor function to see errorhandler's print. e.g. I'm overwriting the setColor function to accommodate 0-255 values and the error message is being printed with 1/255 alpha (invisible). Removing the 1 will print the message in black. P.S. I'm currently overwriting errorhandler for this, but I assume others are also overwriting setColor and see no error messages. --- src/scripts/boot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 9130f7355..cd0e28b14 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -673,7 +673,7 @@ function love.errhand(msg) love.graphics.reset() local font = love.graphics.setNewFont(14) - love.graphics.setColor(1, 1, 1, 1) + love.graphics.setColor(1, 1, 1) local trace = debug.traceback() From 99e1c0034d78c4fcd6b9afe4be305136b017fa4c Mon Sep 17 00:00:00 2001 From: niki Date: Fri, 14 Aug 2020 19:27:42 +0200 Subject: [PATCH 2/5] make love lua 5.4 conform --- src/common/runtime.cpp | 6 ++++-- src/common/runtime.h | 2 +- src/libraries/lua53/lstrlib.c | 4 +++- src/libraries/lua53/lutf8lib.c | 6 +++++- src/love.cpp | 7 ++++++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/common/runtime.cpp b/src/common/runtime.cpp index d76bded00..72c1bbe94 100644 --- a/src/common/runtime.cpp +++ b/src/common/runtime.cpp @@ -963,9 +963,11 @@ Type *luax_type(lua_State *L, int idx) return Type::byName(luaL_checkstring(L, idx)); } -int luax_resume(lua_State *L, int nargs) +int luax_resume(lua_State *L, int nargs, int* nres) { -#if LUA_VERSION_NUM >= 502 +#if LUA_VERSION_NUM >= 504 + return lua_resume(L, nullptr, nargs, nres); +#elif LUA_VERSION_NUM >= 502 return lua_resume(L, nullptr, nargs); #else return lua_resume(L, nargs); diff --git a/src/common/runtime.h b/src/common/runtime.h index 620a00646..aa6c981ee 100644 --- a/src/common/runtime.h +++ b/src/common/runtime.h @@ -701,7 +701,7 @@ int luax_catchexcept(lua_State *L, const T& func, const F& finallyfunc) * Compatibility shim for lua_resume * Exported because it's used in the launcher **/ -LOVE_EXPORT int luax_resume(lua_State *L, int nargs); +LOVE_EXPORT int luax_resume(lua_State *L, int nargs, int* nres); } // love diff --git a/src/libraries/lua53/lstrlib.c b/src/libraries/lua53/lstrlib.c index 03f574f18..437a5ee5c 100644 --- a/src/libraries/lua53/lstrlib.c +++ b/src/libraries/lua53/lstrlib.c @@ -73,7 +73,9 @@ typedef size_t lua_Unsigned; #endif -#if LUA_VERSION_NUM == 501 +#if LUA_VERSION_NUM >= 504 +# define LUAL_BUFFER53_BUFFER(B) (B)->b.b +#elif LUA_VERSION_NUM == 501 # define LUAL_BUFFER53_BUFFER(B) (B)->b.buffer #else # define LUAL_BUFFER53_BUFFER(B) (B)->b.initb diff --git a/src/libraries/lua53/lutf8lib.c b/src/libraries/lua53/lutf8lib.c index 48abc338a..8091a1116 100644 --- a/src/libraries/lua53/lutf8lib.c +++ b/src/libraries/lua53/lutf8lib.c @@ -309,8 +309,12 @@ int luaopen_luautf8 (lua_State *L) { lua_setfield(L, -2, l->name); } } +#if LUA_VERSION_NUM >= 504 + lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT) / sizeof(char) - 1); + lua_setfield(L, -2, "charpattern"); +#else lua_pushliteral(L, UTF8PATT); lua_setfield(L, -2, "charpattern"); +#endif return 1; } - diff --git a/src/love.cpp b/src/love.cpp index 58f36f3f6..414472eda 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -215,8 +215,13 @@ static DoneAction runlove(int argc, char **argv, int &retval) lua_newthread(L); lua_pushvalue(L, -2); int stackpos = lua_gettop(L); - while (love::luax_resume(L, 0) == LUA_YIELD) + int nres; + while (love::luax_resume(L, 0, &nres) == LUA_YIELD) +#if LUA_VERSION_NUM >= 504 + lua_pop(L, nres); +#else lua_pop(L, lua_gettop(L) - stackpos); +#endif retval = 0; DoneAction done = DONE_QUIT; From c3e6659fcb7fc27c160458f2a3120b816bf5d9ec Mon Sep 17 00:00:00 2001 From: niki Date: Sat, 15 Aug 2020 01:28:49 +0200 Subject: [PATCH 3/5] remove pushliteral version in luaopen_luautf8 --- src/libraries/lua53/lutf8lib.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libraries/lua53/lutf8lib.c b/src/libraries/lua53/lutf8lib.c index 8091a1116..603a20b14 100644 --- a/src/libraries/lua53/lutf8lib.c +++ b/src/libraries/lua53/lutf8lib.c @@ -309,12 +309,7 @@ int luaopen_luautf8 (lua_State *L) { lua_setfield(L, -2, l->name); } } -#if LUA_VERSION_NUM >= 504 lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT) / sizeof(char) - 1); lua_setfield(L, -2, "charpattern"); -#else - lua_pushliteral(L, UTF8PATT); - lua_setfield(L, -2, "charpattern"); -#endif return 1; } From da644085e476221ba6017b72859c8526db355c8f Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Sat, 15 Aug 2020 22:57:30 -0400 Subject: [PATCH 4/5] Update boot.lua.h --- src/scripts/boot.lua.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index efa2ee738..8f759af78 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -1347,7 +1347,7 @@ const unsigned char boot_lua[] = 0x6e, 0x74, 0x28, 0x31, 0x34, 0x29, 0x0a, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x0a, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x0a, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x74, 0x72, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x62, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x0a, From 6be79bdd89f8b148e250d6ead69d644677a0cd7e Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 21 Sep 2020 22:14:41 -0300 Subject: [PATCH 5/5] Fix build errors when Xcode 12 is used. --- src/libraries/glad/glad.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/glad/glad.cpp b/src/libraries/glad/glad.cpp index a9f8af1be..f63f62450 100644 --- a/src/libraries/glad/glad.cpp +++ b/src/libraries/glad/glad.cpp @@ -1,8 +1,4 @@ #include -#include "glad.hpp" - -namespace glad { - #ifdef GLAD_USE_SDL #include @@ -13,6 +9,10 @@ namespace glad { #include #endif +#include "glad.hpp" + +namespace glad { + bool gladLoadGL(void) { #ifdef GLAD_USE_SDL return gladLoadGLLoader(SDL_GL_GetProcAddress);