From d82d2c93b695d28b05554a502079619c97ab315e Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 11 Feb 2015 15:40:22 -0400 Subject: [PATCH 1/7] If love is run from an existing console window in Windows, it will use that for stdout (when console mode is enabled via love.conf or --console) rather than creating a new console. --- src/modules/love/love.cpp | 63 +++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 6ff11df90..2e205f2a1 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -250,44 +250,77 @@ int luaopen_love(lua_State * L) #ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK +// Mostly taken from the Windows 8.1 SDK's VersionHelpers.h. +static bool IsWindowsVistaOrGreater() +{ + OSVERSIONINFOEXW osvi = {sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0}; + + osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA); + osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA); + osvi.wServicePackMajor = 0; + + DWORDLONG majorversionmask = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); + DWORDLONG versionmask = VerSetConditionMask(majorversionmask, VER_MINORVERSION, VER_GREATER_EQUAL); + DWORDLONG mask = VerSetConditionMask(versionmask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); + + return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, mask) != FALSE; +} + int w__openConsole(lua_State *L) { static bool is_open = false; + if (is_open) - return 0; + { + love::luax_pushboolean(L, is_open); + return 1; + } + is_open = true; - if (GetConsoleWindow() != NULL || AllocConsole() == 0) - return 0; + // FIXME: we don't call AttachConsole in Windows XP because it seems to + // break later AllocConsole calls if it fails. A better workaround might be + // possible, but it's hard to find a WinXP system to test on these days... + if (!IsWindowsVistaOrGreater() || !AttachConsole(ATTACH_PARENT_PROCESS)) + { + // Create our own console if we can't attach to an existing one. + if (!AllocConsole()) + { + is_open = false; + love::luax_pushboolean(L, is_open); + return 1; + } - const int MAX_CONSOLE_LINES = 5000; - CONSOLE_SCREEN_BUFFER_INFO console_info; + SetConsoleTitle(TEXT("LOVE Console")); - // Set size. - GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &console_info); - console_info.dwSize.Y = MAX_CONSOLE_LINES; - SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), console_info.dwSize); + const int MAX_CONSOLE_LINES = 5000; + CONSOLE_SCREEN_BUFFER_INFO console_info; - SetConsoleTitle(TEXT("LOVE Console")); + // Set size. + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &console_info); + console_info.dwSize.Y = MAX_CONSOLE_LINES; + SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), console_info.dwSize); + } - FILE * fp; + FILE *fp; // Redirect stdout. fp = freopen("CONOUT$", "w", stdout); if (L && fp == NULL) - luaL_error(L, "Console redirection of stdout failed."); + return luaL_error(L, "Console redirection of stdout failed."); // Redirect stdin. fp = freopen("CONIN$", "r", stdin); if (L && fp == NULL) - luaL_error(L, "Console redirection of stdin failed."); + return luaL_error(L, "Console redirection of stdin failed."); // Redirect stderr. fp = freopen("CONOUT$", "w", stderr); if (L && fp == NULL) - luaL_error(L, "Console redirection of stderr failed."); + return luaL_error(L, "Console redirection of stderr failed."); - return 0; + love::luax_pushboolean(L, is_open); + return 1; } #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK From 600a369d77ce74dd7f5cd8611d40042d727dd62c Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 13 Feb 2015 15:18:52 +0100 Subject: [PATCH 2/7] Allow calling newRasterizer without arguments from newFont again Fixes regression introduced by commit 9b0752574f26, the default value for the 1-argument newFont could not be called. Thanks to josefnpat for reporting. --- src/modules/graphics/opengl/wrap_Graphics.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index a4b5615e6..63db95d31 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -249,8 +249,11 @@ int w_newFont(lua_State *L) // Convert to Rasterizer, if necessary. Note that lua_isstring returns true // if the value is a number, which we rely on for the variant that uses the // default Font rather than a font file. - if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T)) + if (lua_isnoneornil(L, 1) || lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T)) { + if (lua_isnone(L, 1)) + lua_pushnil(L); + std::vector idxs; for (int i = 0; i < lua_gettop(L); i++) idxs.push_back(i + 1); From 5e088aa183edec9422273d032699fced15976d70 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 14 Feb 2015 00:43:28 -0400 Subject: [PATCH 3/7] Updated changelog --- changes.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changes.txt b/changes.txt index 19248b845..4ae218631 100644 --- a/changes.txt +++ b/changes.txt @@ -34,6 +34,7 @@ LOVE 0.9.2 [Baby Inspector] * Added love.window.toPixels and love.window.fromPixels. * Added love.window.setPosition and love.window.getPosition, and 'x' and 'y' fields to love.window.setMode and t.window in love.conf. * Added love.filesystem.isSymlink, love.filesystem.setSymlinksEnabled, and love.filesystem.areSymlinksEnabled. + * Added love.filesystem.getRealDirectory. * Deprecated SpriteBatch:bind and SpriteBatch:unbind. * Deprecated all uses of the name 'FSAA' in favor of 'MSAA'. @@ -73,6 +74,7 @@ LOVE 0.9.2 [Baby Inspector] * Updated the Windows executable to automatically prefer the higher performance GPU on nvidia Optimus systems. * Updated the --console command-line argument in Windows to open the console before conf.lua is loaded. + * Updated t.console and the --console command-line argument in Windows to use the existing Console window, if love was launched from one. * Updated the love executable to verify that the love library's version matches. * Updated the Lua wrapper code for modules to avoid crashes when the module's instance is created, deleted, and recreated. * Updated internal code for handling garbage collection of love objects to be more efficient. From 902a7cb68bbe6c5506c3c14f61669d3364ac811e Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 14 Feb 2015 20:19:47 +0100 Subject: [PATCH 4/7] Update debian package files to the 0.9.2~rc1 version --- platform/unix/debian/changelog.in | 2 +- platform/unix/debian/control.in | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/unix/debian/changelog.in b/platform/unix/debian/changelog.in index 4901a576a..158bc6aab 100644 --- a/platform/unix/debian/changelog.in +++ b/platform/unix/debian/changelog.in @@ -1,4 +1,4 @@ -love@LOVE_SUFFIX@ (0.9.0~ppatest5) precise; urgency=medium +love@LOVE_SUFFIX@ (0.9.2~rc1ppa3) precise; urgency=medium * Upstream testing release diff --git a/platform/unix/debian/control.in b/platform/unix/debian/control.in index 52a48b5ee..541ea680f 100644 --- a/platform/unix/debian/control.in +++ b/platform/unix/debian/control.in @@ -4,6 +4,9 @@ Priority: extra Maintainer: Bart van Strien Build-Depends: debhelper (>= 9), autotools-dev, + autoconf, + automake, + libtool, pkg-config, libdevil-dev, libfreetype6-dev, @@ -16,9 +19,8 @@ Build-Depends: debhelper (>= 9), libflac-dev, libflac++-dev, libmodplug-dev, - libmpg123-dev, - libmng-dev -Standards-Version: 3.9.3 + libmpg123-dev +Standards-Version: 3.9.5 Homepage: http://love2d.org Package: liblove@LOVE_SUFFIX@ @@ -28,7 +30,6 @@ Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${shlibs:Depends}, libdevil1c2, - libmng1, libfreetype6, libgl1-mesa-glx, libluajit-5.1-2, From 39db975cb55b01818daa3cb6066c9c562bb1eac9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 14 Feb 2015 16:11:45 -0400 Subject: [PATCH 5/7] Added release date for 0.9.2 --- changes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes.txt b/changes.txt index 4ae218631..71e796f05 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,7 @@ LOVE 0.9.2 [Baby Inspector] --------------------------- - Released: N/A + Released: 2015-02-14 * Added Lua 5.3's UTF-8 module (via utf8 = require("utf8")). * Added Shader:getExternVariable. From 84294ac68406d51d7ad981a5def12e3dc48207d9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 14 Feb 2015 16:12:18 -0400 Subject: [PATCH 6/7] Added tag 0.9.2 for changeset a5e405cdf14d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e12439c6a..1df67720a 100644 --- a/.hgtags +++ b/.hgtags @@ -7,3 +7,4 @@ bcca82b60d0f5cd724edbe4ed65db18ab95d4691 0.7.2 e0f98d53debb62347c6433ca0534a0f77f15f76f 0.8.0 38c00c788bcb03bda2ad40efebcdfe7a6be85b4a 0.9.0 8b113c345e97e7bb7e963e5d67451abdfb05cfde 0.9.1 +a5e405cdf14d030b71d09a105086797942ae91a9 0.9.2 From ed4c3641716f08173ee512abccc2e51f95bdecb8 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 14 Feb 2015 17:54:25 -0400 Subject: [PATCH 7/7] Fixed a potential crash when an invalid Scancode constant argument is used in love.keyboard.getKeyFromScancode. --- src/modules/keyboard/wrap_Keyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/keyboard/wrap_Keyboard.cpp b/src/modules/keyboard/wrap_Keyboard.cpp index cc5e26716..a2eb77eb9 100644 --- a/src/modules/keyboard/wrap_Keyboard.cpp +++ b/src/modules/keyboard/wrap_Keyboard.cpp @@ -84,7 +84,7 @@ int w_getKeyFromScancode(lua_State *L) const char *scancodestr = luaL_checkstring(L, 1); Keyboard::Scancode scancode; if (!Keyboard::getConstant(scancodestr, scancode)) - return luaL_error(L, "Invalid scancode: %s", scancode); + return luaL_error(L, "Invalid scancode: %s", scancodestr); Keyboard::Key key = instance()->getKeyFromScancode(scancode);