]> git.saurik.com Git - winterboard.git/blobdiff - Library.mm
Consistently remap arguments, not individual files.
[winterboard.git] / Library.mm
index cc20f1d99d2f7e616fd1a2f40653dde35981743c..d928a0306612bae0206cfee8aa9fc54f623ac9c1 100644 (file)
@@ -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;