Added initial support for MFi game controllers on iOS.
authorAlex Szpakowski <slime73@gmail.com>
Sun, 20 Sep 2015 23:08:36 -0300
changeset 98761496e502e51d
parent 9875 620024536f80
child 9877 e6fa7403893b
Added initial support for MFi game controllers on iOS.
WhatsNew.txt
Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj
Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
configure
include/SDL_config.h.cmake
include/SDL_config_iphoneos.h
premake/README-ios.txt
premake/Xcode-iOS/Demos/happy/happy.xcodeproj/project.pbxproj
premake/projects/SDL2.lua
src/joystick/SDL_gamecontrollerdb.h
src/joystick/SDL_joystick.c
src/joystick/iphoneos/SDL_sysjoystick.m
src/joystick/iphoneos/SDL_sysjoystick_c.h
test/testgamecontroller.c
test/testjoystick.c
     1.1 --- a/WhatsNew.txt	Fri Sep 18 16:22:23 2015 -0400
     1.2 +++ b/WhatsNew.txt	Sun Sep 20 23:08:36 2015 -0300
     1.3 @@ -67,6 +67,7 @@
     1.4  
     1.5  iOS:
     1.6  * Added support for iOS 8
     1.7 +* Added support for MFi game controllers
     1.8  * Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK
     1.9  * Added sRGB OpenGL ES context support on iOS 7+
    1.10  * Added native resolution support for the iPhone 6 Plus
     2.1 --- a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj	Fri Sep 18 16:22:23 2015 -0400
     2.2 +++ b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj	Sun Sep 20 23:08:36 2015 -0300
     2.3 @@ -17,6 +17,13 @@
     2.4  		FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
     2.5  		FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
     2.6  		FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
     2.7 +		FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
     2.8 +		FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
     2.9 +		FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
    2.10 +		FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
    2.11 +		FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
    2.12 +		FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
    2.13 +		FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
    2.14  		FD15FD690E086911003BDF25 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
    2.15  		FD15FD6A0E086911003BDF25 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
    2.16  		FD15FD6B0E086911003BDF25 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
    2.17 @@ -177,6 +184,7 @@
    2.18  		1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
    2.19  		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
    2.20  		FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
    2.21 +		FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
    2.22  		FD15FCB20E086866003BDF25 /* Happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
    2.23  		FD1B48920E313154007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; };
    2.24  		FD5F9BE40E0DEBEA008E885B /* Accel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Accel.app; sourceTree = BUILT_PRODUCTS_DIR; };
    2.25 @@ -217,6 +225,7 @@
    2.26  			buildActionMask = 2147483647;
    2.27  			files = (
    2.28  				FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */,
    2.29 +				FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */,
    2.30  				FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */,
    2.31  				FDF0D7AB0E12D53800247964 /* CoreAudio.framework in Frameworks */,
    2.32  				FDF0D7AC0E12D53800247964 /* AudioToolbox.framework in Frameworks */,
    2.33 @@ -233,6 +242,7 @@
    2.34  			buildActionMask = 2147483647;
    2.35  			files = (
    2.36  				FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */,
    2.37 +				FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */,
    2.38  				FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */,
    2.39  				FDF0D7A90E12D53500247964 /* CoreAudio.framework in Frameworks */,
    2.40  				FDF0D7AA0E12D53500247964 /* AudioToolbox.framework in Frameworks */,
    2.41 @@ -249,6 +259,7 @@
    2.42  			buildActionMask = 2147483647;
    2.43  			files = (
    2.44  				FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */,
    2.45 +				FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */,
    2.46  				FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */,
    2.47  				FDF0D7A70E12D53200247964 /* CoreAudio.framework in Frameworks */,
    2.48  				FDF0D7A80E12D53200247964 /* AudioToolbox.framework in Frameworks */,
    2.49 @@ -265,6 +276,7 @@
    2.50  			buildActionMask = 2147483647;
    2.51  			files = (
    2.52  				FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */,
    2.53 +				FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */,
    2.54  				FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */,
    2.55  				FDB652020E43D1F300F688B5 /* Foundation.framework in Frameworks */,
    2.56  				FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */,
    2.57 @@ -281,6 +293,7 @@
    2.58  			buildActionMask = 2147483647;
    2.59  			files = (
    2.60  				FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */,
    2.61 +				FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */,
    2.62  				FA8B4BA61967072100F8EB7C /* CoreMotion.framework in Frameworks */,
    2.63  				FDF0D7950E12D52900247964 /* CoreAudio.framework in Frameworks */,
    2.64  				FDF0D7960E12D52900247964 /* AudioToolbox.framework in Frameworks */,
    2.65 @@ -297,6 +310,7 @@
    2.66  			buildActionMask = 2147483647;
    2.67  			files = (
    2.68  				FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */,
    2.69 +				FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */,
    2.70  				FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */,
    2.71  				FDC52ED40E2843D6008D768C /* Foundation.framework in Frameworks */,
    2.72  				FDC52ED50E2843D6008D768C /* UIKit.framework in Frameworks */,
    2.73 @@ -313,6 +327,7 @@
    2.74  			buildActionMask = 2147483647;
    2.75  			files = (
    2.76  				FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */,
    2.77 +				FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */,
    2.78  				FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */,
    2.79  				FDF0D69C0E12D05400247964 /* Foundation.framework in Frameworks */,
    2.80  				FDF0D69D0E12D05400247964 /* UIKit.framework in Frameworks */,
    2.81 @@ -367,6 +382,7 @@
    2.82  		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
    2.83  			isa = PBXGroup;
    2.84  			children = (
    2.85 +				FAE0E9691BAF96A00098DFA4 /* GameController.framework */,
    2.86  				FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */,
    2.87  				FDF0D7220E12D31800247964 /* AudioToolbox.framework */,
    2.88  				FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */,
     3.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Fri Sep 18 16:22:23 2015 -0400
     3.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Sep 20 23:08:36 2015 -0300
     3.3 @@ -143,6 +143,7 @@
     3.4  		AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; };
     3.5  		AABCC3951640643D00AB8930 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; };
     3.6  		AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; };
     3.7 +		FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; settings = {ASSET_TAGS = (); }; };
     3.8  		FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; };
     3.9  		FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; };
    3.10  		FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; };
    3.11 @@ -339,6 +340,7 @@
    3.12  		AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmessagebox.h; sourceTree = "<group>"; };
    3.13  		AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmessagebox.m; sourceTree = "<group>"; };
    3.14  		AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = "<group>"; };
    3.15 +		FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = "<group>"; };
    3.16  		FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = "<group>"; };
    3.17  		FD3F4A700DEA620800C5B771 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = "<group>"; };
    3.18  		FD3F4A710DEA620800C5B771 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iconv.c; sourceTree = "<group>"; };
    3.19 @@ -634,6 +636,7 @@
    3.20  		FD689EFF0E26E5B600F90B21 /* iphoneos */ = {
    3.21  			isa = PBXGroup;
    3.22  			children = (
    3.23 +				FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */,
    3.24  				FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */,
    3.25  			);
    3.26  			path = iphoneos;
    3.27 @@ -1037,6 +1040,7 @@
    3.28  				AA7558BE1595D55500BBD41B /* SDL_scancode.h in Headers */,
    3.29  				AA7558BF1595D55500BBD41B /* SDL_shape.h in Headers */,
    3.30  				AA7558C01595D55500BBD41B /* SDL_stdinc.h in Headers */,
    3.31 +				FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */,
    3.32  				AA7558C11595D55500BBD41B /* SDL_surface.h in Headers */,
    3.33  				AA7558C21595D55500BBD41B /* SDL_system.h in Headers */,
    3.34  				AA7558C31595D55500BBD41B /* SDL_syswm.h in Headers */,
    3.35 @@ -1282,7 +1286,6 @@
    3.36  				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
    3.37  				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
    3.38  				GCC_WARN_UNDECLARED_SELECTOR = YES;
    3.39 -				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
    3.40  				PRODUCT_NAME = SDL2;
    3.41  				SKIP_INSTALL = YES;
    3.42  			};
    3.43 @@ -1298,7 +1301,6 @@
    3.44  				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
    3.45  				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
    3.46  				GCC_WARN_UNDECLARED_SELECTOR = YES;
    3.47 -				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
    3.48  				PRODUCT_NAME = SDL2;
    3.49  				SKIP_INSTALL = YES;
    3.50  			};
     4.1 --- a/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj	Fri Sep 18 16:22:23 2015 -0400
     4.2 +++ b/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj	Sun Sep 20 23:08:36 2015 -0300
     4.3 @@ -14,6 +14,7 @@
     4.4  		944A656F195747D90094A81E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 944A656E1957463F0094A81E /* libSDL2.a */; };
     4.5  		945C4F53195AF17F00DBBF61 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 945C4F52195AF17F00DBBF61 /* Default-568h@2x.png */; };
     4.6  		FA8B4B97196703B400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4B96196703B400F8EB7C /* CoreMotion.framework */; };
     4.7 +		FAE0E9651BAF967F0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9641BAF967F0098DFA4 /* GameController.framework */; };
     4.8  		FD779EDE0E26BA1200F39101 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD779EDD0E26BA1200F39101 /* CoreAudio.framework */; };
     4.9  		FD77A07D0E26BD8C00F39101 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD77A07C0E26BD8C00F39101 /* Icon.png */; };
    4.10  		FD77A07F0E26BDA900F39101 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD77A07E0E26BDA900F39101 /* Default.png */; };
    4.11 @@ -42,6 +43,7 @@
    4.12  		944A65681957463F0094A81E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../../SDL/SDL.xcodeproj; sourceTree = "<group>"; };
    4.13  		945C4F52195AF17F00DBBF61 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
    4.14  		FA8B4B96196703B400F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
    4.15 +		FAE0E9641BAF967F0098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
    4.16  		FD779EDD0E26BA1200F39101 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
    4.17  		FD77A07C0E26BD8C00F39101 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
    4.18  		FD77A07E0E26BDA900F39101 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
    4.19 @@ -56,6 +58,7 @@
    4.20  			buildActionMask = 2147483647;
    4.21  			files = (
    4.22  				944A656F195747D90094A81E /* libSDL2.a in Frameworks */,
    4.23 +				FAE0E9651BAF967F0098DFA4 /* GameController.framework in Frameworks */,
    4.24  				1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
    4.25  				1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
    4.26  				28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */,
    4.27 @@ -112,6 +115,7 @@
    4.28  		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
    4.29  			isa = PBXGroup;
    4.30  			children = (
    4.31 +				FAE0E9641BAF967F0098DFA4 /* GameController.framework */,
    4.32  				FA8B4B96196703B400F8EB7C /* CoreMotion.framework */,
    4.33  				FDB8BFC50E5A0F6A00980157 /* CoreGraphics.framework */,
    4.34  				FD77A0840E26BDB800F39101 /* AudioToolbox.framework */,
     5.1 --- a/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj	Fri Sep 18 16:22:23 2015 -0400
     5.2 +++ b/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj	Sun Sep 20 23:08:36 2015 -0300
     5.3 @@ -65,6 +65,30 @@
     5.4  		AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
     5.5  		AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
     5.6  		AAE7DFB514CBB5F700DF1A0E /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */; };
     5.7 +		FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; settings = {ASSET_TAGS = (); }; };
     5.8 +		FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
     5.9 +		FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.10 +		FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.11 +		FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.12 +		FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.13 +		FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.14 +		FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.15 +		FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.16 +		FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.17 +		FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.18 +		FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.19 +		FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.20 +		FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.21 +		FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.22 +		FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.23 +		FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.24 +		FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.25 +		FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.26 +		FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.27 +		FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.28 +		FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.29 +		FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.30 +		FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.31  		FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.32  		FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.33  		FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.34 @@ -88,6 +112,21 @@
    5.35  		FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.36  		FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.37  		FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.38 +		FAE0E9821BAF9B230098DFA4 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
    5.39 +		FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
    5.40 +		FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
    5.41 +		FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
    5.42 +		FAE0E9891BAF9B230098DFA4 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
    5.43 +		FAE0E98A1BAF9B230098DFA4 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
    5.44 +		FAE0E98B1BAF9B230098DFA4 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
    5.45 +		FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; };
    5.46 +		FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
    5.47 +		FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
    5.48 +		FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
    5.49 +		FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */; settings = {ASSET_TAGS = (); }; };
    5.50 +		FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */; settings = {ASSET_TAGS = (); }; };
    5.51 +		FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2291BAF4487000E07A6 /* button.bmp */; settings = {ASSET_TAGS = (); }; };
    5.52 +		FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2281BAF4487000E07A6 /* axis.bmp */; settings = {ASSET_TAGS = (); }; };
    5.53  		FDA8A79C0E2D0F9300EA573E /* testwm2.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A75F0E2D0F1600EA573E /* testwm2.c */; };
    5.54  		FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
    5.55  		FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
    5.56 @@ -188,7 +227,6 @@
    5.57  		FDD2C19F0E2E534F00B7A85F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
    5.58  		FDD2C1A00E2E534F00B7A85F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
    5.59  		FDD2C1A10E2E534F00B7A85F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
    5.60 -		FDD2C1A80E2E536400B7A85F /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; };
    5.61  		FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
    5.62  		FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
    5.63  		FDD2C4560E2E773800B7A85F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
    5.64 @@ -288,7 +326,13 @@
    5.65  		AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = "<group>"; };
    5.66  		AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; };
    5.67  		AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = "<group>"; };
    5.68 +		FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = "<group>"; };
    5.69 +		FA0EF2281BAF4487000E07A6 /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = "<group>"; };
    5.70 +		FA0EF2291BAF4487000E07A6 /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = "<group>"; };
    5.71 +		FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = "<group>"; };
    5.72 +		FA684F7A1BAF1A4400DCFD1A /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
    5.73  		FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
    5.74 +		FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; };
    5.75  		FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; };
    5.76  		FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; };
    5.77  		FDA8A7470E2D0F1600EA573E /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; };
    5.78 @@ -347,6 +391,7 @@
    5.79  			buildActionMask = 2147483647;
    5.80  			files = (
    5.81  				046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */,
    5.82 +				FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */,
    5.83  				FA8B4BD1196766C900F8EB7C /* CoreMotion.framework in Frameworks */,
    5.84  				046CEF7C13254F23007AD51D /* AudioToolbox.framework in Frameworks */,
    5.85  				046CEF7D13254F23007AD51D /* QuartzCore.framework in Frameworks */,
    5.86 @@ -364,6 +409,7 @@
    5.87  			files = (
    5.88  				AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */,
    5.89  				047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */,
    5.90 +				FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */,
    5.91  				FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */,
    5.92  				047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */,
    5.93  				047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */,
    5.94 @@ -381,6 +427,7 @@
    5.95  			files = (
    5.96  				AA1EE47817605BF60029C7A5 /* libSDL2test.a in Frameworks */,
    5.97  				FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */,
    5.98 +				FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */,
    5.99  				FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */,
   5.100  				FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */,
   5.101  				FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */,
   5.102 @@ -397,6 +444,7 @@
   5.103  			buildActionMask = 2147483647;
   5.104  			files = (
   5.105  				56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */,
   5.106 +				FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */,
   5.107  				FA8B4BD8196766DD00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.108  				56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */,
   5.109  				56ED0504118A8FE400A56AA6 /* QuartzCore.framework in Frameworks */,
   5.110 @@ -414,6 +462,7 @@
   5.111  			files = (
   5.112  				AA1EE47617605B9E0029C7A5 /* libSDL2test.a in Frameworks */,
   5.113  				AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */,
   5.114 +				FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */,
   5.115  				FA8B4BDA196766E200F8EB7C /* CoreMotion.framework in Frameworks */,
   5.116  				AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */,
   5.117  				AAE7DEE314CBB1E100DF1A0E /* QuartzCore.framework in Frameworks */,
   5.118 @@ -431,6 +480,7 @@
   5.119  			files = (
   5.120  				AA1EE47517605B930029C7A5 /* libSDL2test.a in Frameworks */,
   5.121  				AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */,
   5.122 +				FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */,
   5.123  				FA8B4BD9196766E000F8EB7C /* CoreMotion.framework in Frameworks */,
   5.124  				AAE7DFA714CBB54E00DF1A0E /* AudioToolbox.framework in Frameworks */,
   5.125  				AAE7DFA814CBB54E00DF1A0E /* QuartzCore.framework in Frameworks */,
   5.126 @@ -442,11 +492,29 @@
   5.127  			);
   5.128  			runOnlyForDeploymentPostprocessing = 0;
   5.129  		};
   5.130 +		FAE0E9851BAF9B230098DFA4 /* Frameworks */ = {
   5.131 +			isa = PBXFrameworksBuildPhase;
   5.132 +			buildActionMask = 2147483647;
   5.133 +			files = (
   5.134 +				FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */,
   5.135 +				FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */,
   5.136 +				FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */,
   5.137 +				FAE0E9891BAF9B230098DFA4 /* AudioToolbox.framework in Frameworks */,
   5.138 +				FAE0E98A1BAF9B230098DFA4 /* QuartzCore.framework in Frameworks */,
   5.139 +				FAE0E98B1BAF9B230098DFA4 /* OpenGLES.framework in Frameworks */,
   5.140 +				FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */,
   5.141 +				FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */,
   5.142 +				FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */,
   5.143 +				FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */,
   5.144 +			);
   5.145 +			runOnlyForDeploymentPostprocessing = 0;
   5.146 +		};
   5.147  		FDA8AAAE0E2D330F00EA573E /* Frameworks */ = {
   5.148  			isa = PBXFrameworksBuildPhase;
   5.149  			buildActionMask = 2147483647;
   5.150  			files = (
   5.151  				FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */,
   5.152 +				FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */,
   5.153  				FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.154  				FDA8AAB10E2D330F00EA573E /* AudioToolbox.framework in Frameworks */,
   5.155  				FDA8AAB20E2D330F00EA573E /* QuartzCore.framework in Frameworks */,
   5.156 @@ -463,6 +531,7 @@
   5.157  			buildActionMask = 2147483647;
   5.158  			files = (
   5.159  				FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */,
   5.160 +				FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */,
   5.161  				FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.162  				FDAAC3C30E2D47E6001DB1D8 /* AudioToolbox.framework in Frameworks */,
   5.163  				FDAAC3C40E2D47E6001DB1D8 /* QuartzCore.framework in Frameworks */,
   5.164 @@ -479,6 +548,7 @@
   5.165  			buildActionMask = 2147483647;
   5.166  			files = (
   5.167  				FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */,
   5.168 +				FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */,
   5.169  				FA8B4BCF196766C400F8EB7C /* CoreMotion.framework in Frameworks */,
   5.170  				FDAAC5910E2D5429001DB1D8 /* AudioToolbox.framework in Frameworks */,
   5.171  				FDAAC5920E2D5429001DB1D8 /* QuartzCore.framework in Frameworks */,
   5.172 @@ -495,6 +565,7 @@
   5.173  			buildActionMask = 2147483647;
   5.174  			files = (
   5.175  				FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */,
   5.176 +				FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */,
   5.177  				FA8B4BD0196766C600F8EB7C /* CoreMotion.framework in Frameworks */,
   5.178  				FDAAC5BF0E2D55B5001DB1D8 /* AudioToolbox.framework in Frameworks */,
   5.179  				FDAAC5C00E2D55B5001DB1D8 /* QuartzCore.framework in Frameworks */,
   5.180 @@ -512,6 +583,7 @@
   5.181  			files = (
   5.182  				AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */,
   5.183  				FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */,
   5.184 +				FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */,
   5.185  				FA8B4BD2196766CB00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.186  				FDAAC61C0E2D5914001DB1D8 /* AudioToolbox.framework in Frameworks */,
   5.187  				FDAAC61D0E2D5914001DB1D8 /* QuartzCore.framework in Frameworks */,
   5.188 @@ -529,6 +601,7 @@
   5.189  			files = (
   5.190  				AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */,
   5.191  				FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */,
   5.192 +				FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */,
   5.193  				FA8B4BCE196766C100F8EB7C /* CoreMotion.framework in Frameworks */,
   5.194  				FDC42FF60F0D866D009C87E1 /* AudioToolbox.framework in Frameworks */,
   5.195  				FDC42FF70F0D866D009C87E1 /* QuartzCore.framework in Frameworks */,
   5.196 @@ -545,6 +618,7 @@
   5.197  			buildActionMask = 2147483647;
   5.198  			files = (
   5.199  				FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */,
   5.200 +				FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */,
   5.201  				FA8B4BDD196766EB00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.202  				FDD2C1000E2E4F4B00B7A85F /* AudioToolbox.framework in Frameworks */,
   5.203  				FDD2C1010E2E4F4B00B7A85F /* QuartzCore.framework in Frameworks */,
   5.204 @@ -561,6 +635,7 @@
   5.205  			buildActionMask = 2147483647;
   5.206  			files = (
   5.207  				FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */,
   5.208 +				FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */,
   5.209  				FA8B4BD3196766CE00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.210  				FDD2C1770E2E52C000B7A85F /* AudioToolbox.framework in Frameworks */,
   5.211  				FDD2C1780E2E52C000B7A85F /* QuartzCore.framework in Frameworks */,
   5.212 @@ -577,6 +652,7 @@
   5.213  			buildActionMask = 2147483647;
   5.214  			files = (
   5.215  				FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */,
   5.216 +				FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */,
   5.217  				FA8B4BD4196766D100F8EB7C /* CoreMotion.framework in Frameworks */,
   5.218  				FDD2C19B0E2E534F00B7A85F /* AudioToolbox.framework in Frameworks */,
   5.219  				FDD2C19C0E2E534F00B7A85F /* QuartzCore.framework in Frameworks */,
   5.220 @@ -593,6 +669,7 @@
   5.221  			buildActionMask = 2147483647;
   5.222  			files = (
   5.223  				FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */,
   5.224 +				FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */,
   5.225  				FA8B4BD5196766D400F8EB7C /* CoreMotion.framework in Frameworks */,
   5.226  				FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */,
   5.227  				FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */,
   5.228 @@ -609,6 +686,7 @@
   5.229  			buildActionMask = 2147483647;
   5.230  			files = (
   5.231  				FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */,
   5.232 +				FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */,
   5.233  				FA8B4BD6196766D700F8EB7C /* CoreMotion.framework in Frameworks */,
   5.234  				FDD2C4720E2E77D700B7A85F /* AudioToolbox.framework in Frameworks */,
   5.235  				FDD2C4730E2E77D700B7A85F /* QuartzCore.framework in Frameworks */,
   5.236 @@ -625,6 +703,7 @@
   5.237  			buildActionMask = 2147483647;
   5.238  			files = (
   5.239  				FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */,
   5.240 +				FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */,
   5.241  				FA8B4BD7196766DA00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.242  				FDD2C5010E2E7F4800B7A85F /* AudioToolbox.framework in Frameworks */,
   5.243  				FDD2C5020E2E7F4800B7A85F /* QuartzCore.framework in Frameworks */,
   5.244 @@ -641,6 +720,7 @@
   5.245  			buildActionMask = 2147483647;
   5.246  			files = (
   5.247  				FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */,
   5.248 +				FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */,
   5.249  				FA8B4BDB196766E500F8EB7C /* CoreMotion.framework in Frameworks */,
   5.250  				FDD2C51F0E2E807600B7A85F /* AudioToolbox.framework in Frameworks */,
   5.251  				FDD2C5200E2E807600B7A85F /* QuartzCore.framework in Frameworks */,
   5.252 @@ -658,6 +738,7 @@
   5.253  			files = (
   5.254  				AA1EE47717605BAB0029C7A5 /* libSDL2test.a in Frameworks */,
   5.255  				FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */,
   5.256 +				FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */,
   5.257  				FA8B4BDC196766E800F8EB7C /* CoreMotion.framework in Frameworks */,
   5.258  				FDD2C5440E2E80E400B7A85F /* AudioToolbox.framework in Frameworks */,
   5.259  				FDD2C5450E2E80E400B7A85F /* QuartzCore.framework in Frameworks */,
   5.260 @@ -674,6 +755,7 @@
   5.261  			buildActionMask = 2147483647;
   5.262  			files = (
   5.263  				FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */,
   5.264 +				FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */,
   5.265  				FA8B4BDE196766EE00F8EB7C /* CoreMotion.framework in Frameworks */,
   5.266  				FDD2C57D0E2E8C7400B7A85F /* AudioToolbox.framework in Frameworks */,
   5.267  				FDD2C57E0E2E8C7400B7A85F /* QuartzCore.framework in Frameworks */,
   5.268 @@ -690,6 +772,7 @@
   5.269  			buildActionMask = 2147483647;
   5.270  			files = (
   5.271  				FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */,
   5.272 +				FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */,
   5.273  				FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */,
   5.274  				FDD2C5BB0E2E8CFC00B7A85F /* AudioToolbox.framework in Frameworks */,
   5.275  				FDD2C5BC0E2E8CFC00B7A85F /* QuartzCore.framework in Frameworks */,
   5.276 @@ -706,6 +789,7 @@
   5.277  			buildActionMask = 2147483647;
   5.278  			files = (
   5.279  				FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */,
   5.280 +				FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */,
   5.281  				FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */,
   5.282  				FDD2C6EA0E2E959E00B7A85F /* AudioToolbox.framework in Frameworks */,
   5.283  				FDD2C6EB0E2E959E00B7A85F /* QuartzCore.framework in Frameworks */,
   5.284 @@ -746,6 +830,7 @@
   5.285  				047A63ED13285C3200CD7973 /* checkkeys.app */,
   5.286  				AAE7DEEC14CBB1E100DF1A0E /* testscale.app */,
   5.287  				AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */,
   5.288 +				FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */,
   5.289  			);
   5.290  			name = Products;
   5.291  			sourceTree = "<group>";
   5.292 @@ -788,6 +873,7 @@
   5.293  				FDC430090F0D86BF009C87E1 /* testdraw2.c */,
   5.294  				FDA8A7470E2D0F1600EA573E /* testerror.c */,
   5.295  				FDA8A7480E2D0F1600EA573E /* testfile.c */,
   5.296 +				FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */,
   5.297  				046CEF8913254F63007AD51D /* testgesture.c */,
   5.298  				FDAAC6290E2D5960001DB1D8 /* testgles.c */,
   5.299  				FDA8A74D0E2D0F1600EA573E /* testiconv.c */,
   5.300 @@ -813,6 +899,7 @@
   5.301  		FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */ = {
   5.302  			isa = PBXGroup;
   5.303  			children = (
   5.304 +				FA684F7A1BAF1A4400DCFD1A /* GameController.framework */,
   5.305  				FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */,
   5.306  				FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */,
   5.307  				FDA8A8990E2D111A00EA573E /* QuartzCore.framework */,
   5.308 @@ -828,6 +915,9 @@
   5.309  		FDA8AAD60E2D339A00EA573E /* Resources */ = {
   5.310  			isa = PBXGroup;
   5.311  			children = (
   5.312 +				FA0EF2281BAF4487000E07A6 /* axis.bmp */,
   5.313 +				FA0EF2291BAF4487000E07A6 /* button.bmp */,
   5.314 +				FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */,
   5.315  				FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
   5.316  				FDA8AAD90E2D33B000EA573E /* icon.bmp */,
   5.317  				FDA8AADA0E2D33BA00EA573E /* moose.dat */,
   5.318 @@ -943,6 +1033,23 @@
   5.319  			productReference = AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */;
   5.320  			productType = "com.apple.product-type.application";
   5.321  		};
   5.322 +		FAE0E9801BAF9B230098DFA4 /* testgamecontroller */ = {
   5.323 +			isa = PBXNativeTarget;
   5.324 +			buildConfigurationList = FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */;
   5.325 +			buildPhases = (
   5.326 +				FAE0E9811BAF9B230098DFA4 /* Resources */,
   5.327 +				FAE0E9831BAF9B230098DFA4 /* Sources */,
   5.328 +				FAE0E9851BAF9B230098DFA4 /* Frameworks */,
   5.329 +			);
   5.330 +			buildRules = (
   5.331 +			);
   5.332 +			dependencies = (
   5.333 +			);
   5.334 +			name = testgamecontroller;
   5.335 +			productName = Test;
   5.336 +			productReference = FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */;
   5.337 +			productType = "com.apple.product-type.application";
   5.338 +		};
   5.339  		FDA8AAAA0E2D330F00EA573E /* loopwav */ = {
   5.340  			isa = PBXNativeTarget;
   5.341  			buildConfigurationList = FDA8AAB80E2D330F00EA573E /* Build configuration list for PBXNativeTarget "loopwav" */;
   5.342 @@ -1270,6 +1377,7 @@
   5.343  				FDC42FEF0F0D866D009C87E1 /* testdraw2 */,
   5.344  				FDAAC58A0E2D5429001DB1D8 /* testerror */,
   5.345  				FDAAC5B80E2D55B5001DB1D8 /* testfile */,
   5.346 +				FAE0E9801BAF9B230098DFA4 /* testgamecontroller */,
   5.347  				046CEF7513254F23007AD51D /* testgesture */,
   5.348  				FDAAC6150E2D5914001DB1D8 /* testgles */,
   5.349  				FDD2C1700E2E52C000B7A85F /* testiconv */,
   5.350 @@ -1357,6 +1465,17 @@
   5.351  			);
   5.352  			runOnlyForDeploymentPostprocessing = 0;
   5.353  		};
   5.354 +		FAE0E9811BAF9B230098DFA4 /* Resources */ = {
   5.355 +			isa = PBXResourcesBuildPhase;
   5.356 +			buildActionMask = 2147483647;
   5.357 +			files = (
   5.358 +				FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */,
   5.359 +				FAE0E9821BAF9B230098DFA4 /* icon.bmp in Resources */,
   5.360 +				FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */,
   5.361 +				FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */,
   5.362 +			);
   5.363 +			runOnlyForDeploymentPostprocessing = 0;
   5.364 +		};
   5.365  		FDA8AAAB0E2D330F00EA573E /* Resources */ = {
   5.366  			isa = PBXResourcesBuildPhase;
   5.367  			buildActionMask = 2147483647;
   5.368 @@ -1533,6 +1652,14 @@
   5.369  			);
   5.370  			runOnlyForDeploymentPostprocessing = 0;
   5.371  		};
   5.372 +		FAE0E9831BAF9B230098DFA4 /* Sources */ = {
   5.373 +			isa = PBXSourcesBuildPhase;
   5.374 +			buildActionMask = 2147483647;
   5.375 +			files = (
   5.376 +				FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */,
   5.377 +			);
   5.378 +			runOnlyForDeploymentPostprocessing = 0;
   5.379 +		};
   5.380  		FDA8AAAC0E2D330F00EA573E /* Sources */ = {
   5.381  			isa = PBXSourcesBuildPhase;
   5.382  			buildActionMask = 2147483647;
   5.383 @@ -1601,7 +1728,7 @@
   5.384  			isa = PBXSourcesBuildPhase;
   5.385  			buildActionMask = 2147483647;
   5.386  			files = (
   5.387 -				FDD2C1A80E2E536400B7A85F /* testjoystick.c in Sources */,
   5.388 +				FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */,
   5.389  			);
   5.390  			runOnlyForDeploymentPostprocessing = 0;
   5.391  		};
   5.392 @@ -1794,6 +1921,22 @@
   5.393  			};
   5.394  			name = Release;
   5.395  		};
   5.396 +		FAE0E9911BAF9B230098DFA4 /* Debug */ = {
   5.397 +			isa = XCBuildConfiguration;
   5.398 +			buildSettings = {
   5.399 +				INFOPLIST_FILE = Info.plist;
   5.400 +				PRODUCT_NAME = "$(TARGET_NAME)";
   5.401 +			};
   5.402 +			name = Debug;
   5.403 +		};
   5.404 +		FAE0E9921BAF9B230098DFA4 /* Release */ = {
   5.405 +			isa = XCBuildConfiguration;
   5.406 +			buildSettings = {
   5.407 +				INFOPLIST_FILE = Info.plist;
   5.408 +				PRODUCT_NAME = "$(TARGET_NAME)";
   5.409 +			};
   5.410 +			name = Release;
   5.411 +		};
   5.412  		FDA8AAB90E2D330F00EA573E /* Debug */ = {
   5.413  			isa = XCBuildConfiguration;
   5.414  			buildSettings = {
   5.415 @@ -2132,6 +2275,15 @@
   5.416  			defaultConfigurationIsVisible = 0;
   5.417  			defaultConfigurationName = Release;
   5.418  		};
   5.419 +		FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = {
   5.420 +			isa = XCConfigurationList;
   5.421 +			buildConfigurations = (
   5.422 +				FAE0E9911BAF9B230098DFA4 /* Debug */,
   5.423 +				FAE0E9921BAF9B230098DFA4 /* Release */,
   5.424 +			);
   5.425 +			defaultConfigurationIsVisible = 0;
   5.426 +			defaultConfigurationName = Release;
   5.427 +		};
   5.428  		FDA8AAB80E2D330F00EA573E /* Build configuration list for PBXNativeTarget "loopwav" */ = {
   5.429  			isa = XCConfigurationList;
   5.430  			buildConfigurations = (
     6.1 --- a/configure	Fri Sep 18 16:22:23 2015 -0400
     6.2 +++ b/configure	Sun Sep 20 23:08:36 2015 -0300
     6.3 @@ -23433,6 +23433,7 @@
     6.4          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
     6.5          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
     6.6          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
     6.7 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
     6.8          ;;
     6.9      *-*-darwin* )
    6.10          # This could be either full "Mac OS X", or plain "Darwin" which is
     7.1 --- a/include/SDL_config.h.cmake	Fri Sep 18 16:22:23 2015 -0400
     7.2 +++ b/include/SDL_config.h.cmake	Sun Sep 20 23:08:36 2015 -0300
     7.3 @@ -235,6 +235,7 @@
     7.4  #cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
     7.5  #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
     7.6  #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
     7.7 +#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
     7.8  #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
     7.9  #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
    7.10  #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
     8.1 --- a/include/SDL_config_iphoneos.h	Fri Sep 18 16:22:23 2015 -0400
     8.2 +++ b/include/SDL_config_iphoneos.h	Sun Sep 20 23:08:36 2015 -0300
     8.3 @@ -115,8 +115,11 @@
     8.4  /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
     8.5  #define SDL_HAPTIC_DUMMY 1
     8.6  
     8.7 +/* Enable MFi joystick support */
     8.8 +#define SDL_JOYSTICK_MFI 1
     8.9 +
    8.10  /* Enable Unix style SO loading */
    8.11 -/* Technically this works, but it violates the iPhone developer agreement */
    8.12 +/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
    8.13  /* #define SDL_LOADSO_DLOPEN 1 */
    8.14  
    8.15  /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
    8.16 @@ -148,9 +151,6 @@
    8.17  /* enable iOS extended launch screen */
    8.18  #define SDL_IPHONE_LAUNCHSCREEN 1
    8.19  
    8.20 -/* enable joystick subsystem */
    8.21 -#define SDL_JOYSTICK_DISABLED 0
    8.22 -
    8.23  /* Set max recognized G-force from accelerometer
    8.24     See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
    8.25   */
     9.1 --- a/premake/README-ios.txt	Fri Sep 18 16:22:23 2015 -0400
     9.2 +++ b/premake/README-ios.txt	Sun Sep 20 23:08:36 2015 -0300
     9.3 @@ -26,6 +26,7 @@
     9.4    -Foundation.framework
     9.5    -CoreAudio.framework
     9.6    -CoreMotion.framework
     9.7 +  -GameController.framework
     9.8  
     9.9  All of these frameworks are part of the iOS SDK, not part of the core OS X
    9.10  system.
    10.1 --- a/premake/Xcode-iOS/Demos/happy/happy.xcodeproj/project.pbxproj	Fri Sep 18 16:22:23 2015 -0400
    10.2 +++ b/premake/Xcode-iOS/Demos/happy/happy.xcodeproj/project.pbxproj	Sun Sep 20 23:08:36 2015 -0300
    10.3 @@ -3,55 +3,55 @@
    10.4  	archiveVersion = 1;
    10.5  	classes = {
    10.6  	};
    10.7 -	objectVersion = 45;
    10.8 +	objectVersion = 46;
    10.9  	objects = {
   10.10  
   10.11  /* Begin PBXBuildFile section */
   10.12 +		039E2FCB749D2AE6705435A4 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B210870772357A20E4576EE /* OpenGLES.framework */; };
   10.13 +		04CE7E9842C4612763496460 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C147BCA187412202A676460 /* AudioToolbox.framework */; };
   10.14 +		081D5E427A420BEA66DF6129 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 489C1A076394164C7F853083 /* Foundation.framework */; };
   10.15 +		263A59BA6D20796421AC3870 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 603E37DB4001230953C943FD /* CoreGraphics.framework */; };
   10.16 +		2F5A7AB72FA52C3D029335B6 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 49AD32CF351438B316C15B7A /* common.c */; };
   10.17 +		424C13DC60653FEE6370536B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327333F1228F1B0D0A582BEC /* libSDL2.a */; };
   10.18  		43587E112FDE41E3486A5141 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 67E105821F9D19C248BF17B6 /* icon.bmp */; };
   10.19 -		2F5A7AB72FA52C3D029335B6 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 49AD32CF351438B316C15B7A /* common.c */; };
   10.20 +		5DC8148934C32F3407541C0F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */; };
   10.21 +		65AC30DF305741C6521420A7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF1729947305D7E10DA777D /* CoreAudio.framework */; };
   10.22  		66455D1E7E3179156E546AA8 /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = 1F0270E77CC100E968633EBA /* happy.c */; };
   10.23 -		04CE7E9842C4612763496460 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C147BCA187412202A676460 /* AudioToolbox.framework */; };
   10.24 -		5DC8148934C32F3407541C0F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */; };
   10.25 -		039E2FCB749D2AE6705435A4 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B210870772357A20E4576EE /* OpenGLES.framework */; };
   10.26 -		263A59BA6D20796421AC3870 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 603E37DB4001230953C943FD /* CoreGraphics.framework */; };
   10.27  		7E2000C447ED370218691A83 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C87CB0268927E071506CEA /* UIKit.framework */; };
   10.28 -		081D5E427A420BEA66DF6129 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 489C1A076394164C7F853083 /* Foundation.framework */; };
   10.29 -		65AC30DF305741C6521420A7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF1729947305D7E10DA777D /* CoreAudio.framework */; };
   10.30 -		424C13DC60653FEE6370536B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327333F1228F1B0D0A582BEC /* libSDL2.a */; };
   10.31  /* End PBXBuildFile section */
   10.32  
   10.33  /* Begin PBXContainerItemProxy section */
   10.34 +		6D92213A249742C860667923 /* PBXContainerItemProxy */ = {
   10.35 +			isa = PBXContainerItemProxy;
   10.36 +			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
   10.37 +			proxyType = 1;
   10.38 +			remoteGlobalIDString = 515D4C462ACD2DA8180E7783;
   10.39 +			remoteInfo = libSDL2.a;
   10.40 +		};
   10.41  		73DD36916E01179F50147B85 /* PBXContainerItemProxy */ = {
   10.42  			isa = PBXContainerItemProxy;
   10.43  			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
   10.44  			proxyType = 2;
   10.45  			remoteGlobalIDString = 224D2C85085A7BA60E532655;
   10.46 -			remoteInfo = "libSDL2.a";
   10.47 -		};
   10.48 -		6D92213A249742C860667923 /* PBXContainerItemProxy */ = {
   10.49 -			isa = PBXContainerItemProxy;
   10.50 -			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
   10.51 -			proxyType = 1;
   10.52 -			remoteGlobalIDString = 515D4C462ACD2DA8180E7783;
   10.53 -			remoteInfo = "libSDL2.a";
   10.54 +			remoteInfo = libSDL2.a;
   10.55  		};
   10.56  /* End PBXContainerItemProxy section */
   10.57  
   10.58  /* Begin PBXFileReference section */
   10.59 -		4E8504577F0B2DC43C2073B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info.plist"; path = "../../../../Xcode-iOS/Demos/Info.plist"; sourceTree = "<group>"; };
   10.60 -		67E105821F9D19C248BF17B6 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = "icon.bmp"; path = "../../../../Xcode-iOS/Demos/data/icon.bmp"; sourceTree = "<group>"; };
   10.61 -		49AD32CF351438B316C15B7A /* common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "common.c"; path = "../../../../Xcode-iOS/Demos/src/common.c"; sourceTree = "<group>"; };
   10.62 -		4346585005E47029491C60D0 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "common.h"; path = "../../../../Xcode-iOS/Demos/src/common.h"; sourceTree = "<group>"; };
   10.63 -		1F0270E77CC100E968633EBA /* happy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "happy.c"; path = "../../../../Xcode-iOS/Demos/src/happy.c"; sourceTree = "<group>"; };
   10.64 -		2C147BCA187412202A676460 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "AudioToolbox.framework"; path = "System/Library/Frameworks/AudioToolbox.framework"; sourceTree = "SDKROOT"; };
   10.65 -		5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "QuartzCore.framework"; path = "System/Library/Frameworks/QuartzCore.framework"; sourceTree = "SDKROOT"; };
   10.66 -		3B210870772357A20E4576EE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenGLES.framework"; path = "System/Library/Frameworks/OpenGLES.framework"; sourceTree = "SDKROOT"; };
   10.67 -		603E37DB4001230953C943FD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "CoreGraphics.framework"; path = "System/Library/Frameworks/CoreGraphics.framework"; sourceTree = "SDKROOT"; };
   10.68 -		49C87CB0268927E071506CEA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "UIKit.framework"; path = "System/Library/Frameworks/UIKit.framework"; sourceTree = "SDKROOT"; };
   10.69 -		489C1A076394164C7F853083 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "Foundation.framework"; path = "System/Library/Frameworks/Foundation.framework"; sourceTree = "SDKROOT"; };
   10.70 -		7AF1729947305D7E10DA777D /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "CoreAudio.framework"; path = "System/Library/Frameworks/CoreAudio.framework"; sourceTree = "SDKROOT"; };
   10.71 -		65F833BA06B514AD0EE36218 /* happy */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = "happy"; path = "happy"; sourceTree = BUILT_PRODUCTS_DIR; };
   10.72 -		45B64B000539221732843506 /* SDL2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "SDL2.xcodeproj"; path = "../../SDL2/SDL2.xcodeproj"; sourceTree = SOURCE_ROOT; };
   10.73 +		1F0270E77CC100E968633EBA /* happy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = happy.c; path = "../../../../Xcode-iOS/Demos/src/happy.c"; sourceTree = "<group>"; };
   10.74 +		2C147BCA187412202A676460 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
   10.75 +		3B210870772357A20E4576EE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
   10.76 +		4346585005E47029491C60D0 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = common.h; path = "../../../../Xcode-iOS/Demos/src/common.h"; sourceTree = "<group>"; };
   10.77 +		45B64B000539221732843506 /* SDL2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL2.xcodeproj; path = ../../SDL2/SDL2.xcodeproj; sourceTree = SOURCE_ROOT; };
   10.78 +		489C1A076394164C7F853083 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
   10.79 +		49AD32CF351438B316C15B7A /* common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = common.c; path = "../../../../Xcode-iOS/Demos/src/common.c"; sourceTree = "<group>"; };
   10.80 +		49C87CB0268927E071506CEA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
   10.81 +		4E8504577F0B2DC43C2073B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../../../../Xcode-iOS/Demos/Info.plist"; sourceTree = "<group>"; };
   10.82 +		5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
   10.83 +		603E37DB4001230953C943FD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
   10.84 +		65F833BA06B514AD0EE36218 /* happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
   10.85 +		67E105821F9D19C248BF17B6 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = "../../../../Xcode-iOS/Demos/data/icon.bmp"; sourceTree = "<group>"; };
   10.86 +		7AF1729947305D7E10DA777D /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
   10.87  /* End PBXFileReference section */
   10.88  
   10.89  /* Begin PBXFrameworksBuildPhase section */
   10.90 @@ -73,23 +73,30 @@
   10.91  /* End PBXFrameworksBuildPhase section */
   10.92  
   10.93  /* Begin PBXGroup section */
   10.94 -		3555679049400DAA17916DD7 /* happy */ = {
   10.95 +		1EEF027C57A725660BCF6FB9 /* data */ = {
   10.96  			isa = PBXGroup;
   10.97  			children = (
   10.98 -				7CFE361B495F31F009A616F6 /* Xcode-iOS */,
   10.99 -				532F72873A65662513E35533 /* Frameworks */,
  10.100 -				343C7E606DE365001C7D0B84 /* Products */,
  10.101 -				20D87CCB7D1E6AC128B72992 /* Projects */,
  10.102 +				67E105821F9D19C248BF17B6 /* icon.bmp */,
  10.103  			);
  10.104 -			name = "happy";
  10.105 +			name = data;
  10.106  			sourceTree = "<group>";
  10.107  		};
  10.108 -		7CFE361B495F31F009A616F6 /* Xcode-iOS */ = {
  10.109 +		1F3D1DBD7857554A0C1C1965 /* src */ = {
  10.110  			isa = PBXGroup;
  10.111  			children = (
  10.112 -				224D240956AC3D2636C95904 /* Demos */,
  10.113 +				49AD32CF351438B316C15B7A /* common.c */,
  10.114 +				4346585005E47029491C60D0 /* common.h */,
  10.115 +				1F0270E77CC100E968633EBA /* happy.c */,
  10.116  			);
  10.117 -			name = "Xcode-iOS";
  10.118 +			name = src;
  10.119 +			sourceTree = "<group>";
  10.120 +		};
  10.121 +		20D87CCB7D1E6AC128B72992 /* Projects */ = {
  10.122 +			isa = PBXGroup;
  10.123 +			children = (
  10.124 +				45B64B000539221732843506 /* SDL2.xcodeproj */,
  10.125 +			);
  10.126 +			name = Projects;
  10.127  			sourceTree = "<group>";
  10.128  		};
  10.129  		224D240956AC3D2636C95904 /* Demos */ = {
  10.130 @@ -99,25 +106,34 @@
  10.131  				1EEF027C57A725660BCF6FB9 /* data */,
  10.132  				1F3D1DBD7857554A0C1C1965 /* src */,
  10.133  			);
  10.134 -			name = "Demos";
  10.135 +			name = Demos;
  10.136  			sourceTree = "<group>";
  10.137  		};
  10.138 -		1EEF027C57A725660BCF6FB9 /* data */ = {
  10.139 +		343C7E606DE365001C7D0B84 /* Products */ = {
  10.140  			isa = PBXGroup;
  10.141  			children = (
  10.142 -				67E105821F9D19C248BF17B6 /* icon.bmp */,
  10.143 +				65F833BA06B514AD0EE36218 /* happy.app */,
  10.144  			);
  10.145 -			name = "data";
  10.146 +			name = Products;
  10.147  			sourceTree = "<group>";
  10.148  		};
  10.149 -		1F3D1DBD7857554A0C1C1965 /* src */ = {
  10.150 +		3555679049400DAA17916DD7 /* happy */ = {
  10.151  			isa = PBXGroup;
  10.152  			children = (
  10.153 -				49AD32CF351438B316C15B7A /* common.c */,
  10.154 -				4346585005E47029491C60D0 /* common.h */,
  10.155 -				1F0270E77CC100E968633EBA /* happy.c */,
  10.156 +				7CFE361B495F31F009A616F6 /* Xcode-iOS */,
  10.157 +				532F72873A65662513E35533 /* Frameworks */,
  10.158 +				343C7E606DE365001C7D0B84 /* Products */,
  10.159 +				20D87CCB7D1E6AC128B72992 /* Projects */,
  10.160  			);
  10.161 -			name = "src";
  10.162 +			name = happy;
  10.163 +			sourceTree = "<group>";
  10.164 +		};
  10.165 +		452A4F211058019E46671F0C /* Products */ = {
  10.166 +			isa = PBXGroup;
  10.167 +			children = (
  10.168 +				327333F1228F1B0D0A582BEC /* libSDL2.a */,
  10.169 +			);
  10.170 +			name = Products;
  10.171  			sourceTree = "<group>";
  10.172  		};
  10.173  		532F72873A65662513E35533 /* Frameworks */ = {
  10.174 @@ -131,31 +147,15 @@
  10.175  				489C1A076394164C7F853083 /* Foundation.framework */,
  10.176  				7AF1729947305D7E10DA777D /* CoreAudio.framework */,
  10.177  			);
  10.178 -			name = "Frameworks";
  10.179 +			name = Frameworks;
  10.180  			sourceTree = "<group>";
  10.181  		};
  10.182 -		343C7E606DE365001C7D0B84 /* Products */ = {
  10.183 +		7CFE361B495F31F009A616F6 /* Xcode-iOS */ = {
  10.184  			isa = PBXGroup;
  10.185  			children = (
  10.186 -				65F833BA06B514AD0EE36218 /* happy */,
  10.187 +				224D240956AC3D2636C95904 /* Demos */,
  10.188  			);
  10.189 -			name = "Products";
  10.190 -			sourceTree = "<group>";
  10.191 -		};
  10.192 -		20D87CCB7D1E6AC128B72992 /* Projects */ = {
  10.193 -			isa = PBXGroup;
  10.194 -			children = (
  10.195 -				45B64B000539221732843506 /* SDL2.xcodeproj */,
  10.196 -			);
  10.197 -			name = "Projects";
  10.198 -			sourceTree = "<group>";
  10.199 -		};
  10.200 -		452A4F211058019E46671F0C /* Products */ = {
  10.201 -			isa = PBXGroup;
  10.202 -			children = (
  10.203 -				327333F1228F1B0D0A582BEC /* libSDL2.a */,
  10.204 -			);
  10.205 -			name = Products;
  10.206 +			name = "Xcode-iOS";
  10.207  			sourceTree = "<group>";
  10.208  		};
  10.209  /* End PBXGroup section */
  10.210 @@ -174,10 +174,10 @@
  10.211  			dependencies = (
  10.212  				1F023F2F3EDE66E20BCC17E1 /* PBXTargetDependency */,
  10.213  			);
  10.214 -			name = "happy";
  10.215 +			name = happy;
  10.216  			productInstallPath = "$(HOME)/Applications";
  10.217 -			productName = "happy";
  10.218 -			productReference = 65F833BA06B514AD0EE36218 /* happy */;
  10.219 +			productName = happy;
  10.220 +			productReference = 65F833BA06B514AD0EE36218 /* happy.app */;
  10.221  			productType = "com.apple.product-type.application";
  10.222  		};
  10.223  /* End PBXNativeTarget section */
  10.224 @@ -185,9 +185,15 @@
  10.225  /* Begin PBXProject section */
  10.226  		08FB7793FE84155DC02AAC07 /* Project object */ = {
  10.227  			isa = PBXProject;
  10.228 +			attributes = {
  10.229 +			};
  10.230  			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */;
  10.231  			compatibilityVersion = "Xcode 3.2";
  10.232 +			developmentRegion = English;
  10.233  			hasScannedForEncodings = 1;
  10.234 +			knownRegions = (
  10.235 +				en,
  10.236 +			);
  10.237  			mainGroup = 3555679049400DAA17916DD7 /* happy */;
  10.238  			projectDirPath = "";
  10.239  			projectReferences = (
  10.240 @@ -207,7 +213,7 @@
  10.241  		327333F1228F1B0D0A582BEC /* libSDL2.a */ = {
  10.242  			isa = PBXReferenceProxy;
  10.243  			fileType = archive.ar;
  10.244 -			path = "Build/Debug/libSDL2.a";
  10.245 +			path = libSDL2.a;
  10.246  			remoteRef = 73DD36916E01179F50147B85 /* PBXContainerItemProxy */;
  10.247  			sourceTree = BUILT_PRODUCTS_DIR;
  10.248  		};
  10.249 @@ -236,18 +242,88 @@
  10.250  		};
  10.251  /* End PBXSourcesBuildPhase section */
  10.252  
  10.253 -/* Begin PBXVariantGroup section */
  10.254 -/* End PBXVariantGroup section */
  10.255 -
  10.256  /* Begin PBXTargetDependency section */
  10.257  		1F023F2F3EDE66E20BCC17E1 /* PBXTargetDependency */ = {
  10.258  			isa = PBXTargetDependency;
  10.259 -			name = "libSDL2.a";
  10.260 +			name = libSDL2.a;
  10.261  			targetProxy = 6D92213A249742C860667923 /* PBXContainerItemProxy */;
  10.262  		};
  10.263  /* End PBXTargetDependency section */
  10.264  
  10.265  /* Begin XCBuildConfiguration section */
  10.266 +		115846ED1EDF44EA13E06D02 /* Debug */ = {
  10.267 +			isa = XCBuildConfiguration;
  10.268 +			buildSettings = {
  10.269 +				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
  10.270 +				CODE_SIGN_IDENTITY = "iPhone Developer";
  10.271 +				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
  10.272 +				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
  10.273 +				COPY_PHASE_STRIP = NO;
  10.274 +				GCC_C_LANGUAGE_STANDARD = gnu99;
  10.275 +				GCC_ENABLE_CPP_EXCEPTIONS = NO;
  10.276 +				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
  10.277 +				GCC_OPTIMIZATION_LEVEL = 0;
  10.278 +				GCC_PREPROCESSOR_DEFINITIONS = (
  10.279 +					USING_PREMAKE_CONFIG_H,
  10.280 +					_DEBUG,
  10.281 +				);
  10.282 +				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  10.283 +				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  10.284 +				GCC_WARN_UNUSED_VARIABLE = YES;
  10.285 +				HEADER_SEARCH_PATHS = (
  10.286 +					../..,
  10.287 +					../../../../include,
  10.288 +				);
  10.289 +				OBJROOT = obj/iOS/Debug;
  10.290 +				ONLY_ACTIVE_ARCH = YES;
  10.291 +				SDKROOT = iphoneos;
  10.292 +				SYMROOT = Build/Debug;
  10.293 +			};
  10.294 +			name = Debug;
  10.295 +		};
  10.296 +		205A208D2C4F2495443E582F /* Release */ = {
  10.297 +			isa = XCBuildConfiguration;
  10.298 +			buildSettings = {
  10.299 +				ALWAYS_SEARCH_USER_PATHS = NO;
  10.300 +				CONFIGURATION_BUILD_DIR = Build/Release;
  10.301 +				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  10.302 +				GCC_DYNAMIC_NO_PIC = NO;
  10.303 +				GCC_MODEL_TUNING = G5;
  10.304 +				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
  10.305 +				INSTALL_PATH = "$(HOME)/Applications";
  10.306 +				PRODUCT_NAME = happy;
  10.307 +			};
  10.308 +			name = Release;
  10.309 +		};
  10.310 +		3536279D443370B3347E7CB6 /* Release */ = {
  10.311 +			isa = XCBuildConfiguration;
  10.312 +			buildSettings = {
  10.313 +				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
  10.314 +				CODE_SIGN_IDENTITY = "iPhone Developer";
  10.315 +				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
  10.316 +				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
  10.317 +				GCC_C_LANGUAGE_STANDARD = gnu99;
  10.318 +				GCC_ENABLE_CPP_EXCEPTIONS = NO;
  10.319 +				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
  10.320 +				GCC_OPTIMIZATION_LEVEL = 3;
  10.321 +				GCC_PREPROCESSOR_DEFINITIONS = (
  10.322 +					USING_PREMAKE_CONFIG_H,
  10.323 +					NDEBUG,
  10.324 +				);
  10.325 +				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  10.326 +				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  10.327 +				GCC_WARN_UNUSED_VARIABLE = YES;
  10.328 +				HEADER_SEARCH_PATHS = (
  10.329 +					../..,
  10.330 +					../../../../include,
  10.331 +				);
  10.332 +				OBJROOT = obj/iOS/Release;
  10.333 +				ONLY_ACTIVE_ARCH = NO;
  10.334 +				SDKROOT = iphoneos;
  10.335 +				SYMROOT = Build/Release;
  10.336 +			};
  10.337 +			name = Release;
  10.338 +		};
  10.339  		563C339925F445BB2F1E01DB /* Debug */ = {
  10.340  			isa = XCBuildConfiguration;
  10.341  			buildSettings = {
  10.342 @@ -257,86 +333,22 @@
  10.343  				GCC_MODEL_TUNING = G5;
  10.344  				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
  10.345  				INSTALL_PATH = "$(HOME)/Applications";
  10.346 -				PRODUCT_NAME = "happy";
  10.347 +				PRODUCT_NAME = happy;
  10.348  			};
  10.349 -			name = "Debug";
  10.350 -		};
  10.351 -		205A208D2C4F2495443E582F /* Release */ = {
  10.352 -			isa = XCBuildConfiguration;
  10.353 -			buildSettings = {
  10.354 -				ALWAYS_SEARCH_USER_PATHS = NO;
  10.355 -				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  10.356 -				CONFIGURATION_BUILD_DIR = Build/Release;
  10.357 -				GCC_DYNAMIC_NO_PIC = NO;
  10.358 -				GCC_MODEL_TUNING = G5;
  10.359 -				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
  10.360 -				INSTALL_PATH = "$(HOME)/Applications";
  10.361 -				PRODUCT_NAME = "happy";
  10.362 -			};
  10.363 -			name = "Release";
  10.364 -		};
  10.365 -		115846ED1EDF44EA13E06D02 /* Debug */ = {
  10.366 -			isa = XCBuildConfiguration;
  10.367 -			buildSettings = {
  10.368 -				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
  10.369 -				SDKROOT = iphoneos;
  10.370 -				CODE_SIGN_IDENTITY = "iPhone Developer";
  10.371 -				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
  10.372 -				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
  10.373 -				COPY_PHASE_STRIP = NO;
  10.374 -				GCC_C_LANGUAGE_STANDARD = gnu99;
  10.375 -				GCC_ENABLE_CPP_EXCEPTIONS = NO;
  10.376 -				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
  10.377 -				GCC_OPTIMIZATION_LEVEL = 0;
  10.378 -				GCC_PREPROCESSOR_DEFINITIONS = (
  10.379 -					"USING_PREMAKE_CONFIG_H",
  10.380 -					"_DEBUG",
  10.381 -				);
  10.382 -				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  10.383 -				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  10.384 -				GCC_WARN_UNUSED_VARIABLE = YES;
  10.385 -				HEADER_SEARCH_PATHS = (
  10.386 -					"../..",
  10.387 -					"../../../../include",
  10.388 -				);
  10.389 -				OBJROOT = "obj/iOS/Debug";
  10.390 -				ONLY_ACTIVE_ARCH = YES;
  10.391 -				SYMROOT = "Build/Debug";
  10.392 -			};
  10.393 -			name = "Debug";
  10.394 -		};
  10.395 -		3536279D443370B3347E7CB6 /* Release */ = {
  10.396 -			isa = XCBuildConfiguration;
  10.397 -			buildSettings = {
  10.398 -				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
  10.399 -				SDKROOT = iphoneos;
  10.400 -				CODE_SIGN_IDENTITY = "iPhone Developer";
  10.401 -				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
  10.402 -				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
  10.403 -				GCC_C_LANGUAGE_STANDARD = gnu99;
  10.404 -				GCC_ENABLE_CPP_EXCEPTIONS = NO;
  10.405 -				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
  10.406 -				GCC_OPTIMIZATION_LEVEL = 3;
  10.407 -				GCC_PREPROCESSOR_DEFINITIONS = (
  10.408 -					"USING_PREMAKE_CONFIG_H",
  10.409 -					"NDEBUG",
  10.410 -				);
  10.411 -				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  10.412 -				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  10.413 -				GCC_WARN_UNUSED_VARIABLE = YES;
  10.414 -				HEADER_SEARCH_PATHS = (
  10.415 -					"../..",
  10.416 -					"../../../../include",
  10.417 -				);
  10.418 -				OBJROOT = "obj/iOS/Release";
  10.419 -				ONLY_ACTIVE_ARCH = NO;
  10.420 -				SYMROOT = "Build/Release";
  10.421 -			};
  10.422 -			name = "Release";
  10.423 +			name = Debug;
  10.424  		};
  10.425  /* End XCBuildConfiguration section */
  10.426  
  10.427  /* Begin XCConfigurationList section */
  10.428 +		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */ = {
  10.429 +			isa = XCConfigurationList;
  10.430 +			buildConfigurations = (
  10.431 +				115846ED1EDF44EA13E06D02 /* Debug */,
  10.432 +				3536279D443370B3347E7CB6 /* Release */,
  10.433 +			);
  10.434 +			defaultConfigurationIsVisible = 0;
  10.435 +			defaultConfigurationName = Debug;
  10.436 +		};
  10.437  		233F10BA36C35A146C6A4B3E /* Build configuration list for PBXNativeTarget "happy" */ = {
  10.438  			isa = XCConfigurationList;
  10.439  			buildConfigurations = (
  10.440 @@ -344,19 +356,9 @@
  10.441  				205A208D2C4F2495443E582F /* Release */,
  10.442  			);
  10.443  			defaultConfigurationIsVisible = 0;
  10.444 -			defaultConfigurationName = "Debug";
  10.445 -		};
  10.446 -		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */ = {
  10.447 -			isa = XCConfigurationList;
  10.448 -			buildConfigurations = (
  10.449 -				115846ED1EDF44EA13E06D02 /* Debug */,
  10.450 -				3536279D443370B3347E7CB6 /* Release */,
  10.451 -			);
  10.452 -			defaultConfigurationIsVisible = 0;
  10.453 -			defaultConfigurationName = "Debug";
  10.454 +			defaultConfigurationName = Debug;
  10.455  		};
  10.456  /* End XCConfigurationList section */
  10.457 -
  10.458  	};
  10.459  	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
  10.460  }
    11.1 --- a/premake/projects/SDL2.lua	Fri Sep 18 16:22:23 2015 -0400
    11.2 +++ b/premake/projects/SDL2.lua	Sun Sep 20 23:08:36 2015 -0300
    11.3 @@ -367,7 +367,7 @@
    11.4  		SDL_config
    11.5  		{
    11.6  			["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
    11.7 -			["SDL_JOYSTICK_DISABLED"] = 0,
    11.8 +			["SDL_JOYSTICK_MFI"] = 1,
    11.9  			["SDL_HAPTIC_DISABLED"] = 1,
   11.10  			["SDL_LOADSO_DISABLED"] = 1,
   11.11  			["SDL_THREAD_PTHREAD"] = 1,
   11.12 @@ -404,5 +404,6 @@
   11.13  			"$(SDKROOT)/UIKit.framework",
   11.14  			"$(SDKROOT)/Foundation.framework",
   11.15  			"$(SDKROOT)/CoreAudio.framework",
   11.16 -			"$(SDKROOT)/CoreMotion.framework"
   11.17 +			"$(SDKROOT)/CoreMotion.framework",
   11.18 +			"$(SDKROOT)/GameController.framework"
   11.19  		}
    12.1 --- a/src/joystick/SDL_gamecontrollerdb.h	Fri Sep 18 16:22:23 2015 -0400
    12.2 +++ b/src/joystick/SDL_gamecontrollerdb.h	Sun Sep 20 23:08:36 2015 -0300
    12.3 @@ -45,6 +45,10 @@
    12.4      "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
    12.5      "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
    12.6  #endif
    12.7 +#if SDL_JOYSTICK_MFI
    12.8 +    "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,start:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,",
    12.9 +    "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,start:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,",
   12.10 +#endif
   12.11  #if defined(__MACOSX__)
   12.12      "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
   12.13      "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
    13.1 --- a/src/joystick/SDL_joystick.c	Fri Sep 18 16:22:23 2015 -0400
    13.2 +++ b/src/joystick/SDL_joystick.c	Sun Sep 20 23:08:36 2015 -0300
    13.3 @@ -669,14 +669,17 @@
    13.4              int i;
    13.5  
    13.6              /* Tell the app that everything is centered/unpressed...  */
    13.7 -            for (i = 0; i < joystick->naxes; i++)
    13.8 +            for (i = 0; i < joystick->naxes; i++) {
    13.9                  SDL_PrivateJoystickAxis(joystick, i, 0);
   13.10 +            }
   13.11  
   13.12 -            for (i = 0; i < joystick->nbuttons; i++)
   13.13 +            for (i = 0; i < joystick->nbuttons; i++) {
   13.14                  SDL_PrivateJoystickButton(joystick, i, 0);
   13.15 +            }
   13.16  
   13.17 -            for (i = 0; i < joystick->nhats; i++)
   13.18 +            for (i = 0; i < joystick->nhats; i++) {
   13.19                  SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
   13.20 +            }
   13.21  
   13.22              joystick->force_recentering = SDL_FALSE;
   13.23          }
    14.1 --- a/src/joystick/iphoneos/SDL_sysjoystick.m	Fri Sep 18 16:22:23 2015 -0400
    14.2 +++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Sun Sep 20 23:08:36 2015 -0300
    14.3 @@ -21,6 +21,10 @@
    14.4  #include "../../SDL_internal.h"
    14.5  
    14.6  /* This is the iOS implementation of the SDL joystick API */
    14.7 +#include "SDL_sysjoystick_c.h"
    14.8 +
    14.9 +/* needed for SDL_IPHONE_MAX_GFORCE macro */
   14.10 +#include "SDL_config_iphoneos.h"
   14.11  
   14.12  #include "SDL_joystick.h"
   14.13  #include "SDL_hints.h"
   14.14 @@ -28,15 +32,221 @@
   14.15  #include "../SDL_sysjoystick.h"
   14.16  #include "../SDL_joystick_c.h"
   14.17  
   14.18 +#if !SDL_EVENTS_DISABLED
   14.19 +#include "../../events/SDL_events_c.h"
   14.20 +#endif
   14.21 +
   14.22  #import <CoreMotion/CoreMotion.h>
   14.23  
   14.24 -/* needed for SDL_IPHONE_MAX_GFORCE macro */
   14.25 -#import "SDL_config_iphoneos.h"
   14.26 +#ifdef SDL_JOYSTICK_MFI
   14.27 +#import <GameController/GameController.h>
   14.28  
   14.29 -const char *accelerometerName = "iOS Accelerometer";
   14.30 +static id connectObserver = nil;
   14.31 +static id disconnectObserver = nil;
   14.32 +#endif /* SDL_JOYSTICK_MFI */
   14.33  
   14.34 +static const char *accelerometerName = "iOS Accelerometer";
   14.35  static CMMotionManager *motionManager = nil;
   14.36 +
   14.37 +static SDL_JoystickDeviceItem *deviceList = NULL;
   14.38 +
   14.39  static int numjoysticks = 0;
   14.40 +static SDL_JoystickID instancecounter = 0;
   14.41 +
   14.42 +static SDL_JoystickDeviceItem *
   14.43 +GetDeviceForIndex(int device_index)
   14.44 +{
   14.45 +    SDL_JoystickDeviceItem *device = deviceList;
   14.46 +    int i = 0;
   14.47 +
   14.48 +    while (i < device_index) {
   14.49 +        if (device == NULL) {
   14.50 +            return NULL;
   14.51 +        }
   14.52 +        device = device->next;
   14.53 +        i++;
   14.54 +    }
   14.55 +
   14.56 +    return device;
   14.57 +}
   14.58 +
   14.59 +static void
   14.60 +SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
   14.61 +{
   14.62 +#ifdef SDL_JOYSTICK_MFI
   14.63 +    const char *name = NULL;
   14.64 +    /* Explicitly retain the controller because SDL_JoystickDeviceItem is a
   14.65 +     * struct, and ARC doesn't work with structs. */
   14.66 +    device->controller = (__bridge GCController *) CFBridgingRetain(controller);
   14.67 +
   14.68 +    if (controller.vendorName) {
   14.69 +        name = controller.vendorName.UTF8String;
   14.70 +    }
   14.71 +
   14.72 +    if (!name) {
   14.73 +        name = "MFi Gamepad";
   14.74 +    }
   14.75 +
   14.76 +    device->name = SDL_strdup(name);
   14.77 +
   14.78 +    device->guid.data[0] = 'M';
   14.79 +    device->guid.data[1] = 'F';
   14.80 +    device->guid.data[2] = 'i';
   14.81 +    device->guid.data[3] = 'G';
   14.82 +    device->guid.data[4] = 'a';
   14.83 +    device->guid.data[5] = 'm';
   14.84 +    device->guid.data[6] = 'e';
   14.85 +    device->guid.data[7] = 'p';
   14.86 +    device->guid.data[8] = 'a';
   14.87 +    device->guid.data[9] = 'd';
   14.88 +
   14.89 +    if (controller.extendedGamepad) {
   14.90 +        device->guid.data[10] = 1;
   14.91 +    } else if (controller.gamepad) {
   14.92 +        device->guid.data[10] = 2;
   14.93 +    }
   14.94 +
   14.95 +    if (controller.extendedGamepad) {
   14.96 +        device->naxes = 6; /* 2 thumbsticks and 2 triggers */
   14.97 +        device->nhats = 1; /* d-pad */
   14.98 +        device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
   14.99 +    } else if (controller.gamepad) {
  14.100 +        device->naxes = 0; /* no traditional analog inputs */
  14.101 +        device->nhats = 1; /* d-pad */
  14.102 +        device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
  14.103 +    }
  14.104 +    /* TODO: Handle micro profiles on tvOS. */
  14.105 +#endif
  14.106 +}
  14.107 +
  14.108 +static void
  14.109 +SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer)
  14.110 +{
  14.111 +    SDL_JoystickDeviceItem *device = deviceList;
  14.112 +#if !SDL_EVENTS_DISABLED
  14.113 +    SDL_Event event;
  14.114 +#endif
  14.115 +
  14.116 +    while (device != NULL) {
  14.117 +        if (device->controller == controller) {
  14.118 +            return;
  14.119 +        }
  14.120 +        device = device->next;
  14.121 +    }
  14.122 +
  14.123 +    device = (SDL_JoystickDeviceItem *) SDL_malloc(sizeof(SDL_JoystickDeviceItem));
  14.124 +    if (device == NULL) {
  14.125 +        return;
  14.126 +    }
  14.127 +
  14.128 +    SDL_zerop(device);
  14.129 +
  14.130 +    device->accelerometer = accelerometer;
  14.131 +    device->instance_id = instancecounter++;
  14.132 +
  14.133 +    if (accelerometer) {
  14.134 +        device->name = SDL_strdup(accelerometerName);
  14.135 +        device->naxes = 3; /* Device acceleration in the x, y, and z axes. */
  14.136 +        device->nhats = 0;
  14.137 +        device->nbuttons = 0;
  14.138 +
  14.139 +        /* Use the accelerometer name as a GUID. */
  14.140 +        SDL_memcpy(&device->guid.data, device->name, SDL_min(sizeof(SDL_JoystickGUID), SDL_strlen(device->name)));
  14.141 +    } else if (controller) {
  14.142 +        SDL_SYS_AddMFIJoystickDevice(device, controller);
  14.143 +    }
  14.144 +
  14.145 +    if (deviceList == NULL) {
  14.146 +        deviceList = device;
  14.147 +    } else {
  14.148 +        SDL_JoystickDeviceItem *lastdevice = deviceList;
  14.149 +        while (lastdevice->next != NULL) {
  14.150 +            lastdevice = lastdevice->next;
  14.151 +        }
  14.152 +        lastdevice->next = device;
  14.153 +    }
  14.154 +
  14.155 +    ++numjoysticks;
  14.156 +
  14.157 +#if !SDL_EVENTS_DISABLED
  14.158 +    event.type = SDL_JOYDEVICEADDED;
  14.159 +
  14.160 +    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  14.161 +        event.jdevice.which = numjoysticks - 1;
  14.162 +        if ((SDL_EventOK == NULL) ||
  14.163 +            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
  14.164 +            SDL_PushEvent(&event);
  14.165 +        }
  14.166 +    }
  14.167 +#endif /* !SDL_EVENTS_DISABLED */
  14.168 +}
  14.169 +
  14.170 +SDL_JoystickDeviceItem *
  14.171 +SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
  14.172 +{
  14.173 +    SDL_JoystickDeviceItem *prev = NULL;
  14.174 +    SDL_JoystickDeviceItem *next = NULL;
  14.175 +    SDL_JoystickDeviceItem *item = deviceList;
  14.176 +#if !SDL_EVENTS_DISABLED
  14.177 +    SDL_Event event;
  14.178 +#endif
  14.179 +
  14.180 +    if (device == NULL) {
  14.181 +        return NULL;
  14.182 +    }
  14.183 +
  14.184 +    next = device->next;
  14.185 +
  14.186 +    while (item != NULL) {
  14.187 +        if (item == device) {
  14.188 +            break;
  14.189 +        }
  14.190 +        prev = item;
  14.191 +        item = item->next;
  14.192 +    }
  14.193 +
  14.194 +    /* Unlink the device item from the device list. */
  14.195 +    if (prev) {
  14.196 +        prev->next = device->next;
  14.197 +    } else if (device == deviceList) {
  14.198 +        deviceList = device->next;
  14.199 +    }
  14.200 +
  14.201 +    if (device->joystick) {
  14.202 +        device->joystick->hwdata = NULL;
  14.203 +    }
  14.204 +
  14.205 +#ifdef SDL_JOYSTICK_MFI
  14.206 +    @autoreleasepool {
  14.207 +        if (device->controller) {
  14.208 +            /* The controller was explicitly retained in the struct, so it
  14.209 +             * should be explicitly released before freeing the struct. */
  14.210 +            GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller));
  14.211 +            controller.controllerPausedHandler = nil;
  14.212 +            device->controller = nil;
  14.213 +        }
  14.214 +    }
  14.215 +#endif /* SDL_JOYSTICK_MFI */
  14.216 +
  14.217 +    SDL_free(device->name);
  14.218 +    SDL_free(device);
  14.219 +
  14.220 +    --numjoysticks;
  14.221 +
  14.222 +#if !SDL_EVENTS_DISABLED
  14.223 +    event.type = SDL_JOYDEVICEREMOVED;
  14.224 +
  14.225 +    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  14.226 +        event.jdevice.which = device->instance_id;
  14.227 +        if ((SDL_EventOK == NULL) ||
  14.228 +            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
  14.229 +            SDL_PushEvent(&event);
  14.230 +        }
  14.231 +    }
  14.232 +#endif /* !SDL_EVENTS_DISABLED */
  14.233 +
  14.234 +    return next;
  14.235 +}
  14.236  
  14.237  /* Function to scan the system for joysticks.
  14.238   * Joystick 0 should be the system default joystick.
  14.239 @@ -45,10 +255,48 @@
  14.240  int
  14.241  SDL_SYS_JoystickInit(void)
  14.242  {
  14.243 -    const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
  14.244 -    if (!hint || SDL_atoi(hint)) {
  14.245 -        /* Default behavior, accelerometer as joystick */
  14.246 -        numjoysticks = 1;
  14.247 +    @autoreleasepool {
  14.248 +        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
  14.249 +        const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
  14.250 +
  14.251 +        if (!hint || SDL_atoi(hint)) {
  14.252 +            /* Default behavior, accelerometer as joystick */
  14.253 +            SDL_SYS_AddJoystickDevice(nil, SDL_TRUE);
  14.254 +        }
  14.255 +
  14.256 +#ifdef SDL_JOYSTICK_MFI
  14.257 +        /* GameController.framework was added in iOS 7. */
  14.258 +        if (![GCController class]) {
  14.259 +            return numjoysticks;
  14.260 +        }
  14.261 +
  14.262 +        for (GCController *controller in [GCController controllers]) {
  14.263 +            SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
  14.264 +        }
  14.265 +
  14.266 +        connectObserver = [center addObserverForName:GCControllerDidConnectNotification
  14.267 +                                              object:nil
  14.268 +                                               queue:nil
  14.269 +                                          usingBlock:^(NSNotification *note) {
  14.270 +                                              GCController *controller = note.object;
  14.271 +                                              SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
  14.272 +                                          }];
  14.273 +
  14.274 +        disconnectObserver = [center addObserverForName:GCControllerDidDisconnectNotification
  14.275 +                                                 object:nil
  14.276 +                                                  queue:nil
  14.277 +                                             usingBlock:^(NSNotification *note) {
  14.278 +                                                 GCController *controller = note.object;
  14.279 +                                                 SDL_JoystickDeviceItem *device = deviceList;
  14.280 +                                                 while (device != NULL) {
  14.281 +                                                     if (device->controller == controller) {
  14.282 +                                                         SDL_SYS_RemoveJoystickDevice(device);
  14.283 +                                                         break;
  14.284 +                                                     }
  14.285 +                                                     device = device->next;
  14.286 +                                                 }
  14.287 +                                             }];
  14.288 +#endif /* SDL_JOYSTICK_MFI */
  14.289      }
  14.290  
  14.291      return numjoysticks;
  14.292 @@ -67,13 +315,15 @@
  14.293  const char *
  14.294  SDL_SYS_JoystickNameForDeviceIndex(int device_index)
  14.295  {
  14.296 -    return accelerometerName;
  14.297 +    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
  14.298 +    return device ? device->name : "Unknown";
  14.299  }
  14.300  
  14.301  /* Function to perform the mapping from device index to the instance id for this index */
  14.302  SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
  14.303  {
  14.304 -    return device_index;
  14.305 +    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
  14.306 +    return device ? device->instance_id : 0;
  14.307  }
  14.308  
  14.309  /* Function to open a joystick for use.
  14.310 @@ -84,19 +334,40 @@
  14.311  int
  14.312  SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
  14.313  {
  14.314 -    joystick->naxes = 3;
  14.315 -    joystick->nhats = 0;
  14.316 +    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
  14.317 +    if (device == NULL) {
  14.318 +        return SDL_SetError("Could not open Joystick: no hardware device for the specified index");
  14.319 +    }
  14.320 +
  14.321 +    joystick->hwdata = device;
  14.322 +    joystick->instance_id = device->instance_id;
  14.323 +
  14.324 +    joystick->naxes = device->naxes;
  14.325 +    joystick->nhats = device->nhats;
  14.326 +    joystick->nbuttons = device->nbuttons;
  14.327      joystick->nballs = 0;
  14.328 -    joystick->nbuttons = 0;
  14.329 +
  14.330 +    device->joystick = joystick;
  14.331  
  14.332      @autoreleasepool {
  14.333 -        if (motionManager == nil) {
  14.334 -            motionManager = [[CMMotionManager alloc] init];
  14.335 +        if (device->accelerometer) {
  14.336 +            if (motionManager == nil) {
  14.337 +                motionManager = [[CMMotionManager alloc] init];
  14.338 +            }
  14.339 +
  14.340 +            /* Shorter times between updates can significantly increase CPU usage. */
  14.341 +            motionManager.accelerometerUpdateInterval = 0.1;
  14.342 +            [motionManager startAccelerometerUpdates];
  14.343 +        } else {
  14.344 +#ifdef SDL_JOYSTICK_MFI
  14.345 +            GCController *controller = device->controller;
  14.346 +            controller.controllerPausedHandler = ^(GCController *controller) {
  14.347 +                if (joystick->hwdata) {
  14.348 +                    ++joystick->hwdata->num_pause_presses;
  14.349 +                }
  14.350 +            };
  14.351 +#endif /* SDL_JOYSTICK_MFI */
  14.352          }
  14.353 -
  14.354 -        /* Shorter times between updates can significantly increase CPU usage. */
  14.355 -        motionManager.accelerometerUpdateInterval = 0.1;
  14.356 -        [motionManager startAccelerometerUpdates];
  14.357      }
  14.358  
  14.359      return 0;
  14.360 @@ -105,7 +376,7 @@
  14.361  /* Function to determine if this joystick is attached to the system right now */
  14.362  SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
  14.363  {
  14.364 -    return SDL_TRUE;
  14.365 +    return joystick->hwdata != NULL;
  14.366  }
  14.367  
  14.368  static void SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
  14.369 @@ -115,7 +386,7 @@
  14.370      CMAcceleration accel;
  14.371  
  14.372      @autoreleasepool {
  14.373 -        if (!motionManager.accelerometerActive) {
  14.374 +        if (!motionManager.isAccelerometerActive) {
  14.375              return;
  14.376          }
  14.377  
  14.378 @@ -144,9 +415,94 @@
  14.379      accel.z = SDL_min(SDL_max(accel.z, -maxgforce), maxgforce);
  14.380  
  14.381      /* pass in data mapped to range of SInt16 */
  14.382 -    SDL_PrivateJoystickAxis(joystick, 0, (accel.x / maxgforce) * maxsint16);
  14.383 +    SDL_PrivateJoystickAxis(joystick, 0,  (accel.x / maxgforce) * maxsint16);
  14.384      SDL_PrivateJoystickAxis(joystick, 1, -(accel.y / maxgforce) * maxsint16);
  14.385 -    SDL_PrivateJoystickAxis(joystick, 2, (accel.z / maxgforce) * maxsint16);
  14.386 +    SDL_PrivateJoystickAxis(joystick, 2,  (accel.z / maxgforce) * maxsint16);
  14.387 +}
  14.388 +
  14.389 +#ifdef SDL_JOYSTICK_MFI
  14.390 +static Uint8
  14.391 +SDL_SYS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
  14.392 +{
  14.393 +    Uint8 hat = 0;
  14.394 +
  14.395 +    if (dpad.up.isPressed) {
  14.396 +        hat |= SDL_HAT_UP;
  14.397 +    } else if (dpad.down.isPressed) {
  14.398 +        hat |= SDL_HAT_DOWN;
  14.399 +    }
  14.400 +
  14.401 +    if (dpad.left.isPressed) {
  14.402 +        hat |= SDL_HAT_LEFT;
  14.403 +    } else if (dpad.right.isPressed) {
  14.404 +        hat |= SDL_HAT_RIGHT;
  14.405 +    }
  14.406 +
  14.407 +    if (hat == 0) {
  14.408 +        return SDL_HAT_CENTERED;
  14.409 +    }
  14.410 +
  14.411 +    return hat;
  14.412 +}
  14.413 +#endif
  14.414 +
  14.415 +static void
  14.416 +SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick)
  14.417 +{
  14.418 +#ifdef SDL_JOYSTICK_MFI
  14.419 +    @autoreleasepool {
  14.420 +        GCController *controller = joystick->hwdata->controller;
  14.421 +        Uint8 hatstate = SDL_HAT_CENTERED;
  14.422 +        int i;
  14.423 +
  14.424 +        if (controller.extendedGamepad) {
  14.425 +            GCExtendedGamepad *gamepad = controller.extendedGamepad;
  14.426 +
  14.427 +            /* Axis order matches the XInput Windows mappings. */
  14.428 +            SDL_PrivateJoystickAxis(joystick, 0, (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767));
  14.429 +            SDL_PrivateJoystickAxis(joystick, 1, (Sint16) (gamepad.leftThumbstick.yAxis.value * 32767));
  14.430 +            SDL_PrivateJoystickAxis(joystick, 2, (Sint16) (gamepad.leftTrigger.value * 32767));
  14.431 +            SDL_PrivateJoystickAxis(joystick, 3, (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767));
  14.432 +            SDL_PrivateJoystickAxis(joystick, 4, (Sint16) (gamepad.rightThumbstick.yAxis.value * 32767));
  14.433 +            SDL_PrivateJoystickAxis(joystick, 5, (Sint16) (gamepad.rightTrigger.value * 32767));
  14.434 +
  14.435 +            hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
  14.436 +
  14.437 +            /* Button order matches the XInput Windows mappings. */
  14.438 +            SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed);
  14.439 +            SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed);
  14.440 +            SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed);
  14.441 +            SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed);
  14.442 +            SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed);
  14.443 +            SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed);
  14.444 +        } else if (controller.gamepad) {
  14.445 +            GCGamepad *gamepad = controller.gamepad;
  14.446 +
  14.447 +            hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
  14.448 +
  14.449 +            /* Button order matches the XInput Windows mappings. */
  14.450 +            SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed);
  14.451 +            SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed);
  14.452 +            SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed);
  14.453 +            SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed);
  14.454 +            SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed);
  14.455 +            SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed);
  14.456 +        }
  14.457 +        /* TODO: Handle micro profiles on tvOS. */
  14.458 +
  14.459 +        SDL_PrivateJoystickHat(joystick, 0, hatstate);
  14.460 +
  14.461 +        for (i = 0; i < joystick->hwdata->num_pause_presses; i++) {
  14.462 +            /* The pause button is always last. */
  14.463 +            Uint8 pausebutton = joystick->nbuttons - 1;
  14.464 +
  14.465 +            SDL_PrivateJoystickButton(joystick, pausebutton, 1);
  14.466 +            SDL_PrivateJoystickButton(joystick, pausebutton, 0);
  14.467 +        }
  14.468 +
  14.469 +        joystick->hwdata->num_pause_presses = 0;
  14.470 +    }
  14.471 +#endif
  14.472  }
  14.473  
  14.474  /* Function to update the state of a joystick - called as a device poll.
  14.475 @@ -157,15 +513,40 @@
  14.476  void
  14.477  SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
  14.478  {
  14.479 -    SDL_SYS_AccelerometerUpdate(joystick);
  14.480 +    SDL_JoystickDeviceItem *device = joystick->hwdata;
  14.481 +
  14.482 +    if (device == NULL) {
  14.483 +        return;
  14.484 +    }
  14.485 +
  14.486 +    if (device->accelerometer) {
  14.487 +        SDL_SYS_AccelerometerUpdate(joystick);
  14.488 +    } else if (device->controller) {
  14.489 +        SDL_SYS_MFIJoystickUpdate(joystick);
  14.490 +    }
  14.491  }
  14.492  
  14.493  /* Function to close a joystick after use */
  14.494  void
  14.495  SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  14.496  {
  14.497 +    SDL_JoystickDeviceItem *device = joystick->hwdata;
  14.498 +
  14.499 +    if (device == NULL) {
  14.500 +        return;
  14.501 +    }
  14.502 +
  14.503 +    device->joystick = NULL;
  14.504 +
  14.505      @autoreleasepool {
  14.506 -        [motionManager stopAccelerometerUpdates];
  14.507 +        if (device->accelerometer) {
  14.508 +            [motionManager stopAccelerometerUpdates];
  14.509 +        } else if (device->controller) {
  14.510 +#ifdef SDL_JOYSTICK_MFI
  14.511 +            GCController *controller = device->controller;
  14.512 +            controller.controllerPausedHandler = nil;
  14.513 +#endif
  14.514 +        }
  14.515      }
  14.516  }
  14.517  
  14.518 @@ -174,6 +555,24 @@
  14.519  SDL_SYS_JoystickQuit(void)
  14.520  {
  14.521      @autoreleasepool {
  14.522 +#ifdef SDL_JOYSTICK_MFI
  14.523 +        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
  14.524 +
  14.525 +        if (connectObserver) {
  14.526 +            [center removeObserver:connectObserver name:GCControllerDidConnectNotification object:nil];
  14.527 +            connectObserver = nil;
  14.528 +        }
  14.529 +
  14.530 +        if (disconnectObserver) {
  14.531 +            [center removeObserver:disconnectObserver name:GCControllerDidDisconnectNotification object:nil];
  14.532 +            disconnectObserver = nil;
  14.533 +        }
  14.534 +#endif /* SDL_JOYSTICK_MFI */
  14.535 +
  14.536 +        while (deviceList != NULL) {
  14.537 +            SDL_SYS_RemoveJoystickDevice(deviceList);
  14.538 +        }
  14.539 +
  14.540          motionManager = nil;
  14.541      }
  14.542  
  14.543 @@ -182,21 +581,24 @@
  14.544  
  14.545  SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
  14.546  {
  14.547 +    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
  14.548      SDL_JoystickGUID guid;
  14.549 -    /* the GUID is just the first 16 chars of the name for now */
  14.550 -    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
  14.551 -    SDL_zero( guid );
  14.552 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  14.553 +    if (device) {
  14.554 +        guid = device->guid;
  14.555 +    } else {
  14.556 +        SDL_zero(guid);
  14.557 +    }
  14.558      return guid;
  14.559  }
  14.560  
  14.561  SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
  14.562  {
  14.563      SDL_JoystickGUID guid;
  14.564 -    /* the GUID is just the first 16 chars of the name for now */
  14.565 -    const char *name = joystick->name;
  14.566 -    SDL_zero( guid );
  14.567 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  14.568 +    if (joystick->hwdata) {
  14.569 +        guid = joystick->hwdata->guid;
  14.570 +    } else {
  14.571 +        SDL_zero(guid);
  14.572 +    }
  14.573      return guid;
  14.574  }
  14.575  
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/joystick/iphoneos/SDL_sysjoystick_c.h	Sun Sep 20 23:08:36 2015 -0300
    15.3 @@ -0,0 +1,55 @@
    15.4 +/*
    15.5 +  Simple DirectMedia Layer
    15.6 +  Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
    15.7 +
    15.8 +  This software is provided 'as-is', without any express or implied
    15.9 +  warranty.  In no event will the authors be held liable for any damages
   15.10 +  arising from the use of this software.
   15.11 +
   15.12 +  Permission is granted to anyone to use this software for any purpose,
   15.13 +  including commercial applications, and to alter it and redistribute it
   15.14 +  freely, subject to the following restrictions:
   15.15 +
   15.16 +  1. The origin of this software must not be misrepresented; you must not
   15.17 +     claim that you wrote the original software. If you use this software
   15.18 +     in a product, an acknowledgment in the product documentation would be
   15.19 +     appreciated but is not required.
   15.20 +  2. Altered source versions must be plainly marked as such, and must not be
   15.21 +     misrepresented as being the original software.
   15.22 +  3. This notice may not be removed or altered from any source distribution.
   15.23 +*/
   15.24 +#include "../../SDL_internal.h"
   15.25 +
   15.26 +#ifndef SDL_JOYSTICK_IOS_H
   15.27 +#define SDL_JOYSTICK_IOS_H
   15.28 +
   15.29 +#include "SDL_stdinc.h"
   15.30 +#include "../SDL_sysjoystick.h"
   15.31 +
   15.32 +@class GCController;
   15.33 +
   15.34 +typedef struct joystick_hwdata
   15.35 +{
   15.36 +    SDL_bool accelerometer;
   15.37 +
   15.38 +    GCController __unsafe_unretained *controller;
   15.39 +    int num_pause_presses;
   15.40 +
   15.41 +    char *name;
   15.42 +    SDL_Joystick *joystick;
   15.43 +    SDL_JoystickID instance_id;
   15.44 +    SDL_JoystickGUID guid;
   15.45 +
   15.46 +    int naxes;
   15.47 +    int nbuttons;
   15.48 +    int nhats;
   15.49 +
   15.50 +    struct joystick_hwdata *next;
   15.51 +} joystick_hwdata;
   15.52 +
   15.53 +typedef joystick_hwdata SDL_JoystickDeviceItem;
   15.54 +
   15.55 +#endif /* SDL_JOYSTICK_IOS_H */
   15.56 +
   15.57 +
   15.58 +/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/test/testgamecontroller.c	Fri Sep 18 16:22:23 2015 -0400
    16.2 +++ b/test/testgamecontroller.c	Sun Sep 20 23:08:36 2015 -0300
    16.3 @@ -25,8 +25,8 @@
    16.4  #ifndef SDL_JOYSTICK_DISABLED
    16.5  
    16.6  #ifdef __IPHONEOS__
    16.7 -#define SCREEN_WIDTH    320
    16.8 -#define SCREEN_HEIGHT    480
    16.9 +#define SCREEN_WIDTH    480
   16.10 +#define SCREEN_HEIGHT    320
   16.11  #else
   16.12  #define SCREEN_WIDTH    512
   16.13  #define SCREEN_HEIGHT   317
    17.1 --- a/test/testjoystick.c	Fri Sep 18 16:22:23 2015 -0400
    17.2 +++ b/test/testjoystick.c	Sun Sep 20 23:08:36 2015 -0300
    17.3 @@ -243,6 +243,8 @@
    17.4      int i;
    17.5      SDL_Joystick *joystick;
    17.6  
    17.7 +    SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
    17.8 +
    17.9      /* Enable standard application logging */
   17.10      SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);	
   17.11  
   17.12 @@ -275,7 +277,7 @@
   17.13          }
   17.14      }
   17.15  
   17.16 -#ifdef __ANDROID__
   17.17 +#if defined(__ANDROID__) || defined(__IPHONEOS__)
   17.18      if (SDL_NumJoysticks() > 0) {
   17.19  #else
   17.20      if (argv[1]) {
   17.21 @@ -284,7 +286,7 @@
   17.22          SDL_bool keepGoing = SDL_TRUE;
   17.23          SDL_Event event;
   17.24          int device;
   17.25 -#ifdef __ANDROID__
   17.26 +#if defined(__ANDROID__) || defined(__IPHONEOS__)
   17.27          device = 0;
   17.28  #else
   17.29          device = atoi(argv[1]);