362 NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; |
362 NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; |
363 NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; |
363 NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; |
364 CGRect screenBounds = [[UIScreen mainScreen] bounds]; |
364 CGRect screenBounds = [[UIScreen mainScreen] bounds]; |
365 NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; |
365 NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width]; |
366 NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; |
366 NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height]; |
367 const char **gameArgs = (const char**) malloc(sizeof(char *) * 9); |
367 const char **gameArgs = (const char**) malloc(sizeof(char *) * 10); |
368 |
368 |
369 /* |
|
370 size_t size; |
369 size_t size; |
371 // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space |
370 // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space |
372 sysctlbyname("hw.machine", NULL, &size, NULL, 0); |
371 sysctlbyname("hw.machine", NULL, &size, NULL, 0); |
373 char *name = malloc(size); |
372 char *name = (char *)malloc(sizeof(char) * size); |
374 // Get the platform name |
373 // Get the platform name |
375 sysctlbyname("hw.machine", name, &size, NULL, 0); |
374 sysctlbyname("hw.machine", name, &size, NULL, 0); |
376 NSString *machine = [[NSString alloc] initWithUTF8String:name]; |
375 NSString *modelId = [[NSString alloc] initWithUTF8String:name]; |
377 free(name); |
376 free(name); |
378 |
377 |
379 const char **gameArgs = (const char**) malloc(sizeof(char*) * 9); |
378 if ([modelId hasPrefix:@"iPhone1"] || // = iPhone or iPhone 3G |
380 |
379 [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) // = iPod Touch or iPod Touch 2G |
381 // if the machine is less than iphone 3gs or less than ipod touch 3g use reduced graphics (land array) |
380 gameArgs[9] = "2"; // rqLowRes & rqBlurryLand |
382 if ([machine hasPrefix:@"iPhone1"] || ([machine hasPrefix:@"iPod"] && ([machine hasSuffix:@"1,1"] || [machine hasSuffix:@"2,1"]))) |
381 else if ([modelId hasPrefix:@"iPhone2"] || // = iPhone 3GS |
383 gameArgs[8] = "1"; |
382 [modelId hasPrefix:@"iPad1"] || // = iPad |
384 else |
383 [modelId hasPrefix:@"iPod3"]) // = iPod Touch 3G |
385 gameArgs[8] = "0"; |
384 gameArgs[9] = "1"; // rqBlurryLand |
386 [machine release]; |
385 else // = everything else |
387 */ |
386 gameArgs[9] = "0"; // full quality |
|
387 [modelId release]; |
|
388 |
388 |
389 |
389 // prevents using an empty nickname |
390 // prevents using an empty nickname |
390 NSString *username; |
391 NSString *username; |
391 NSString *originalUsername = [self.systemSettings objectForKey:@"username"]; |
392 NSString *originalUsername = [self.systemSettings objectForKey:@"username"]; |
392 if ([originalUsername length] == 0) |
393 if ([originalUsername length] == 0) |