various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
authorkoda
Sun, 03 Oct 2010 00:23:05 +0200
changeset 3923 694e6f6e0e30
parent 3922 44804043b691
child 3924 2a9ace189288
child 3925 44b4218605f6
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames) added the patch for compiling SDL
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/GameConfigViewController.h
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/LevelViewController.m
project_files/HedgewarsMobile/Classes/MainMenuViewController.h
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/SavedGamesViewController.h
project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib
project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib
project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib
project_files/HedgewarsMobile/Resources/Settings/version.txt
project_files/HedgewarsMobile/SDL.patch
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sun Oct 03 00:23:05 2010 +0200
@@ -27,7 +27,7 @@
 #define DOCUMENTS_FOLDER()      [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
 
 #define SETTINGS_FILE()         [DOCUMENTS_FOLDER() stringByAppendingString:@"/settings.plist"]
-#define DEBUG_FILE()            [DOCUMENTS_FOLDER() stringByAppendingString:@"/hw-debug.log"]
+#define DEBUG_FILE()            [DOCUMENTS_FOLDER() stringByAppendingString:@"/hw-game.log"]
 
 #define TEAMS_DIRECTORY()       [DOCUMENTS_FOLDER() stringByAppendingString:@"/Teams/"]
 #define WEAPONS_DIRECTORY()     [DOCUMENTS_FOLDER() stringByAppendingString:@"/Weapons/"]
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h	Sun Oct 03 00:23:05 2010 +0200
@@ -31,7 +31,6 @@
     UIView *imgContainer;
     HelpPageViewController *helpPage;
     
-    UIViewController *activeController;
     MapConfigViewController *mapConfigViewController;
     TeamConfigViewController *teamConfigViewController;
     SchemeWeaponConfigViewController *schemeWeaponConfigViewController;
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Sun Oct 03 00:23:05 2010 +0200
@@ -81,27 +81,34 @@
             // this init here is just aestetic as this controller was already set up in viewDidLoad
             if (mapConfigViewController == nil) {
                 mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
+                [self.view addSubview:mapConfigViewController.view];
             }
-            activeController = mapConfigViewController;
+            // this message is compulsory otherwise the table won't be loaded at all
+            [mapConfigViewController viewWillAppear:NO];
+            [self.view bringSubviewToFront:mapConfigViewController.view];
             break;
         case 1:
             if (teamConfigViewController == nil) {
                 teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                // this message is compulsory otherwise the table won't be loaded at all
+                [self.view addSubview:teamConfigViewController.view];
             }
-            activeController = teamConfigViewController;
+            // this message is compulsory otherwise the table won't be loaded at all
+            [teamConfigViewController viewWillAppear:NO];
+            [self.view bringSubviewToFront:teamConfigViewController.view];
             break;
         case 2:
             if (schemeWeaponConfigViewController == nil) {
                 schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                [self.view addSubview:schemeWeaponConfigViewController.view];
             }
-            activeController = schemeWeaponConfigViewController;
+            // this message is compulsory otherwise the table won't be loaded at all
+            [schemeWeaponConfigViewController viewWillAppear:NO];
+            [self.view bringSubviewToFront:schemeWeaponConfigViewController.view];
+            break;
+        default:
+            DLog(@"Nope");
             break;
     }
-
-    // this message is compulsory otherwise the table won't be loaded at all
-    [activeController viewWillAppear:NO];
-    [self.view addSubview:activeController.view];
 }
 
 -(BOOL) isEverythingSet {
@@ -234,27 +241,22 @@
     self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width);
 
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
-        // load a base image that will be updated in viewWill Load
-        NSString *filePath = [NSString stringWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()];
-        UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath andCutAt:CGRectMake(96, 0, 32, 32)];
-        self.hedgehogImage = sprite;
-        [sprite release];
         srandom(time(NULL));
+        self.hedgehogImage = nil;
         
         // load other controllers
         if (mapConfigViewController == nil)
             mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil];
         mapConfigViewController.delegate = self;
+        mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width);
         if (teamConfigViewController == nil)
             teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
-        teamConfigViewController.view.frame = CGRectMake(362, 200, 300, 480);
-        teamConfigViewController.view.backgroundColor = [UIColor clearColor];
+        teamConfigViewController.view.frame = CGRectMake(362, 200, 328, 480);
         [mapConfigViewController.view addSubview:teamConfigViewController.view];
         if (schemeWeaponConfigViewController == nil)
             schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
         schemeWeaponConfigViewController.view.frame = CGRectMake(10, 70, 300, 550);
         [mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view];
-        mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width);
     } else {
         // this is the visible controller
         mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
@@ -262,8 +264,6 @@
         schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
         [self.view addSubview:schemeWeaponConfigViewController.view];
     }
-    activeController = mapConfigViewController;
-
     [self.view addSubview:mapConfigViewController.view];
 
     [super viewDidLoad];
@@ -271,6 +271,14 @@
 
 -(void) viewWillAppear:(BOOL)animated {
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+        // load a base image that will be updated in viewWill Load
+        if (self.hedgehogImage == nil) {
+            NSString *filePath = [NSString stringWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()];
+            UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath andCutAt:CGRectMake(96, 0, 32, 32)];
+            self.hedgehogImage = sprite;
+            [sprite release];
+        }
+        
         NSArray *hatArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:HATS_DIRECTORY() error:NULL];
         int numberOfHats = [hatArray count];
         if (self.imgContainer == nil)
@@ -329,25 +337,23 @@
 
 -(void) didReceiveMemoryWarning {
     // Releases the view if it doesn't have a superview.
-    if (activeController.view.superview == nil)
-        activeController = nil;
     if (mapConfigViewController.view.superview == nil)
         mapConfigViewController = nil;
     if (teamConfigViewController.view.superview == nil)
         teamConfigViewController = nil;
     if (schemeWeaponConfigViewController.view.superview == nil)
-        schemeWeaponConfigViewController = nil;    
-    // Release any cached data, images, etc that aren't in use.
+        schemeWeaponConfigViewController = nil;
 
+    // Release any cached data, images, etc that aren't in use.
     self.imgContainer = nil;
+    self.hedgehogImage = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    MSG_MEMCLEAN();
 }
 
 -(void) viewDidUnload {
-    hedgehogImage = nil;
-    imgContainer = nil;
-    activeController = nil;
+    self.hedgehogImage = nil;
+    self.imgContainer = nil;
     mapConfigViewController = nil;
     teamConfigViewController = nil;
     schemeWeaponConfigViewController = nil;
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Sun Oct 03 00:23:05 2010 +0200
@@ -199,6 +199,7 @@
     if ([[gamemodArray objectAtIndex:i++] boolValue])
         result |= 0x00100000;  
 
+    DLog(@"Sent %d flags",i);
     NSString *flags = [[NSString alloc] initWithFormat:@"e$gmflags %d",result];
     [self sendToEngine:flags];
     [flags release];
@@ -242,6 +243,7 @@
     [self sendToEngine:explosives];
     [explosives release];
 
+    DLog(@"Sent %d modes",i);
     [schemeDictionary release];
     return result;
 }
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.m	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m	Sun Oct 03 00:23:05 2010 +0200
@@ -144,6 +144,7 @@
         level = 0;
     }
 
+    DLog(@"New level is %d",level);
     for (NSMutableDictionary *hog in hogs)
         [hog setObject:[NSNumber numberWithInt:0] forKey:@"level"];
 
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.h	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.h	Sun Oct 03 00:23:05 2010 +0200
@@ -21,20 +21,18 @@
 
 #import <UIKit/UIKit.h>
 
+@class GameConfigViewController;
 @class SplitViewRootController;
-@class GameConfigViewController;
 @class AboutViewController;
 @class SavedGamesViewController;
 
 @interface MainMenuViewController : UIViewController <UIAlertViewDelegate> {
-    UILabel *versionLabel;
     GameConfigViewController *gameConfigViewController;
     SplitViewRootController *settingsViewController;
     AboutViewController *aboutViewController;
     SavedGamesViewController *savedGamesViewController;
 }
 
-@property (nonatomic,retain) IBOutlet UILabel *versionLabel;
 @property (nonatomic,retain) GameConfigViewController *gameConfigViewController;
 @property (nonatomic,retain) SplitViewRootController *settingsViewController;
 @property (nonatomic,retain) AboutViewController *aboutViewController;
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sun Oct 03 00:23:05 2010 +0200
@@ -22,7 +22,6 @@
 #import "MainMenuViewController.h"
 #import "CommodityFunctions.h"
 #import "SDL_uikitappdelegate.h"
-#import "SDL_mixer.h"
 #import "PascalImports.h"
 #import "GameConfigViewController.h"
 #import "SplitViewRootController.h"
@@ -30,7 +29,7 @@
 #import "SavedGamesViewController.h"
 
 @implementation MainMenuViewController
-@synthesize versionLabel, gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController;
+@synthesize gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController;
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
     return rotationManager(interfaceOrientation);
@@ -55,175 +54,106 @@
 
 // check if some configuration files are already set; if they are present it means that the current copy must be updated
 -(void) createNecessaryFiles {
-    BOOL doCreateFiles = NO;
+    NSError *err = nil;
+    NSString *directoryToCheck, *fileToCheck, *fileToUpdate;
     NSString *resDir = [[NSBundle mainBundle] resourcePath];
+    DLog(@"Creating necessary files");
     
-    NSString *versionFileToCheck = [NSString stringWithFormat:@"%@/version.txt",DOCUMENTS_FOLDER()];
-    if ([[NSFileManager defaultManager] fileExistsAtPath:versionFileToCheck]) {
-        NSString *currentVersion = [NSString stringWithContentsOfFile:versionFileToCheck encoding:NSUTF8StringEncoding error:nil];
-        NSString *newVersion = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/Settings/version.txt",resDir] encoding:NSUTF8StringEncoding error:nil];
-        if ([currentVersion intValue] < [newVersion intValue]) {
-            doCreateFiles = YES;
-            [newVersion writeToFile:versionFileToCheck atomically:YES encoding:NSUTF8StringEncoding error:nil];
-        }
-    } else {
-        doCreateFiles = YES;
-        [[NSFileManager defaultManager] copyItemAtPath:[NSString stringWithFormat:@"%@/Settings/version.txt",resDir] toPath:versionFileToCheck error:nil];
-    } 
-
+    // create an empty saves directory by deleting the previous one (saves are incompatible between releases)
+    if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
+        [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
+    [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
     
-    if (doCreateFiles == YES) {
-        NSError *err = nil;
-        NSString *directoryToCheck, *fileToCheck, *fileToUpdate;
-        DLog(@"Creating necessary files");
-        
-        // create an empty saves directory by deleting the previous one (saves are incompatible between releases)
-        if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
-            [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
-        [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
-        
-        // if the settings file is already present, we merge current preferences with the update
-        directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir];
-        if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) {
-            NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()];
-            NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:directoryToCheck];
-            [update addEntriesFromDictionary:settings];
-            [settings release];
-            [update writeToFile:SETTINGS_FILE() atomically:YES];
-            [update release];
-        } else 
-            [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:SETTINGS_FILE() error:&err];
-        
-        // if the teams are already present we merge the old teams if they still exist
-        directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Teams",resDir];
-        if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()]) {
-            for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:nil]) {
-                fileToCheck = [NSString stringWithFormat:@"%@/%@",TEAMS_DIRECTORY(),str];
-                fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Teams/%@",resDir,str];
-                if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
-                    NSDictionary *team = [[NSDictionary alloc] initWithContentsOfFile:fileToCheck];
-                    NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:fileToUpdate];
-                    [update addEntriesFromDictionary:team];
-                    [team release];
-                    [update writeToFile:fileToCheck atomically:YES];
-                    [update release];
-                }
+    // if the settings file is already present, we merge current preferences with the update
+    directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) {
+        NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()];
+        NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:directoryToCheck];
+        [update addEntriesFromDictionary:settings];
+        [settings release];
+        [update writeToFile:SETTINGS_FILE() atomically:YES];
+        [update release];
+    } else 
+        [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:SETTINGS_FILE() error:&err];
+    
+    // if the teams are already present we merge the old teams if they still exist
+    directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Teams",resDir];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()]) {
+        for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:&err]) {
+            fileToCheck = [NSString stringWithFormat:@"%@/%@",TEAMS_DIRECTORY(),str];
+            fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Teams/%@",resDir,str];
+            if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
+                NSDictionary *team = [[NSDictionary alloc] initWithContentsOfFile:fileToCheck];
+                NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:fileToUpdate];
+                [update addEntriesFromDictionary:team];
+                [team release];
+                [update writeToFile:fileToCheck atomically:YES];
+                [update release];
             }
-        } else
-            [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:TEAMS_DIRECTORY() error:&err];
-
-        // the same holds for schemes (but they're arrays)
-        directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Schemes",resDir];
-        if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()]) {
-            for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:nil]) {
-                fileToCheck = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),str];
-                fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Schemes/%@",resDir,str];
-                if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
-                    NSArray *scheme = [[NSArray alloc] initWithContentsOfFile:fileToCheck];
-                    NSArray *update = [[NSArray alloc] initWithContentsOfFile:fileToUpdate];
-                    if ([update count] > [scheme count])
-                        [update writeToFile:fileToCheck atomically:YES];
-                    [update release];
-                    [scheme release];
-                }
+        }
+    } else
+        [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:TEAMS_DIRECTORY() error:&err];
+    
+    // the same holds for schemes (but they're arrays)
+    directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Schemes",resDir];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()]) {
+        for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:nil]) {
+            fileToCheck = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),str];
+            fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Schemes/%@",resDir,str];
+            if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
+                NSArray *scheme = [[NSArray alloc] initWithContentsOfFile:fileToCheck];
+                NSArray *update = [[NSArray alloc] initWithContentsOfFile:fileToUpdate];
+                if ([update count] > [scheme count])
+                    [update writeToFile:fileToCheck atomically:YES];
+                [update release];
+                [scheme release];
             }
-        } else
-            [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:SCHEMES_DIRECTORY() error:&err];
-        
-        // we create weapons the first time only, they are autoupdated each time
-        if ([[NSFileManager defaultManager] fileExistsAtPath:WEAPONS_DIRECTORY()] == NO) {
-            [[NSFileManager defaultManager] createDirectoryAtPath:WEAPONS_DIRECTORY()
-                                      withIntermediateDirectories:YES
-                                                       attributes:nil
-                                                            error:&err];
-            createWeaponNamed(@"Default", 0);
-            createWeaponNamed(@"Crazy", 1);
-            createWeaponNamed(@"Pro mode", 2);
-            createWeaponNamed(@"Shoppa", 3);
-            createWeaponNamed(@"Basketball", 4);
-            createWeaponNamed(@"Minefield", 5);
         }
-        
-        DLog(@"Success");
-        
-        if (err != nil) 
-            DLog(@"%@", err);
-    }
-}
-
-/* // ask the user to leave a review for this app
--(void) reviewCounter {
-    CGFloat reviewInt = [[NSUserDefaults standardUserDefaults] integerForKey: @"intValueKey"];
+    } else
+        [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:SCHEMES_DIRECTORY() error:&err];
     
-    if (reviewInt) {
-        reviewInt++;
-        [[NSUserDefaults standardUserDefaults] setInteger:reviewInt forKey:@"intValueKey"];
-    } else {
-        CGFloat start = 1;
-        NSUserDefaults *reviewPrefs = [NSUserDefaults standardUserDefaults];
-        [reviewPrefs setInteger:start forKey: @"intValueKey"];
-        [reviewPrefs synchronize]; // writes modifications to disk
+    // we create weapons the first time only, they are autoupdated each time
+    if ([[NSFileManager defaultManager] fileExistsAtPath:WEAPONS_DIRECTORY()] == NO) {
+        [[NSFileManager defaultManager] createDirectoryAtPath:WEAPONS_DIRECTORY()
+                                  withIntermediateDirectories:YES
+                                                   attributes:nil
+                                                        error:&err];
+        createWeaponNamed(@"Default", 0);
+        createWeaponNamed(@"Crazy", 1);
+        createWeaponNamed(@"Pro mode", 2);
+        createWeaponNamed(@"Shoppa", 3);
+        createWeaponNamed(@"Basketball", 4);
+        createWeaponNamed(@"Minefield", 5);
     }
     
-    if (1) {
-        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Mabuhay!"
-                                                        message:@"Looks like you Enjoy using this app. Could you spare a moment of your time to review it in the AppStore?"
-                                                       delegate:self
-                                              cancelButtonTitle:nil
-                                              otherButtonTitles: @"OK, I'll Review It Now", @"Remind Me Later", @"Don't Remind Me", nil];
-        [alert show]; 
-        [alert release];
-        
-        reviewInt++;
-        
-        [[NSUserDefaults standardUserDefaults] setInteger:reviewInt forKey:@"intValueKey"];
-    }
+    if (err != nil) 
+        DLog(@"%@", err);
+    else
+        DLog(@"Success");
 }
 
 #pragma mark -
-#pragma mark alert view delegate
--(void) alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger) buttonIndex {
-    // the user clicked one of the OK/Cancel buttons
-    if (buttonIndex == 0) {
-        NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
-        str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str]; 
-        str = [NSString stringWithFormat:@"%@type=Vittorio+Giovara&id=", str];
-        
-        // Here is the app id from itunesconnect
-        str = [NSString stringWithFormat:@"%@391234866", str]; 
-        
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=391234866&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"]]; 
-    } else if (buttonIndex == 1) {
-        int startAgain = 0;
-        [[NSUserDefaults standardUserDefaults] setInteger:startAgain forKey:@"intValueKey"];
-        
-    } else if (buttonIndex == 2) { 
-        int neverRemind = 4;
-        [[NSUserDefaults standardUserDefaults] setInteger:neverRemind forKey:@"intValueKey"];
-    }
-} */
+-(void) viewDidLoad {
+    [super viewDidLoad];
 
-#pragma mark -
--(void) viewDidLoad {
-    [NSThread detachNewThreadSelector:@selector(initAudioThread)
-                             toTarget:self
-                           withObject:nil];
-
-    char *ver;
-    HW_versionInfo(NULL, &ver);
-    NSString *versionNumber = [[NSString alloc] initWithCString:ver];
-    self.versionLabel.text = @"";//versionNumber;
-    [versionNumber release];
-
-    // listen to request to remove the modalviewcontroller
+    // listen to request to remove the modalviewcontroller (needed due to the splitcontroller)
     [[NSNotificationCenter defaultCenter] addObserver:self
                                              selector:@selector(dismissModalViewController)
                                                  name: @"dismissModalView"
                                                object:nil];
 
-    [self createNecessaryFiles];
-    
-    [super viewDidLoad];
+    // get the app's version
+    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
+
+    // get the version number that we've been tracking
+    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+    NSString *trackingVersion = [userDefaults stringForKey:@"HedgeVersion"];
+
+    if (trackingVersion == nil || [trackingVersion isEqualToString:version] == NO) {
+        [userDefaults setObject:version forKey:@"HedgeVersion"];
+        [userDefaults synchronize];
+        [self createNecessaryFiles];
+    }
 }
 
 
@@ -318,7 +248,6 @@
 
 -(void) viewDidUnload {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
-    self.versionLabel = nil;
     self.gameConfigViewController = nil;
     self.settingsViewController = nil;
     self.aboutViewController = nil;
@@ -328,7 +257,6 @@
 }
 
 -(void) dealloc {
-    [versionLabel release];
     [settingsViewController release];
     [gameConfigViewController release];
     [aboutViewController release];
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Sun Oct 03 00:23:05 2010 +0200
@@ -32,5 +32,6 @@
 
 -(IBAction) buttonPressed:(id) sender;
 -(IBAction) toggleEdit:(id) sender;
+-(IBAction) clearAll:(id) sender;
 
 @end
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m	Sun Oct 03 00:23:05 2010 +0200
@@ -30,6 +30,15 @@
     return rotationManager(interfaceOrientation);
 }
 
+-(void) updateTable {
+    NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SAVES_DIRECTORY() error:NULL];
+    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
+    self.listOfSavegames = array;
+    [array release];
+
+    [self.tableView reloadData];
+}
+
 -(void) viewDidLoad {
     self.tableView.backgroundView = nil;
     [[NSNotificationCenter defaultCenter] addObserver:self
@@ -41,15 +50,11 @@
 
 -(void) viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
-
-    NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SAVES_DIRECTORY() error:NULL];
-    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
-    self.listOfSavegames = array;
-    [array release];
-
-    [self.tableView reloadData];    
+    [self updateTable];
 }
 
+#pragma mark -
+#pragma mark button functions
 -(IBAction) buttonPressed:(id) sender {
     playSound(@"backSound");
     [self.tableView setEditing:NO animated:YES];
@@ -59,6 +64,16 @@
 -(IBAction) toggleEdit:(id) sender {
     BOOL isEditing = self.tableView.editing;
     [self.tableView setEditing:!isEditing animated:YES];
+    UIToolbar *toolbar = (UIToolbar *)[self.view viewWithTag:458912];
+    for (UIBarButtonItem *item in toolbar.items)
+        if (item.tag == 452198)
+            item.enabled = !isEditing;
+}
+
+-(IBAction) clearAll:(id) sender {
+    [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
+    [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
+    [self updateTable];
 }
 
 #pragma mark -
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib	Sun Oct 03 00:23:05 2010 +0200
@@ -12,7 +12,7 @@
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="4"/>
+			<integer value="2"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -60,6 +60,7 @@
 						<string key="NSFrameSize">{768, 44}</string>
 						<reference key="NSSuperview" ref="766721923"/>
 						<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+						<int key="IBUITag">458912</int>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
 						<object class="NSMutableArray" key="IBUIItems">
 							<bool key="EncodedWithXMLCoder">YES</bool>
@@ -74,6 +75,14 @@
 								<reference key="IBUIToolbar" ref="832454237"/>
 								<int key="IBUISystemItemIdentifier">5</int>
 							</object>
+							<object class="IBUIBarButtonItem" id="882246004">
+								<int key="IBUITag">452198</int>
+								<bool key="IBUIEnabled">NO</bool>
+								<string key="IBUITitle">Clear All</string>
+								<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+								<int key="IBUIStyle">1</int>
+								<reference key="IBUIToolbar" ref="832454237"/>
+							</object>
 							<object class="IBUIBarButtonItem" id="793091239">
 								<string key="targetRuntimeIdentifier">IBIPadFramework</string>
 								<reference key="IBUIToolbar" ref="832454237"/>
@@ -166,6 +175,14 @@
 					</object>
 					<int key="connectionID">14</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchEventConnection" key="connection">
+						<string key="label">clearAll:</string>
+						<reference key="source" ref="882246004"/>
+						<reference key="destination" ref="841351856"/>
+					</object>
+					<int key="connectionID">16</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -206,6 +223,7 @@
 							<reference ref="422926197"/>
 							<reference ref="793091239"/>
 							<reference ref="881124109"/>
+							<reference ref="882246004"/>
 						</object>
 						<reference key="parent" ref="766721923"/>
 					</object>
@@ -234,6 +252,11 @@
 						<reference key="object" ref="881124109"/>
 						<reference key="parent" ref="832454237"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">15</int>
+						<reference key="object" ref="882246004"/>
+						<reference key="parent" ref="832454237"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -245,6 +268,7 @@
 					<string>11.IBPluginDependency</string>
 					<string>12.IBPluginDependency</string>
 					<string>13.IBPluginDependency</string>
+					<string>15.IBPluginDependency</string>
 					<string>2.IBEditorWindowLastContentRect</string>
 					<string>2.IBPluginDependency</string>
 					<string>4.IBPluginDependency</string>
@@ -258,7 +282,8 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-					<string>{{486, 215}, {768, 768}}</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>{{467, 276}, {768, 768}}</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -281,7 +306,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">14</int>
+			<int key="maxID">16</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -294,12 +319,14 @@
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>buttonPressed:</string>
+							<string>clearAll:</string>
 							<string>toggleEdit:</string>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
@@ -307,6 +334,7 @@
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>buttonPressed:</string>
+							<string>clearAll:</string>
 							<string>toggleEdit:</string>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
@@ -316,6 +344,10 @@
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">clearAll:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">toggleEdit:</string>
 								<string key="candidateClassName">id</string>
 							</object>
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sun Oct 03 00:23:05 2010 +0200
@@ -1444,7 +1444,7 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		1D6058900D05DD3D006BFB54 /* Test Lua */ = {
+		1D6058900D05DD3D006BFB54 /* Hedgewars */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Hedgewars" */;
 			buildPhases = (
@@ -1528,7 +1528,7 @@
 			);
 			projectRoot = "";
 			targets = (
-				1D6058900D05DD3D006BFB54 /* Test Lua */,
+				1D6058900D05DD3D006BFB54 /* Hedgewars */,
 				928301160F10CAFC00CC5A3C /* fpc */,
 				6179928B114AE0C800BA94A9 /* UpdateDataFolder */,
 			);
--- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib	Sun Oct 03 00:23:05 2010 +0200
@@ -138,34 +138,6 @@
 						</object>
 						<reference key="IBUINormalTitleShadowColor" ref="112471976"/>
 					</object>
-					<object class="IBUILabel" id="177360137">
-						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{376, 345}, {271, 21}}</string>
-						<reference key="NSSuperview" ref="191373211"/>
-						<bool key="IBUIOpaque">NO</bool>
-						<bool key="IBUIClipsSubviews">YES</bool>
-						<int key="IBUIContentMode">7</int>
-						<bool key="IBUIUserInteractionEnabled">NO</bool>
-						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
-						<string key="IBUIText"/>
-						<object class="NSFont" key="IBUIFont">
-							<string key="NSName">Helvetica-Oblique</string>
-							<double key="NSSize">17</double>
-							<int key="NSfFlags">16</int>
-						</object>
-						<object class="NSColor" key="IBUITextColor">
-							<int key="NSColorSpace">1</int>
-							<bytes key="NSRGB">MSAxIDEAA</bytes>
-							<object class="NSColorSpace" key="NSCustomColorSpace">
-								<int key="NSID">1</int>
-							</object>
-						</object>
-						<nil key="IBUIHighlightedColor"/>
-						<int key="IBUIBaselineAdjustment">1</int>
-						<float key="IBUIMinimumFontSize">10</float>
-						<int key="IBUITextAlignment">1</int>
-					</object>
 					<object class="IBUIButton" id="898948205">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
@@ -262,14 +234,6 @@
 					<int key="connectionID">49</int>
 				</object>
 				<object class="IBConnectionRecord">
-					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">versionLabel</string>
-						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="177360137"/>
-					</object>
-					<int key="connectionID">51</int>
-				</object>
-				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">switchViews:</string>
 						<reference key="source" ref="898948205"/>
@@ -303,7 +267,6 @@
 						<object class="NSMutableArray" key="children">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<reference ref="976741091"/>
-							<reference ref="177360137"/>
 							<reference ref="607338789"/>
 							<reference ref="898948205"/>
 							<reference ref="867308721"/>
@@ -341,11 +304,6 @@
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
-						<int key="objectID">50</int>
-						<reference key="object" ref="177360137"/>
-						<reference key="parent" ref="191373211"/>
-					</object>
-					<object class="IBObjectRecord">
 						<int key="objectID">52</int>
 						<reference key="object" ref="898948205"/>
 						<reference key="parent" ref="191373211"/>
@@ -374,7 +332,6 @@
 					<string>39.IBPluginDependency</string>
 					<string>40.IBPluginDependency</string>
 					<string>45.IBPluginDependency</string>
-					<string>50.IBPluginDependency</string>
 					<string>52.IBPluginDependency</string>
 					<string>88.IBPluginDependency</string>
 				</object>
@@ -390,7 +347,6 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
--- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib	Sun Oct 03 00:23:05 2010 +0200
@@ -164,30 +164,6 @@
 							<string key="NSResourceName">storeButton.png</string>
 						</object>
 					</object>
-					<object class="IBUILabel" id="533529472">
-						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{37, 102}, {168, 21}}</string>
-						<reference key="NSSuperview" ref="191373211"/>
-						<bool key="IBUIOpaque">NO</bool>
-						<bool key="IBUIClipsSubviews">YES</bool>
-						<bool key="IBUIUserInteractionEnabled">NO</bool>
-						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
-						<string key="IBUIText"/>
-						<object class="NSFont" key="IBUIFont">
-							<string key="NSName">Helvetica-Oblique</string>
-							<double key="NSSize">17</double>
-							<int key="NSfFlags">16</int>
-						</object>
-						<object class="NSColor" key="IBUITextColor">
-							<int key="NSColorSpace">1</int>
-							<bytes key="NSRGB">MSAxIDEAA</bytes>
-						</object>
-						<nil key="IBUIHighlightedColor"/>
-						<int key="IBUIBaselineAdjustment">1</int>
-						<float key="IBUIMinimumFontSize">10</float>
-						<int key="IBUITextAlignment">1</int>
-					</object>
 					<object class="IBUIButton" id="753723574">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">269</int>
@@ -295,14 +271,6 @@
 					<int key="connectionID">30</int>
 				</object>
 				<object class="IBConnectionRecord">
-					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">versionLabel</string>
-						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="533529472"/>
-					</object>
-					<int key="connectionID">37</int>
-				</object>
-				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">switchViews:</string>
 						<reference key="source" ref="836337039"/>
@@ -354,7 +322,6 @@
 						<object class="NSMutableArray" key="children">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<reference ref="249993817"/>
-							<reference ref="533529472"/>
 							<reference ref="821240857"/>
 							<reference ref="936485487"/>
 							<reference ref="818907840"/>
@@ -408,11 +375,6 @@
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
-						<int key="objectID">27</int>
-						<reference key="object" ref="533529472"/>
-						<reference key="parent" ref="191373211"/>
-					</object>
-					<object class="IBObjectRecord">
 						<int key="objectID">28</int>
 						<reference key="object" ref="753723574"/>
 						<reference key="parent" ref="191373211"/>
@@ -442,7 +404,6 @@
 					<string>24.IBPluginDependency</string>
 					<string>25.IBPluginDependency</string>
 					<string>26.IBPluginDependency</string>
-					<string>27.IBPluginDependency</string>
 					<string>28.IBPluginDependency</string>
 					<string>35.IBPluginDependency</string>
 					<string>36.IBPluginDependency</string>
@@ -463,7 +424,6 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
--- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Sat Oct 02 04:23:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Sun Oct 03 00:23:05 2010 +0200
@@ -80,7 +80,7 @@
 					<object class="IBUIImageView" id="438802257">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{342, 187}, {340, 502}}</string>
+						<string key="NSFrame">{{337, 187}, {350, 505}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -306,7 +306,7 @@
 					<object class="IBUIButton" id="68378447">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">-2147483356</int>
-						<string key="NSFrame">{{362, 200}, {300, 480}}</string>
+						<string key="NSFrame">{{348, 200}, {328, 480}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -804,7 +804,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">114</int>
+			<int key="maxID">115</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
--- a/project_files/HedgewarsMobile/Resources/Settings/version.txt	Sat Oct 02 04:23:32 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/SDL.patch	Sun Oct 03 00:23:05 2010 +0200
@@ -0,0 +1,398 @@
+diff -r f50c7996d925 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
+--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Wed Sep 29 21:24:50 2010 -0700
++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Oct 03 00:21:37 2010 +0200
+@@ -106,6 +106,7 @@
+ 		04F2AF561104ABD200D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */; };
+ 		56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
+ 		56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; };
++		61F7E7F4125543DA00DE6C14 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */; };
+ 		FD24846D0E5655AE0021E198 /* SDL_uikitkeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FD24846B0E5655AE0021E198 /* SDL_uikitkeyboard.h */; };
+ 		FD3F495C0DEA5B2100C5B771 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = FD99B8CC0DD52EB400FB1D6B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 		FD3F495D0DEA5B2100C5B771 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = FD99B8CD0DD52EB400FB1D6B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; };
+@@ -192,8 +193,6 @@
+ 		FD689F250E26E5D900F90B21 /* SDL_uikitwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F150E26E5D900F90B21 /* SDL_uikitwindow.m */; };
+ 		FD689F260E26E5D900F90B21 /* SDL_uikitopenglview.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F160E26E5D900F90B21 /* SDL_uikitopenglview.h */; };
+ 		FD689F270E26E5D900F90B21 /* SDL_uikitopenglview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F170E26E5D900F90B21 /* SDL_uikitopenglview.m */; };
+-		FD689FCE0E26E9D400F90B21 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */; };
+-		FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689FCD0E26E9D400F90B21 /* SDL_uikitappdelegate.h */; };
+ 		FD6C83B60DEA66E500ABEE55 /* SDL_systimer.h in Headers */ = {isa = PBXBuildFile; fileRef = FD99BA2D0DD52EDC00FB1D6B /* SDL_systimer.h */; };
+ 		FD8BD7AC0E27DCA400B52CD5 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = FD8BD7AB0E27DCA400B52CD5 /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 		FD8BD8250E27E25900B52CD5 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = FD8BD8190E27E25900B52CD5 /* SDL_sysloadso.c */; };
+@@ -1186,7 +1185,6 @@
+ 				FD689F200E26E5D900F90B21 /* SDL_uikitvideo.h in Headers */,
+ 				FD689F240E26E5D900F90B21 /* SDL_uikitwindow.h in Headers */,
+ 				FD689F260E26E5D900F90B21 /* SDL_uikitopenglview.h in Headers */,
+-				FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */,
+ 				FD8BD7AC0E27DCA400B52CD5 /* SDL_opengles.h in Headers */,
+ 				FDC656490E560DF800311C8E /* jumphack.h in Headers */,
+ 				FD24846D0E5655AE0021E198 /* SDL_uikitkeyboard.h in Headers */,
+@@ -1347,6 +1345,7 @@
+ 			isa = PBXSourcesBuildPhase;
+ 			buildActionMask = 2147483647;
+ 			files = (
++				61F7E7F4125543DA00DE6C14 /* SDL_uikitappdelegate.m in Sources */,
+ 				006E9852119550FB001DE610 /* audio.c in Sources */,
+ 				006E9853119550FB001DE610 /* common.c in Sources */,
+ 				006E9859119550FB001DE610 /* platform.c in Sources */,
+@@ -1429,7 +1428,6 @@
+ 				FD689F230E26E5D900F90B21 /* SDL_uikitview.m in Sources */,
+ 				FD689F250E26E5D900F90B21 /* SDL_uikitwindow.m in Sources */,
+ 				FD689F270E26E5D900F90B21 /* SDL_uikitopenglview.m in Sources */,
+-				FD689FCE0E26E9D400F90B21 /* SDL_uikitappdelegate.m in Sources */,
+ 				FD8BD8250E27E25900B52CD5 /* SDL_sysloadso.c in Sources */,
+ 				FDC656480E560DF800311C8E /* jumphack.c in Sources */,
+ 				0495E68C0E97408800152DFE /* SDL_renderer_gl.c in Sources */,
+@@ -1549,15 +1547,19 @@
+ 			isa = XCBuildConfiguration;
+ 			buildSettings = {
+ 				ALWAYS_SEARCH_USER_PATHS = NO;
++				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
+ 				GCC_DEBUGGING_SYMBOLS = full;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvmgcc42;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
++				HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../include\"";
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				ONLY_ACTIVE_ARCH = NO;
+ 				PREBINDING = NO;
+-				SDKROOT = iphoneos3.2;
++				SDKROOT = iphoneos4.0;
+ 				TARGETED_DEVICE_FAMILY = "1,2";
+ 			};
+ 			name = Debug;
+@@ -1566,14 +1568,18 @@
+ 			isa = XCBuildConfiguration;
+ 			buildSettings = {
+ 				ALWAYS_SEARCH_USER_PATHS = NO;
+-				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
++				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
++				GCC_OPTIMIZATION_LEVEL = 2;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvmgcc42;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
++				HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../include\"";
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				PREBINDING = NO;
+-				SDKROOT = iphoneos3.2;
++				SDKROOT = iphoneos4.0;
+ 				TARGETED_DEVICE_FAMILY = "1,2";
+ 			};
+ 			name = Release;
+diff -r f50c7996d925 Xcode-iPhoneOS/SDL/testsdl-Info.plist
+--- a/Xcode-iPhoneOS/SDL/testsdl-Info.plist	Wed Sep 29 21:24:50 2010 -0700
++++ b/Xcode-iPhoneOS/SDL/testsdl-Info.plist	Sun Oct 03 00:21:37 2010 +0200
+@@ -16,7 +16,5 @@
+ 	<string>????</string>
+ 	<key>CFBundleVersion</key>
+ 	<string>1.0</string>
+-	<key>NSMainNibFile</key>
+-	<string>MainWindow</string>
+ </dict>
+ </plist>
+diff -r f50c7996d925 include/SDL_config_iphoneos.h
+--- a/include/SDL_config_iphoneos.h	Wed Sep 29 21:24:50 2010 -0700
++++ b/include/SDL_config_iphoneos.h	Sun Oct 03 00:21:37 2010 +0200
+@@ -98,6 +98,8 @@
+ #define HAVE_COS	1
+ #define HAVE_COSF	1
+ #define HAVE_FABS	1
++#define HAVE_ATAN       1
++#define HAVE_ATAN2      1
+ #define HAVE_FLOOR	1
+ #define HAVE_LOG	1
+ #define HAVE_POW	1
+@@ -114,7 +116,7 @@
+ /* enable iPhone version of Core Audio driver */
+ #define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 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
+@@ -135,7 +137,7 @@
+ 
+ /* Supported video drivers */
+ #define SDL_VIDEO_DRIVER_UIKIT	1
+-#define SDL_VIDEO_DRIVER_DUMMY	1
++#define SDL_VIDEO_DRIVER_DUMMY	0
+ 
+ /* enable OpenGL ES */
+ #define SDL_VIDEO_OPENGL_ES	1
+@@ -152,4 +154,7 @@
+  */
+ #define SDL_IPHONE_MAX_GFORCE 5.0
+ 
++/* Tag to grab the uikit view from external code for further modification */
++#define SDL_VIEW_TAG 456987
++
+ #endif /* _SDL_config_iphoneos_h */
+diff -r f50c7996d925 src/video/SDL_renderer_gles.c
+--- a/src/video/SDL_renderer_gles.c	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/SDL_renderer_gles.c	Sun Oct 03 00:21:37 2010 +0200
+@@ -324,6 +324,9 @@
+     data->glDisable(GL_CULL_FACE);
+     data->updateSize = SDL_TRUE;
+ 
++    data->glEnableClientState(GL_VERTEX_ARRAY);
++    data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
++    
+     return renderer;
+ }
+ 
+@@ -665,9 +668,7 @@
+         vertices[2*i+1] = (GLshort)points[i].y;
+     }
+     data->glVertexPointer(2, GL_SHORT, 0, vertices);
+-    data->glEnableClientState(GL_VERTEX_ARRAY);
+     data->glDrawArrays(GL_POINTS, 0, count);
+-    data->glDisableClientState(GL_VERTEX_ARRAY);
+     SDL_stack_free(vertices);
+ 
+     return 0;
+@@ -694,7 +695,6 @@
+         vertices[2*i+1] = (GLshort)points[i].y;
+     }
+     data->glVertexPointer(2, GL_SHORT, 0, vertices);
+-    data->glEnableClientState(GL_VERTEX_ARRAY);
+     if (count > 2 && 
+         points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
+         /* GL_LINE_LOOP takes care of the final segment */
+@@ -703,7 +703,6 @@
+     } else {
+         data->glDrawArrays(GL_LINE_STRIP, 0, count);
+     }
+-    data->glDisableClientState(GL_VERTEX_ARRAY);
+     SDL_stack_free(vertices);
+ 
+     return 0;
+@@ -723,7 +722,6 @@
+                     (GLfloat) renderer->b * inv255f,
+                     (GLfloat) renderer->a * inv255f);
+ 
+-    data->glEnableClientState(GL_VERTEX_ARRAY);
+     for (i = 0; i < count; ++i) {
+         const SDL_Rect *rect = rects[i];
+         GLshort minx = rect->x;
+@@ -743,7 +741,6 @@
+         data->glVertexPointer(2, GL_SHORT, 0, vertices);
+         data->glDrawArrays(GL_LINE_LOOP, 0, 4);
+     }
+-    data->glDisableClientState(GL_VERTEX_ARRAY);
+ 
+     return 0;
+ }
+@@ -762,7 +759,6 @@
+                     (GLfloat) renderer->b * inv255f,
+                     (GLfloat) renderer->a * inv255f);
+ 
+-    data->glEnableClientState(GL_VERTEX_ARRAY);
+     for (i = 0; i < count; ++i) {
+         const SDL_Rect *rect = rects[i];
+         GLshort minx = rect->x;
+@@ -782,7 +778,6 @@
+         data->glVertexPointer(2, GL_SHORT, 0, vertices);
+         data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+     }
+-    data->glDisableClientState(GL_VERTEX_ARRAY);
+ 
+     return 0;
+ }
+@@ -925,12 +920,8 @@
+         texCoords[7] = maxv;
+ 
+         data->glVertexPointer(2, GL_SHORT, 0, vertices);
+-        data->glEnableClientState(GL_VERTEX_ARRAY);
+         data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+-        data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+         data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+-        data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+-        data->glDisableClientState(GL_VERTEX_ARRAY);
+     }
+ 
+     data->glDisable(GL_TEXTURE_2D);
+diff -r f50c7996d925 src/video/SDL_video.c
+--- a/src/video/SDL_video.c	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/SDL_video.c	Sun Oct 03 00:21:37 2010 +0200
+@@ -1416,9 +1416,9 @@
+         SDL_MinimizeWindow(window);
+     }
+ 
+-    if (display->gamma && _this->SetDisplayGammaRamp) {
++    /*if (display->gamma && _this->SetDisplayGammaRamp) {
+         _this->SetDisplayGammaRamp(_this, display, display->saved_gamma);
+-    }
++    }*/
+     if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN))
+         && _this->SetWindowGrab) {
+         _this->SetWindowGrab(_this, window);
+diff -r f50c7996d925 src/video/uikit/SDL_uikitopengles.m
+--- a/src/video/uikit/SDL_uikitopengles.m	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/uikit/SDL_uikitopengles.m	Sun Oct 03 00:21:37 2010 +0200
+@@ -114,7 +114,7 @@
+ 									bBits: _this->gl_config.blue_size \
+ 									aBits: _this->gl_config.alpha_size \
+ 									depthBits: _this->gl_config.depth_size];
+-	
++        view.tag = SDL_VIEW_TAG;
+ 	data->view = view;
+ 	
+ 	/* add the view to our window */
+diff -r f50c7996d925 src/video/uikit/SDL_uikitview.m
+--- a/src/video/uikit/SDL_uikitview.m	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/uikit/SDL_uikitview.m	Sun Oct 03 00:21:37 2010 +0200
+@@ -35,9 +35,6 @@
+ @implementation SDL_uikitview
+ 
+ - (void)dealloc {
+-#if SDL_IPHONE_KEYBOARD
+-	[textField release];
+-#endif
+ 	[super dealloc];
+ }
+ 
+@@ -220,7 +217,7 @@
+ /* Set ourselves up as a UITextFieldDelegate */
+ - (void)initializeKeyboard {
+ 		
+-	textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
++	textField = [[UITextField alloc] initWithFrame: CGRectZero];
+ 	textField.delegate = self;
+ 	/* placeholder so there is something to delete! */
+ 	textField.text = @" ";	
+@@ -238,6 +235,7 @@
+ 	keyboardVisible = NO;
+ 	/* add the UITextField (hidden) to our view */
+ 	[self addSubview: textField];
++        [textField release];
+ }
+ 
+ /* reveal onscreen virtual keyboard */
+@@ -300,6 +298,7 @@
+ 
+ /* Terminates the editing session */
+ - (BOOL)textFieldShouldReturn:(UITextField*)_textField {
++        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN);
+ 	[self hideKeyboard];
+ 	return YES;
+ }
+@@ -314,7 +313,7 @@
+ int SDL_iPhoneKeyboardShow(SDL_Window * window) {
+ 	
+ 	SDL_WindowData *data;
+-	SDL_uikitview *view;
++	SDL_uikitview *view = NULL;
+ 	
+ 	if (NULL == window) {
+ 		SDL_SetError("Window does not exist");
+@@ -322,7 +321,8 @@
+ 	}
+ 	
+ 	data = (SDL_WindowData *)window->driverdata;
+-	view = data->view;
++	if (data != NULL)
++            view = data->view;
+ 	
+ 	if (nil == view) {
+ 		SDL_SetError("Window has no view");
+@@ -337,7 +337,7 @@
+ int SDL_iPhoneKeyboardHide(SDL_Window * window) {
+ 	
+ 	SDL_WindowData *data;
+-	SDL_uikitview *view;
++	SDL_uikitview *view = NULL;
+ 	
+ 	if (NULL == window) {
+ 		SDL_SetError("Window does not exist");
+@@ -345,7 +345,8 @@
+ 	}	
+ 	
+ 	data = (SDL_WindowData *)window->driverdata;
+-	view = data->view;
++	if (data != NULL)
++            view = data->view;
+ 	
+ 	if (NULL == view) {
+ 		SDL_SetError("Window has no view");
+@@ -360,7 +361,7 @@
+ SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
+ 	
+ 	SDL_WindowData *data;
+-	SDL_uikitview *view;
++	SDL_uikitview *view = NULL;
+ 	
+ 	if (NULL == window) {
+ 		SDL_SetError("Window does not exist");
+@@ -368,7 +369,8 @@
+ 	}	
+ 	
+ 	data = (SDL_WindowData *)window->driverdata;
+-	view = data->view;
++	if (data != NULL)
++            view = data->view;
+ 	
+ 	if (NULL == view) {
+ 		SDL_SetError("Window has no view");
+@@ -382,7 +384,7 @@
+ int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
+ 	
+ 	SDL_WindowData *data;
+-	SDL_uikitview *view;
++	SDL_uikitview *view = NULL;
+ 	
+ 	if (NULL == window) {
+ 		SDL_SetError("Window does not exist");
+@@ -390,7 +392,8 @@
+ 	}	
+ 	
+ 	data = (SDL_WindowData *)window->driverdata;
+-	view = data->view;
++	if (data != NULL)
++            view = data->view;
+ 	
+ 	if (NULL == view) {
+ 		SDL_SetError("Window has no view");
+diff -r f50c7996d925 src/video/uikit/SDL_uikitwindow.m
+--- a/src/video/uikit/SDL_uikitwindow.m	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/uikit/SDL_uikitwindow.m	Sun Oct 03 00:21:37 2010 +0200
+@@ -144,7 +144,10 @@
+     if (SDL_UIKit_supports_multiple_displays) {
+         [uiwindow setScreen:uiscreen];
+     }
+-
++    
++    if ([[UIScreen screens] count] > 1)
++        uiwindow.screen = [[UIScreen screens] objectAtIndex:1];
++    
+     if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
+         [uiwindow release];
+         return -1;
+diff -r f50c7996d925 src/video/uikit/keyinfotable.h
+--- a/src/video/uikit/keyinfotable.h	Wed Sep 29 21:24:50 2010 -0700
++++ b/src/video/uikit/keyinfotable.h	Sun Oct 03 00:21:37 2010 +0200
+@@ -54,7 +54,7 @@
+ /*  10 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+ /*  11 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+ /*  12 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+-/*  13 */ {   SDL_SCANCODE_UNKNOWN, 0 },
++/*  13 */ {   SDL_SCANCODE_RETURN, 0 },
+ /*  14 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+ /*  15 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+ /*  16 */ {   SDL_SCANCODE_UNKNOWN, 0 },
+@@ -137,7 +137,7 @@
+ /*  93 */ {   SDL_SCANCODE_RIGHTBRACKET, 0 },
+ /*  94 */ {   SDL_SCANCODE_6,  KMOD_SHIFT },			/* plus shift modifier '^' */
+ /*  95 */ {   SDL_SCANCODE_MINUS,  KMOD_SHIFT },		/* plus shift modifier '_' */
+-/*  96 */ {   SDL_SCANCODE_GRAVE,  KMOD_SHIFT },		/* '`'
++/*  96 */ {   SDL_SCANCODE_GRAVE,  KMOD_SHIFT },		/* '`' */
+ /*  97 */ {   SDL_SCANCODE_A, 0	},	
+ /*  98 */ {   SDL_SCANCODE_B, 0 },
+ /*  99 */ {   SDL_SCANCODE_C, 0 },