project_files/HedgewarsMobile/SDL-2cf94ca4ad24.patch
author koda
Sun, 28 Aug 2011 11:48:09 +0200
changeset 5697 e6630feefe88
permissions -rw-r--r--
the return of SDL.patch D: contains fixes for double free at window destruction, touch interface and the minimum ios version supported
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5697
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     1
diff -r 2cf94ca4ad24 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     2
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Tue Jul 26 14:20:22 2011 -0700
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     3
+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Aug 28 11:45:10 2011 +0200
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     4
@@ -1588,9 +1588,12 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     5
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     6
 				GCC_C_LANGUAGE_STANDARD = c99;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     7
 				GCC_DEBUGGING_SYMBOLS = full;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     8
+				GCC_OPTIMIZATION_LEVEL = 0;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
     9
+				GCC_THUMB_SUPPORT = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    10
+				GCC_VERSION = com.apple.compilers.llvmgcc42;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    11
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    12
 				GCC_WARN_UNUSED_VARIABLE = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    13
-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    14
+				IPHONEOS_DEPLOYMENT_TARGET = 4.0;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    15
 				ONLY_ACTIVE_ARCH = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    16
 				PREBINDING = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    17
 				SDKROOT = iphoneos;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    18
@@ -1605,9 +1608,12 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    19
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    20
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    21
 				GCC_C_LANGUAGE_STANDARD = c99;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    22
+				GCC_FAST_MATH = YES;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    23
+				GCC_THUMB_SUPPORT = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    24
+				GCC_VERSION = com.apple.compilers.llvmgcc42;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    25
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    26
 				GCC_WARN_UNUSED_VARIABLE = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    27
-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    28
+				IPHONEOS_DEPLOYMENT_TARGET = 4.0;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    29
 				PREBINDING = NO;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    30
 				SDKROOT = iphoneos;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    31
 				TARGETED_DEVICE_FAMILY = "1,2";
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    32
diff -r 2cf94ca4ad24 include/SDL_config_iphoneos.h
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    33
--- a/include/SDL_config_iphoneos.h	Tue Jul 26 14:20:22 2011 -0700
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    34
+++ b/include/SDL_config_iphoneos.h	Sun Aug 28 11:45:10 2011 +0200
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    35
@@ -106,7 +106,7 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    36
 /* enable iPhone version of Core Audio driver */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    37
 #define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    38
 /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    39
-#define SDL_AUDIO_DRIVER_DUMMY	1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    40
+#define SDL_AUDIO_DRIVER_DUMMY	0
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    41
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    42
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    43
 #define SDL_HAPTIC_DISABLED	1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    44
@@ -132,14 +132,17 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    45
 /* enable OpenGL ES */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    46
 #define SDL_VIDEO_OPENGL_ES	1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    47
 #define SDL_VIDEO_RENDER_OGL_ES	1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    48
-#define SDL_VIDEO_RENDER_OGL_ES2	1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    49
+#define SDL_VIDEO_RENDER_OGL_ES2	0
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    50
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    51
 /* Enable system power support */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    52
-#define SDL_POWER_UIKIT 1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    53
+#define SDL_POWER_UIKIT 0
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    54
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    55
 /* enable iPhone keyboard support */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    56
 #define SDL_IPHONE_KEYBOARD 1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    57
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    58
+/* enable joystick subsystem */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    59
+#define SDL_JOYSTICK_DISABLED 1
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    60
+
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    61
 /* Set max recognized G-force from accelerometer
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    62
    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    63
  */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    64
diff -r 2cf94ca4ad24 src/video/uikit/SDL_uikitopenglview.m
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    65
--- a/src/video/uikit/SDL_uikitopenglview.m	Tue Jul 26 14:20:22 2011 -0700
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    66
+++ b/src/video/uikit/SDL_uikitopenglview.m	Sun Aug 28 11:45:10 2011 +0200
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    67
@@ -123,8 +123,8 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    68
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    69
         // !!! FIXME: use the screen this is on!
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    70
         /* Use the main screen scale (for retina display support) */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    71
-        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    72
-            self.contentScaleFactor = [UIScreen mainScreen].scale;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    73
+        if ([self respondsToSelector:@selector(contentScaleFactor)])
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    74
+            self.contentScaleFactor = [[UIScreen mainScreen] scale];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    75
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    76
         self.autoresizingMask = 0;  // don't allow autoresize, since we need to do some magic in -(void)updateFrame.
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    77
     }
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    78
@@ -152,8 +152,8 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    79
     
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    80
     // !!! FIXME: use the screen this is on!
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    81
     /* Use the main screen scale (for retina display support) */
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    82
-    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    83
-        self.contentScaleFactor = [UIScreen mainScreen].scale;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    84
+    if ([self respondsToSelector:@selector(contentScaleFactor)])
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    85
+        self.contentScaleFactor = [[UIScreen mainScreen] scale];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    86
 }
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    87
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    88
 - (void)setCurrentContext {
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    89
diff -r 2cf94ca4ad24 src/video/uikit/SDL_uikitvideo.m
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    90
--- a/src/video/uikit/SDL_uikitvideo.m	Tue Jul 26 14:20:22 2011 -0700
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    91
+++ b/src/video/uikit/SDL_uikitvideo.m	Sun Aug 28 11:45:10 2011 +0200
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    92
@@ -245,12 +245,8 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    93
         const CGRect rect = [uiscreen bounds];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    94
         UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height);
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    95
     } else {
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    96
-        const NSArray *screens = [UIScreen screens];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    97
-        const NSUInteger screen_count = [screens count];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    98
-        NSUInteger i;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
    99
-        for (i = 0; i < screen_count; i++) {
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   100
+        for (UIScreen *uiscreen in [UIScreen screens]) {
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   101
             // the main screen is the first element in the array.
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   102
-            UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   103
             UIScreenMode *uiscreenmode = [uiscreen currentMode];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   104
             const CGSize size = [[uiscreen currentMode] size];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   105
             UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   106
@@ -286,6 +282,9 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   107
         UIScreen *uiscreen = (UIScreen *) display->driverdata;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   108
         [uiscreen release];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   109
         display->driverdata = NULL;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   110
+        UIScreenMode *desktopmode = (UIScreenMode *) display->desktop_mode.driverdata;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   111
+        [desktopmode release];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   112
+        display->desktop_mode.driverdata = NULL;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   113
         for (j = 0; j < display->num_display_modes; j++) {
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   114
             SDL_DisplayMode *mode = &display->display_modes[j];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   115
             UIScreenMode *uimode = (UIScreenMode *) mode->driverdata;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   116
diff -r 2cf94ca4ad24 src/video/uikit/SDL_uikitwindow.m
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   117
--- a/src/video/uikit/SDL_uikitwindow.m	Tue Jul 26 14:20:22 2011 -0700
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   118
+++ b/src/video/uikit/SDL_uikitwindow.m	Sun Aug 28 11:45:10 2011 +0200
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   119
@@ -145,7 +145,7 @@
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   120
     frame.origin.x = 0;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   121
     frame.origin.y = 0;
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   122
 
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   123
-    [uiwindow setFrame:frame];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   124
+    [uiwindow setFrame:[[UIScreen mainScreen] bounds]];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   125
     [data->view updateFrame];
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   126
     SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
e6630feefe88 the return of SDL.patch D:
koda
parents:
diff changeset
   127
 }