- $WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
-
- $SBApplication = objc_getClass("SBApplication");
- $SBApplicationIcon = objc_getClass("SBApplicationIcon");
- $SBAwayView = objc_getClass("SBAwayView");
- $SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
- $SBButtonBar = objc_getClass("SBButtonBar");
- $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
- $SBIcon = objc_getClass("SBIcon");
- $SBIconBadge = objc_getClass("SBIconBadge");
- $SBIconController = objc_getClass("SBIconController");
- $SBIconLabel = objc_getClass("SBIconLabel");
- $SBIconList = objc_getClass("SBIconList");
- $SBIconModel = objc_getClass("SBIconModel");
- //$SBImageCache = objc_getClass("SBImageCache");
- $SBSearchView = objc_getClass("SBSearchView");
- $SBSearchTableViewCell = objc_getClass("SBSearchTableViewCell");
- $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
- $SBStatusBarController = objc_getClass("SBStatusBarController");
- $SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
- $SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
- $SBUIController = objc_getClass("SBUIController");
- $SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
-
- WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
-
- if (SummerBoard_) {
- WBRename(SBApplication, pathForIcon, pathForIcon);
- WBRename(SBApplicationIcon, icon, icon);
- WBRename(SBApplicationIcon, generateIconImage:, generateIconImage$);
- }
-
- WBRename(SBBookmarkIcon, icon, icon);
- WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
- WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
- WBRename(SBIcon, setAlpha:, setAlpha$);
- WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
- WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
- WBRename(SBUIController, init, init);
- WBRename(SBWidgetApplicationIcon, icon, icon);
-
- WBRename(SBIconLabel, drawRect:, drawRect$);
- WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
- WBRename(SBIconLabel, setInDock:, setInDock$);
-
- WBRename(SBIconList, setFrame:, setFrame$);
-
- WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
- WBRename(SBIconModel, cacheImagesForIcon:, cacheImagesForIcon$);
- WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
- WBRename(SBIconModel, getCachedImagedForIcon:smallIcon:, getCachedImagedForIcon$smallIcon$);
-
- WBRename(SBSearchView, initWithFrame:, initWithFrame$);
- WBRename(SBSearchTableViewCell, drawRect:, drawRect$);
- WBRename(SBSearchTableViewCell, initWithStyle:reuseIdentifier:, initWithStyle$reuseIdentifier$);
-
- //WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
-
- WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
- WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
- //WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
- //WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
- WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
- WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:startTime:, setStatusBarMode$orientation$duration$fenceID$animation$startTime$);
- WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
- WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
- WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
-
- if (SummerBoard_)
- English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
-
- Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
+ SBInitialize();
+ }
+ // }}}
+ // UIKit {{{
+ if ([NSBundle bundleWithIdentifier:@"com.apple.UIKit"] != nil) {
+ struct nlist nl[6];
+ memset(nl, 0, sizeof(nl));
+ nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
+ nl[1].n_un.n_name = (char *) "__UIImageWithNameInDomain";
+ nl[2].n_un.n_name = (char *) "__UIKitBundle";
+ nl[3].n_un.n_name = (char *) "__UIPackedImageTableGetIdentifierForName";
+ nl[4].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
+ nlist(UIKit, nl);
+
+ nlset(_UIApplicationImageWithName, nl, 0);
+ nlset(_UIImageWithNameInDomain, nl, 1);
+ nlset(_UIKitBundle, nl, 2);
+ nlset(_UIPackedImageTableGetIdentifierForName, nl, 3);
+ nlset(_UISharedImageNameGetIdentifier, nl, 4);
+
+ MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
+ MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
+ MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
+ }
+ // }}}
+
+ if (UIDebug_ && ![Manager_ fileExistsAtPath:@"/tmp/UIImages"]) {
+ NSError *error(nil);
+ if (![Manager_ createDirectoryAtPath:@"/tmp/UIImages" withIntermediateDirectories:NO attributes:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithShort:0777], NSFilePosixPermissions,
+ nil] error:&error])
+ NSLog(@"WB:Error: cannot create /tmp/UIImages (%@)", error);