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 #include <sys/sysctl.h>
106 extern "C" void __clear_cache (char *beg, char *end);
108 @protocol WinterBoard
112 Class $MPMoviePlayerController;
114 Class $WebCoreFrameBridge;
119 Class $UINavigationBar;
122 Class $CKMessageCell;
123 Class $CKTimestampView;
124 Class $CKTranscriptController;
125 Class $CKTranscriptTableView;
127 Class $SBApplication;
128 Class $SBApplicationIcon;
130 Class $SBBookmarkIcon;
132 Class $SBCalendarIconContentsView;
133 Class $SBDockIconListView;
136 Class $SBIconController;
140 //Class $SBImageCache;
142 Class $SBSearchTableViewCell;
143 Class $SBStatusBarContentsView;
144 Class $SBStatusBarController;
145 Class $SBStatusBarOperatorNameView;
146 Class $SBStatusBarTimeView;
147 Class $SBUIController;
148 Class $SBWidgetApplicationIcon;
153 @interface NSDictionary (WinterBoard)
154 - (UIColor *) wb$colorForKey:(NSString *)key;
155 - (BOOL) wb$boolForKey:(NSString *)key;
158 @implementation NSDictionary (WinterBoard)
160 - (UIColor *) wb$colorForKey:(NSString *)key {
161 NSString *value = [self objectForKey:key];
168 - (BOOL) wb$boolForKey:(NSString *)key {
169 if (NSString *value = [self objectForKey:key])
170 return [value boolValue];
176 static BOOL (*_GSFontGetUseLegacyFontMetrics)();
177 #define $GSFontGetUseLegacyFontMetrics() \
178 (_GSFontGetUseLegacyFontMetrics == NULL ? YES : _GSFontGetUseLegacyFontMetrics())
180 static bool Debug_ = false;
181 static bool Engineer_ = false;
182 static bool SummerBoard_ = true;
183 static bool SpringBoard_;
185 static UIImage *(*_UIApplicationImageWithName)(NSString *name);
186 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
187 static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation, float *scale);
188 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
189 static NSBundle *(*_UIKitBundle)();
190 static bool (*_UIPackedImageTableGetIdentifierForName)(NSString *, int *);
191 static int (*_UISharedImageNameGetIdentifier)(NSString *);
193 static NSMutableDictionary *UIImages_;
194 static NSMutableDictionary *PathImages_;
195 static NSMutableDictionary *Cache_;
196 static NSMutableDictionary *Strings_;
197 static NSMutableDictionary *Themed_;
198 static NSMutableDictionary *Bundles_;
200 static NSFileManager *Manager_;
201 static NSDictionary *English_;
202 static NSMutableDictionary *Info_;
203 static NSMutableArray *themes_;
205 static NSString *$getTheme$(NSArray *files, bool parent = false) {
207 if (NSString *path = [Themed_ objectForKey:files])
208 return reinterpret_cast<id>(path) == [NSNull null] ? nil : path;
211 NSLog(@"WB:Debug: %@", [files description]);
215 for (NSString *theme in themes_)
216 for (NSString *file in files) {
217 path = [NSString stringWithFormat:@"%@/%@", theme, file];
218 if ([Manager_ fileExistsAtPath:path]) {
219 path = parent ? theme : path;
227 [Themed_ setObject:(path == nil ? [NSNull null] : reinterpret_cast<id>(path)) forKey:files];
231 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui) {
232 NSString *identifier = [bundle bundleIdentifier];
233 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
235 if (identifier != nil)
236 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
237 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
238 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
240 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
242 #define remapResourceName(oldname, newname) \
243 else if ([file isEqualToString:(oldname)]) \
244 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
246 bool summer(SpringBoard_ && SummerBoard_);
248 if (identifier == nil);
249 else if ([identifier isEqualToString:@"com.apple.chatkit"])
250 [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.MobileSMS/%@", file]];
251 else if ([identifier isEqualToString:@"com.apple.calculator"])
252 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
254 remapResourceName(@"FSO_BG.png", @"StatusBar")
255 remapResourceName(Four_ ? @"SBDockBG-old.png" : @"SBDockBG.png", @"Dock")
256 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
258 if (NSString *path = $getTheme$(names))
264 static NSString *$pathForIcon$(SBApplication *self, NSString *suffix = @"") {
265 NSString *identifier = [self bundleIdentifier];
266 NSString *path = [self path];
267 NSString *folder = [path lastPathComponent];
268 NSString *dname = [self displayName];
269 NSString *didentifier = [self displayIdentifier];
272 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
274 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
276 /* XXX: I might need to keep this for backwards compatibility
277 if (identifier != nil)
278 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
280 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]]; */
282 #define testForIcon(Name) \
283 if (NSString *name = Name) \
284 [names addObject:[NSString stringWithFormat:@"Icons%@/%@.png", suffix, name]];
286 if (![didentifier isEqualToString:identifier])
287 testForIcon(didentifier);
289 testForIcon(identifier);
292 if ([identifier isEqualToString:@"com.apple.MobileSMS"])
295 if (didentifier != nil) {
296 testForIcon([English_ objectForKey:didentifier]);
298 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
299 if ([parts count] != 1)
300 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
301 testForIcon([english objectForKey:[parts lastObject]]);
304 if (NSString *path = $getTheme$(names))
310 @interface NSBundle (WinterBoard)
311 + (NSBundle *) wb$bundleWithFile:(NSString *)path;
314 @implementation NSBundle (WinterBoard)
316 + (NSBundle *) wb$bundleWithFile:(NSString *)path {
317 path = [path stringByDeletingLastPathComponent];
318 if (path == nil || [path length] == 0 || [path isEqualToString:@"/"])
321 NSBundle *bundle([Bundles_ objectForKey:path]);
322 if (reinterpret_cast<id>(bundle) == [NSNull null])
324 else if (bundle == nil) {
325 if ([Manager_ fileExistsAtPath:[path stringByAppendingPathComponent:@"Info.plist"]])
326 bundle = [NSBundle bundleWithPath:path];
328 bundle = [NSBundle wb$bundleWithFile:path];
330 NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle);
331 [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast<id>(bundle)) forKey:path];
339 @interface NSString (WinterBoard)
340 - (NSString *) wb$themedPath;
343 @implementation NSString (WinterBoard)
345 - (NSString *) wb$themedPath {
347 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
349 if (NSBundle *bundle = [NSBundle wb$bundleWithFile:self]) {
350 NSString *file([self stringByResolvingSymlinksInPath]);
351 NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
352 if ([file hasPrefix:prefix]) {
353 NSUInteger length([prefix length]);
354 if (length != [file length])
355 if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
365 void WBLogRect(const char *tag, struct CGRect rect) {
366 NSLog(@"%s:{%f,%f+%f,%f}", tag, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
369 void WBLogHierarchy(UIView *view, unsigned index = 0, unsigned indent = 0) {
370 CGRect frame([view frame]);
371 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]);
373 for (UIView *child in [view subviews])
374 WBLogHierarchy(child, index++, indent + 1);
377 UIImage *$cacheForImage$(UIImage *image) {
378 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
379 CGRect rect = {CGPointMake(1, 1), [image size]};
380 CGSize size = {rect.size.width + 2, rect.size.height + 2};
382 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
383 CGColorSpaceRelease(space);
385 CGContextDrawImage(context, rect, [image CGImage]);
386 CGImageRef ref(CGBitmapContextCreateImage(context));
387 CGContextRelease(context);
389 UIImage *cache([UIImage imageWithCGImage:ref]);
395 /*MSHook(id, SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$, SBImageCache *self, SEL sel, NSString *name, unsigned width, unsigned height, unsigned capacity) {
396 //if ([name isEqualToString:@"icons"]) return nil;
397 return _SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$(self, sel, name, width, height, capacity);
400 MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
401 NSString *key([icon displayIdentifier]);
403 if (UIImage *image = [icon icon]) {
404 CGSize size = [image size];
405 if (size.width != 59 || size.height != 60) {
406 UIImage *cache($cacheForImage$(image));
407 [Cache_ setObject:cache forKey:key];
412 _SBIconModel$cacheImageForIcon$(self, sel, icon);
415 MSHook(void, SBIconModel$cacheImagesForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
416 /* XXX: do I /really/ have to do this? figure out how to cache the small icon! */
417 _SBIconModel$cacheImagesForIcon$(self, sel, icon);
419 NSString *key([icon displayIdentifier]);
421 if (UIImage *image = [icon icon]) {
422 CGSize size = [image size];
423 if (size.width != 59 || size.height != 60) {
424 UIImage *cache($cacheForImage$(image));
425 [Cache_ setObject:cache forKey:key];
431 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
432 NSString *key([icon displayIdentifier]);
433 if (UIImage *image = [Cache_ objectForKey:key])
436 return _SBIconModel$getCachedImagedForIcon$(self, sel, icon);
439 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$smallIcon$, SBIconModel *self, SEL sel, SBIcon *icon, BOOL small) {
441 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
442 NSString *key([icon displayIdentifier]);
443 if (UIImage *image = [Cache_ objectForKey:key])
446 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
449 MSHook(id, SBSearchView$initWithFrame$, id /* XXX: SBSearchView */ self, SEL sel, struct CGRect frame) {
450 if ((self = _SBSearchView$initWithFrame$(self, sel, frame)) != nil) {
451 [self setBackgroundColor:[UIColor clearColor]];
452 for (UIView *child in [self subviews])
453 [child setBackgroundColor:[UIColor clearColor]];
457 MSHook(id, SBSearchTableViewCell$initWithStyle$reuseIdentifier$, SBSearchTableViewCell *self, SEL sel, int style, NSString *reuse) {
458 if ((self = _SBSearchTableViewCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
459 [self setBackgroundColor:[UIColor clearColor]];
463 MSHook(void, SBSearchTableViewCell$drawRect$, SBSearchTableViewCell *self, SEL sel, struct CGRect rect, BOOL selected) {
464 _SBSearchTableViewCell$drawRect$(self, sel, rect, selected);
465 float inset([self edgeInset]);
466 [[UIColor clearColor] set];
467 UIRectFill(CGRectMake(0, 0, inset, rect.size.height));
468 UIRectFill(CGRectMake(rect.size.width - inset, 0, inset, rect.size.height));
471 MSHook(UIImage *, SBApplicationIcon$icon, SBApplicationIcon *self, SEL sel) {
472 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"])
473 if (NSString *path = $pathForIcon$([self application]))
474 return [UIImage imageWithContentsOfFile:path];
475 return _SBApplicationIcon$icon(self, sel);
478 MSHook(UIImage *, SBApplicationIcon$generateIconImage$, SBApplicationIcon *self, SEL sel, int type) {
480 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"]) {
481 if (IsWild_ && false) // XXX: delete this code, it should not be supported
482 if (NSString *path72 = $pathForIcon$([self application], @"-72"))
483 return [UIImage imageWithContentsOfFile:path72];
484 if (NSString *path = $pathForIcon$([self application]))
485 if (UIImage *image = [UIImage imageWithContentsOfFile:path]) {
487 if ([$SBIcon respondsToSelector:@selector(defaultIconImageSize)])
488 width = [$SBIcon defaultIconImageSize].width;
491 return width == 59 ? image : [image _imageScaledToProportion:(width / 59.0) interpolationQuality:5];
494 return _SBApplicationIcon$generateIconImage$(self, sel, type);
497 MSHook(UIImage *, SBWidgetApplicationIcon$icon, SBWidgetApplicationIcon *self, SEL sel) {
499 NSLog(@"WB:Debug:Widget(%@:%@)", [self displayIdentifier], [self displayName]);
500 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
501 return [UIImage imageWithContentsOfFile:path];
502 return _SBWidgetApplicationIcon$icon(self, sel);
505 MSHook(UIImage *, SBBookmarkIcon$icon, SBBookmarkIcon *self, SEL sel) {
507 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
508 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
509 return [UIImage imageWithContentsOfFile:path];
510 return _SBBookmarkIcon$icon(self, sel);
513 MSHook(NSString *, SBApplication$pathForIcon, SBApplication *self, SEL sel) {
514 if (NSString *path = $pathForIcon$(self))
516 return _SBApplication$pathForIcon(self, sel);
519 static UIImage *CachedImageAtPath(NSString *path) {
520 path = [path stringByResolvingSymlinksInPath];
521 UIImage *image = [PathImages_ objectForKey:path];
523 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
524 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
526 image = [image autorelease];
527 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
531 MSHook(CGImageSourceRef, CGImageSourceCreateWithURL, CFURLRef url, CFDictionaryRef options) {
533 NSLog(@"WB:Debug: CGImageSourceCreateWithURL(\"%@\", %s)", url, options);
534 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
535 if (NSString *path = (NSString *) CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle))
536 if (NSString *themed = [path wb$themedPath])
538 url = (CFURLRef) [NSURL fileURLWithPath:themed];
539 CGImageSourceRef source(_CGImageSourceCreateWithURL(url, options));
544 MSHook(CGImageRef, _UIImageRefAtPath, NSString *name, bool cache, UIImageOrientation *orientation, float *scale) {
546 NSLog(@"WB:Debug: _UIImageRefAtPath(\"%@\")", name);
548 NSString *themed([name wb$themedPath]);
550 if (false && SpringBoard_ && SummerBoard_ && themed == name) {
551 if ([name isEqualToString:@"/System/Library/CoreServices/SpringBoard.app/SBDockBGT-Portrait.png"])
552 if (NSString *path = $getTheme$([NSArray arrayWithObject:@"Dock.png"])) {
553 UIImage *image([UIImage imageWithContentsOfFile:path]);
554 CGImageRef ref([[image _imageScaledToProportion:2.4 interpolationQuality:5] imageRef]);
560 return __UIImageRefAtPath(themed, cache, orientation, scale);
563 /*MSHook(UIImage *, _UIImageAtPath, NSString *name, NSBundle *bundle) {
565 return __UIImageAtPath(name, nil);
567 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
568 UIImage *image = [PathImages_ objectForKey:key];
570 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
572 NSLog(@"WB:Debug: _UIImageAtPath(\"%@\", %@)", name, bundle);
573 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
574 image = CachedImageAtPath(path);
576 image = __UIImageAtPath(name, bundle);
577 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
582 MSHook(UIImage *, _UIApplicationImageWithName, NSString *name) {
583 NSBundle *bundle = [NSBundle mainBundle];
585 NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
586 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
587 return CachedImageAtPath(path);
588 return __UIApplicationImageWithName(name);
591 #define WBDelegate(delegate) \
592 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
594 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
595 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
597 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
601 - (void) forwardInvocation:(NSInvocation*)inv { \
602 SEL sel = [inv selector]; \
603 if ([delegate respondsToSelector:sel]) \
604 [inv invokeWithTarget:delegate]; \
606 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
609 MSHook(NSString *, NSBundle$pathForResource$ofType$, NSBundle *self, SEL sel, NSString *resource, NSString *type) {
610 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
612 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
613 if (NSString *path = $pathForFile$inBundle$(file, self, false))
615 return _NSBundle$pathForResource$ofType$(self, sel, resource, type);
618 void $setBarStyle$_(NSString *name, int &style) {
620 NSLog(@"WB:Debug:%@Style:%d", name, style);
621 NSNumber *number = nil;
623 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
625 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
627 style = [number intValue];
629 NSLog(@"WB:Debug:%@Style=%d", name, style);
633 MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *self, SEL sel, CGRect rect) {
634 NSBundle *bundle([NSBundle mainBundle]);
636 CFLocaleRef locale(CFLocaleCopyCurrent());
637 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
640 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
642 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"d" table:@"SpringBoard"]);
643 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
644 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"cccc" table:@"SpringBoard"]);
645 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
649 CFRelease(formatter);
651 NSString *datestyle([@""
652 "font-family: Helvetica; "
653 "font-weight: bold; "
656 "" stringByAppendingString:(IsWild_
657 ? @"font-size: 54px; "
658 : @"font-size: 39px; "
661 NSString *daystyle([@""
662 "font-family: Helvetica; "
663 "font-weight: bold; "
665 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
666 "" stringByAppendingString:(IsWild_
667 ? @"font-size: 11px; "
668 : @"font-size: 9px; "
671 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
672 datestyle = [datestyle stringByAppendingString:style];
673 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
674 daystyle = [daystyle stringByAppendingString:style];
676 float width([self bounds].size.width);
678 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
679 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
681 unsigned base0(IsWild_ ? 89 : 70);
682 if ($GSFontGetUseLegacyFontMetrics())
684 unsigned base1(IsWild_ ? 18 : 16);
691 [(NSString *)date drawAtPoint:CGPointMake(
692 (width + 1 - datesize.width) / 2, (base0 - datesize.height) / 2
693 ) withStyle:datestyle];
695 [(NSString *)day drawAtPoint:CGPointMake(
696 (width + 1 - daysize.width) / 2, (base1 - daysize.height) / 2
697 ) withStyle:daystyle];
703 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
706 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
707 style = [number intValue];
709 if (UIColor *color = [Info_ wb$colorForKey:@"NavigationBarTint"])
712 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
715 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
716 self = [self wb$initWithCoder:coder];
719 UINavigationBar$setBarStyle$_(self);
723 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
724 self = [self wb$initWithFrame:frame];
727 UINavigationBar$setBarStyle$_(self);
731 MSHook(void, UIToolbar$setBarStyle$, UIToolbar *self, SEL sel, int style) {
732 $setBarStyle$_(@"Toolbar", style);
733 return _UIToolbar$setBarStyle$(self, sel, style);
736 MSHook(void, UINavigationBar$setBarStyle$, UINavigationBar *self, SEL sel, int style) {
737 $setBarStyle$_(@"NavigationBar", style);
738 return _UINavigationBar$setBarStyle$(self, sel, style);
741 MSHook(void, SBButtonBar$didMoveToSuperview, UIView *self, SEL sel) {
742 [[self superview] setBackgroundColor:[UIColor clearColor]];
743 _SBButtonBar$didMoveToSuperview(self, sel);
746 MSHook(void, SBStatusBarContentsView$didMoveToSuperview, UIView *self, SEL sel) {
747 [[self superview] setBackgroundColor:[UIColor clearColor]];
748 _SBStatusBarContentsView$didMoveToSuperview(self, sel);
751 MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) {
753 NSLog(@"WB:Debug:DefaultDesktopImage");
754 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
755 return [UIImage imageWithContentsOfFile:path];
756 return _UIImage$defaultDesktopImage(self, sel);
759 static NSArray *Wallpapers_;
760 static bool Papered_;
762 static NSString *WallpaperFile_;
763 static UIImageView *WallpaperImage_;
764 static UIWebDocumentView *WallpaperPage_;
765 static NSURL *WallpaperURL_;
767 #define _release(object) \
768 do if (object != nil) { \
773 MSHook(id, SBUIController$init, SBUIController *self, SEL sel) {
774 self = _SBUIController$init(self, sel);
780 sysctlbyname("hw.machine", NULL, &size, NULL, 0);
781 char *machine = new char[size];
783 if (sysctlbyname("hw.machine", machine, &size, NULL, 0) == -1) {
784 perror("sysctlbyname(\"hw.machine\", ?)");
789 IsWild_ = machine != NULL && strncmp(machine, "iPad", 4) == 0;
792 BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability"));
794 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
795 [Info_ setObject:[NSNumber numberWithBool:(
796 !(Papered_ || GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("homescreen-wallpaper"))) ||
797 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
798 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
799 )] forKey:@"UndockedIconLabels"];
802 NSLog(@"WB:Debug:Info = %@", [Info_ description]);
805 UIImageView *&_wallpaperView(MSHookIvar<UIImageView *>(self, "_wallpaperView"));
806 if (&_wallpaperView != NULL) {
807 [_wallpaperView removeFromSuperview];
808 [_wallpaperView release];
809 _wallpaperView = nil;
813 UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
814 UIView *&_contentView(MSHookIvar<UIView *>(self, "_contentView"));
817 if (&_contentLayer != NULL)
818 player = &_contentLayer;
819 else if (&_contentView != NULL)
820 player = &_contentView;
823 UIView *layer(player == NULL ? nil : *player);
825 UIWindow *window([[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
826 UIView *content([[[UIView alloc] initWithFrame:[window frame]] autorelease]);
827 [window setContentView:content];
829 UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
830 [window setBackgroundColor:[_window backgroundColor]];
831 [_window setBackgroundColor:[UIColor clearColor]];
833 [window setLevel:-1000];
834 [window setHidden:NO];
836 /*if (player != NULL)
839 [content setBackgroundColor:[layer backgroundColor]];
840 [layer setBackgroundColor:[UIColor clearColor]];
843 if (!SummerBoard_ || !IsWild_)
846 CGRect bounds([content bounds]);
847 bounds.origin.y = -30;
848 indirect = [[[UIView alloc] initWithFrame:bounds] autorelease];
849 [content addSubview:indirect];
850 [indirect zoomToScale:2.4];
853 _release(WallpaperFile_);
854 _release(WallpaperImage_);
855 _release(WallpaperPage_);
856 _release(WallpaperURL_);
858 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
859 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
860 if ([Manager_ fileExistsAtPath:mp4]) {
864 static AVController *controller_(nil);
865 if (controller_ == nil) {
866 AVQueue *queue([AVQueue avQueue]);
867 controller_ = [[AVController avControllerWithQueue:queue error:&error] retain];
870 AVQueue *queue([controller_ queue]);
872 UIView *video([[[UIView alloc] initWithFrame:[indirect bounds]] autorelease]);
873 [controller_ setLayer:[video _layer]];
875 AVItem *item([[[AVItem alloc] initWithPath:mp4 error:&error] autorelease]);
876 [queue appendItem:item error:&error];
878 [controller_ play:&error];
879 #elif UseMPMoviePlayerController
880 NSURL *url([NSURL fileURLWithPath:mp4]);
881 MPMoviePlayerController *controller = [[$MPMoviePlayerController alloc] initWithContentURL:url];
882 controller.movieControlMode = MPMovieControlModeHidden;
885 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[indirect bounds]] autorelease];
886 [video setMovieWithPath:mp4];
887 [video setRepeatMode:1];
888 [video setRepeatGap:-1];
889 [video playFromBeginning];;
892 [indirect addSubview:video];
895 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
896 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
899 if ([Manager_ fileExistsAtPath:png])
901 else if ([Manager_ fileExistsAtPath:jpg])
907 image = [[UIImage alloc] initWithContentsOfFile:path];
909 image = [image autorelease];
913 WallpaperFile_ = [path retain];
914 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
915 if (NSNumber *number = [Info_ objectForKey:@"WallpaperAlpha"])
916 [WallpaperImage_ setAlpha:[number floatValue]];
917 [indirect addSubview:WallpaperImage_];
920 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
921 if ([Manager_ fileExistsAtPath:html]) {
922 CGRect bounds = [indirect bounds];
924 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
925 [view setAutoresizes:true];
927 WallpaperPage_ = [view retain];
928 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
930 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
932 [view setBackgroundColor:[UIColor clearColor]];
933 if ([view respondsToSelector:@selector(setDrawsBackground:)])
934 [view setDrawsBackground:NO];
935 [[view webView] setDrawsBackground:NO];
937 [indirect addSubview:view];
941 for (size_t i(0), e([themes_ count]); i != e; ++i) {
942 NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
943 NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
944 if ([Manager_ fileExistsAtPath:html]) {
945 CGRect bounds = [indirect bounds];
947 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
948 [view setAutoresizes:true];
950 NSURL *url = [NSURL fileURLWithPath:html];
951 [view loadRequest:[NSURLRequest requestWithURL:url]];
953 [view setBackgroundColor:[UIColor clearColor]];
954 if ([view respondsToSelector:@selector(setDrawsBackground:)])
955 [view setDrawsBackground:NO];
956 [[view webView] setDrawsBackground:NO];
958 [indirect addSubview:view];
965 MSHook(void, SBAwayView$updateDesktopImage$, SBAwayView *self, SEL sel, UIImage *image) {
966 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
967 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
969 if (path != nil && _backgroundView != nil)
972 _SBAwayView$updateDesktopImage$(self, sel, image);
975 CGRect bounds = [self bounds];
977 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
978 [view setAutoresizes:true];
980 if (WallpaperPage_ != nil)
981 [WallpaperPage_ release];
982 WallpaperPage_ = [view retain];
984 if (WallpaperURL_ != nil)
985 [WallpaperURL_ release];
986 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
988 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
990 [[view webView] setDrawsBackground:false];
991 [view setBackgroundColor:[UIColor clearColor]];
993 [self insertSubview:view aboveSubview:_backgroundView];
997 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
998 extern "C" CGColorRef CGGStateGetFillColor(void *);
999 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
1000 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
1002 /* WBTimeLabel {{{ */
1003 @interface WBTimeLabel : NSProxy {
1005 _transient SBStatusBarTimeView *view_;
1008 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
1012 @implementation WBTimeLabel
1019 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
1020 time_ = [time retain];
1025 - (NSString *) description {
1031 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
1032 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
1033 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
1035 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
1036 "font-family: Helvetica; "
1037 "font-weight: bold; "
1040 "%@", _mode ? @"white" : @"black", custom]];
1045 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1050 /* WBBadgeLabel {{{ */
1051 @interface WBBadgeLabel : NSProxy {
1055 - (id) initWithBadge:(NSString *)badge;
1056 - (NSString *) description;
1060 @implementation WBBadgeLabel
1067 - (id) initWithBadge:(NSString *)badge {
1068 badge_ = [badge retain];
1072 - (NSString *) description {
1073 return [badge_ description];
1078 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
1079 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
1080 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
1081 "font-family: Helvetica; "
1082 "font-weight: bold; "
1090 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1096 MSHook(void, SBIcon$setAlpha$, SBIcon *self, SEL sel, float alpha) {
1097 if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
1098 alpha = [number floatValue];
1099 return _SBIcon$setAlpha$(self, sel, alpha);
1102 MSHook(id, SBIconBadge$initWithBadge$, SBIconBadge *self, SEL sel, NSString *badge) {
1103 if ((self = _SBIconBadge$initWithBadge$(self, sel, badge)) != nil) {
1104 id &_badge(MSHookIvar<id>(self, "_badge"));
1106 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
1111 void SBStatusBarController$setStatusBarMode(int &mode) {
1113 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
1114 if (mode < 100) // 104:hidden 105:glowing
1115 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
1116 mode = [number intValue];
1119 /*MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int animation) {
1120 NSLog(@"mode:%d orientation:%d duration:%f animation:%d", mode, orientation, duration, animation);
1121 SBStatusBarController$setStatusBarMode(mode);
1122 return _SBStatusBarController$setStatusBarMode$orientation$duration$animation$(self, sel, mode, orientation, duration, animation);
1125 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int fenceID, int animation) {
1126 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d", mode, orientation, duration, fenceID, animation);
1127 SBStatusBarController$setStatusBarMode(mode);
1128 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, fenceID, animation);
1131 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) {
1132 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d startTime:%f", mode, orientation, duration, fenceID, animation, startTime);
1133 SBStatusBarController$setStatusBarMode(mode);
1134 //NSLog(@"mode=%u", mode);
1135 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$(self, sel, mode, orientation, duration, fenceID, animation, startTime);
1138 /*MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
1139 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
1140 mode = [number intValue];
1141 return _SBStatusBarContentsView$initWithStatusBar$mode$(self, sel, bar, mode);
1144 MSHook(NSString *, SBStatusBarOperatorNameView$operatorNameStyle, SBStatusBarOperatorNameView *self, SEL sel) {
1145 NSString *style(_SBStatusBarOperatorNameView$operatorNameStyle(self, sel));
1147 NSLog(@"operatorNameStyle= %@", style);
1148 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
1149 style = [NSString stringWithFormat:@"%@; %@", style, custom];
1153 MSHook(void, SBStatusBarOperatorNameView$setOperatorName$fullSize$, SBStatusBarOperatorNameView *self, SEL sel, NSString *name, BOOL full) {
1155 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
1156 return _SBStatusBarOperatorNameView$setOperatorName$fullSize$(self, sel, name, NO);
1159 // XXX: replace this with [SBStatusBarTimeView tile]
1160 MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, CGRect rect) {
1161 id &_time(MSHookIvar<id>(self, "_time"));
1162 if (_time != nil && [_time class] != [WBTimeLabel class])
1163 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
1164 return _SBStatusBarTimeView$drawRect$(self, sel, rect);
1167 @interface UIView (WinterBoard)
1168 - (bool) wb$isWBImageView;
1169 - (void) wb$logHierarchy;
1172 @implementation UIView (WinterBoard)
1174 - (bool) wb$isWBImageView {
1178 - (void) wb$logHierarchy {
1179 WBLogHierarchy(self);
1184 @interface WBImageView : UIImageView {
1187 - (bool) wb$isWBImageView;
1188 - (void) wb$updateFrame;
1191 @implementation WBImageView
1193 - (bool) wb$isWBImageView {
1197 - (void) wb$updateFrame {
1198 CGRect frame([self frame]);
1201 for (UIView *view(self); ; ) {
1202 view = [view superview];
1205 frame.origin.y -= [view frame].origin.y;
1208 [self setFrame:frame];
1213 MSHook(void, SBIconList$setFrame$, SBIconList *self, SEL sel, CGRect frame) {
1214 NSArray *subviews([self subviews]);
1215 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1216 if (view != nil && [view wb$isWBImageView])
1217 [view wb$updateFrame];
1218 _SBIconList$setFrame$(self, sel, frame);
1221 MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *self, SEL sel) {
1222 SBIconModel *&_iconModel(MSHookIvar<SBIconModel *>(self, "_iconModel"));
1223 NSArray *lists([_iconModel iconLists]);
1225 for (unsigned i(0), e([lists count]); i != e; ++i)
1226 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Page%u.png", i]])) {
1227 SBIconList *list([lists objectAtIndex:i]);
1228 NSArray *subviews([list subviews]);
1230 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1231 if (view == nil || ![view wb$isWBImageView]) {
1232 view = [[[WBImageView alloc] init] autorelease];
1233 [list insertSubview:view atIndex:0];
1236 UIImage *image([UIImage imageWithContentsOfFile:path]);
1238 CGRect frame([view frame]);
1239 frame.size = [image size];
1240 [view setFrame:frame];
1242 [view setImage:image];
1243 [view wb$updateFrame];
1246 return _SBIconController$noteNumberOfIconListsChanged(self, sel);
1249 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
1250 self = _SBIconLabel$initWithSize$label$(self, sel, size, label);
1252 [self setClipsToBounds:NO];
1256 MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
1257 id &_label(MSHookIvar<id>(self, "_label"));
1258 if (![Info_ wb$boolForKey:@"UndockedIconLabels"])
1260 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
1261 [_label setInDock:docked];
1262 return _SBIconLabel$setInDock$(self, sel, docked);
1265 MSHook(BOOL, SBDockIconListView$shouldShowNewDock, id self, SEL sel) {
1266 return SummerBoard_ && Docked_ ? NO : _SBDockIconListView$shouldShowNewDock(self, sel);
1269 MSHook(void, SBDockIconListView$setFrame$, id self, SEL sel, CGRect frame) {
1270 _SBDockIconListView$setFrame$(self, sel, frame);
1273 MSHook(NSString *, NSBundle$localizedStringForKey$value$table$, NSBundle *self, SEL sel, NSString *key, NSString *value, NSString *table) {
1274 NSString *identifier = [self bundleIdentifier];
1275 NSLocale *locale = [NSLocale currentLocale];
1276 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
1278 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
1279 NSString *file = table == nil ? @"Localizable" : table;
1280 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
1281 NSDictionary *strings;
1282 if ((strings = [Strings_ objectForKey:name]) != nil) {
1283 if (static_cast<id>(strings) != [NSNull null]) strings:
1284 if (NSString *value = [strings objectForKey:key])
1286 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
1289 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
1290 [Strings_ setObject:[strings autorelease] forKey:name];
1294 [Strings_ setObject:[NSNull null] forKey:name];
1295 return _NSBundle$localizedStringForKey$value$table$(self, sel, key, value, table);
1298 @class WebCoreFrameBridge;
1299 MSHook(CGSize, WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$, WebCoreFrameBridge *self, SEL sel, id node, float width) {
1302 void **core(reinterpret_cast<void **>([node _node]));
1303 if (core == NULL || core[6] == NULL)
1305 return _WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(self, sel, node, width);
1308 MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) {
1309 CGRect bounds = [self bounds];
1311 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
1314 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
1315 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
1317 NSString *label(MSHookIvar<NSString *>(self, "_label"));
1319 NSString *style = [NSString stringWithFormat:@""
1320 "font-family: Helvetica; "
1321 "font-weight: bold; "
1323 "", (docked || !SummerBoard_ ? @"white" : @"#b3b3b3"), (IsWild_
1324 ? @"font-size: 12px; "
1325 : @"font-size: 11px; "
1329 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px 1px 0px; "];
1331 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
1333 bool ellipsis(false);
1334 float max = 75, width;
1336 width = [(ellipsis ? [label stringByAppendingString:@"..."] : label) sizeWithStyle:style forWidth:320].width;
1339 size_t length([label length]);
1340 float spacing((width - max) / (length - 1));
1342 if (spacing > 1.25) {
1344 label = [label substringToIndex:(length - 1)];
1348 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", spacing]];
1352 label = [label stringByAppendingString:@"..."];
1354 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
1355 style = [style stringByAppendingString:custom];
1357 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
1358 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
1361 MSHook(void, CKMessageCell$addBalloonView$, id self, SEL sel, CKBalloonView *balloon) {
1362 _CKMessageCell$addBalloonView$(self, sel, balloon);
1363 [balloon setBackgroundColor:[UIColor clearColor]];
1366 MSHook(id, CKMessageCell$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1367 if ((self = _CKMessageCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1368 [[self contentView] setBackgroundColor:[UIColor clearColor]];
1372 MSHook(id, CKTimestampView$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1373 if ((self = _CKTimestampView$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1374 UILabel *&_label(MSHookIvar<UILabel *>(self, "_label"));
1375 [_label setBackgroundColor:[UIColor clearColor]];
1379 MSHook(void, CKTranscriptTableView$setSeparatorStyle$, id self, SEL sel, int style) {
1380 _CKTranscriptTableView$setSeparatorStyle$(self, sel, UITableViewCellSeparatorStyleNone);
1383 MSHook(id, CKTranscriptTableView$initWithFrame$style$, id self, SEL sel, CGRect frame, int style) {
1385 if ((self = _CKTranscriptTableView$initWithFrame$style$(self, sel, frame, style)) != nil) {
1386 [self setSeparatorStyle:UITableViewCellSeparatorStyleNone];
1390 MSHook(void, TranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) {
1391 _TranscriptController$loadView(self, sel);
1393 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
1394 if (UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]) {
1395 [image autorelease];
1397 UIView *&_transcriptTable(MSHookIvar<UIView *>(self, "_transcriptTable"));
1398 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
1400 if (&_transcriptTable != NULL)
1401 table = _transcriptTable;
1402 else if (&_transcriptLayer != NULL)
1403 table = _transcriptLayer;
1407 UIView *placard(table != nil ? [table superview] : MSHookIvar<UIView *>(self, "_backPlacard"));
1408 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
1411 [placard insertSubview:background atIndex:0];
1413 [table setBackgroundColor:[UIColor clearColor]];
1414 [placard insertSubview:background belowSubview:table];
1419 MSHook(UIImage *, _UIImageWithName, NSString *name) {
1421 NSLog(@"WB:Debug: _UIImageWithName(\"%@\")", name);
1428 if (_UIPackedImageTableGetIdentifierForName != NULL)
1429 packed = _UIPackedImageTableGetIdentifierForName(name, &identifier);
1430 else if (_UISharedImageNameGetIdentifier != NULL) {
1431 identifier = _UISharedImageNameGetIdentifier(name);
1432 packed = identifier != -1;
1439 NSLog(@"WB:Debug: _UISharedImageNameGetIdentifier(\"%@\") = %d", name, identifier);
1442 return __UIImageWithName(name);
1444 NSNumber *key([NSNumber numberWithInt:identifier]);
1445 UIImage *image([UIImages_ objectForKey:key]);
1447 return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithName(name) : image;
1448 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
1449 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
1451 [image autorelease];
1453 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1454 return image == nil ? __UIImageWithName(name) : image;
1458 MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
1459 NSString *key([NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name]);
1460 UIImage *image([PathImages_ objectForKey:key]);
1462 return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image;
1464 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
1465 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
1466 image = [[UIImage alloc] initWithContentsOfFile:path];
1468 [image autorelease];
1470 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1471 return image == nil ? __UIImageWithNameInDomain(name, domain) : image;
1474 MSHook(GSFontRef, GSFontCreateWithName, const char *name, GSFontSymbolicTraits traits, float size) {
1476 NSLog(@"WB:Debug: GSFontCreateWithName(\"%s\", %f)", name, size);
1477 if (NSString *font = [Info_ objectForKey:[NSString stringWithFormat:@"FontName-%s", name]])
1478 name = [font UTF8String];
1479 //if (NSString *scale = [Info_ objectForKey:[NSString stringWithFormat:@"FontScale-%s", name]])
1480 // size *= [scale floatValue];
1481 return _GSFontCreateWithName(name, traits, size);
1484 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
1485 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
1487 bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
1489 MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
1491 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %p, %u)", a0, a1, a2);
1492 bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
1494 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
1497 NSString *path = [NSString stringWithUTF8String:a1];
1498 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
1499 NSString *file = [path substringFromIndex:31];
1500 for (NSString *theme in themes_) {
1501 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
1502 if ([Manager_ fileExistsAtPath:path]) {
1503 strcpy(a1, [path UTF8String]);
1512 static void ChangeWallpaper(
1513 CFNotificationCenterRef center,
1517 CFDictionaryRef info
1520 NSLog(@"WB:Debug:ChangeWallpaper!");
1523 if (WallpaperFile_ != nil) {
1524 image = [[UIImage alloc] initWithContentsOfFile:WallpaperFile_];
1526 image = [image autorelease];
1529 if (WallpaperImage_ != nil)
1530 [WallpaperImage_ setImage:image];
1531 if (WallpaperPage_ != nil)
1532 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
1536 #define WBRename(name, sel, imp) \
1537 _ ## name ## $ ## imp = MSHookMessage($ ## name, @selector(sel), &$ ## name ## $ ## imp)
1539 template <typename Type_>
1540 static void nlset(Type_ &function, struct nlist *nl, size_t index) {
1541 struct nlist &name(nl[index]);
1542 uintptr_t value(name.n_value);
1543 if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
1544 value |= 0x00000001;
1545 function = reinterpret_cast<Type_>(value);
1548 template <typename Type_>
1549 static void dlset(Type_ &function, const char *name) {
1550 function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
1553 /*static void WBImage(const struct mach_header* mh, intptr_t vmaddr_slide) {
1554 uint32_t count(_dyld_image_count());
1555 for (uint32_t index(0); index != count; ++index)
1556 if (_dyld_get_image_header(index) == mh) {
1557 CGImageSourceRef (*CGImageSourceCreateWithURL)(CFURLRef url, CFDictionaryRef options);
1558 dlset(CGImageSourceCreateWithURL, "CGImageSourceCreateWithURL");
1559 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1563 extern "C" void WBInitialize() {
1564 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
1566 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
1568 NSLog(@"WB:Notice: WinterBoard");
1570 dlset(_GSFontGetUseLegacyFontMetrics, "GSFontGetUseLegacyFontMetrics");
1572 //if ([NSBundle bundleWithIdentifier:@"com.apple.ImageIO.framework"] != nil)
1573 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1575 // _dyld_register_func_for_add_image(&WBImage);
1579 if ([NSBundle bundleWithIdentifier:@"com.apple.UIKit"] != nil) {
1581 memset(nl, 0, sizeof(nl));
1582 nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
1583 nl[1].n_un.n_name = (char *) "__UIImageAtPath";
1584 nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
1585 nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
1586 nl[4].n_un.n_name = (char *) "__UIKitBundle";
1587 nl[5].n_un.n_name = (char *) "__UIPackedImageTableGetIdentifierForName";
1588 nl[6].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
1591 nlset(_UIApplicationImageWithName, nl, 0);
1592 nlset(_UIImageAtPath, nl, 1);
1593 nlset(_UIImageRefAtPath, nl, 2);
1594 nlset(_UIImageWithNameInDomain, nl, 3);
1595 nlset(_UIKitBundle, nl, 4);
1596 nlset(_UIPackedImageTableGetIdentifierForName, nl, 5);
1597 nlset(_UISharedImageNameGetIdentifier, nl, 6);
1599 MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
1600 MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
1601 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
1602 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
1606 MSHookFunction(&GSFontCreateWithName, &$GSFontCreateWithName, &_GSFontCreateWithName);
1608 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1611 memset(nl, 0, sizeof(nl));
1612 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1613 nlist(AudioToolbox, nl);
1614 nlset(_Z24GetFileNameForThisActionmPcRb, nl, 0);
1615 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
1619 $NSBundle = objc_getClass("NSBundle");
1621 _NSBundle$localizedStringForKey$value$table$ = MSHookMessage($NSBundle, @selector(localizedStringForKey:value:table:), &$NSBundle$localizedStringForKey$value$table$);
1622 _NSBundle$pathForResource$ofType$ = MSHookMessage($NSBundle, @selector(pathForResource:ofType:), &$NSBundle$pathForResource$ofType$);
1624 $UIImage = objc_getClass("UIImage");
1625 $UINavigationBar = objc_getClass("UINavigationBar");
1626 $UIToolbar = objc_getClass("UIToolbar");
1628 _UIImage$defaultDesktopImage = MSHookMessage(object_getClass($UIImage), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage);
1630 //WBRename("UINavigationBar", @selector(initWithCoder:), (IMP) &UINavigationBar$initWithCoder$);
1631 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:), (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1633 _UINavigationBar$setBarStyle$ = MSHookMessage($UINavigationBar, @selector(setBarStyle:), &$UINavigationBar$setBarStyle$);
1634 _UIToolbar$setBarStyle$ = MSHookMessage($UIToolbar, @selector(setBarStyle:), &$UIToolbar$setBarStyle$);
1636 Manager_ = [[NSFileManager defaultManager] retain];
1637 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1638 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1639 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1640 Bundles_ = [[NSMutableDictionary alloc] initWithCapacity:2];
1641 Themed_ = [[NSMutableDictionary alloc] initWithCapacity:128];
1643 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1645 if (NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1646 // Load Settings {{{
1647 if (NSNumber *value = [settings objectForKey:@"SummerBoard"])
1648 SummerBoard_ = [value boolValue];
1649 if (NSNumber *value = [settings objectForKey:@"Debug"])
1650 Debug_ = [value boolValue];
1652 NSArray *themes([settings objectForKey:@"Themes"]);
1654 if (NSString *theme = [settings objectForKey:@"Theme"])
1655 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1657 [NSNumber numberWithBool:true], @"Active",
1661 for (NSDictionary *theme in themes) {
1662 NSNumber *active([theme objectForKey:@"Active"]);
1663 if (![active boolValue])
1666 NSString *name([theme objectForKey:@"Name"]);
1670 NSString *theme(nil);
1672 #define testForTheme(format...) \
1673 if (theme == nil) { \
1674 NSString *path = [NSString stringWithFormat:format]; \
1675 if ([Manager_ fileExistsAtPath:path]) { \
1676 [themes_ addObject:path]; \
1681 testForTheme(@"/Library/Themes/%@.theme", name)
1682 testForTheme(@"/Library/Themes/%@", name)
1683 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1689 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1691 for (NSString *theme in themes_)
1692 if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1693 for (NSString *key in [info allKeys])
1694 if ([Info_ objectForKey:key] == nil)
1695 [Info_ setObject:[info objectForKey:key] forKey:key];
1697 bool sms($getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]) != nil);
1699 SpringBoard_ = [identifier isEqualToString:@"com.apple.springboard"];
1701 if ([NSBundle bundleWithIdentifier:@"com.apple.chatkit"] != nil)
1704 $CKMessageCell = objc_getClass("CKMessageCell");
1705 _CKMessageCell$addBalloonView$ = MSHookMessage($CKMessageCell, @selector(addBalloonView:), &$CKMessageCell$addBalloonView$);
1706 _CKMessageCell$initWithStyle$reuseIdentifier$ = MSHookMessage($CKMessageCell, @selector(initWithStyle:reuseIdentifier:), &$CKMessageCell$initWithStyle$reuseIdentifier$);
1708 $CKTranscriptTableView = objc_getClass("CKTranscriptTableView");
1709 _CKTranscriptTableView$setSeparatorStyle$ = MSHookMessage($CKTranscriptTableView, @selector(setSeparatorStyle:), &$CKTranscriptTableView$setSeparatorStyle$);
1710 _CKTranscriptTableView$initWithFrame$style$ = MSHookMessage($CKTranscriptTableView, @selector(initWithFrame:style:), &$CKTranscriptTableView$initWithFrame$style$);
1712 $CKTimestampView = objc_getClass("CKTimestampView");
1713 _CKTimestampView$initWithStyle$reuseIdentifier$ = MSHookMessage($CKTimestampView, @selector(initWithStyle:reuseIdentifier:), &$CKTimestampView$initWithStyle$reuseIdentifier$);
1715 $CKTranscriptController = objc_getClass("CKTranscriptController");
1716 _TranscriptController$loadView = MSHookMessage($CKTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1720 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1723 if (_TranscriptController$loadView == NULL) {
1724 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1725 _TranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1729 } else if (SpringBoard_) {
1731 CFNotificationCenterAddObserver(
1732 CFNotificationCenterGetDarwinNotifyCenter(),
1733 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1736 if ($getTheme$([NSArray arrayWithObject:@"Wallpaper.mp4"]) != nil) {
1737 NSBundle *MediaPlayer([NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"]);
1738 if (MediaPlayer != nil)
1741 $MPMoviePlayerController = objc_getClass("MPMoviePlayerController");
1742 $MPVideoView = objc_getClass("MPVideoView");
1745 $WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
1747 bool olden(dlsym(RTLD_DEFAULT, "GSLibraryCopyGenerationInfoValueForKey") == NULL);
1750 $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
1752 $SBApplication = objc_getClass("SBApplication");
1753 $SBApplicationIcon = objc_getClass("SBApplicationIcon");
1754 $SBAwayView = objc_getClass("SBAwayView");
1755 $SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
1756 $SBButtonBar = objc_getClass("SBButtonBar");
1757 $SBDockIconListView = objc_getClass("SBDockIconListView");
1758 $SBIcon = objc_getClass("SBIcon");
1759 $SBIconBadge = objc_getClass("SBIconBadge");
1760 $SBIconController = objc_getClass("SBIconController");
1761 $SBIconLabel = objc_getClass("SBIconLabel");
1762 $SBIconList = objc_getClass("SBIconList");
1763 $SBIconModel = objc_getClass("SBIconModel");
1764 //$SBImageCache = objc_getClass("SBImageCache");
1765 $SBSearchView = objc_getClass("SBSearchView");
1766 $SBSearchTableViewCell = objc_getClass("SBSearchTableViewCell");
1767 $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
1768 $SBStatusBarController = objc_getClass("SBStatusBarController");
1769 $SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
1770 $SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
1771 $SBUIController = objc_getClass("SBUIController");
1772 $SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
1774 Four_ = $SBDockIconListView != nil;
1776 WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
1779 WBRename(SBApplication, pathForIcon, pathForIcon);
1780 WBRename(SBApplicationIcon, icon, icon);
1781 WBRename(SBApplicationIcon, generateIconImage:, generateIconImage$);
1784 WBRename(SBBookmarkIcon, icon, icon);
1785 WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
1786 WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
1787 WBRename(SBIcon, setAlpha:, setAlpha$);
1788 WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
1789 WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
1790 WBRename(SBUIController, init, init);
1791 WBRename(SBWidgetApplicationIcon, icon, icon);
1793 WBRename(SBDockIconListView, setFrame:, setFrame$);
1794 MSHookMessage(object_getClass($SBDockIconListView), @selector(shouldShowNewDock), &$SBDockIconListView$shouldShowNewDock, &_SBDockIconListView$shouldShowNewDock);
1797 WBRename(SBIconLabel, drawRect:, drawRect$);
1799 WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
1800 WBRename(SBIconLabel, setInDock:, setInDock$);
1802 WBRename(SBIconList, setFrame:, setFrame$);
1804 WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
1805 WBRename(SBIconModel, cacheImagesForIcon:, cacheImagesForIcon$);
1806 WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
1807 WBRename(SBIconModel, getCachedImagedForIcon:smallIcon:, getCachedImagedForIcon$smallIcon$);
1809 WBRename(SBSearchView, initWithFrame:, initWithFrame$);
1810 WBRename(SBSearchTableViewCell, drawRect:, drawRect$);
1811 WBRename(SBSearchTableViewCell, initWithStyle:reuseIdentifier:, initWithStyle$reuseIdentifier$);
1813 //WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
1815 WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
1816 WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
1817 //WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
1818 //WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
1819 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
1820 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:startTime:, setStatusBarMode$orientation$duration$fenceID$animation$startTime$);
1821 WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
1822 WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
1823 WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
1826 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1828 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1832 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1833 Papered_ = $getTheme$(Wallpapers_) != nil;
1835 Docked_ = $getTheme$([NSArray arrayWithObjects:@"Dock.png", nil]);