1 /* WinterBoard - Theme Manager for the iPhone
2 * Copyright (C) 2008 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.
38 #define _trace() NSLog(@"WB:_trace(%u)", __LINE__);
41 #import <CoreFoundation/CoreFoundation.h>
42 #import <Foundation/Foundation.h>
43 #import <CoreGraphics/CoreGraphics.h>
45 #include <substrate.h>
47 #import <UIKit/UIKit.h>
49 #import <SpringBoard/SBApplication.h>
50 #import <SpringBoard/SBApplicationIcon.h>
51 #import <SpringBoard/SBAppWindow.h>
52 #import <SpringBoard/SBBookmarkIcon.h>
53 #import <SpringBoard/SBButtonBar.h>
54 #import <SpringBoard/SBCalendarIconContentsView.h>
55 #import <SpringBoard/SBContentLayer.h>
56 #import <SpringBoard/SBIconController.h>
57 #import <SpringBoard/SBIconLabel.h>
58 #import <SpringBoard/SBSlidingAlertDisplay.h>
59 #import <SpringBoard/SBStatusBarContentsView.h>
60 #import <SpringBoard/SBStatusBarController.h>
61 #import <SpringBoard/SBStatusBarOperatorNameView.h>
62 #import <SpringBoard/SBStatusBarTimeView.h>
63 #import <SpringBoard/SBUIController.h>
65 #import <MobileSMS/mSMSMessageTranscriptController.h>
67 #import <MediaPlayer/MPVideoView.h>
68 #import <MediaPlayer/MPVideoView-PlaybackControl.h>
70 #import <CoreGraphics/CGGeometry.h>
72 extern "C" void __clear_cache (char *beg, char *end);
76 @interface NSDictionary (WinterBoard)
77 - (UIColor *) colorForKey:(NSString *)key;
78 - (BOOL) boolForKey:(NSString *)key;
81 @implementation NSDictionary (WinterBoard)
83 - (UIColor *) colorForKey:(NSString *)key {
84 NSString *value = [self objectForKey:key];
91 - (BOOL) boolForKey:(NSString *)key {
92 if (NSString *value = [self objectForKey:key])
93 return [value boolValue];
100 bool Engineer_ = false;
102 @protocol WinterBoard
103 - (void) wb$setOperatorName:(NSString *)name fullSize:(BOOL)full;
104 - (NSString *) wb$operatorNameStyle;
105 - (NSString *) wb$localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)table;
106 - (id) wb$initWithBadge:(id)badge;
107 - (void) wb$cacheImageForIcon:(SBIcon *)icon;
108 - (UIImage *) wb$getCachedImagedForIcon:(SBIcon *)icon;
109 - (CGSize) wb$renderedSizeOfNode:(id)node constrainedToWidth:(float)width;
111 - (void) wb$updateDesktopImage:(UIImage *)image;
112 - (UIImage *) wb$defaultDesktopImage;
113 - (NSString *) wb$pathForIcon;
114 - (NSString *) wb$pathForResource:(NSString *)resource ofType:(NSString *)type;
117 - (id) wb$initWithSize:(CGSize)size;
118 - (id) wb$initWithFrame:(CGRect)frame;
119 - (id) wb$initWithCoder:(NSCoder *)coder;
120 - (void) wb$setFrame:(CGRect)frame;
121 - (void) wb$drawRect:(CGRect)rect;
122 - (void) wb$setBackgroundColor:(id)color;
123 - (void) wb$setAlpha:(float)value;
124 - (void) wb$setBarStyle:(int)style;
125 - (id) wb$initWithFrame:(CGRect)frame withBarStyle:(int)style withTintColor:(UIColor *)color;
126 - (void) wb$setOpaque:(BOOL)opaque;
127 - (void) wb$didMoveToSuperview;
128 - (NSDictionary *) wb$infoDictionary;
129 - (UIImage *) wb$icon;
130 - (void) wb$appendIconList:(SBIconList *)list;
131 - (id) wb$initWithStatusBar:(id)bar mode:(int)mode;
132 - (id) wb$initWithMode:(int)mode orientation:(int)orientation;
133 - (void) wb$setStatusBarMode:(int)mode orientation:(int)orientation duration:(float)duration fenceID:(int)id animation:(int)animation;
136 static UIImage *(*_UIApplicationImageWithName)(NSString *name);
137 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
138 static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation);
139 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
140 static NSBundle *(*_UIKitBundle)();
141 static void (*_UISharedImageInitialize)(bool);
142 static int (*_UISharedImageNameGetIdentifier)(NSString *);
143 static UIImage *(*_UISharedImageWithIdentifier)(int);
145 static NSMutableDictionary *UIImages_;
146 static NSMutableDictionary *PathImages_;
147 static NSMutableDictionary *Cache_;
148 static NSMutableDictionary *Strings_;
149 static NSMutableDictionary *Bundles_;
151 static NSFileManager *Manager_;
152 static NSDictionary *English_;
153 static NSMutableDictionary *Info_;
154 static NSMutableArray *themes_;
156 static NSString *$getTheme$(NSArray *files, bool parent = false) {
158 NSLog(@"WB:Debug: %@", [files description]);
160 for (NSString *theme in themes_)
161 for (NSString *file in files) {
162 NSString *path([NSString stringWithFormat:@"%@/%@", theme, file]);
163 if ([Manager_ fileExistsAtPath:path])
164 return parent ? theme : path;
170 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle<WinterBoard> *bundle, bool ui) {
171 NSString *identifier = [bundle bundleIdentifier];
172 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
174 if (identifier != nil)
175 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
176 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
177 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
179 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
181 #define remapResourceName(oldname, newname) \
182 else if ([file isEqualToString:oldname]) \
183 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
185 if (identifier == nil);
186 else if ([identifier isEqualToString:@"com.apple.calculator"])
187 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
188 else if (![identifier isEqualToString:@"com.apple.springboard"]);
189 remapResourceName(@"FSO_BG.png", @"StatusBar")
190 remapResourceName(@"SBDockBG.png", @"Dock")
191 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
193 if (NSString *path = $getTheme$(names))
198 static NSString *$pathForIcon$(SBApplication<WinterBoard> *self) {
199 NSString *identifier = [self bundleIdentifier];
200 NSString *path = [self path];
201 NSString *folder = [path lastPathComponent];
202 NSString *dname = [self displayName];
203 NSString *didentifier = [self displayIdentifier];
206 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
208 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
210 if (identifier != nil)
211 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
213 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]];
215 #define testForIcon(Name) \
216 if (NSString *name = Name) \
217 [names addObject:[NSString stringWithFormat:@"Icons/%@.png", name]];
219 testForIcon(identifier);
222 if (didentifier != nil) {
223 testForIcon([English_ objectForKey:didentifier]);
225 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
226 if ([parts count] != 1)
227 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
228 testForIcon([english objectForKey:[parts lastObject]]);
231 if (NSString *path = $getTheme$(names))
236 @interface NSBundle (WinterBoard)
237 + (NSBundle *) wb$bundleWithFile:(NSString *)path;
240 @implementation NSBundle (WinterBoard)
242 + (NSBundle *) wb$bundleWithFile:(NSString *)path {
243 path = [path stringByDeletingLastPathComponent];
244 if (path == nil || [path length] == 0 || [path isEqualToString:@"/"])
247 NSBundle *bundle([Bundles_ objectForKey:path]);
248 if (reinterpret_cast<id>(bundle) == [NSNull null])
250 else if (bundle == nil) {
251 bundle = [NSBundle bundleWithPath:path];
253 bundle = [NSBundle wb$bundleWithFile:path];
255 NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle);
256 [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast<id>(bundle)) forKey:path];
264 @interface NSString (WinterBoard)
265 - (NSString *) wb$themedPath;
268 @implementation NSString (WinterBoard)
270 - (NSString *) wb$themedPath {
272 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
274 if (NSBundle *bundle = [NSBundle wb$bundleWithFile:self]) {
275 NSString *file([self stringByResolvingSymlinksInPath]);
276 NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
277 if ([file hasPrefix:prefix]) {
278 NSUInteger length([prefix length]);
279 if (length != [file length])
280 if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
290 static void SBIconModel$cacheImageForIcon$(SBIconModel<WinterBoard> *self, SEL sel, SBIcon *icon) {
291 [self wb$cacheImageForIcon:icon];
292 NSString *key([icon displayIdentifier]);
294 if (UIImage *image = [icon icon]) {
295 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
296 CGRect rect = {CGPointMake(1, 1), [image size]};
297 CGSize size = {rect.size.width + 2, rect.size.height + 2};
299 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
300 CGColorSpaceRelease(space);
302 CGContextDrawImage(context, rect, [image CGImage]);
303 CGImageRef ref(CGBitmapContextCreateImage(context));
304 CGContextRelease(context);
306 UIImage *image([UIImage imageWithCGImage:ref]);
309 [Cache_ setObject:image forKey:key];
313 static UIImage *SBIconModel$getCachedImagedForIcon$(SBIconModel<WinterBoard> *self, SEL sel, SBIcon *icon) {
314 NSString *key([icon displayIdentifier]);
315 if (UIImage *image = [Cache_ objectForKey:key])
318 return [self wb$getCachedImagedForIcon:icon];
321 static UIImage *SBApplicationIcon$icon(SBApplicationIcon<WinterBoard> *self, SEL sel) {
322 if (![Info_ boolForKey:@"ComposeStoreIcons"])
323 if (NSString *path = $pathForIcon$([self application]))
324 return [UIImage imageWithContentsOfFile:path];
325 return [self wb$icon];
328 static UIImage *SBBookmarkIcon$icon(SBBookmarkIcon<WinterBoard> *self, SEL sel) {
330 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
331 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
332 return [UIImage imageWithContentsOfFile:path];
333 return [self wb$icon];
336 static NSString *SBApplication$pathForIcon(SBApplication<WinterBoard> *self, SEL sel) {
337 if (NSString *path = $pathForIcon$(self))
339 return [self wb$pathForIcon];
342 static UIImage *CachedImageAtPath(NSString *path) {
343 path = [path stringByResolvingSymlinksInPath];
344 UIImage *image = [PathImages_ objectForKey:path];
346 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
347 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
349 image = [image autorelease];
350 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
354 MSHook(CGImageRef, _UIImageRefAtPath, NSString *name, bool cache, UIImageOrientation *orientation) {
356 NSLog(@"WB:Debug: _UIImageRefAtPath(\"%@\", %s)", name, cache ? "true" : "false");
357 return __UIImageRefAtPath([name wb$themedPath], cache, orientation);
360 /*MSHook(UIImage *, _UIImageAtPath, NSString *name, NSBundle *bundle) {
362 return __UIImageAtPath(name, nil);
364 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
365 UIImage *image = [PathImages_ objectForKey:key];
367 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
369 NSLog(@"WB:Debug: _UIImageAtPath(\"%@\", %@)", name, bundle);
370 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
371 image = CachedImageAtPath(path);
373 image = __UIImageAtPath(name, bundle);
374 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
379 MSHook(UIImage *, _UIApplicationImageWithName, NSString *name) {
380 NSBundle *bundle = [NSBundle mainBundle];
382 NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
383 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
384 return CachedImageAtPath(path);
385 return __UIApplicationImageWithName(name);
388 #define WBDelegate(delegate) \
389 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
391 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
392 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
394 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
398 - (void) forwardInvocation:(NSInvocation*)inv { \
399 SEL sel = [inv selector]; \
400 if ([delegate respondsToSelector:sel]) \
401 [inv invokeWithTarget:delegate]; \
403 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
406 static NSString *NSBundle$pathForResource$ofType$(NSBundle<WinterBoard> *self, SEL sel, NSString *resource, NSString *type) {
407 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
409 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
410 if (NSString *path = $pathForFile$inBundle$(file, self, false))
412 return [self wb$pathForResource:resource ofType:type];
415 static bool $setBarStyle$_(NSString *name, UIView<WinterBoard> *self, int style) {
417 NSLog(@"WB:Debug:%@Style:%d", name, style);
418 NSNumber *number = nil;
420 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
422 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
426 style = [number intValue];
428 NSLog(@"WB:Debug:%@Style=%d", name, style);
429 [self wb$setBarStyle:style];
434 static void SBCalendarIconContentsView$drawRect$(SBCalendarIconContentsView<WinterBoard> *self, SEL sel, CGRect rect) {
435 NSBundle *bundle([NSBundle mainBundle]);
437 CFLocaleRef locale(CFLocaleCopyCurrent());
438 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
441 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
443 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);
444 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
445 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"" table:@"SpringBoard"]);
446 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
450 CFRelease(formatter);
452 NSString *datestyle(@""
453 "font-family: Helvetica; "
454 "font-weight: bold; "
460 NSString *daystyle(@""
461 "font-family: Helvetica; "
462 "font-weight: bold; "
465 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
468 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
469 datestyle = [datestyle stringByAppendingString:style];
470 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
471 daystyle = [daystyle stringByAppendingString:style];
473 float width([self bounds].size.width);
475 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
476 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
478 [(NSString *)date drawAtPoint:CGPointMake(
479 (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2
480 ) withStyle:datestyle];
482 [(NSString *)day drawAtPoint:CGPointMake(
483 (width + 1 - daysize.width) / 2, (16 - daysize.height) / 2
484 ) withStyle:daystyle];
490 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
493 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
494 style = [number intValue];
496 if (UIColor *color = [Info_ colorForKey:@"NavigationBarTint"])
499 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
502 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
503 self = [self wb$initWithCoder:coder];
506 UINavigationBar$setBarStyle$_(self);
510 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
511 self = [self wb$initWithFrame:frame];
514 UINavigationBar$setBarStyle$_(self);
518 static void UIToolbar$setBarStyle$(UIToolbar<WinterBoard> *self, SEL sel, int style) {
519 if ($setBarStyle$_(@"Toolbar", self, style))
521 return [self wb$setBarStyle:style];
524 static void UINavigationBar$setBarStyle$(UINavigationBar<WinterBoard> *self, SEL sel, int style) {
525 if ($setBarStyle$_(@"NavigationBar", self, style))
527 return [self wb$setBarStyle:style];
530 static void $didMoveToSuperview(SBButtonBar<WinterBoard> *self, SEL sel) {
531 [[self superview] setBackgroundColor:[UIColor clearColor]];
532 [self wb$didMoveToSuperview];
535 static UIImage *UIImage$defaultDesktopImage$(UIImage<WinterBoard> *self, SEL sel) {
537 NSLog(@"WB:Debug:DefaultDesktopImage");
538 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
539 return [UIImage imageWithContentsOfFile:path];
540 return [self wb$defaultDesktopImage];
543 static NSArray *Wallpapers_;
544 static NSString *WallpaperFile_;
545 static UIImageView *WallpaperImage_;
546 static UIWebDocumentView *WallpaperPage_;
547 static NSURL *WallpaperURL_;
549 #define _release(object) \
550 do if (object != nil) { \
555 static id SBContentLayer$initWithSize$(SBContentLayer<WinterBoard> *self, SEL sel, CGSize size) {
556 self = [self wb$initWithSize:size];
560 _release(WallpaperFile_);
561 _release(WallpaperImage_);
562 _release(WallpaperPage_);
563 _release(WallpaperURL_);
565 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
566 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
567 if ([Manager_ fileExistsAtPath:mp4]) {
568 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[self bounds]] autorelease];
569 [video setMovieWithPath:mp4];
570 [video setRepeatMode:1];
571 [video setRepeatGap:0];
572 [self addSubview:video];
573 [video playFromBeginning];;
576 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
577 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
580 if ([Manager_ fileExistsAtPath:png])
582 else if ([Manager_ fileExistsAtPath:jpg])
588 image = [[UIImage alloc] initWithContentsOfFile:path];
590 image = [image autorelease];
594 WallpaperFile_ = [path retain];
595 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
596 [self addSubview:WallpaperImage_];
599 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
600 if ([Manager_ fileExistsAtPath:html]) {
601 CGRect bounds = [self bounds];
603 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
604 [view setAutoresizes:true];
606 WallpaperPage_ = [view retain];
607 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
609 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
611 [[view webView] setDrawsBackground:false];
612 [view setBackgroundColor:[UIColor clearColor]];
614 [self addSubview:view];
618 for (size_t i(0), e([themes_ count]); i != e; ++i) {
619 NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
620 NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
621 if ([Manager_ fileExistsAtPath:html]) {
622 CGRect bounds = [self bounds];
624 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
625 [view setAutoresizes:true];
627 NSURL *url = [NSURL fileURLWithPath:html];
628 [view loadRequest:[NSURLRequest requestWithURL:url]];
630 [[view webView] setDrawsBackground:false];
631 [view setBackgroundColor:[UIColor clearColor]];
633 [self addSubview:view];
640 static void SBSlidingAlertDisplay$updateDesktopImage$(SBSlidingAlertDisplay<WinterBoard> *self, SEL sel, UIImage *image) {
641 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
642 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
644 if (path != nil && _backgroundView != nil)
647 [self wb$updateDesktopImage:image];
650 CGRect bounds = [self bounds];
652 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
653 [view setAutoresizes:true];
655 if (WallpaperPage_ != nil)
656 [WallpaperPage_ release];
657 WallpaperPage_ = [view retain];
659 if (WallpaperURL_ != nil)
660 [WallpaperURL_ release];
661 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
663 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
665 [[view webView] setDrawsBackground:false];
666 [view setBackgroundColor:[UIColor clearColor]];
668 [self insertSubview:view aboveSubview:_backgroundView];
672 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
673 extern "C" CGColorRef CGGStateGetFillColor(void *);
674 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
675 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
677 /* WBTimeLabel {{{ */
678 @interface WBTimeLabel : NSProxy {
680 _transient SBStatusBarTimeView *view_;
683 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
687 @implementation WBTimeLabel
694 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
695 time_ = [time retain];
702 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
703 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
704 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
706 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
707 "font-family: Helvetica; "
708 "font-weight: bold; "
711 "%@", _mode ? @"white" : @"black", custom]];
716 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
721 /* WBBadgeLabel {{{ */
722 @interface WBBadgeLabel : NSProxy {
726 - (id) initWithBadge:(NSString *)badge;
730 @implementation WBBadgeLabel
737 - (id) initWithBadge:(NSString *)badge {
738 badge_ = [badge retain];
744 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
745 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
746 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
747 "font-family: Helvetica; "
748 "font-weight: bold; "
756 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
762 static id SBIconBadge$initWithBadge$(SBIconBadge<WinterBoard> *self, SEL sel, NSString *badge) {
763 if ((self = [self wb$initWithBadge:badge]) != nil) {
764 id &_badge(MSHookIvar<id>(self, "_badge"));
766 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
771 static void SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(SBStatusBarController<WinterBoard> *self, SEL sel, int mode, int orientation, float duration, int id, int animation) {
773 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
774 if (mode < 100) // 104:hidden 105:glowing
775 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
776 mode = [number intValue];
777 return [self wb$setStatusBarMode:mode orientation:orientation duration:duration fenceID:id animation:animation];
780 static id SBStatusBarContentsView$initWithStatusBar$mode$(SBStatusBarContentsView<WinterBoard> *self, SEL sel, id bar, int mode) {
781 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
782 mode = [number intValue];
783 return [self wb$initWithStatusBar:bar mode:mode];
786 static NSString *SBStatusBarOperatorNameView$operatorNameStyle(SBStatusBarOperatorNameView<WinterBoard> *self, SEL sel, NSString *name, BOOL full) {
787 NSString *style([self wb$operatorNameStyle]);
789 NSLog(@"operatorNameStyle= %@", style);
790 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
791 style = [NSString stringWithFormat:@"%@; %@", style, custom];
795 static void SBStatusBarOperatorNameView$setOperatorName$fullSize$(SBStatusBarOperatorNameView<WinterBoard> *self, SEL sel, NSString *name, BOOL full) {
797 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
798 [self wb$setOperatorName:name fullSize:NO];
801 static void SBStatusBarTimeView$drawRect$(SBStatusBarTimeView<WinterBoard> *self, SEL sel, CGRect rect) {
802 id &_time(MSHookIvar<id>(self, "_time"));
803 if (_time != nil && [_time class] != [WBTimeLabel class])
804 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
805 return [self wb$drawRect:rect];
808 static void SBIconController$appendIconList$(SBIconController<WinterBoard> *self, SEL sel, SBIconList *list) {
810 NSLog(@"appendIconList:%@", list);
811 return [self wb$appendIconList:list];
814 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
815 self = _SBIconLabel$initWithSize$label$(self, sel, size, label);
817 [self setClipsToBounds:NO];
821 MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
822 id &_label(MSHookIvar<id>(self, "_label"));
823 if (![Info_ boolForKey:@"UndockedIconLabels"])
825 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
826 [_label setInDock:docked];
827 return _SBIconLabel$setInDock$(self, sel, docked);
830 static NSString *NSBundle$localizedStringForKey$value$table$(NSBundle<WinterBoard> *self, SEL sel, NSString *key, NSString *value, NSString *table) {
831 NSString *identifier = [self bundleIdentifier];
832 NSLocale *locale = [NSLocale currentLocale];
833 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
835 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
836 NSString *file = table == nil ? @"Localizable" : table;
837 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
838 NSDictionary *strings;
839 if ((strings = [Strings_ objectForKey:name]) != nil) {
840 if (static_cast<id>(strings) != [NSNull null]) strings:
841 if (NSString *value = [strings objectForKey:key])
843 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
846 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
847 [Strings_ setObject:[strings autorelease] forKey:name];
851 [Strings_ setObject:[NSNull null] forKey:name];
852 return [self wb$localizedStringForKey:key value:value table:table];
855 @class WebCoreFrameBridge;
856 static CGSize WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(WebCoreFrameBridge<WinterBoard> *self, SEL sel, id node, float width) {
859 void **core(reinterpret_cast<void **>([node _node]));
860 if (core == NULL || core[6] == NULL)
862 return [self wb$renderedSizeOfNode:node constrainedToWidth:width];
865 MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) {
866 CGRect bounds = [self bounds];
868 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
871 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
872 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
874 NSString *&label(MSHookIvar<NSString *>(self, "_label"));
876 NSString *style = [NSString stringWithFormat:@""
877 "font-family: Helvetica; "
878 "font-weight: bold; "
881 "", docked ? @"white" : @"#b3b3b3"];
884 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
885 float max = 75, width = [label sizeWithStyle:style forWidth:320].width;
887 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", ((width - max) / ([label length] - 1))]];
888 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
889 style = [style stringByAppendingString:custom];
891 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
892 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
895 MSHook(void, mSMSMessageTranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) {
896 _mSMSMessageTranscriptController$loadView(self, sel);
898 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
899 if (UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]) {
901 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
902 UIView *parent([_transcriptLayer superview]);
903 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
904 [parent insertSubview:background belowSubview:_transcriptLayer];
905 [_transcriptLayer setBackgroundColor:[UIColor clearColor]];
909 MSHook(UIImage *, _UIImageWithName, NSString *name) {
910 int id(_UISharedImageNameGetIdentifier(name));
912 NSLog(@"WB:Debug: _UIImageWithName(\"%@\", %d)", name, id);
915 return _UIImageAtPath(name, _UIKitBundle());
917 NSNumber *key([NSNumber numberWithInt:id]);
918 UIImage *image = [UIImages_ objectForKey:key];
920 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
921 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
922 image = [[UIImage alloc] initWithContentsOfFile:path];
927 image = _UISharedImageWithIdentifier(id);
928 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
933 MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
934 NSString *key = [NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name];
935 UIImage *image = [PathImages_ objectForKey:key];
937 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
939 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
940 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
941 image = [[UIImage alloc] initWithContentsOfFile:path];
946 image = __UIImageWithNameInDomain(name, domain);
947 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
951 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
952 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
954 bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
956 MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
957 bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
959 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
962 NSString *path = [NSString stringWithUTF8String:a1];
963 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
964 NSString *file = [path substringFromIndex:31];
966 for (NSString *theme in themes_) {
967 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
968 if ([Manager_ fileExistsAtPath:path]) {
969 strcpy(a1, [path UTF8String]);
978 static void ChangeWallpaper(
979 CFNotificationCenterRef center,
986 NSLog(@"WB:Debug:ChangeWallpaper!");
989 if (WallpaperFile_ != nil) {
990 image = [[UIImage alloc] initWithContentsOfFile:WallpaperFile_];
992 image = [image autorelease];
995 if (WallpaperImage_ != nil)
996 [WallpaperImage_ setImage:image];
997 if (WallpaperPage_ != nil)
998 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
1002 #define Prefix_ "wb$"
1004 void WBRename(bool instance, const char *name, SEL sel, IMP imp) {
1005 if (Class _class = objc_getClass(name)) {
1007 _class = object_getClass(_class);
1008 MSHookMessage(_class, sel, imp, Prefix_);
1010 NSLog(@"WB:Warning: cannot find class [%s]", name);
1013 extern "C" void WBInitialize() {
1014 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1016 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
1018 NSLog(@"WB:Notice: WinterBoard");
1021 memset(nl, 0, sizeof(nl));
1023 nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
1024 nl[1].n_un.n_name = (char *) "__UIImageAtPath";
1025 nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
1026 nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
1027 nl[4].n_un.n_name = (char *) "__UIKitBundle";
1028 nl[5].n_un.n_name = (char *) "__UISharedImageInitialize";
1029 nl[6].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
1030 nl[7].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
1034 _UIApplicationImageWithName = (UIImage *(*)(NSString *)) nl[0].n_value;
1035 _UIImageAtPath = (UIImage *(*)(NSString *, NSBundle *)) nl[1].n_value;
1036 _UIImageRefAtPath = (CGImageRef (*)(NSString *, bool, UIImageOrientation *)) nl[2].n_value;
1037 _UIImageWithNameInDomain = (UIImage *(*)(NSString *, NSString *)) nl[3].n_value;
1038 _UIKitBundle = (NSBundle *(*)()) nl[4].n_value;
1039 _UISharedImageInitialize = (void (*)(bool)) nl[5].n_value;
1040 _UISharedImageNameGetIdentifier = (int (*)(NSString *)) nl[6].n_value;
1041 _UISharedImageWithIdentifier = (UIImage *(*)(int)) nl[7].n_value;
1043 MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
1044 MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
1045 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
1046 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
1048 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1050 memset(nl, 0, sizeof(nl));
1051 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1052 nlist(AudioToolbox, nl);
1053 _Z24GetFileNameForThisActionmPcRb = (bool (*)(unsigned long, char *, bool &)) nl[0].n_value;
1054 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
1057 WBRename(false, "UIImage", @selector(defaultDesktopImage), (IMP) &UIImage$defaultDesktopImage$);
1059 //WBRename("UINavigationBar", @selector(initWithCoder:", (IMP) &UINavigationBar$initWithCoder$);
1060 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:", (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1062 WBRename(true, "NSBundle", @selector(localizedStringForKey:value:table:), (IMP) &NSBundle$localizedStringForKey$value$table$);
1063 WBRename(true, "NSBundle", @selector(pathForResource:ofType:), (IMP) &NSBundle$pathForResource$ofType$);
1065 WBRename(true, "UINavigationBar", @selector(setBarStyle:), (IMP) &UINavigationBar$setBarStyle$);
1066 WBRename(true, "UIToolbar", @selector(setBarStyle:), (IMP) &UIToolbar$setBarStyle$);
1068 _UISharedImageInitialize(false);
1070 Manager_ = [[NSFileManager defaultManager] retain];
1071 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1072 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1073 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1074 Bundles_ = [[NSMutableDictionary alloc] initWithCapacity:2];
1076 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1078 if (NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1079 [settings autorelease];
1081 if (NSNumber *debug = [settings objectForKey:@"Debug"])
1082 Debug_ = [debug boolValue];
1084 NSArray *themes = [settings objectForKey:@"Themes"];
1086 if (NSString *theme = [settings objectForKey:@"Theme"])
1087 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1089 [NSNumber numberWithBool:true], @"Active",
1092 for (NSDictionary *theme in themes) {
1093 NSNumber *active = [theme objectForKey:@"Active"];
1094 if (![active boolValue])
1097 NSString *name = [theme objectForKey:@"Name"];
1101 NSString *theme = nil;
1103 #define testForTheme(format...) \
1104 if (theme == nil) { \
1105 NSString *path = [NSString stringWithFormat:format]; \
1106 if ([Manager_ fileExistsAtPath:path]) { \
1107 [themes_ addObject:path]; \
1112 testForTheme(@"/Library/Themes/%@.theme", name)
1113 testForTheme(@"/Library/Themes/%@", name)
1114 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1118 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1120 for (NSString *theme in themes_)
1121 if (NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1122 for (NSString *key in [info allKeys])
1123 if ([Info_ objectForKey:key] == nil)
1124 [Info_ setObject:[info objectForKey:key] forKey:key];
1126 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1127 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1128 _mSMSMessageTranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$mSMSMessageTranscriptController$loadView);
1129 } else if ([identifier isEqualToString:@"com.apple.springboard"]) {
1130 CFNotificationCenterAddObserver(
1131 CFNotificationCenterGetDarwinNotifyCenter(),
1132 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1135 NSBundle *MediaPlayer = [NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"];
1136 if (MediaPlayer != nil)
1139 $MPVideoView = objc_getClass("MPVideoView");
1141 WBRename(true, "WebCoreFrameBridge", @selector(renderedSizeOfNode:constrainedToWidth:), (IMP) &WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$);
1143 WBRename(true, "SBApplication", @selector(pathForIcon), (IMP) &SBApplication$pathForIcon);
1144 WBRename(true, "SBApplicationIcon", @selector(icon), (IMP) &SBApplicationIcon$icon);
1145 WBRename(true, "SBBookmarkIcon", @selector(icon), (IMP) &SBBookmarkIcon$icon);
1146 WBRename(true, "SBButtonBar", @selector(didMoveToSuperview), (IMP) &$didMoveToSuperview);
1147 WBRename(true, "SBCalendarIconContentsView", @selector(drawRect:), (IMP) &SBCalendarIconContentsView$drawRect$);
1148 WBRename(true, "SBContentLayer", @selector(initWithSize:), (IMP) &SBContentLayer$initWithSize$);
1149 WBRename(true, "SBIconBadge", @selector(initWithBadge:), (IMP) &SBIconBadge$initWithBadge$);
1150 WBRename(true, "SBIconController", @selector(appendIconList:), (IMP) &SBIconController$appendIconList$);
1152 Class SBIconLabel = objc_getClass("SBIconLabel");
1153 _SBIconLabel$drawRect$ = MSHookMessage(SBIconLabel, @selector(drawRect:), &$SBIconLabel$drawRect$);
1154 _SBIconLabel$initWithSize$label$ = MSHookMessage(SBIconLabel, @selector(initWithSize:label:), &$SBIconLabel$initWithSize$label$);
1155 _SBIconLabel$setInDock$ = MSHookMessage(SBIconLabel, @selector(setInDock:), &$SBIconLabel$setInDock$);
1157 WBRename(true, "SBIconModel", @selector(cacheImageForIcon:), (IMP) &SBIconModel$cacheImageForIcon$);
1158 WBRename(true, "SBIconModel", @selector(getCachedImagedForIcon:), (IMP) &SBIconModel$getCachedImagedForIcon$);
1160 WBRename(true, "SBSlidingAlertDisplay", @selector(updateDesktopImage:), (IMP) &SBSlidingAlertDisplay$updateDesktopImage$);
1161 WBRename(true, "SBStatusBarContentsView", @selector(didMoveToSuperview), (IMP) &$didMoveToSuperview);
1162 WBRename(true, "SBStatusBarContentsView", @selector(initWithStatusBar:mode:), (IMP) &SBStatusBarContentsView$initWithStatusBar$mode$);
1163 WBRename(true, "SBStatusBarController", @selector(setStatusBarMode:orientation:duration:fenceID:animation:), (IMP) &SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$);
1164 WBRename(true, "SBStatusBarOperatorNameView", @selector(operatorNameStyle), (IMP) &SBStatusBarOperatorNameView$operatorNameStyle);
1165 WBRename(true, "SBStatusBarOperatorNameView", @selector(setOperatorName:fullSize:), (IMP) &SBStatusBarOperatorNameView$setOperatorName$fullSize$);
1166 WBRename(true, "SBStatusBarTimeView", @selector(drawRect:), (IMP) &SBStatusBarTimeView$drawRect$);
1168 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1169 if (English_ != nil)
1170 English_ = [English_ retain];
1172 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1175 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1177 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
1178 [Info_ setObject:[NSNumber numberWithBool:(
1179 $getTheme$(Wallpapers_) == nil ||
1180 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
1181 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
1182 )] forKey:@"UndockedIconLabels"];
1185 NSLog(@"WB:Debug:Info = %@", [Info_ description]);