1 /* WinterBoard - Theme Manager for the iPhone
2 * Copyright (C) 2008-2010 Jay Freeman (saurik)
6 * Redistribution and use in source and binary
7 * forms, with or without modification, are permitted
8 * provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the
11 * above copyright notice, this list of conditions
12 * and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the
14 * above copyright notice, this list of conditions
15 * and the following disclaimer in the documentation
16 * and/or other materials provided with the
18 * 3. The name of the author may not be used to endorse
19 * or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 #define _trace() do { \
44 struct timeval _ctv; \
45 gettimeofday(&_ctv, NULL); \
50 fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \
51 _ctv.tv_sec, _ctv.tv_usec, \
52 (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \
53 __FILE__, __LINE__, __FUNCTION__\
60 #import <CoreFoundation/CoreFoundation.h>
61 #import <Foundation/Foundation.h>
62 #import <CoreGraphics/CoreGraphics.h>
63 #import <ImageIO/CGImageSource.h>
65 #import <Celestial/AVController.h>
66 #import <Celestial/AVItem.h>
67 #import <Celestial/AVQueue.h>
69 #include <substrate.h>
71 #import <UIKit/UIKit.h>
73 #import <SpringBoard/SBApplication.h>
74 #import <SpringBoard/SBApplicationIcon.h>
75 #import <SpringBoard/SBAppWindow.h>
76 #import <SpringBoard/SBAwayView.h>
77 #import <SpringBoard/SBBookmarkIcon.h>
78 #import <SpringBoard/SBButtonBar.h>
79 #import <SpringBoard/SBCalendarIconContentsView.h>
80 #import <SpringBoard/SBIconController.h>
81 #import <SpringBoard/SBIconLabel.h>
82 #import <SpringBoard/SBIconList.h>
83 #import <SpringBoard/SBIconModel.h>
84 #import <SpringBoard/SBImageCache.h>
85 // XXX: #import <SpringBoard/SBSearchView.h>
86 #import <SpringBoard/SBSearchTableViewCell.h>
87 #import <SpringBoard/SBStatusBarContentsView.h>
88 #import <SpringBoard/SBStatusBarController.h>
89 #import <SpringBoard/SBStatusBarOperatorNameView.h>
90 #import <SpringBoard/SBStatusBarTimeView.h>
91 #import <SpringBoard/SBUIController.h>
92 #import <SpringBoard/SBWidgetApplicationIcon.h>
94 #import <MobileSMS/mSMSMessageTranscriptController.h>
96 #import <MediaPlayer/MPMoviePlayerController.h>
97 #import <MediaPlayer/MPVideoView.h>
98 #import <MediaPlayer/MPVideoView-PlaybackControl.h>
100 #import <CoreGraphics/CGGeometry.h>
102 #import <ChatKit/CKMessageCell.h>
104 extern "C" void __clear_cache (char *beg, char *end);
106 @protocol WinterBoard
110 Class $MPMoviePlayerController;
112 Class $WebCoreFrameBridge;
117 Class $UINavigationBar;
120 Class $CKMessageCell;
121 Class $CKTimestampView;
122 Class $CKTranscriptController;
123 Class $CKTranscriptTableView;
125 Class $SBApplication;
126 Class $SBApplicationIcon;
128 Class $SBBookmarkIcon;
130 Class $SBCalendarIconContentsView;
131 Class $SBDockIconListView;
134 Class $SBIconController;
138 //Class $SBImageCache;
140 Class $SBSearchTableViewCell;
141 Class $SBStatusBarContentsView;
142 Class $SBStatusBarController;
143 Class $SBStatusBarOperatorNameView;
144 Class $SBStatusBarTimeView;
145 Class $SBUIController;
146 Class $SBWidgetApplicationIcon;
151 @interface NSDictionary (WinterBoard)
152 - (UIColor *) wb$colorForKey:(NSString *)key;
153 - (BOOL) wb$boolForKey:(NSString *)key;
156 @implementation NSDictionary (WinterBoard)
158 - (UIColor *) wb$colorForKey:(NSString *)key {
159 NSString *value = [self objectForKey:key];
166 - (BOOL) wb$boolForKey:(NSString *)key {
167 if (NSString *value = [self objectForKey:key])
168 return [value boolValue];
174 static BOOL (*_GSFontGetUseLegacyFontMetrics)();
175 #define $GSFontGetUseLegacyFontMetrics() \
176 (_GSFontGetUseLegacyFontMetrics == NULL ? YES : _GSFontGetUseLegacyFontMetrics())
178 static bool Debug_ = false;
179 static bool Engineer_ = false;
180 static bool SummerBoard_ = true;
181 static bool SpringBoard_;
183 static UIImage *(*_UIApplicationImageWithName)(NSString *name);
184 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
185 static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation, float *scale);
186 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
187 static NSBundle *(*_UIKitBundle)();
188 static bool (*_UIPackedImageTableGetIdentifierForName)(NSString *, int *);
189 static int (*_UISharedImageNameGetIdentifier)(NSString *);
191 static NSMutableDictionary *UIImages_;
192 static NSMutableDictionary *PathImages_;
193 static NSMutableDictionary *Cache_;
194 static NSMutableDictionary *Strings_;
195 static NSMutableDictionary *Themed_;
196 static NSMutableDictionary *Bundles_;
198 static NSFileManager *Manager_;
199 static NSDictionary *English_;
200 static NSMutableDictionary *Info_;
201 static NSMutableArray *themes_;
203 static NSString *$getTheme$(NSArray *files, bool parent = false) {
205 if (NSString *path = [Themed_ objectForKey:files])
206 return reinterpret_cast<id>(path) == [NSNull null] ? nil : path;
209 NSLog(@"WB:Debug: %@", [files description]);
213 for (NSString *theme in themes_)
214 for (NSString *file in files) {
215 path = [NSString stringWithFormat:@"%@/%@", theme, file];
216 if ([Manager_ fileExistsAtPath:path]) {
217 path = parent ? theme : path;
225 [Themed_ setObject:(path == nil ? [NSNull null] : reinterpret_cast<id>(path)) forKey:files];
229 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui) {
230 NSString *identifier = [bundle bundleIdentifier];
231 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
233 if (identifier != nil)
234 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
235 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
236 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
238 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
240 #define remapResourceName(oldname, newname) \
241 else if ([file isEqualToString:(oldname)]) \
242 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
244 bool summer(SpringBoard_ && SummerBoard_);
246 if (identifier == nil);
247 else if ([identifier isEqualToString:@"com.apple.chatkit"])
248 [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.MobileSMS/%@", file]];
249 else if ([identifier isEqualToString:@"com.apple.calculator"])
250 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
252 remapResourceName(@"FSO_BG.png", @"StatusBar")
253 remapResourceName(Four_ ? @"SBDockBG-old.png" : @"SBDockBG.png", @"Dock")
254 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
256 if (NSString *path = $getTheme$(names))
262 static NSString *$pathForIcon$(SBApplication *self, NSString *suffix = @"") {
263 NSString *identifier = [self bundleIdentifier];
264 NSString *path = [self path];
265 NSString *folder = [path lastPathComponent];
266 NSString *dname = [self displayName];
267 NSString *didentifier = [self displayIdentifier];
270 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
272 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
274 /* XXX: I might need to keep this for backwards compatibility
275 if (identifier != nil)
276 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
278 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]]; */
280 #define testForIcon(Name) \
281 if (NSString *name = Name) \
282 [names addObject:[NSString stringWithFormat:@"Icons%@/%@.png", suffix, name]];
284 if (![didentifier isEqualToString:identifier])
285 testForIcon(didentifier);
287 testForIcon(identifier);
290 if ([identifier isEqualToString:@"com.apple.MobileSMS"])
293 if (didentifier != nil) {
294 testForIcon([English_ objectForKey:didentifier]);
296 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
297 if ([parts count] != 1)
298 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
299 testForIcon([english objectForKey:[parts lastObject]]);
302 if (NSString *path = $getTheme$(names))
308 @interface NSBundle (WinterBoard)
309 + (NSBundle *) wb$bundleWithFile:(NSString *)path;
312 @implementation NSBundle (WinterBoard)
314 + (NSBundle *) wb$bundleWithFile:(NSString *)path {
315 path = [path stringByDeletingLastPathComponent];
316 if (path == nil || [path length] == 0 || [path isEqualToString:@"/"])
319 NSBundle *bundle([Bundles_ objectForKey:path]);
320 if (reinterpret_cast<id>(bundle) == [NSNull null])
322 else if (bundle == nil) {
323 if ([Manager_ fileExistsAtPath:[path stringByAppendingPathComponent:@"Info.plist"]])
324 bundle = [NSBundle bundleWithPath:path];
326 bundle = [NSBundle wb$bundleWithFile:path];
328 NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle);
329 [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast<id>(bundle)) forKey:path];
337 @interface NSString (WinterBoard)
338 - (NSString *) wb$themedPath;
341 @implementation NSString (WinterBoard)
343 - (NSString *) wb$themedPath {
345 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
347 if (NSBundle *bundle = [NSBundle wb$bundleWithFile:self]) {
348 NSString *file([self stringByResolvingSymlinksInPath]);
349 NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
350 if ([file hasPrefix:prefix]) {
351 NSUInteger length([prefix length]);
352 if (length != [file length])
353 if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
363 void WBLogRect(const char *tag, struct CGRect rect) {
364 NSLog(@"%s:{%f,%f+%f,%f}", tag, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
367 void WBLogHierarchy(UIView *view, unsigned index = 0, unsigned indent = 0) {
368 CGRect frame([view frame]);
369 NSLog(@"%*s|%2d:%p:%s : {%f,%f+%f,%f} (%@)", indent * 3, "", index, view, class_getName([view class]), frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, [view backgroundColor]);
371 for (UIView *child in [view subviews])
372 WBLogHierarchy(child, index++, indent + 1);
375 UIImage *$cacheForImage$(UIImage *image) {
376 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
377 CGRect rect = {CGPointMake(1, 1), [image size]};
378 CGSize size = {rect.size.width + 2, rect.size.height + 2};
380 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
381 CGColorSpaceRelease(space);
383 CGContextDrawImage(context, rect, [image CGImage]);
384 CGImageRef ref(CGBitmapContextCreateImage(context));
385 CGContextRelease(context);
387 UIImage *cache([UIImage imageWithCGImage:ref]);
393 /*MSHook(id, SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$, SBImageCache *self, SEL sel, NSString *name, unsigned width, unsigned height, unsigned capacity) {
394 //if ([name isEqualToString:@"icons"]) return nil;
395 return _SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$(self, sel, name, width, height, capacity);
398 MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
399 NSString *key([icon displayIdentifier]);
401 if (UIImage *image = [icon icon]) {
402 CGSize size = [image size];
403 if (size.width != 59 || size.height != 60) {
404 UIImage *cache($cacheForImage$(image));
405 [Cache_ setObject:cache forKey:key];
410 _SBIconModel$cacheImageForIcon$(self, sel, icon);
413 MSHook(void, SBIconModel$cacheImagesForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
414 /* XXX: do I /really/ have to do this? figure out how to cache the small icon! */
415 _SBIconModel$cacheImagesForIcon$(self, sel, icon);
417 NSString *key([icon displayIdentifier]);
419 if (UIImage *image = [icon icon]) {
420 CGSize size = [image size];
421 if (size.width != 59 || size.height != 60) {
422 UIImage *cache($cacheForImage$(image));
423 [Cache_ setObject:cache forKey:key];
429 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
430 NSString *key([icon displayIdentifier]);
431 if (UIImage *image = [Cache_ objectForKey:key])
434 return _SBIconModel$getCachedImagedForIcon$(self, sel, icon);
437 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$smallIcon$, SBIconModel *self, SEL sel, SBIcon *icon, BOOL small) {
439 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
440 NSString *key([icon displayIdentifier]);
441 if (UIImage *image = [Cache_ objectForKey:key])
444 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
447 MSHook(id, SBSearchView$initWithFrame$, id /* XXX: SBSearchView */ self, SEL sel, struct CGRect frame) {
448 if ((self = _SBSearchView$initWithFrame$(self, sel, frame)) != nil) {
449 [self setBackgroundColor:[UIColor clearColor]];
450 for (UIView *child in [self subviews])
451 [child setBackgroundColor:[UIColor clearColor]];
455 MSHook(id, SBSearchTableViewCell$initWithStyle$reuseIdentifier$, SBSearchTableViewCell *self, SEL sel, int style, NSString *reuse) {
456 if ((self = _SBSearchTableViewCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
457 [self setBackgroundColor:[UIColor clearColor]];
461 MSHook(void, SBSearchTableViewCell$drawRect$, SBSearchTableViewCell *self, SEL sel, struct CGRect rect, BOOL selected) {
462 _SBSearchTableViewCell$drawRect$(self, sel, rect, selected);
463 float inset([self edgeInset]);
464 [[UIColor clearColor] set];
465 UIRectFill(CGRectMake(0, 0, inset, rect.size.height));
466 UIRectFill(CGRectMake(rect.size.width - inset, 0, inset, rect.size.height));
469 MSHook(UIImage *, SBApplicationIcon$icon, SBApplicationIcon *self, SEL sel) {
470 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"])
471 if (NSString *path = $pathForIcon$([self application]))
472 return [UIImage imageWithContentsOfFile:path];
473 return _SBApplicationIcon$icon(self, sel);
476 MSHook(UIImage *, SBApplicationIcon$generateIconImage$, SBApplicationIcon *self, SEL sel, int type) {
478 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"]) {
479 if (IsWild_ && false) // XXX: delete this code, it should not be supported
480 if (NSString *path72 = $pathForIcon$([self application], @"-72"))
481 return [UIImage imageWithContentsOfFile:path72];
482 if (NSString *path = $pathForIcon$([self application]))
483 if (UIImage *image = [UIImage imageWithContentsOfFile:path]) {
485 if ([$SBIcon respondsToSelector:@selector(defaultIconImageSize)])
486 width = [$SBIcon defaultIconImageSize].width;
489 return width == 59 ? image : [image _imageScaledToProportion:(width / 59.0) interpolationQuality:5];
492 return _SBApplicationIcon$generateIconImage$(self, sel, type);
495 MSHook(UIImage *, SBWidgetApplicationIcon$icon, SBWidgetApplicationIcon *self, SEL sel) {
497 NSLog(@"WB:Debug:Widget(%@:%@)", [self displayIdentifier], [self displayName]);
498 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
499 return [UIImage imageWithContentsOfFile:path];
500 return _SBWidgetApplicationIcon$icon(self, sel);
503 MSHook(UIImage *, SBBookmarkIcon$icon, SBBookmarkIcon *self, SEL sel) {
505 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
506 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
507 return [UIImage imageWithContentsOfFile:path];
508 return _SBBookmarkIcon$icon(self, sel);
511 MSHook(NSString *, SBApplication$pathForIcon, SBApplication *self, SEL sel) {
512 if (NSString *path = $pathForIcon$(self))
514 return _SBApplication$pathForIcon(self, sel);
517 static UIImage *CachedImageAtPath(NSString *path) {
518 path = [path stringByResolvingSymlinksInPath];
519 UIImage *image = [PathImages_ objectForKey:path];
521 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
522 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
524 image = [image autorelease];
525 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
529 MSHook(CGImageSourceRef, CGImageSourceCreateWithURL, CFURLRef url, CFDictionaryRef options) {
531 NSLog(@"WB:Debug: CGImageSourceCreateWithURL(\"%@\", %s)", url, options);
532 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
533 if (NSString *path = (NSString *) CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle))
534 if (NSString *themed = [path wb$themedPath])
536 url = (CFURLRef) [NSURL fileURLWithPath:themed];
537 CGImageSourceRef source(_CGImageSourceCreateWithURL(url, options));
542 MSHook(CGImageRef, _UIImageRefAtPath, NSString *name, bool cache, UIImageOrientation *orientation, float *scale) {
544 NSLog(@"WB:Debug: _UIImageRefAtPath(\"%@\")", name);
546 NSString *themed([name wb$themedPath]);
548 if (false && SpringBoard_ && SummerBoard_ && themed == name) {
549 if ([name isEqualToString:@"/System/Library/CoreServices/SpringBoard.app/SBDockBGT-Portrait.png"])
550 if (NSString *path = $getTheme$([NSArray arrayWithObject:@"Dock.png"])) {
551 UIImage *image([UIImage imageWithContentsOfFile:path]);
552 CGImageRef ref([[image _imageScaledToProportion:2.4 interpolationQuality:5] imageRef]);
558 return __UIImageRefAtPath(themed, cache, orientation, scale);
561 /*MSHook(UIImage *, _UIImageAtPath, NSString *name, NSBundle *bundle) {
563 return __UIImageAtPath(name, nil);
565 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
566 UIImage *image = [PathImages_ objectForKey:key];
568 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
570 NSLog(@"WB:Debug: _UIImageAtPath(\"%@\", %@)", name, bundle);
571 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
572 image = CachedImageAtPath(path);
574 image = __UIImageAtPath(name, bundle);
575 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
580 MSHook(UIImage *, _UIApplicationImageWithName, NSString *name) {
581 NSBundle *bundle = [NSBundle mainBundle];
583 NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
584 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
585 return CachedImageAtPath(path);
586 return __UIApplicationImageWithName(name);
589 #define WBDelegate(delegate) \
590 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
592 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
593 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
595 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
599 - (void) forwardInvocation:(NSInvocation*)inv { \
600 SEL sel = [inv selector]; \
601 if ([delegate respondsToSelector:sel]) \
602 [inv invokeWithTarget:delegate]; \
604 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
607 MSHook(NSString *, NSBundle$pathForResource$ofType$, NSBundle *self, SEL sel, NSString *resource, NSString *type) {
608 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
610 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
611 if (NSString *path = $pathForFile$inBundle$(file, self, false))
613 return _NSBundle$pathForResource$ofType$(self, sel, resource, type);
616 void $setBarStyle$_(NSString *name, int &style) {
618 NSLog(@"WB:Debug:%@Style:%d", name, style);
619 NSNumber *number = nil;
621 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
623 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
625 style = [number intValue];
627 NSLog(@"WB:Debug:%@Style=%d", name, style);
631 MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *self, SEL sel, CGRect rect) {
632 NSBundle *bundle([NSBundle mainBundle]);
634 CFLocaleRef locale(CFLocaleCopyCurrent());
635 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
638 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
640 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"d" table:@"SpringBoard"]);
641 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
642 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"cccc" table:@"SpringBoard"]);
643 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
647 CFRelease(formatter);
649 NSString *datestyle([@""
650 "font-family: Helvetica; "
651 "font-weight: bold; "
654 "" stringByAppendingString:(IsWild_
655 ? @"font-size: 54px; "
656 : @"font-size: 39px; "
659 NSString *daystyle([@""
660 "font-family: Helvetica; "
661 "font-weight: bold; "
663 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
664 "" stringByAppendingString:(IsWild_
665 ? @"font-size: 11px; "
666 : @"font-size: 9px; "
669 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
670 datestyle = [datestyle stringByAppendingString:style];
671 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
672 daystyle = [daystyle stringByAppendingString:style];
674 float width([self bounds].size.width);
676 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
677 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
679 unsigned base0(IsWild_ ? 89 : 70);
680 if ($GSFontGetUseLegacyFontMetrics())
682 unsigned base1(IsWild_ ? 18 : 16);
689 [(NSString *)date drawAtPoint:CGPointMake(
690 (width + 1 - datesize.width) / 2, (base0 - datesize.height) / 2
691 ) withStyle:datestyle];
693 [(NSString *)day drawAtPoint:CGPointMake(
694 (width + 1 - daysize.width) / 2, (base1 - daysize.height) / 2
695 ) withStyle:daystyle];
701 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
704 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
705 style = [number intValue];
707 if (UIColor *color = [Info_ wb$colorForKey:@"NavigationBarTint"])
710 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
713 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
714 self = [self wb$initWithCoder:coder];
717 UINavigationBar$setBarStyle$_(self);
721 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
722 self = [self wb$initWithFrame:frame];
725 UINavigationBar$setBarStyle$_(self);
729 MSHook(void, UIToolbar$setBarStyle$, UIToolbar *self, SEL sel, int style) {
730 $setBarStyle$_(@"Toolbar", style);
731 return _UIToolbar$setBarStyle$(self, sel, style);
734 MSHook(void, UINavigationBar$setBarStyle$, UINavigationBar *self, SEL sel, int style) {
735 $setBarStyle$_(@"NavigationBar", style);
736 return _UINavigationBar$setBarStyle$(self, sel, style);
739 MSHook(void, SBButtonBar$didMoveToSuperview, UIView *self, SEL sel) {
740 [[self superview] setBackgroundColor:[UIColor clearColor]];
741 _SBButtonBar$didMoveToSuperview(self, sel);
744 MSHook(void, SBStatusBarContentsView$didMoveToSuperview, UIView *self, SEL sel) {
745 [[self superview] setBackgroundColor:[UIColor clearColor]];
746 _SBStatusBarContentsView$didMoveToSuperview(self, sel);
749 MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) {
751 NSLog(@"WB:Debug:DefaultDesktopImage");
752 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
753 return [UIImage imageWithContentsOfFile:path];
754 return _UIImage$defaultDesktopImage(self, sel);
757 static NSArray *Wallpapers_;
758 static bool Papered_;
760 static NSString *WallpaperFile_;
761 static UIImageView *WallpaperImage_;
762 static UIWebDocumentView *WallpaperPage_;
763 static NSURL *WallpaperURL_;
765 #define _release(object) \
766 do if (object != nil) { \
771 MSHook(id, SBUIController$init, SBUIController *self, SEL sel) {
772 self = _SBUIController$init(self, sel);
776 UIDevice *device([UIDevice currentDevice]);
777 IsWild_ = [device respondsToSelector:@selector(isWildcat)] && [device isWildcat];
779 BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability"));
781 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
782 [Info_ setObject:[NSNumber numberWithBool:(
783 !(Papered_ || GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("homescreen-wallpaper"))) ||
784 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
785 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
786 )] forKey:@"UndockedIconLabels"];
789 NSLog(@"WB:Debug:Info = %@", [Info_ description]);
792 UIImageView *&_wallpaperView(MSHookIvar<UIImageView *>(self, "_wallpaperView"));
793 if (&_wallpaperView != NULL) {
794 [_wallpaperView removeFromSuperview];
795 [_wallpaperView release];
796 _wallpaperView = nil;
800 UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
801 UIView *&_contentView(MSHookIvar<UIView *>(self, "_contentView"));
804 if (&_contentLayer != NULL)
805 player = &_contentLayer;
806 else if (&_contentView != NULL)
807 player = &_contentView;
810 UIView *layer(player == NULL ? nil : *player);
812 UIWindow *window([[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
813 UIView *content([[[UIView alloc] initWithFrame:[window frame]] autorelease]);
814 [window setContentView:content];
816 UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
817 [window setBackgroundColor:[_window backgroundColor]];
818 [_window setBackgroundColor:[UIColor clearColor]];
820 [window setLevel:-1000];
821 [window setHidden:NO];
823 /*if (player != NULL)
826 [content setBackgroundColor:[layer backgroundColor]];
827 [layer setBackgroundColor:[UIColor clearColor]];
830 if (!SummerBoard_ || !IsWild_)
833 CGRect bounds([content bounds]);
834 bounds.origin.y = -30;
835 indirect = [[[UIView alloc] initWithFrame:bounds] autorelease];
836 [content addSubview:indirect];
837 [indirect zoomToScale:2.4];
840 _release(WallpaperFile_);
841 _release(WallpaperImage_);
842 _release(WallpaperPage_);
843 _release(WallpaperURL_);
845 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
846 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
847 if ([Manager_ fileExistsAtPath:mp4]) {
851 static AVController *controller_(nil);
852 if (controller_ == nil) {
853 AVQueue *queue([AVQueue avQueue]);
854 controller_ = [[AVController avControllerWithQueue:queue error:&error] retain];
857 AVQueue *queue([controller_ queue]);
859 UIView *video([[[UIView alloc] initWithFrame:[indirect bounds]] autorelease]);
860 [controller_ setLayer:[video _layer]];
862 AVItem *item([[[AVItem alloc] initWithPath:mp4 error:&error] autorelease]);
863 [queue appendItem:item error:&error];
865 [controller_ play:&error];
866 #elif UseMPMoviePlayerController
867 NSURL *url([NSURL fileURLWithPath:mp4]);
868 MPMoviePlayerController *controller = [[$MPMoviePlayerController alloc] initWithContentURL:url];
869 controller.movieControlMode = MPMovieControlModeHidden;
872 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[indirect bounds]] autorelease];
873 [video setMovieWithPath:mp4];
874 [video setRepeatMode:1];
875 [video setRepeatGap:-1];
876 [video playFromBeginning];;
879 [indirect addSubview:video];
882 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
883 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
886 if ([Manager_ fileExistsAtPath:png])
888 else if ([Manager_ fileExistsAtPath:jpg])
894 image = [[UIImage alloc] initWithContentsOfFile:path];
896 image = [image autorelease];
900 WallpaperFile_ = [path retain];
901 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
902 if (NSNumber *number = [Info_ objectForKey:@"WallpaperAlpha"])
903 [WallpaperImage_ setAlpha:[number floatValue]];
904 [indirect addSubview:WallpaperImage_];
907 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
908 if ([Manager_ fileExistsAtPath:html]) {
909 CGRect bounds = [indirect bounds];
911 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
912 [view setAutoresizes:true];
914 WallpaperPage_ = [view retain];
915 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
917 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
919 [view setBackgroundColor:[UIColor clearColor]];
920 if ([view respondsToSelector:@selector(setDrawsBackground:)])
921 [view setDrawsBackground:NO];
922 [[view webView] setDrawsBackground:NO];
924 [indirect addSubview:view];
928 for (size_t i(0), e([themes_ count]); i != e; ++i) {
929 NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
930 NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
931 if ([Manager_ fileExistsAtPath:html]) {
932 CGRect bounds = [indirect bounds];
934 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
935 [view setAutoresizes:true];
937 NSURL *url = [NSURL fileURLWithPath:html];
938 [view loadRequest:[NSURLRequest requestWithURL:url]];
940 [view setBackgroundColor:[UIColor clearColor]];
941 if ([view respondsToSelector:@selector(setDrawsBackground:)])
942 [view setDrawsBackground:NO];
943 [[view webView] setDrawsBackground:NO];
945 [indirect addSubview:view];
952 MSHook(void, SBAwayView$updateDesktopImage$, SBAwayView *self, SEL sel, UIImage *image) {
953 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
954 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
956 if (path != nil && _backgroundView != nil)
959 _SBAwayView$updateDesktopImage$(self, sel, image);
962 CGRect bounds = [self bounds];
964 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
965 [view setAutoresizes:true];
967 if (WallpaperPage_ != nil)
968 [WallpaperPage_ release];
969 WallpaperPage_ = [view retain];
971 if (WallpaperURL_ != nil)
972 [WallpaperURL_ release];
973 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
975 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
977 [[view webView] setDrawsBackground:false];
978 [view setBackgroundColor:[UIColor clearColor]];
980 [self insertSubview:view aboveSubview:_backgroundView];
984 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
985 extern "C" CGColorRef CGGStateGetFillColor(void *);
986 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
987 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
989 /* WBTimeLabel {{{ */
990 @interface WBTimeLabel : NSProxy {
992 _transient SBStatusBarTimeView *view_;
995 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
999 @implementation WBTimeLabel
1006 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
1007 time_ = [time retain];
1012 - (NSString *) description {
1018 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
1019 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
1020 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
1022 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
1023 "font-family: Helvetica; "
1024 "font-weight: bold; "
1027 "%@", _mode ? @"white" : @"black", custom]];
1032 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1037 /* WBBadgeLabel {{{ */
1038 @interface WBBadgeLabel : NSProxy {
1042 - (id) initWithBadge:(NSString *)badge;
1043 - (NSString *) description;
1047 @implementation WBBadgeLabel
1054 - (id) initWithBadge:(NSString *)badge {
1055 badge_ = [badge retain];
1059 - (NSString *) description {
1060 return [badge_ description];
1065 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
1066 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
1067 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
1068 "font-family: Helvetica; "
1069 "font-weight: bold; "
1077 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1083 MSHook(void, SBIcon$setAlpha$, SBIcon *self, SEL sel, float alpha) {
1084 if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
1085 alpha = [number floatValue];
1086 return _SBIcon$setAlpha$(self, sel, alpha);
1089 MSHook(id, SBIconBadge$initWithBadge$, SBIconBadge *self, SEL sel, NSString *badge) {
1090 if ((self = _SBIconBadge$initWithBadge$(self, sel, badge)) != nil) {
1091 id &_badge(MSHookIvar<id>(self, "_badge"));
1093 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
1098 void SBStatusBarController$setStatusBarMode(int &mode) {
1100 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
1101 if (mode < 100) // 104:hidden 105:glowing
1102 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
1103 mode = [number intValue];
1106 /*MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int animation) {
1107 NSLog(@"mode:%d orientation:%d duration:%f animation:%d", mode, orientation, duration, animation);
1108 SBStatusBarController$setStatusBarMode(mode);
1109 return _SBStatusBarController$setStatusBarMode$orientation$duration$animation$(self, sel, mode, orientation, duration, animation);
1112 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int fenceID, int animation) {
1113 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d", mode, orientation, duration, fenceID, animation);
1114 SBStatusBarController$setStatusBarMode(mode);
1115 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, fenceID, animation);
1118 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int fenceID, int animation, double startTime) {
1119 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d startTime:%f", mode, orientation, duration, fenceID, animation, startTime);
1120 SBStatusBarController$setStatusBarMode(mode);
1121 //NSLog(@"mode=%u", mode);
1122 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$(self, sel, mode, orientation, duration, fenceID, animation, startTime);
1125 /*MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
1126 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
1127 mode = [number intValue];
1128 return _SBStatusBarContentsView$initWithStatusBar$mode$(self, sel, bar, mode);
1131 MSHook(NSString *, SBStatusBarOperatorNameView$operatorNameStyle, SBStatusBarOperatorNameView *self, SEL sel) {
1132 NSString *style(_SBStatusBarOperatorNameView$operatorNameStyle(self, sel));
1134 NSLog(@"operatorNameStyle= %@", style);
1135 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
1136 style = [NSString stringWithFormat:@"%@; %@", style, custom];
1140 MSHook(void, SBStatusBarOperatorNameView$setOperatorName$fullSize$, SBStatusBarOperatorNameView *self, SEL sel, NSString *name, BOOL full) {
1142 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
1143 return _SBStatusBarOperatorNameView$setOperatorName$fullSize$(self, sel, name, NO);
1146 // XXX: replace this with [SBStatusBarTimeView tile]
1147 MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, CGRect rect) {
1148 id &_time(MSHookIvar<id>(self, "_time"));
1149 if (_time != nil && [_time class] != [WBTimeLabel class])
1150 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
1151 return _SBStatusBarTimeView$drawRect$(self, sel, rect);
1154 @interface UIView (WinterBoard)
1155 - (bool) wb$isWBImageView;
1156 - (void) wb$logHierarchy;
1159 @implementation UIView (WinterBoard)
1161 - (bool) wb$isWBImageView {
1165 - (void) wb$logHierarchy {
1166 WBLogHierarchy(self);
1171 @interface WBImageView : UIImageView {
1174 - (bool) wb$isWBImageView;
1175 - (void) wb$updateFrame;
1178 @implementation WBImageView
1180 - (bool) wb$isWBImageView {
1184 - (void) wb$updateFrame {
1185 CGRect frame([self frame]);
1188 for (UIView *view(self); ; ) {
1189 view = [view superview];
1192 frame.origin.y -= [view frame].origin.y;
1195 [self setFrame:frame];
1200 MSHook(void, SBIconList$setFrame$, SBIconList *self, SEL sel, CGRect frame) {
1201 NSArray *subviews([self subviews]);
1202 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1203 if (view != nil && [view wb$isWBImageView])
1204 [view wb$updateFrame];
1205 _SBIconList$setFrame$(self, sel, frame);
1208 MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *self, SEL sel) {
1209 SBIconModel *&_iconModel(MSHookIvar<SBIconModel *>(self, "_iconModel"));
1210 NSArray *lists([_iconModel iconLists]);
1212 for (unsigned i(0), e([lists count]); i != e; ++i)
1213 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Page%u.png", i]])) {
1214 SBIconList *list([lists objectAtIndex:i]);
1215 NSArray *subviews([list subviews]);
1217 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1218 if (view == nil || ![view wb$isWBImageView]) {
1219 view = [[[WBImageView alloc] init] autorelease];
1220 [list insertSubview:view atIndex:0];
1223 UIImage *image([UIImage imageWithContentsOfFile:path]);
1225 CGRect frame([view frame]);
1226 frame.size = [image size];
1227 [view setFrame:frame];
1229 [view setImage:image];
1230 [view wb$updateFrame];
1233 return _SBIconController$noteNumberOfIconListsChanged(self, sel);
1236 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
1237 self = _SBIconLabel$initWithSize$label$(self, sel, size, label);
1239 [self setClipsToBounds:NO];
1243 MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
1244 id &_label(MSHookIvar<id>(self, "_label"));
1245 if (![Info_ wb$boolForKey:@"UndockedIconLabels"])
1247 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
1248 [_label setInDock:docked];
1249 return _SBIconLabel$setInDock$(self, sel, docked);
1252 MSHook(BOOL, SBDockIconListView$shouldShowNewDock, id self, SEL sel) {
1253 return SummerBoard_ && Docked_ ? NO : _SBDockIconListView$shouldShowNewDock(self, sel);
1256 MSHook(void, SBDockIconListView$setFrame$, id self, SEL sel, CGRect frame) {
1257 _SBDockIconListView$setFrame$(self, sel, frame);
1260 MSHook(NSString *, NSBundle$localizedStringForKey$value$table$, NSBundle *self, SEL sel, NSString *key, NSString *value, NSString *table) {
1261 NSString *identifier = [self bundleIdentifier];
1262 NSLocale *locale = [NSLocale currentLocale];
1263 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
1265 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
1266 NSString *file = table == nil ? @"Localizable" : table;
1267 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
1268 NSDictionary *strings;
1269 if ((strings = [Strings_ objectForKey:name]) != nil) {
1270 if (static_cast<id>(strings) != [NSNull null]) strings:
1271 if (NSString *value = [strings objectForKey:key])
1273 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
1276 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
1277 [Strings_ setObject:[strings autorelease] forKey:name];
1281 [Strings_ setObject:[NSNull null] forKey:name];
1282 return _NSBundle$localizedStringForKey$value$table$(self, sel, key, value, table);
1285 @class WebCoreFrameBridge;
1286 MSHook(CGSize, WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$, WebCoreFrameBridge *self, SEL sel, id node, float width) {
1289 void **core(reinterpret_cast<void **>([node _node]));
1290 if (core == NULL || core[6] == NULL)
1292 return _WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(self, sel, node, width);
1295 MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) {
1296 CGRect bounds = [self bounds];
1298 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
1301 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
1302 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
1304 NSString *label(MSHookIvar<NSString *>(self, "_label"));
1306 NSString *style = [NSString stringWithFormat:@""
1307 "font-family: Helvetica; "
1308 "font-weight: bold; "
1310 "", (docked || !SummerBoard_ ? @"white" : @"#b3b3b3"), (IsWild_
1311 ? @"font-size: 12px; "
1312 : @"font-size: 11px; "
1316 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px 1px 0px; "];
1318 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
1320 bool ellipsis(false);
1321 float max = 75, width;
1323 width = [(ellipsis ? [label stringByAppendingString:@"..."] : label) sizeWithStyle:style forWidth:320].width;
1326 size_t length([label length]);
1327 float spacing((width - max) / (length - 1));
1329 if (spacing > 1.25) {
1331 label = [label substringToIndex:(length - 1)];
1335 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", spacing]];
1339 label = [label stringByAppendingString:@"..."];
1341 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
1342 style = [style stringByAppendingString:custom];
1344 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
1345 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
1348 MSHook(void, CKMessageCell$addBalloonView$, id self, SEL sel, CKBalloonView *balloon) {
1349 _CKMessageCell$addBalloonView$(self, sel, balloon);
1350 [balloon setBackgroundColor:[UIColor clearColor]];
1353 MSHook(id, CKMessageCell$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1354 if ((self = _CKMessageCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1355 [[self contentView] setBackgroundColor:[UIColor clearColor]];
1359 MSHook(id, CKTimestampView$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1360 if ((self = _CKTimestampView$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1361 UILabel *&_label(MSHookIvar<UILabel *>(self, "_label"));
1362 [_label setBackgroundColor:[UIColor clearColor]];
1366 MSHook(void, CKTranscriptTableView$setSeparatorStyle$, id self, SEL sel, int style) {
1367 _CKTranscriptTableView$setSeparatorStyle$(self, sel, UITableViewCellSeparatorStyleNone);
1370 MSHook(id, CKTranscriptTableView$initWithFrame$style$, id self, SEL sel, CGRect frame, int style) {
1372 if ((self = _CKTranscriptTableView$initWithFrame$style$(self, sel, frame, style)) != nil) {
1373 [self setSeparatorStyle:UITableViewCellSeparatorStyleNone];
1377 MSHook(void, TranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) {
1378 _TranscriptController$loadView(self, sel);
1380 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
1381 if (UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]) {
1382 [image autorelease];
1384 UIView *&_transcriptTable(MSHookIvar<UIView *>(self, "_transcriptTable"));
1385 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
1387 if (&_transcriptTable != NULL)
1388 table = _transcriptTable;
1389 else if (&_transcriptLayer != NULL)
1390 table = _transcriptLayer;
1394 UIView *placard(table != nil ? [table superview] : MSHookIvar<UIView *>(self, "_backPlacard"));
1395 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
1398 [placard insertSubview:background atIndex:0];
1400 [table setBackgroundColor:[UIColor clearColor]];
1401 [placard insertSubview:background belowSubview:table];
1406 MSHook(UIImage *, _UIImageWithName, NSString *name) {
1408 NSLog(@"WB:Debug: _UIImageWithName(\"%@\")", name);
1415 if (_UIPackedImageTableGetIdentifierForName != NULL)
1416 packed = _UIPackedImageTableGetIdentifierForName(name, &identifier);
1417 else if (_UISharedImageNameGetIdentifier != NULL) {
1418 identifier = _UISharedImageNameGetIdentifier(name);
1419 packed = identifier != -1;
1426 NSLog(@"WB:Debug: _UISharedImageNameGetIdentifier(\"%@\") = %d", name, identifier);
1429 return __UIImageWithName(name);
1431 NSNumber *key([NSNumber numberWithInt:identifier]);
1432 UIImage *image([UIImages_ objectForKey:key]);
1434 return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithName(name) : image;
1435 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
1436 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
1438 [image autorelease];
1440 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1441 return image == nil ? __UIImageWithName(name) : image;
1445 MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
1446 NSString *key([NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name]);
1447 UIImage *image([PathImages_ objectForKey:key]);
1449 return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image;
1451 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
1452 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
1453 image = [[UIImage alloc] initWithContentsOfFile:path];
1455 [image autorelease];
1457 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1458 return image == nil ? __UIImageWithNameInDomain(name, domain) : image;
1461 MSHook(GSFontRef, GSFontCreateWithName, const char *name, GSFontSymbolicTraits traits, float size) {
1463 NSLog(@"WB:Debug: GSFontCreateWithName(\"%s\", %f)", name, size);
1464 if (NSString *font = [Info_ objectForKey:[NSString stringWithFormat:@"FontName-%s", name]])
1465 name = [font UTF8String];
1466 //if (NSString *scale = [Info_ objectForKey:[NSString stringWithFormat:@"FontScale-%s", name]])
1467 // size *= [scale floatValue];
1468 return _GSFontCreateWithName(name, traits, size);
1471 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
1472 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
1474 bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
1476 MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
1478 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %p, %u)", a0, a1, a2);
1479 bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
1481 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
1484 NSString *path = [NSString stringWithUTF8String:a1];
1485 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
1486 NSString *file = [path substringFromIndex:31];
1487 for (NSString *theme in themes_) {
1488 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
1489 if ([Manager_ fileExistsAtPath:path]) {
1490 strcpy(a1, [path UTF8String]);
1499 static void ChangeWallpaper(
1500 CFNotificationCenterRef center,
1504 CFDictionaryRef info
1507 NSLog(@"WB:Debug:ChangeWallpaper!");
1510 if (WallpaperFile_ != nil) {
1511 image = [[UIImage alloc] initWithContentsOfFile:WallpaperFile_];
1513 image = [image autorelease];
1516 if (WallpaperImage_ != nil)
1517 [WallpaperImage_ setImage:image];
1518 if (WallpaperPage_ != nil)
1519 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
1523 #define WBRename(name, sel, imp) \
1524 _ ## name ## $ ## imp = MSHookMessage($ ## name, @selector(sel), &$ ## name ## $ ## imp)
1526 template <typename Type_>
1527 static void nlset(Type_ &function, struct nlist *nl, size_t index) {
1528 struct nlist &name(nl[index]);
1529 uintptr_t value(name.n_value);
1530 if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
1531 value |= 0x00000001;
1532 function = reinterpret_cast<Type_>(value);
1535 template <typename Type_>
1536 static void dlset(Type_ &function, const char *name) {
1537 function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
1540 /*static void WBImage(const struct mach_header* mh, intptr_t vmaddr_slide) {
1541 uint32_t count(_dyld_image_count());
1542 for (uint32_t index(0); index != count; ++index)
1543 if (_dyld_get_image_header(index) == mh) {
1544 CGImageSourceRef (*CGImageSourceCreateWithURL)(CFURLRef url, CFDictionaryRef options);
1545 dlset(CGImageSourceCreateWithURL, "CGImageSourceCreateWithURL");
1546 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1550 extern "C" void WBInitialize() {
1551 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
1553 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
1555 NSLog(@"WB:Notice: WinterBoard");
1557 dlset(_GSFontGetUseLegacyFontMetrics, "GSFontGetUseLegacyFontMetrics");
1559 //if ([NSBundle bundleWithIdentifier:@"com.apple.ImageIO.framework"] != nil)
1560 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1562 // _dyld_register_func_for_add_image(&WBImage);
1566 if ([NSBundle bundleWithIdentifier:@"com.apple.UIKit"] != nil) {
1568 memset(nl, 0, sizeof(nl));
1569 nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
1570 nl[1].n_un.n_name = (char *) "__UIImageAtPath";
1571 nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
1572 nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
1573 nl[4].n_un.n_name = (char *) "__UIKitBundle";
1574 nl[5].n_un.n_name = (char *) "__UIPackedImageTableGetIdentifierForName";
1575 nl[6].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
1578 nlset(_UIApplicationImageWithName, nl, 0);
1579 nlset(_UIImageAtPath, nl, 1);
1580 nlset(_UIImageRefAtPath, nl, 2);
1581 nlset(_UIImageWithNameInDomain, nl, 3);
1582 nlset(_UIKitBundle, nl, 4);
1583 nlset(_UIPackedImageTableGetIdentifierForName, nl, 5);
1584 nlset(_UISharedImageNameGetIdentifier, nl, 6);
1586 MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
1587 MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
1588 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
1589 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
1593 MSHookFunction(&GSFontCreateWithName, &$GSFontCreateWithName, &_GSFontCreateWithName);
1595 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1598 memset(nl, 0, sizeof(nl));
1599 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1600 nlist(AudioToolbox, nl);
1601 nlset(_Z24GetFileNameForThisActionmPcRb, nl, 0);
1602 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
1606 $NSBundle = objc_getClass("NSBundle");
1608 _NSBundle$localizedStringForKey$value$table$ = MSHookMessage($NSBundle, @selector(localizedStringForKey:value:table:), &$NSBundle$localizedStringForKey$value$table$);
1609 _NSBundle$pathForResource$ofType$ = MSHookMessage($NSBundle, @selector(pathForResource:ofType:), &$NSBundle$pathForResource$ofType$);
1611 $UIImage = objc_getClass("UIImage");
1612 $UINavigationBar = objc_getClass("UINavigationBar");
1613 $UIToolbar = objc_getClass("UIToolbar");
1615 _UIImage$defaultDesktopImage = MSHookMessage(object_getClass($UIImage), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage);
1617 //WBRename("UINavigationBar", @selector(initWithCoder:), (IMP) &UINavigationBar$initWithCoder$);
1618 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:), (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1620 _UINavigationBar$setBarStyle$ = MSHookMessage($UINavigationBar, @selector(setBarStyle:), &$UINavigationBar$setBarStyle$);
1621 _UIToolbar$setBarStyle$ = MSHookMessage($UIToolbar, @selector(setBarStyle:), &$UIToolbar$setBarStyle$);
1623 Manager_ = [[NSFileManager defaultManager] retain];
1624 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1625 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1626 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1627 Bundles_ = [[NSMutableDictionary alloc] initWithCapacity:2];
1628 Themed_ = [[NSMutableDictionary alloc] initWithCapacity:128];
1630 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1632 if (NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1633 // Load Settings {{{
1634 if (NSNumber *value = [settings objectForKey:@"SummerBoard"])
1635 SummerBoard_ = [value boolValue];
1636 if (NSNumber *value = [settings objectForKey:@"Debug"])
1637 Debug_ = [value boolValue];
1639 NSArray *themes([settings objectForKey:@"Themes"]);
1641 if (NSString *theme = [settings objectForKey:@"Theme"])
1642 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1644 [NSNumber numberWithBool:true], @"Active",
1648 for (NSDictionary *theme in themes) {
1649 NSNumber *active([theme objectForKey:@"Active"]);
1650 if (![active boolValue])
1653 NSString *name([theme objectForKey:@"Name"]);
1657 NSString *theme(nil);
1659 #define testForTheme(format...) \
1660 if (theme == nil) { \
1661 NSString *path = [NSString stringWithFormat:format]; \
1662 if ([Manager_ fileExistsAtPath:path]) { \
1663 [themes_ addObject:path]; \
1668 testForTheme(@"/Library/Themes/%@.theme", name)
1669 testForTheme(@"/Library/Themes/%@", name)
1670 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1676 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1678 for (NSString *theme in themes_)
1679 if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1680 for (NSString *key in [info allKeys])
1681 if ([Info_ objectForKey:key] == nil)
1682 [Info_ setObject:[info objectForKey:key] forKey:key];
1684 bool sms($getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]) != nil);
1686 SpringBoard_ = [identifier isEqualToString:@"com.apple.springboard"];
1688 if ([NSBundle bundleWithIdentifier:@"com.apple.chatkit"] != nil)
1691 $CKMessageCell = objc_getClass("CKMessageCell");
1692 _CKMessageCell$addBalloonView$ = MSHookMessage($CKMessageCell, @selector(addBalloonView:), &$CKMessageCell$addBalloonView$);
1693 _CKMessageCell$initWithStyle$reuseIdentifier$ = MSHookMessage($CKMessageCell, @selector(initWithStyle:reuseIdentifier:), &$CKMessageCell$initWithStyle$reuseIdentifier$);
1695 $CKTranscriptTableView = objc_getClass("CKTranscriptTableView");
1696 _CKTranscriptTableView$setSeparatorStyle$ = MSHookMessage($CKTranscriptTableView, @selector(setSeparatorStyle:), &$CKTranscriptTableView$setSeparatorStyle$);
1697 _CKTranscriptTableView$initWithFrame$style$ = MSHookMessage($CKTranscriptTableView, @selector(initWithFrame:style:), &$CKTranscriptTableView$initWithFrame$style$);
1699 $CKTimestampView = objc_getClass("CKTimestampView");
1700 _CKTimestampView$initWithStyle$reuseIdentifier$ = MSHookMessage($CKTimestampView, @selector(initWithStyle:reuseIdentifier:), &$CKTimestampView$initWithStyle$reuseIdentifier$);
1702 $CKTranscriptController = objc_getClass("CKTranscriptController");
1703 _TranscriptController$loadView = MSHookMessage($CKTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1707 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1710 if (_TranscriptController$loadView == NULL) {
1711 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1712 _TranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1716 } else if (SpringBoard_) {
1718 CFNotificationCenterAddObserver(
1719 CFNotificationCenterGetDarwinNotifyCenter(),
1720 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1723 if ($getTheme$([NSArray arrayWithObject:@"Wallpaper.mp4"]) != nil) {
1724 NSBundle *MediaPlayer([NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"]);
1725 if (MediaPlayer != nil)
1728 $MPMoviePlayerController = objc_getClass("MPMoviePlayerController");
1729 $MPVideoView = objc_getClass("MPVideoView");
1732 $WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
1734 $SBApplication = objc_getClass("SBApplication");
1735 $SBApplicationIcon = objc_getClass("SBApplicationIcon");
1736 $SBAwayView = objc_getClass("SBAwayView");
1737 $SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
1738 $SBButtonBar = objc_getClass("SBButtonBar");
1739 $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
1740 $SBDockIconListView = objc_getClass("SBDockIconListView");
1741 $SBIcon = objc_getClass("SBIcon");
1742 $SBIconBadge = objc_getClass("SBIconBadge");
1743 $SBIconController = objc_getClass("SBIconController");
1744 $SBIconLabel = objc_getClass("SBIconLabel");
1745 $SBIconList = objc_getClass("SBIconList");
1746 $SBIconModel = objc_getClass("SBIconModel");
1747 //$SBImageCache = objc_getClass("SBImageCache");
1748 $SBSearchView = objc_getClass("SBSearchView");
1749 $SBSearchTableViewCell = objc_getClass("SBSearchTableViewCell");
1750 $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
1751 $SBStatusBarController = objc_getClass("SBStatusBarController");
1752 $SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
1753 $SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
1754 $SBUIController = objc_getClass("SBUIController");
1755 $SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
1757 Four_ = $SBDockIconListView != nil;
1759 WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
1762 WBRename(SBApplication, pathForIcon, pathForIcon);
1763 WBRename(SBApplicationIcon, icon, icon);
1764 WBRename(SBApplicationIcon, generateIconImage:, generateIconImage$);
1767 WBRename(SBBookmarkIcon, icon, icon);
1768 WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
1769 WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
1770 WBRename(SBIcon, setAlpha:, setAlpha$);
1771 WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
1772 WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
1773 WBRename(SBUIController, init, init);
1774 WBRename(SBWidgetApplicationIcon, icon, icon);
1776 WBRename(SBDockIconListView, setFrame:, setFrame$);
1777 MSHookMessage(object_getClass($SBDockIconListView), @selector(shouldShowNewDock), &$SBDockIconListView$shouldShowNewDock, &_SBDockIconListView$shouldShowNewDock);
1779 WBRename(SBIconLabel, drawRect:, drawRect$);
1780 WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
1781 WBRename(SBIconLabel, setInDock:, setInDock$);
1783 WBRename(SBIconList, setFrame:, setFrame$);
1785 WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
1786 WBRename(SBIconModel, cacheImagesForIcon:, cacheImagesForIcon$);
1787 WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
1788 WBRename(SBIconModel, getCachedImagedForIcon:smallIcon:, getCachedImagedForIcon$smallIcon$);
1790 WBRename(SBSearchView, initWithFrame:, initWithFrame$);
1791 WBRename(SBSearchTableViewCell, drawRect:, drawRect$);
1792 WBRename(SBSearchTableViewCell, initWithStyle:reuseIdentifier:, initWithStyle$reuseIdentifier$);
1794 //WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
1796 WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
1797 WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
1798 //WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
1799 //WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
1800 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
1801 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:startTime:, setStatusBarMode$orientation$duration$fenceID$animation$startTime$);
1802 WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
1803 WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
1804 WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
1807 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1809 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1813 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1814 Papered_ = $getTheme$(Wallpapers_) != nil;
1816 Docked_ = $getTheme$([NSArray arrayWithObjects:@"Dock.png", nil]);