384 error:NULL]; |
384 error:NULL]; |
385 NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; |
385 NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; |
386 [string release]; |
386 [string release]; |
387 // remove a trailing "" element |
387 // remove a trailing "" element |
388 [themeArray removeLastObject]; |
388 [themeArray removeLastObject]; |
|
389 |
|
390 // remove images that are too big for certain devices without loading the whole image |
389 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
391 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
390 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
392 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
391 for (NSString *str in mapArrayFull) { |
393 for (NSString *str in mapArrayFull) { |
392 CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
394 CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
393 // remove images that are too big for certain devices |
|
394 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
395 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
395 continue; |
396 continue; |
396 if ([modelType() hasPrefix:@"iPad1"] && imgSize.height > 1280.0f) |
397 if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f) |
397 continue; |
398 continue; |
398 [mapArray addObject:str]; |
399 [mapArray addObject:str]; |
399 } |
400 } |
400 |
401 |
401 NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
402 NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
402 NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
403 NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
403 for (NSString *str in missionArrayFull) { |
404 for (NSString *str in missionArrayFull) { |
404 CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
405 CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
405 // remove images that are too big for certain devices |
|
406 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
406 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
407 continue; |
407 continue; |
408 if ([modelType() hasPrefix:@"iPad1"] && imgSize.height > 1280.0f) |
408 if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f) |
409 continue; |
409 continue; |
410 [missionArray addObject:str]; |
410 [missionArray addObject:str]; |
411 } |
411 } |
412 NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
412 NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
413 [missionArray release]; |
413 [missionArray release]; |