SDL included some of our patches mainstream
authorkoda
Sun, 20 Nov 2011 19:07:59 +0100
changeset 6409 ca93f38a1aab
parent 6407 f63b2330147a
child 6411 3cb15ca5319f
SDL included some of our patches mainstream
project_files/HedgewarsMobile/Classes/HWUtils.h
project_files/HedgewarsMobile/Classes/HWUtils.m
project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
project_files/HedgewarsMobile/Classes/ObjcExports.m
project_files/HedgewarsMobile/SDL-50560ca58f80.patch
project_files/HedgewarsMobile/SDL-687400b595ab.patch
--- a/project_files/HedgewarsMobile/Classes/HWUtils.h	Sun Nov 20 19:45:40 2011 +0300
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.h	Sun Nov 20 19:07:59 2011 +0100
@@ -37,9 +37,11 @@
 
 +(NSString *)modelType;
 +(NSArray *)teamColors;
++(void) releaseCache;
+
 +(NSInteger) randomPort;
 +(BOOL) isNetworkReachable;
-+(void) releaseCache;
++(UIView *)mainSDLViewInstance;
 
 @end
 
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m	Sun Nov 20 19:45:40 2011 +0300
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m	Sun Nov 20 19:07:59 2011 +0100
@@ -26,6 +26,7 @@
 #import <SystemConfiguration/SCNetworkReachability.h>
 #import "hwconsts.h"
 #import "EngineProtocolNetwork.h"
+#import "SDL_uikitwindow.h"
 
 static NSString *cachedModel = nil;
 static NSArray *cachedColors = nil;
@@ -62,7 +63,7 @@
 }
 
 #pragma mark -
-#pragma mark Helper Functions
+#pragma mark Helper Functions with cache
 +(NSString *)modelType {
     if (cachedModel == nil) {
         size_t size;
@@ -94,6 +95,13 @@
     return cachedColors;
 }
 
++(void) releaseCache {
+    [cachedModel release], cachedModel = nil;
+    [cachedColors release], cachedColors = nil;
+}
+
+#pragma mark -
+#pragma mark Helper Functions without cache
 +(NSInteger) randomPort {
     srandom(time(NULL));
     NSInteger res = (random() % 64511) + 1024;
@@ -138,9 +146,15 @@
     return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO;
 }
 
-+(void) releaseCache {
-    [cachedModel release], cachedModel = nil;
-    [cachedColors release], cachedColors = nil;
++(UIView *)mainSDLViewInstance {
+    SDL_Window *window = HW_getSDLWindow();
+    if (window == NULL) {
+        SDL_SetError("Window does not exist");
+        return nil;
+    }
+    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+    SDL_uikitview *view = data != NULL ? data->view : nil;
+    return view;
 }
 
 @end
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Sun Nov 20 19:45:40 2011 +0300
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Sun Nov 20 19:07:59 2011 +0100
@@ -23,8 +23,6 @@
 #import "SDL_sysvideo.h"
 #import "SDL_uikitkeyboard.h"
 
-//FIXME: add a proper #import when this is exposed in SDL
-extern UIView *SDL_getUikitView(void *);
 
 #define VIEW_HEIGHT 200
 
@@ -115,7 +113,7 @@
                                              cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"")
                                         destructiveButtonTitle:NSLocalizedString(@"Of course!", @"")
                                              otherButtonTitles:nil];
-            [actionSheet showInView:(IS_IPAD() ? self.view : SDL_getUikitView(HW_getSDLWindow()))];
+            [actionSheet showInView:(IS_IPAD() ? self.view : [HWUtils mainSDLViewInstance])];
             [actionSheet release];
 
             break;
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sun Nov 20 19:45:40 2011 +0300
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sun Nov 20 19:07:59 2011 +0100
@@ -23,8 +23,6 @@
 #import "OverlayViewController.h"
 #import "AmmoMenuViewController.h"
 
-//FIXME: add a proper #import when this is exposed in SDL
-extern UIView *SDL_getUikitView(void *);
 
 // cache the grenade time
 static NSInteger grenadeTime;
@@ -55,7 +53,7 @@
     overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
     // in order to get rotation events we have to insert the view inside the first view of the second window
     //TODO: when multihead make sure that overlay is displayed in the touch-enabled window
-    [SDL_getUikitView(HW_getSDLWindow()) addSubview:overlay_instance.view];
+    [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view];
     grenadeTime = 2;
 
     if ([HWUtils gameType] == gtSave) {
--- a/project_files/HedgewarsMobile/SDL-50560ca58f80.patch	Sun Nov 20 19:45:40 2011 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-diff -r 9738f2a8eee4 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
---- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Wed Nov 09 02:35:49 2011 -0500
-+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat Nov 12 21:55:27 2011 +0100
-@@ -1596,9 +1596,12 @@
- 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- 				GCC_C_LANGUAGE_STANDARD = c99;
- 				GCC_DEBUGGING_SYMBOLS = full;
-+				GCC_OPTIMIZATION_LEVEL = 0;
-+				GCC_THUMB_SUPPORT = NO;
-+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
- 				GCC_WARN_UNUSED_VARIABLE = NO;
--				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
-+				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- 				ONLY_ACTIVE_ARCH = NO;
- 				PREBINDING = NO;
- 				SDKROOT = iphoneos;
-@@ -1613,9 +1616,12 @@
- 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- 				GCC_C_LANGUAGE_STANDARD = c99;
-+				GCC_FAST_MATH = YES;
-+				GCC_THUMB_SUPPORT = NO;
-+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
- 				GCC_WARN_UNUSED_VARIABLE = NO;
--				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
-+				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- 				PREBINDING = NO;
- 				SDKROOT = iphoneos;
- 				TARGETED_DEVICE_FAMILY = "1,2";
-@@ -1630,6 +1636,7 @@
- 				DEPLOYMENT_LOCATION = NO;
- 				GCC_DYNAMIC_NO_PIC = NO;
- 				GCC_OPTIMIZATION_LEVEL = 0;
-+				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
- 				PREBINDING = NO;
- 				PRODUCT_NAME = SDL;
- 				SKIP_INSTALL = YES;
-@@ -1644,6 +1651,7 @@
- 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- 				DEPLOYMENT_LOCATION = NO;
- 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-+				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
- 				PREBINDING = NO;
- 				PRODUCT_NAME = SDL;
- 				SKIP_INSTALL = YES;
-diff -r 9738f2a8eee4 include/SDL_compat.h
---- a/include/SDL_compat.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_compat.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -40,7 +40,7 @@
- 
-  /*@}*/
- 
--#ifdef SDL_NO_COMPAT
-+#ifndef SDL_NO_COMPAT
- #define _SDL_compat_h
- #endif
- 
-diff -r 9738f2a8eee4 include/SDL_config_iphoneos.h
---- a/include/SDL_config_iphoneos.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_config_iphoneos.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -106,7 +106,7 @@
- /* enable iPhone version of Core Audio driver */
- #define SDL_AUDIO_DRIVER_COREAUDIO 1
- /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
--#define SDL_AUDIO_DRIVER_DUMMY	1
-+#define SDL_AUDIO_DRIVER_DUMMY	0
- 
- /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
- #define SDL_HAPTIC_DISABLED	1
-@@ -132,16 +132,16 @@
- /* enable OpenGL ES */
- #define SDL_VIDEO_OPENGL_ES	1
- #define SDL_VIDEO_RENDER_OGL_ES	1
--#define SDL_VIDEO_RENDER_OGL_ES2	1
-+#define SDL_VIDEO_RENDER_OGL_ES2	0
- 
- /* Enable system power support */
--#define SDL_POWER_UIKIT 1
-+#define SDL_POWER_UIKIT 0
- 
- /* enable iPhone keyboard support */
- #define SDL_IPHONE_KEYBOARD 1
- 
- /* enable joystick subsystem */
--#define SDL_JOYSTICK_DISABLED 0
-+#define SDL_JOYSTICK_DISABLED 1
- 
- /* Set max recognized G-force from accelerometer
-    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
-diff -r 9738f2a8eee4 include/SDL_events.h
---- a/include/SDL_events.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_events.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -107,11 +107,12 @@
- 
-     SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
- 
-+#ifndef SDL_NO_COMPAT
-     /* Obsolete events */
-     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
-     SDL_EVENT_COMPAT2,
-     SDL_EVENT_COMPAT3,
--
-+#endif
- 
-     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
-      *  and should be allocated with SDL_RegisterEvents()
-diff -r 9738f2a8eee4 src/SDL_compat.c
---- a/src/SDL_compat.c	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/SDL_compat.c	Sat Nov 12 21:55:27 2011 +0100
-@@ -29,6 +29,7 @@
- #include "video/SDL_pixels_c.h"
- #include "render/SDL_yuv_sw_c.h"
- 
-+#ifndef SDL_NO_COMPAT
- 
- static SDL_Window *SDL_VideoWindow = NULL;
- static SDL_Surface *SDL_WindowSurface = NULL;
-@@ -1813,4 +1814,5 @@
-     return 0;
- }
- 
-+#endif /* SDL_NO_COMPAT */
- /* vi: set ts=4 sw=4 expandtab: */
-diff -r 9738f2a8eee4 src/video/SDL_surface.c
---- a/src/video/SDL_surface.c	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/SDL_surface.c	Sat Nov 12 21:55:27 2011 +0100
-@@ -195,12 +195,14 @@
-         SDL_InvalidateMap(surface->map);
-     }
- 
-+#ifndef SDL_NO_COMPAT
-     /* Compatibility mode */
-     if (surface->map->info.flags & SDL_COPY_COLORKEY) {
-         surface->flags |= SDL_SRCCOLORKEY;
-     } else {
-         surface->flags &= ~SDL_SRCCOLORKEY;
-     }
-+#endif
- 
-     return 0;
- }
-@@ -405,12 +407,14 @@
-         SDL_InvalidateMap(surface->map);
-     }
- 
-+#ifndef SDL_NO_COMPAT
-     /* Compatibility mode */
-     if (surface->map->info.flags & SDL_COPY_BLEND) {
-         surface->flags |= SDL_SRCALPHA;
-     } else {
-         surface->flags &= ~SDL_SRCALPHA;
-     }
-+#endif
- 
-     return status;
- }
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.h
---- a/src/video/uikit/SDL_uikitappdelegate.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitappdelegate.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -24,7 +24,7 @@
- @interface SDLUIKitDelegate : NSObject<UIApplicationDelegate> {
- }
- 
--+ (SDLUIKitDelegate *)sharedAppDelegate;
-++ (id) sharedAppDelegate;
- + (NSString *)getAppDelegateClassName;
- 
- @end
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.m
---- a/src/video/uikit/SDL_uikitappdelegate.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitappdelegate.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -79,10 +79,10 @@
- @implementation SDLUIKitDelegate
- 
- /* convenience method */
--+ (SDLUIKitDelegate *)sharedAppDelegate
-++ (id) sharedAppDelegate
- {
-     /* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
--    return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
-+    return [[UIApplication sharedApplication] delegate];
- }
- 
- + (NSString *)getAppDelegateClassName
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopengles.m
---- a/src/video/uikit/SDL_uikitopengles.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitopengles.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -79,7 +79,7 @@
- 
- void UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
- {
--#ifdef SDL_POWER_UIKIT
-+#if SDL_POWER_UIKIT
-     // Check once a frame to see if we should turn off the battery monitor.
-     SDL_UIKit_UpdateBatteryMonitoring();
- #endif
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopenglview.m
---- a/src/video/uikit/SDL_uikitopenglview.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitopenglview.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -117,8 +117,8 @@
- 
-         // !!! FIXME: use the screen this is on!
-         /* Use the main screen scale (for retina display support) */
--        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
--            self.contentScaleFactor = [UIScreen mainScreen].scale;
-+        if ([self respondsToSelector:@selector(contentScaleFactor)])
-+            self.contentScaleFactor = [[UIScreen mainScreen] scale];
- 
-         self.autoresizingMask = 0;  // don't allow autoresize, since we need to do some magic in -(void)updateFrame.
-     }
-@@ -147,8 +147,8 @@
- 
-     // !!! FIXME: use the screen this is on!
-     /* Use the main screen scale (for retina display support) */
--    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
--        self.contentScaleFactor = [UIScreen mainScreen].scale;
-+    if ([self respondsToSelector:@selector(contentScaleFactor)])
-+        self.contentScaleFactor = [[UIScreen mainScreen] scale];
- }
- 
- - (void)setCurrentContext
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitvideo.m
---- a/src/video/uikit/SDL_uikitvideo.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitvideo.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -201,10 +201,8 @@
- {
-     _this->gl_config.driver_loaded = 1;
- 
--    NSString *reqSysVer = @"3.2";
--    NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
--    if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
--        SDL_UIKit_supports_multiple_displays = YES;
-+    // this tells us whether we are running on ios >= 3.2
-+    SDL_UIKit_supports_multiple_displays = [UIScreen instancesRespondToSelector:@selector(currentMode)];
- 
-     // Add the main screen.
-     UIScreen *uiscreen = [UIScreen mainScreen];
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitview.m
---- a/src/video/uikit/SDL_uikitview.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitview.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -316,7 +316,7 @@
- /* iPhone keyboard addition functions */
- #if SDL_IPHONE_KEYBOARD
- 
--static SDL_uikitview * getWindowView(SDL_Window * window)
-+SDL_uikitview *SDL_getUikitView(SDL_Window *window)
- {
-     if (window == NULL) {
-         SDL_SetError("Window does not exist");
-@@ -333,9 +333,9 @@
-     return view;
- }
- 
--int SDL_iPhoneKeyboardShow(SDL_Window * window)
-+int SDL_iPhoneKeyboardShow(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -344,9 +344,9 @@
-     return 0;
- }
- 
--int SDL_iPhoneKeyboardHide(SDL_Window * window)
-+int SDL_iPhoneKeyboardHide(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -355,9 +355,9 @@
-     return 0;
- }
- 
--SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
-+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return 0;
-     }
-@@ -365,9 +365,9 @@
-     return view.keyboardVisible;
- }
- 
--int SDL_iPhoneKeyboardToggle(SDL_Window * window)
-+int SDL_iPhoneKeyboardToggle(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -385,24 +385,24 @@
- 
- /* stubs, used if compiled without keyboard support */
- 
--int SDL_iPhoneKeyboardShow(SDL_Window * window)
-+int SDL_iPhoneKeyboardShow(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
- }
- 
--int SDL_iPhoneKeyboardHide(SDL_Window * window)
-+int SDL_iPhoneKeyboardHide(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
- }
- 
--SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
-+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window)
- {
-     return 0;
- }
- 
--int SDL_iPhoneKeyboardToggle(SDL_Window * window)
-+int SDL_iPhoneKeyboardToggle(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitviewcontroller.m
---- a/src/video/uikit/SDL_uikitviewcontroller.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitviewcontroller.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -30,8 +30,8 @@
- 
- #include "SDL_uikitwindow.h"
- 
--#import "SDL_uikitviewcontroller.h"
--
-+#include "SDL_uikitviewcontroller.h"
-+#include "SDL_uikitvideo.h"
- 
- @implementation SDL_uikitviewcontroller
- 
-@@ -118,38 +118,17 @@
-     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
-     SDL_WindowData *data = self->window->driverdata;
-     UIWindow *uiwindow = data->uiwindow;
--    UIScreen *uiscreen = [uiwindow screen];
-+    UIScreen *uiscreen;
-+    if (SDL_UIKit_supports_multiple_displays)
-+        uiscreen = [uiwindow screen];
-+    else
-+        uiscreen = [UIScreen mainScreen];
-     const int noborder = self->window->flags & SDL_WINDOW_BORDERLESS;
-     CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame];
--    const CGSize size = frame.size;
--    int w, h;
--
--    switch (toInterfaceOrientation) {
--        case UIInterfaceOrientationPortrait:
--        case UIInterfaceOrientationPortraitUpsideDown:
--            w = (size.width < size.height) ? size.width : size.height;
--            h = (size.width > size.height) ? size.width : size.height;
--            break;
--
--        case UIInterfaceOrientationLandscapeLeft:
--        case UIInterfaceOrientationLandscapeRight:
--            w = (size.width > size.height) ? size.width : size.height;
--            h = (size.width < size.height) ? size.width : size.height;
--            break;
--
--        default:
--            SDL_assert(0 && "Unexpected interface orientation!");
--            return;
--    }
--
--    frame.size.width = w;
--    frame.size.height = h;
--    frame.origin.x = 0;
--    frame.origin.y = 0;
- 
-     [uiwindow setFrame:frame];
-     [data->view updateFrame];
--    SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
-+    SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, frame.size.width, frame.size.height);
- }
- 
- #endif /* SDL_VIDEO_DRIVER_UIKIT */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/SDL-687400b595ab.patch	Sun Nov 20 19:07:59 2011 +0100
@@ -0,0 +1,198 @@
+diff -r 687400b595ab Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
+--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat Nov 19 19:23:33 2011 -0500
++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Nov 20 18:57:07 2011 +0100
+@@ -1596,9 +1596,12 @@
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
+ 				GCC_DEBUGGING_SYMBOLS = full;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				ONLY_ACTIVE_ARCH = NO;
+ 				PREBINDING = NO;
+ 				SDKROOT = iphoneos;
+@@ -1613,9 +1616,12 @@
+ 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
++				GCC_FAST_MATH = YES;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				PREBINDING = NO;
+ 				SDKROOT = iphoneos;
+ 				TARGETED_DEVICE_FAMILY = "1,2";
+@@ -1630,6 +1636,7 @@
+ 				DEPLOYMENT_LOCATION = NO;
+ 				GCC_DYNAMIC_NO_PIC = NO;
+ 				GCC_OPTIMIZATION_LEVEL = 0;
++				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
+ 				PREBINDING = NO;
+ 				PRODUCT_NAME = SDL;
+ 				SKIP_INSTALL = YES;
+@@ -1644,6 +1651,7 @@
+ 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ 				DEPLOYMENT_LOCATION = NO;
+ 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
++				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
+ 				PREBINDING = NO;
+ 				PRODUCT_NAME = SDL;
+ 				SKIP_INSTALL = YES;
+diff -r 687400b595ab include/SDL_compat.h
+--- a/include/SDL_compat.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_compat.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -40,7 +40,7 @@
+ 
+  /*@}*/
+ 
+-#ifdef SDL_NO_COMPAT
++#ifndef SDL_NO_COMPAT
+ #define _SDL_compat_h
+ #endif
+ 
+diff -r 687400b595ab include/SDL_config_iphoneos.h
+--- a/include/SDL_config_iphoneos.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_config_iphoneos.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -106,7 +106,7 @@
+ /* enable iPhone version of Core Audio driver */
+ #define SDL_AUDIO_DRIVER_COREAUDIO 1
+ /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+-#define SDL_AUDIO_DRIVER_DUMMY	1
++#define SDL_AUDIO_DRIVER_DUMMY	0
+ 
+ /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+ #define SDL_HAPTIC_DISABLED	1
+@@ -132,16 +132,16 @@
+ /* enable OpenGL ES */
+ #define SDL_VIDEO_OPENGL_ES	1
+ #define SDL_VIDEO_RENDER_OGL_ES	1
+-#define SDL_VIDEO_RENDER_OGL_ES2	1
++#define SDL_VIDEO_RENDER_OGL_ES2	0
+ 
+ /* Enable system power support */
+-#define SDL_POWER_UIKIT 1
++#define SDL_POWER_UIKIT 0
+ 
+ /* enable iPhone keyboard support */
+ #define SDL_IPHONE_KEYBOARD 1
+ 
+ /* enable joystick subsystem */
+-#define SDL_JOYSTICK_DISABLED 0
++#define SDL_JOYSTICK_DISABLED 1
+ 
+ /* Set max recognized G-force from accelerometer
+    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
+diff -r 687400b595ab include/SDL_events.h
+--- a/include/SDL_events.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_events.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -107,11 +107,12 @@
+ 
+     SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+ 
++#ifndef SDL_NO_COMPAT
+     /* Obsolete events */
+     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
+     SDL_EVENT_COMPAT2,
+     SDL_EVENT_COMPAT3,
+-
++#endif
+ 
+     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+      *  and should be allocated with SDL_RegisterEvents()
+diff -r 687400b595ab src/SDL_compat.c
+--- a/src/SDL_compat.c	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/SDL_compat.c	Sun Nov 20 18:57:07 2011 +0100
+@@ -29,6 +29,7 @@
+ #include "video/SDL_pixels_c.h"
+ #include "render/SDL_yuv_sw_c.h"
+ 
++#ifndef SDL_NO_COMPAT
+ 
+ static SDL_Window *SDL_VideoWindow = NULL;
+ static SDL_Surface *SDL_WindowSurface = NULL;
+@@ -1813,4 +1814,5 @@
+     return 0;
+ }
+ 
++#endif /* SDL_NO_COMPAT */
+ /* vi: set ts=4 sw=4 expandtab: */
+diff -r 687400b595ab src/video/SDL_surface.c
+--- a/src/video/SDL_surface.c	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/SDL_surface.c	Sun Nov 20 18:57:07 2011 +0100
+@@ -195,12 +195,14 @@
+         SDL_InvalidateMap(surface->map);
+     }
+ 
++#ifndef SDL_NO_COMPAT
+     /* Compatibility mode */
+     if (surface->map->info.flags & SDL_COPY_COLORKEY) {
+         surface->flags |= SDL_SRCCOLORKEY;
+     } else {
+         surface->flags &= ~SDL_SRCCOLORKEY;
+     }
++#endif
+ 
+     return 0;
+ }
+@@ -405,12 +407,14 @@
+         SDL_InvalidateMap(surface->map);
+     }
+ 
++#ifndef SDL_NO_COMPAT
+     /* Compatibility mode */
+     if (surface->map->info.flags & SDL_COPY_BLEND) {
+         surface->flags |= SDL_SRCALPHA;
+     } else {
+         surface->flags &= ~SDL_SRCALPHA;
+     }
++#endif
+ 
+     return status;
+ }
+diff -r 687400b595ab src/video/uikit/SDL_uikitopenglview.m
+--- a/src/video/uikit/SDL_uikitopenglview.m	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/uikit/SDL_uikitopenglview.m	Sun Nov 20 18:57:07 2011 +0100
+@@ -80,7 +80,7 @@
+ 
+         // !!! FIXME: use the screen this is on!
+         /* Use the main screen scale (for retina display support) */
+-        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
++        if ([self respondsToSelector:@selector(contentScaleFactor)])
+             self.contentScaleFactor = [UIScreen mainScreen].scale;
+ 
+         /* create the buffers */
+diff -r 687400b595ab src/video/uikit/SDL_uikitviewcontroller.m
+--- a/src/video/uikit/SDL_uikitviewcontroller.m	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/uikit/SDL_uikitviewcontroller.m	Sun Nov 20 18:57:07 2011 +0100
+@@ -29,9 +29,8 @@
+ #include "../../events/SDL_events_c.h"
+ 
+ #include "SDL_uikitwindow.h"
+-
+-#import "SDL_uikitviewcontroller.h"
+-
++#include "SDL_uikitviewcontroller.h"
++#include "SDL_uikitvideo.h"
+ 
+ @implementation SDL_uikitviewcontroller
+ 
+@@ -114,7 +113,11 @@
+     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
+     SDL_WindowData *data = self->window->driverdata;
+     UIWindow *uiwindow = data->uiwindow;
+-    UIScreen *uiscreen = [uiwindow screen];
++    UIScreen *uiscreen;
++    if (SDL_UIKit_supports_multiple_displays)
++        uiscreen = [uiwindow screen];
++    else
++        uiscreen = [UIScreen mainScreen];
+     const int noborder = (self->window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS));
+     CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame];
+     const CGSize size = frame.size;