72 } |
72 } |
73 [seed release]; |
73 [seed release]; |
74 |
74 |
75 // perform as if user clicked on an entry |
75 // perform as if user clicked on an entry |
76 [self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; |
76 [self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; |
77 if (IS_NOT_POWERFUL() == NO) |
77 if (IS_NOT_POWERFUL(getModelType()) == NO) |
78 [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; |
78 [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; |
79 } |
79 } |
80 |
80 |
81 -(void) turnOffWidgets { |
81 -(void) turnOffWidgets { |
82 busy = YES; |
82 busy = YES; |
376 } |
376 } |
377 |
377 |
378 #pragma mark - |
378 #pragma mark - |
379 #pragma mark view management |
379 #pragma mark view management |
380 -(void) loadDataSourceArray { |
380 -(void) loadDataSourceArray { |
|
381 NSString *model = getModelType(); |
|
382 |
381 // themes.cfg contains all the user-selectable themes |
383 // themes.cfg contains all the user-selectable themes |
382 NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] |
384 NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] |
383 encoding:NSUTF8StringEncoding |
385 encoding:NSUTF8StringEncoding |
384 error:NULL]; |
386 error:NULL]; |
385 NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; |
387 NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; |
390 // remove images that are too big for certain devices without loading the whole image |
392 // remove images that are too big for certain devices without loading the whole image |
391 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
393 NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
392 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
394 NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
393 for (NSString *str in mapArrayFull) { |
395 for (NSString *str in mapArrayFull) { |
394 CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
396 CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
395 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
397 if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
396 continue; |
398 continue; |
397 if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f) |
399 if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
398 continue; |
400 continue; |
399 [mapArray addObject:str]; |
401 [mapArray addObject:str]; |
400 } |
402 } |
401 |
403 |
402 NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
404 NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
403 NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
405 NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
404 for (NSString *str in missionArrayFull) { |
406 for (NSString *str in missionArrayFull) { |
405 CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
407 CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
406 if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f) |
408 if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
407 continue; |
409 continue; |
408 if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f) |
410 if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
409 continue; |
411 continue; |
410 [missionArray addObject:str]; |
412 [missionArray addObject:str]; |
411 } |
413 } |
412 NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
414 NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
413 [missionArray release]; |
415 [missionArray release]; |