From 2a09774a5464bd71534d2151f9e4851f1372da86 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 2 Feb 2015 15:26:13 -0400 Subject: [PATCH 1/5] Fixed love.graphics.newFont. --- src/modules/graphics/opengl/wrap_Graphics.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 76d3cfaf8..a4b5615e6 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -251,8 +251,11 @@ int w_newFont(lua_State *L) // 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)) { - int idxs[] = {1, 2}; - luax_convobj(L, idxs, 2, "font", "newRasterizer"); + std::vector idxs; + for (int i = 0; i < lua_gettop(L); i++) + idxs.push_back(i + 1); + + luax_convobj(L, &idxs[0], (int) idxs.size(), "font", "newRasterizer"); } love::font::Rasterizer *rasterizer = luax_checktype(L, 1, "Rasterizer", FONT_RASTERIZER_T); From a84367ef38cd76010faf5f61922be846887e2da9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 2 Feb 2015 16:29:58 -0400 Subject: [PATCH 2/5] Prefer the higher performance GPU on Windows systems that use nvidia optimus (resolves issue #984.) --- src/love.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/love.cpp b/src/love.cpp index 64e3fed72..3543136d6 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -39,6 +39,17 @@ extern "C" { #include "OSX.h" #endif // LOVE_MACOSX +#ifdef LOVE_WINDOWS +extern "C" +{ +// Prefer the higher performance GPU on Windows systems that use nvidia Optimus. +// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf +// TODO: Re-evaluate in the future when the average integrated GPU in Optimus +// systems is less mediocre? +LOVE_EXPORT DWORD NvOptimusEnablement = 0x00000001; +} +#endif + #ifdef LOVE_LEGENDARY_UTF8_ARGV_HACK void get_utf8_arguments(int &argc, char **&argv) From 685c77acd97064ab7f7f4d6ce572d426a404af01 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 2 Feb 2015 17:28:11 -0400 Subject: [PATCH 3/5] Fixed the Windows CMake build. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9687928a4..a5de3f68d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1163,8 +1163,8 @@ if(MEGA_EXTRA_DEPENDECIES) endif() if(MSVC) - set_target_properties(${LOVE_LIB_NAME} PROPERTIES RELEASE_OUTPUT_NAME "love" PDB_NAME "liblove") - set_target_properties(${LOVE_LIB_NAME} PROPERTIES DEBUG_OUTPUT_NAME "love" PDB_NAME "liblove") + set_target_properties(${LOVE_LIB_NAME} PROPERTIES RELEASE_OUTPUT_NAME "love" PDB_NAME "liblove" IMPORT_PREFIX "lib") + set_target_properties(${LOVE_LIB_NAME} PROPERTIES DEBUG_OUTPUT_NAME "love" PDB_NAME "liblove" IMPORT_PREFIX "lib") endif() # From 70ea0e1f3fd5520a3423c0bdc5735b33c12d7d1a Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 3 Feb 2015 03:18:22 -0400 Subject: [PATCH 4/5] Updated changelog. --- changes.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/changes.txt b/changes.txt index a280526be..19248b845 100644 --- a/changes.txt +++ b/changes.txt @@ -3,6 +3,7 @@ LOVE 0.9.2 [Baby Inspector] Released: N/A + * Added Lua 5.3's UTF-8 module (via utf8 = require("utf8")). * Added Shader:getExternVariable. * Added several new canvas texture formats. * Added love.graphics.getCanvasFormats. @@ -12,6 +13,7 @@ LOVE 0.9.2 [Baby Inspector] * Added SpriteBatch:flush. * Added love.graphics.getStats. * Added "mirroredrepeat" wrap mode. + * Added love.audio.setDopplerScale and love.audio.getDopplerScale. * Added optional duration argument to Joystick:setVibration. * Added love.joystick.loadGamepadMappings and love.joystick.saveGamepadMappings. * Added Joint:setUserData and Joint:getUserData. @@ -20,8 +22,13 @@ LOVE 0.9.2 [Baby Inspector] * Added Contact:getFixtures and Body:getContactList. * Added Body:getWorld. * Added Body:getJointList. + * Added Body/Contact/Fixture/Joint/World:isDestroyed. + * Added love.mousemoved event callback. + * Added love.mouse.setRelativeMode and love.mouse.getRelativeMode. + * Added Scancode enums, love.keyboard.getKeyFromScancode, and love.keyboard.getScancodeFromKey. * Added love.window.getDisplayName. * Added love.window.minimize. + * Added love.window.maximize. * Added love.window.showMessageBox. * Added 'refreshrate' field to the table returned by love.window.getMode. * Added love.window.toPixels and love.window.fromPixels. @@ -33,11 +40,16 @@ LOVE 0.9.2 [Baby Inspector] * Deprecated the 'hdrcanvas' graphics feature enum in favor of getCanvasFormats. * Deprecated the 'dxt' and 'bc5' graphics feature enums in favor of getCompressedImageFormats. + * Fixed crashes when love objects are used in multiple threads. * Fixed love.filesystem.setIdentity breaking in some situations when called multiple times. * Fixed the default love.filesystem identity when in Fused mode in Windows. * Fixed love.system.openURL sometimes blocking indefinitely on Linux. * Fixed love.joystick.setGamepadMapping. * Fixed the order of vertices in ChainShapes. + * Fixed love.mouse.getPosition returning outdated values if love.mouse.setPosition is used in the same frame. + * Fixed love.graphics.newFont to error when given an invalid size argument. + * Fixed the filename and backtrace given when love.graphics.print errors. + * Fixed a small memory leak if love.graphics.newCanvas errors. * Fixed shader:getWarnings returning unnecessary information. * Fixed some cases of noncompliant shader code not properly erroring on some nvidia drivers. * Fixed a potential crash when Shader objects are garbage collected. @@ -59,6 +71,9 @@ LOVE 0.9.2 [Baby Inspector] * Renamed all cases of FSAA to MSAA. The FSAA names still exist for backward-compatibility. + * 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 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. * Updated love's initialization code to trigger a Lua error if love.conf has an error in it. From 320ec8b4726ab689342fe8d1fcc9025270626cc5 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 9 Feb 2015 17:43:59 -0400 Subject: [PATCH 5/5] Added love.filesystem.getRealDirectory(filepath). It returns the platform-specific full path of the directory containing the filepath (rather than the file.) For example, if 'saves/save1.txt' exists in the save directory, love.filesystem.getRealDirectory("saves/save1.txt") will equal love.filesystem.getSaveDirectory(). --- src/modules/filesystem/wrap_Filesystem.cpp | 19 +++++++++++++++++++ src/modules/filesystem/wrap_Filesystem.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 59af698cd..29138e610 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -277,6 +277,24 @@ int w_getSourceBaseDirectory(lua_State *L) return 1; } +int w_getRealDirectory(lua_State *L) +{ + const char *filename = luaL_checkstring(L, 1); + std::string dir; + + try + { + dir = instance()->getRealDirectory(filename); + } + catch (love::Exception &e) + { + return luax_ioError(L, "%s", e.what()); + } + + lua_pushstring(L, dir.c_str()); + return 1; +} + int w_exists(lua_State *L) { const char *arg = luaL_checkstring(L, 1); @@ -658,6 +676,7 @@ static const luaL_Reg functions[] = { "getAppdataDirectory", w_getAppdataDirectory }, { "getSaveDirectory", w_getSaveDirectory }, { "getSourceBaseDirectory", w_getSourceBaseDirectory }, + { "getRealDirectory", w_getRealDirectory }, { "exists", w_exists }, { "isDirectory", w_isDirectory }, { "isFile", w_isFile }, diff --git a/src/modules/filesystem/wrap_Filesystem.h b/src/modules/filesystem/wrap_Filesystem.h index 4c6f3953e..01c952523 100644 --- a/src/modules/filesystem/wrap_Filesystem.h +++ b/src/modules/filesystem/wrap_Filesystem.h @@ -56,6 +56,7 @@ int w_getUserDirectory(lua_State *L); int w_getAppdataDirectory(lua_State *L); int w_getSaveDirectory(lua_State *L); int w_getSourceBaseDirectory(lua_State *L); +int w_getRealDirectory(lua_State *L); int w_exists(lua_State *L); int w_isDirectory(lua_State *L); int w_isFile(lua_State *L);