# HG changeset patch # User koda # Date 1286058185 -7200 # Node ID 694e6f6e0e3065ed2a57309231296c8e67cc7925 # Parent 44804043b691cf57d3eaddcc86d4b60e23a0de57 various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames) added the patch for compiling SDL diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/CommodityFunctions.h --- 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/"] diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- 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; diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- 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; diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/GameSetup.m --- 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; } diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/LevelViewController.m --- 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"]; diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/MainMenuViewController.h --- 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 +@class GameConfigViewController; @class SplitViewRootController; -@class GameConfigViewController; @class AboutViewController; @class SavedGamesViewController; @interface MainMenuViewController : UIViewController { - 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; diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- 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]; diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/SavedGamesViewController.h --- 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 diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- 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 - diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib --- 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 @@ YES - + YES @@ -60,6 +60,7 @@ {768, 44} NO + 458912 IBIPadFramework YES @@ -74,6 +75,14 @@ 5 + + 452198 + NO + Clear All + IBIPadFramework + 1 + + IBIPadFramework @@ -166,6 +175,14 @@ 14 + + + clearAll: + + + + 16 + @@ -206,6 +223,7 @@ + @@ -234,6 +252,11 @@ + + 15 + + + @@ -245,6 +268,7 @@ 11.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency + 15.IBPluginDependency 2.IBEditorWindowLastContentRect 2.IBPluginDependency 4.IBPluginDependency @@ -258,7 +282,8 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{486, 215}, {768, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{467, 276}, {768, 768}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -281,7 +306,7 @@ - 14 + 16 @@ -294,12 +319,14 @@ YES buttonPressed: + clearAll: toggleEdit: YES id id + id @@ -307,6 +334,7 @@ YES buttonPressed: + clearAll: toggleEdit: @@ -316,6 +344,10 @@ id + clearAll: + id + + toggleEdit: id diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- 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 */, ); diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib --- 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 @@ - - - 292 - {{376, 345}, {271, 21}} - - NO - YES - 7 - NO - IBIPadFramework - - - Helvetica-Oblique - 17 - 16 - - - 1 - MSAxIDEAA - - 1 - - - - 1 - 10 - 1 - 292 @@ -262,14 +234,6 @@ 49 - - versionLabel - - - - 51 - - switchViews: @@ -303,7 +267,6 @@ YES - @@ -341,11 +304,6 @@ - 50 - - - - 52 @@ -374,7 +332,6 @@ 39.IBPluginDependency 40.IBPluginDependency 45.IBPluginDependency - 50.IBPluginDependency 52.IBPluginDependency 88.IBPluginDependency @@ -390,7 +347,6 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib --- 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 @@ storeButton.png - - - 292 - {{37, 102}, {168, 21}} - - NO - YES - NO - IBCocoaTouchFramework - - - Helvetica-Oblique - 17 - 16 - - - 1 - MSAxIDEAA - - - 1 - 10 - 1 - 269 @@ -295,14 +271,6 @@ 30 - - versionLabel - - - - 37 - - switchViews: @@ -354,7 +322,6 @@ YES - @@ -408,11 +375,6 @@ - 27 - - - - 28 @@ -442,7 +404,6 @@ 24.IBPluginDependency 25.IBPluginDependency 26.IBPluginDependency - 27.IBPluginDependency 28.IBPluginDependency 35.IBPluginDependency 36.IBPluginDependency @@ -463,7 +424,6 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib --- 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 @@ 292 - {{342, 187}, {340, 502}} + {{337, 187}, {350, 505}} NO NO @@ -306,7 +306,7 @@ -2147483356 - {{362, 200}, {300, 480}} + {{348, 200}, {328, 480}} NO IBIPadFramework @@ -804,7 +804,7 @@ - 114 + 115 diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/Resources/Settings/version.txt --- 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 diff -r 44804043b691 -r 694e6f6e0e30 project_files/HedgewarsMobile/SDL.patch --- /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 @@ + ???? + CFBundleVersion + 1.0 +- NSMainNibFile +- MainWindow + + +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 },