Browse Source

Merge default into minor

--HG--
branch : minor
Alex Szpakowski 9 years ago
parent
commit
31b44797bc

+ 8 - 0
changes.txt

@@ -22,15 +22,23 @@ LOVE 0.10.2 [Super Toast]
 Released: N/A
 
   * Added lovec.exe in Windows. It is the same as love.exe but built with the Console subsystem, so it always uses or provides a console.
+  * Added 'shaderswitches' field to the table returned by love.graphics.getStats.
+  * Added Quad:getTextureDimensions.
 
+  * Fixed love on iOS 6.
   * Fixed os.execute always returning -1 on Linux.
+  * Fixed a hang at the end of video playback with some video files.
   * Fixed the video decoding thread to not do any work when there are no videos to decode.
+  * Fixed a rare bug in Source:play for streaming Sources if the associated OpenAL source object was previously used for a static Source.
+  * Fixed corrupted Font glyphs in rare cases.
   * Fixed stencils inside Canvases on some OpenGL ES 2 devices.
   * Fixed love.window.setMode crashing when called with a Canvas active.
   * Fixed gamma correction of ImageFonts and BMFonts with colored images.
   * Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES.
 
   * Improved performance of Channel methods by roughly 2x in many cases.
+  
+  * Updated love.filesystem.mount to accept a DroppedFile as the first parameter.
 
 
 LOVE 0.10.1 [Super Toast]

+ 1 - 1
extra/appveyor/appveyor.yml

@@ -11,7 +11,7 @@ init:
 
 install:
 # We need to install NSIS to create the packaged installer executable.
-- choco install nsis -pre -y
+- choco install nsis -y
 
 # Move all woking directory items except `appveyor.yml` to `love` subdirectory.
 - md love

+ 7 - 1
platform/xcode/love.xcodeproj/project.pbxproj

@@ -17,7 +17,7 @@
 		A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9D307E9106635C3004FEDF8 /* physfs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F169A6109E824900FC83D1 /* mpg123.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
-		FA0797991BF480A200034B7C /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0797981BF480A200034B7C /* GameController.framework */; };
+		FA0797991BF480A200034B7C /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0797981BF480A200034B7C /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
 		FA08F69616C766E000F007B5 /* love.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
 		FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FA0B7F301A95AC7D000E1D17 /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; };
@@ -604,6 +604,7 @@
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
 				ENABLE_BITCODE = NO;
@@ -631,6 +632,7 @@
 				MTL_ENABLE_DEBUG_INFO = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love;
 				PRODUCT_NAME = love;
+				PROVISIONING_PROFILE = "";
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 			};
@@ -650,6 +652,7 @@
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
 				ENABLE_BITCODE = NO;
@@ -672,6 +675,7 @@
 				MTL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love;
 				PRODUCT_NAME = love;
+				PROVISIONING_PROFILE = "";
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = YES;
@@ -692,6 +696,7 @@
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
 				ENABLE_BITCODE = NO;
@@ -714,6 +719,7 @@
 				MTL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = org.love2d.love;
 				PRODUCT_NAME = love;
+				PROVISIONING_PROFILE = "";
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = YES;

+ 13 - 2
src/common/config.h

@@ -24,12 +24,21 @@
 // Platform stuff.
 #if defined(WIN32) || defined(_WIN32)
 #	define LOVE_WINDOWS 1
+	// If _USING_V110_SDK71_ is defined it means we are using the xp toolset.
+#	if defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_
+#	include <winapifamily.h>
+#		if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#			define LOVE_WINDOWS_UWP 1
+#			define LOVE_NO_MODPLUG 1
+#			define LOVE_NOMPG123 1
+#		endif
+#	endif
 #endif
 #if defined(linux) || defined(__linux) || defined(__linux__)
-# define LOVE_LINUX 1
+#	define LOVE_LINUX 1
 #endif
 #if defined(__ANDROID__)
-#  define LOVE_ANDROID 1
+#	define LOVE_ANDROID 1
 #endif
 #if defined(__APPLE__)
 #	include <TargetConditionals.h>
@@ -76,7 +85,9 @@
 #endif
 
 #if defined(LOVE_WINDOWS)
+#ifndef LOVE_WINDOWS_UWP
 #	define LOVE_LEGENDARY_CONSOLE_IO_HACK
+#endif // LOVE_WINDOWS_UWP
 #	define NOMINMAX
 #endif
 

+ 24 - 24
src/love.cpp

@@ -174,6 +174,21 @@ static int l_print_sdl_log(lua_State *L)
 
 static int runlove(int argc, char **argv)
 {
+#ifdef LOVE_LEGENDARY_APP_ARGV_HACK
+	int hack_argc = 0;
+	char **hack_argv = 0;
+	get_app_arguments(argc, argv, hack_argc, hack_argv);
+	argc = hack_argc;
+	argv = hack_argv;
+#endif // LOVE_LEGENDARY_APP_ARGV_HACK
+
+	// Oh, you just want the version? Okay!
+	if (argc > 1 && strcmp(argv[1], "--version") == 0)
+	{
+		printf("LOVE %s (%s)\n", love_version(), love_codename());
+		return 0;
+	}
+
 	// Create the virtual machine.
 	lua_State *L = luaL_newstate();
 	luaL_openlibs(L);
@@ -238,6 +253,15 @@ static int runlove(int argc, char **argv)
 
 	lua_close(L);
 
+#if defined(LOVE_LEGENDARY_APP_ARGV_HACK) && !defined(LOVE_IOS)
+	if (hack_argv)
+	{
+		for (int i = 0; i<hack_argc; ++i)
+			delete [] hack_argv[i];
+		delete [] hack_argv;
+	}
+#endif // LOVE_LEGENDARY_APP_ARGV_HACK
+
 	return retval;
 }
 
@@ -245,14 +269,6 @@ int main(int argc, char **argv)
 {
 	int retval = 0;
 
-#ifdef LOVE_LEGENDARY_APP_ARGV_HACK
-	int hack_argc = 0;
-	char **hack_argv = 0;
-	get_app_arguments(argc, argv, hack_argc, hack_argv);
-	argc = hack_argc;
-	argv = hack_argv;
-#endif // LOVE_LEGENDARY_APP_ARGV_HACK
-
 	if (strcmp(LOVE_VERSION_STRING, love_version()) != 0)
 	{
 		printf("Version mismatch detected!\nLOVE binary is version %s\n"
@@ -260,13 +276,6 @@ int main(int argc, char **argv)
 		return 1;
 	}
 
-	// Oh, you just want the version? Okay!
-	if (argc > 1 && strcmp(argv[1], "--version") == 0)
-	{
-		printf("LOVE %s (%s)\n", love_version(), love_codename());
-		return 0;
-	}
-
 #ifdef LOVE_IOS
 	// on iOS we should never programmatically exit the app, so we'll just
 	// "restart" when that is attempted. Games which use threads might cause
@@ -277,15 +286,6 @@ int main(int argc, char **argv)
 		retval = runlove(argc, argv);
 	}
 
-#if defined(LOVE_LEGENDARY_APP_ARGV_HACK) && !defined(LOVE_IOS)
-	if (hack_argv)
-	{
-		for (int i = 0; i<hack_argc; ++i)
-			delete [] hack_argv[i];
-		delete [] hack_argv;
-	}
-#endif // LOVE_LEGENDARY_APP_ARGV_HACK
-
 #ifdef LOVE_ANDROID
 	SDL_Quit();
 #endif

+ 3 - 1
src/modules/filesystem/physfs/Filesystem.cpp

@@ -496,7 +496,9 @@ std::string Filesystem::getAppdataDirectory()
 {
 	if (appdata.empty())
 	{
-#ifdef LOVE_WINDOWS
+#ifdef LOVE_WINDOWS_UWP
+		appdata = getUserDirectory();
+#elif defined(LOVE_WINDOWS)
 		wchar_t *w_appdata = _wgetenv(L"APPDATA");
 		appdata = to_utf8(w_appdata);
 		replace_char(appdata, '\\', '/');

+ 1 - 1
src/modules/filesystem/physfs/Filesystem.h

@@ -62,7 +62,7 @@ public:
 	bool mount(const char *archive, const char *mountpoint, bool appendToPath = false);
 	bool unmount(const char *archive);
 
-	File *newFile(const char *filename) const;
+	love::filesystem::File *newFile(const char *filename) const;
 
 	const char *getWorkingDirectory();
 	std::string getUserDirectory();

+ 10 - 0
src/modules/graphics/Quad.cpp

@@ -79,6 +79,16 @@ Quad::Viewport Quad::getViewport() const
 	return viewport;
 }
 
+double Quad::getTextureWidth() const
+{
+	return sw;
+}
+
+double Quad::getTextureHeight() const
+{
+	return sh;
+}
+
 const Vertex *Quad::getVertices() const
 {
 	return vertices;

+ 3 - 0
src/modules/graphics/Quad.h

@@ -47,6 +47,9 @@ public:
 	void setViewport(const Viewport &v);
 	Viewport getViewport() const;
 
+	double getTextureWidth() const;
+	double getTextureHeight() const;
+
 	const Vertex *getVertices() const;
 
 private:

+ 9 - 18
src/modules/graphics/opengl/Font.cpp

@@ -252,7 +252,7 @@ love::font::GlyphData *Font::getRasterizerGlyphData(uint32 glyph)
 
 const Font::Glyph &Font::addGlyph(uint32 glyph)
 {
-	love::font::GlyphData *gd = getRasterizerGlyphData(glyph);
+	StrongRef<love::font::GlyphData> gd(getRasterizerGlyphData(glyph), Acquire::NORETAIN);
 
 	int w = gd->getWidth();
 	int h = gd->getHeight();
@@ -264,18 +264,15 @@ const Font::Glyph &Font::addGlyph(uint32 glyph)
 		textureY += rowHeight;
 		rowHeight = TEXTURE_PADDING;
 	}
+
 	if (textureY + h + TEXTURE_PADDING > textureHeight)
 	{
 		// totally out of space - new texture!
-		try
-		{
-			createTexture();
-		}
-		catch (love::Exception &)
-		{
-			gd->release();
-			throw;
-		}
+		createTexture();
+
+		// Makes sure the above code for checking if the glyph can fit at
+		// the current position in the texture is run again for this glyph.
+		return addGlyph(glyph);
 	}
 
 	Glyph g;
@@ -318,18 +315,12 @@ const Font::Glyph &Font::addGlyph(uint32 glyph)
 			g.vertices[i].x += gd->getBearingX();
 			g.vertices[i].y -= gd->getBearingY();
 		}
-	}
-
-	if (w > 0)
-		textureX += (w + TEXTURE_PADDING);
 
-	if (h > 0)
+		textureX += w + TEXTURE_PADDING;
 		rowHeight = std::max(rowHeight, h + TEXTURE_PADDING);
-
-	gd->release();
+	}
 
 	const auto p = glyphs.insert(std::make_pair(glyph, g));
-
 	return p.first->second;
 }
 

+ 11 - 0
src/modules/graphics/wrap_Quad.cpp

@@ -64,10 +64,21 @@ int w_Quad_getViewport(lua_State *L)
 	return 4;
 }
 
+int w_Quad_getTextureDimensions(lua_State *L)
+{
+	Quad *quad = luax_checkquad(L, 1);
+	double sw = quad->getTextureWidth();
+	double sh = quad->getTextureHeight();
+	lua_pushnumber(L, sw);
+	lua_pushnumber(L, sh);
+	return 2;
+}
+
 static const luaL_Reg w_Quad_functions[] =
 {
 	{ "setViewport", w_Quad_setViewport },
 	{ "getViewport", w_Quad_getViewport },
+	{ "getTextureDimensions", w_Quad_getTextureDimensions },
 	{ 0, 0 }
 };
 

+ 3 - 1
src/modules/love/love.cpp

@@ -307,7 +307,9 @@ int luaopen_love(lua_State *L)
 	lua_pushcfunction(L, w_love_isVersionCompatible);
 	lua_setfield(L, -2, "isVersionCompatible");
 
-#ifdef LOVE_WINDOWS
+#ifdef LOVE_WINDOWS_UWP
+	lua_pushstring(L, "UWP");
+#elif LOVE_WINDOWS
 	lua_pushstring(L, "Windows");
 #elif defined(LOVE_MACOSX)
 	lua_pushstring(L, "OS X");

+ 4 - 0
src/modules/sound/lullaby/Mpg123Decoder.cpp

@@ -24,6 +24,8 @@
 
 #include <iostream>
 
+#ifndef LOVE_NOMPG123
+
 namespace love
 {
 namespace sound
@@ -286,3 +288,5 @@ double Mpg123Decoder::getDuration()
 } // lullaby
 } // sound
 } // love
+
+#endif // LOVE_NOMPG123

+ 4 - 0
src/modules/sound/lullaby/Mpg123Decoder.h

@@ -25,6 +25,8 @@
 #include "common/Data.h"
 #include "Decoder.h"
 
+#ifndef LOVE_NOMPG123
+
 // libmpg123
 #ifdef LOVE_APPLE_USE_FRAMEWORKS
 #include <mpg123/mpg123.h>
@@ -88,4 +90,6 @@ private:
 } // sound
 } // love
 
+#endif // LOVE_NOMPG123
+
 #endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H

+ 20 - 6
src/modules/system/System.cpp

@@ -83,6 +83,8 @@ std::string System::getOS() const
 	return "OS X";
 #elif defined(LOVE_IOS)
 	return "iOS";
+#elif defined(LOVE_WINDOWS_UWP)
+	return "UWP";
 #elif defined(LOVE_WINDOWS)
 	return "Windows";
 #elif defined(LOVE_ANDROID)
@@ -147,12 +149,24 @@ bool System::openURL(const std::string &url) const
 	// Unicode-aware WinAPI functions don't accept UTF-8, so we need to convert.
 	std::wstring wurl = to_widestr(url);
 
-	HINSTANCE result = ShellExecuteW(nullptr,
-	                                 L"open",
-	                                 wurl.c_str(),
-	                                 nullptr,
-	                                 nullptr,
-	                                 SW_SHOW);
+	HINSTANCE result = 0;
+
+#if defined(LOVE_WINDOWS_UWP)
+	
+	Platform::String^ urlString = ref new Platform::String(wurl.c_str());
+	auto uwpUri = ref new Windows::Foundation::Uri(urlString);
+	Windows::System::Launcher::LaunchUriAsync(uwpUri);
+
+#else
+
+	result = ShellExecuteW(nullptr,
+		L"open",
+		wurl.c_str(),
+		nullptr,
+		nullptr,
+		SW_SHOW);
+
+#endif
 
 	return (int) result > 32;
 

+ 9 - 2
src/modules/window/sdl/Window.cpp

@@ -229,7 +229,14 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
 	};
 
 	// OpenGL ES 3+ contexts are only properly supported in SDL 2.0.4+.
-	if (hasSDL203orEarlier)
+	bool removeES3 = hasSDL203orEarlier;
+
+	// While UWP SDL is above 2.0.4, it still doesn't support OpenGL ES 3+
+#ifdef LOVE_WINDOWS_UWP
+	removeES3 = true;
+#endif
+	
+	if (removeES3)
 	{
 		auto it = attribslist.begin();
 		while (it != attribslist.end())
@@ -1019,7 +1026,7 @@ int Window::showMessageBox(const MessageBoxData &data)
 
 void Window::requestAttention(bool continuous)
 {
-#if defined(LOVE_WINDOWS)
+#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP)
 
 	if (hasFocus())
 		return;