X-Git-Url: https://git.saurik.com/winterboard.git/blobdiff_plain/2940a99f8b3a280e0acc3236b31762f61757ce56..b704c082e0ad23abfd8690ce504311be0f28f197:/Library.mm diff --git a/Library.mm b/Library.mm index cc20f1d..d928a03 100644 --- a/Library.mm +++ b/Library.mm @@ -370,10 +370,10 @@ static NSString *$getTheme$(NSArray *files, NSArray *themes = Themes_) { } // }}} // $pathForFile$inBundle$() {{{ -static void $pathForFile$inBundle$(NSMutableArray *names, NSString *file, NSString *identifier, NSURL *url) { +static void $pathForFile$inBundle$(NSMutableArray *names, NSString *file, NSString *identifier, NSString *folder) { if (identifier != nil) [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]]; - if (NSString *folder = [url lastPathComponent]) { + if (folder != nil) { [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]]; NSString *base([folder stringByDeletingPathExtension]); if ([base hasSuffix:@"~iphone"]) @@ -390,17 +390,17 @@ static void $pathForFile$inBundle$(NSMutableArray *names, NSString *file, NSStri if (identifier == nil); else if ([identifier isEqualToString:@"com.apple.uikit.Artwork"]) - $pathForFile$inBundle$(names, file, @"com.apple.UIKit", nil); + $pathForFile$inBundle$(names, file, @"com.apple.UIKit", @"UIKit.framework"); else if ([identifier isEqualToString:@"com.apple.uikit.LegacyArtwork"]) - $pathForFile$inBundle$(names, file, @"com.apple.UIKit", nil); + $pathForFile$inBundle$(names, file, @"com.apple.UIKit", @"UIKit.framework"); else if ([identifier isEqualToString:@"com.apple.UIKit"]) [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]]; else if ([identifier isEqualToString:@"com.apple.chatkit"]) - $pathForFile$inBundle$(names, file, @"com.apple.MobileSMS", nil); + $pathForFile$inBundle$(names, file, @"com.apple.MobileSMS", @"MobileSMS.app"); else if ([identifier isEqualToString:@"com.apple.calculator"]) [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]]; else if ([identifier isEqualToString:@"com.apple.Maps"] && [file isEqualToString:@"Icon-57@2x.png"]) - [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.Maps/icon.png"]]; + $pathForFile$inBundle$(names, @"icon.png", identifier, folder); else if (!summer); remapResourceName(@"FSO_BG.png", @"StatusBar") remapResourceName(Four_ ? @"SBDockBG-old.png" : @"SBDockBG.png", @"Dock") @@ -409,7 +409,7 @@ static void $pathForFile$inBundle$(NSMutableArray *names, NSString *file, NSStri static NSString *$pathForFile$inBundle$(NSString *file, NSString *identifier, NSURL *url, bool use) { NSMutableArray *names = [NSMutableArray arrayWithCapacity:8]; - $pathForFile$inBundle$(names, file, identifier, url); + $pathForFile$inBundle$(names, file, identifier, [url lastPathComponent]); [names addObject:[NSString stringWithFormat:@"Fallback/%@", file]]; if (NSString *path = $getTheme$($useScale$(names, use))) return path; @@ -1273,20 +1273,6 @@ MSInstanceMessageHook0(id, SBUIController, init) { if (paper != nil) paper = [paper stringByDeletingLastPathComponent]; - { - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *machine = new char[size]; - - if (sysctlbyname("hw.machine", machine, &size, NULL, 0) == -1) { - perror("sysctlbyname(\"hw.machine\", ?)"); - delete [] machine; - machine = NULL; - } - - IsWild_ = machine != NULL && strncmp(machine, "iPad", 4) == 0; - } - if (Debug_) NSLog(@"WB:Debug:Info = %@", [Info_ description]); @@ -2461,9 +2447,24 @@ MSInitialize { dlset(_GSFontGetUseLegacyFontMetrics, "GSFontGetUseLegacyFontMetrics"); + // Initialize IsWild_ {{{ + size_t size; + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *machine = new char[size]; + + if (sysctlbyname("hw.machine", machine, &size, NULL, 0) == -1) { + perror("sysctlbyname(\"hw.machine\", ?)"); + delete [] machine; + machine = NULL; + } + + IsWild_ = machine != NULL && strncmp(machine, "iPad", 4) == 0; + // }}} // Load Settings.plist {{{ if (NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) { - if (NSNumber *value = [settings objectForKey:@"SummerBoard"]) + if (kCFCoreFoundationVersionNumber >= 1000) + SummerBoard_ = false; + else if (NSNumber *value = [settings objectForKey:@"SummerBoard"]) SummerBoard_ = [value boolValue]; else SummerBoard_ = true;