* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _trace() NSLog(@"WB:_trace(%u)", __LINE__);
+#include <sys/time.h>
+
+struct timeval _ltv;
+bool _itv;
+
+#define _trace() do { \
+ struct timeval _ctv; \
+ gettimeofday(&_ctv, NULL); \
+ if (!_itv) { \
+ _itv = true; \
+ _ltv = _ctv; \
+ } \
+ fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \
+ _ctv.tv_sec, _ctv.tv_usec, \
+ (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \
+ __FILE__, __LINE__, __FUNCTION__\
+ ); \
+ _ltv = _ctv; \
+} while (false)
+
#define _transient
#import <CoreFoundation/CoreFoundation.h>
#import <SpringBoard/SBBookmarkIcon.h>
#import <SpringBoard/SBButtonBar.h>
#import <SpringBoard/SBCalendarIconContentsView.h>
-#import <SpringBoard/SBContentLayer.h>
#import <SpringBoard/SBIconController.h>
#import <SpringBoard/SBIconLabel.h>
#import <SpringBoard/SBIconList.h>
Class $SBBookmarkIcon;
Class $SBButtonBar;
Class $SBCalendarIconContentsView;
-Class $SBContentLayer;
+Class $SBIcon;
Class $SBIconBadge;
Class $SBIconController;
Class $SBIconLabel;
Class $SBStatusBarController;
Class $SBStatusBarOperatorNameView;
Class $SBStatusBarTimeView;
+Class $SBUIController;
Class $SBWidgetApplicationIcon;
@interface NSDictionary (WinterBoard)
-- (UIColor *) colorForKey:(NSString *)key;
-- (BOOL) boolForKey:(NSString *)key;
+- (UIColor *) wb$colorForKey:(NSString *)key;
+- (BOOL) wb$boolForKey:(NSString *)key;
@end
@implementation NSDictionary (WinterBoard)
-- (UIColor *) colorForKey:(NSString *)key {
+- (UIColor *) wb$colorForKey:(NSString *)key {
NSString *value = [self objectForKey:key];
if (value == nil)
return nil;
return nil;
}
-- (BOOL) boolForKey:(NSString *)key {
+- (BOOL) wb$boolForKey:(NSString *)key {
if (NSString *value = [self objectForKey:key])
return [value boolValue];
return false;
@end
+static BOOL (*_GSFontGetUseLegacyFontMetrics)();
+#define $GSFontGetUseLegacyFontMetrics() \
+ (_GSFontGetUseLegacyFontMetrics == NULL ? YES : _GSFontGetUseLegacyFontMetrics())
+
bool Debug_ = false;
bool Engineer_ = false;
static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation);
static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
static NSBundle *(*_UIKitBundle)();
-static void (*_UISharedImageInitialize)(bool);
static int (*_UISharedImageNameGetIdentifier)(NSString *);
static UIImage *(*_UISharedImageWithIdentifier)(int);
if (UIImage *image = [icon icon]) {
CGSize size = [image size];
- if (size.width > 59 || size.height > 60) {
+ if (size.width != 59 || size.height != 60) {
UIImage *cache($cacheForImage$(image));
[Cache_ setObject:cache forKey:key];
return;
}
MSHook(UIImage *, SBApplicationIcon$icon, SBApplicationIcon *self, SEL sel) {
- if (![Info_ boolForKey:@"ComposeStoreIcons"])
+ if (![Info_ wb$boolForKey:@"ComposeStoreIcons"])
if (NSString *path = $pathForIcon$([self application]))
return [UIImage imageWithContentsOfFile:path];
return _SBApplicationIcon$icon(self, sel);
CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);
CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
- CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"" table:@"SpringBoard"]);
+ CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"cccc" table:@"SpringBoard"]);
CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
CFRelease(now);
CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
+ unsigned base($GSFontGetUseLegacyFontMetrics() ? 71 : 70);
+
[(NSString *)date drawAtPoint:CGPointMake(
- (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2
+ (width + 1 - datesize.width) / 2, (base - datesize.height) / 2
) withStyle:datestyle];
[(NSString *)day drawAtPoint:CGPointMake(
}
/*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
- _trace();
+_trace();
if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
style = [number intValue];
- if (UIColor *color = [Info_ colorForKey:@"NavigationBarTint"])
+ if (UIColor *color = [Info_ wb$colorForKey:@"NavigationBarTint"])
tint = color;
return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
object = nil; \
} while (false)
-MSHook(id, SBContentLayer$initWithSize$, SBContentLayer *self, SEL sel, CGSize size) {
- self = _SBContentLayer$initWithSize$(self, sel, size);
+void DumpHierarchy(UIView *view, unsigned index = 0, unsigned indent = 0) {
+ NSLog(@"%*s|%2d:%s", indent * 3, "", index, class_getName([view class]));
+ index = 0;
+ for (UIView *child in [view subviews])
+ DumpHierarchy(child, index++, indent + 1);
+}
+
+MSHook(id, SBUIController$init, SBUIController *self, SEL sel) {
+ self = _SBUIController$init(self, sel);
if (self == nil)
return nil;
+ UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
+ UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
+ UIView *&_contentView(MSHookIvar<UIView *>(self, "_contentView"));
+
+ UIView *layer;
+ if (&_contentLayer != NULL)
+ layer = _contentLayer;
+ else if (&_contentView != NULL)
+ layer = _contentView;
+ else
+ layer = nil;
+
+ UIView *content([[[UIView alloc] initWithFrame:[layer frame]] autorelease]);
+ [content setBackgroundColor:[layer backgroundColor]];
+ [layer setBackgroundColor:[UIColor clearColor]];
+ [layer setFrame:[content bounds]];
+ [_window setContentView:content];
+
_release(WallpaperFile_);
_release(WallpaperImage_);
_release(WallpaperPage_);
AVQueue *queue([controller_ queue]);
- UIView *video([[[UIView alloc] initWithFrame:[self bounds]] autorelease]);
+ UIView *video([[[UIView alloc] initWithFrame:[content bounds]] autorelease]);
[controller_ setLayer:[video _layer]];
AVItem *item([[[AVItem alloc] initWithPath:mp4 error:&error] autorelease]);
controller.movieControlMode = MPMovieControlModeHidden;
[controller play];
#else
- MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[self bounds]] autorelease];
+ MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[content bounds]] autorelease];
[video setMovieWithPath:mp4];
[video setRepeatMode:1];
[video setRepeatGap:-1];
[video playFromBeginning];;
#endif
- [self addSubview:video];
+ [content addSubview:video];
}
NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
if (image != nil) {
WallpaperFile_ = [path retain];
WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
- [self addSubview:WallpaperImage_];
+ [content addSubview:WallpaperImage_];
}
NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
if ([Manager_ fileExistsAtPath:html]) {
- CGRect bounds = [self bounds];
+ CGRect bounds = [content bounds];
UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
[view setAutoresizes:true];
[[view webView] setDrawsBackground:false];
[view setBackgroundColor:[UIColor clearColor]];
- [self addSubview:view];
+ [content addSubview:view];
}
}
NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
if ([Manager_ fileExistsAtPath:html]) {
- CGRect bounds = [self bounds];
+ CGRect bounds = [content bounds];
UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
[view setAutoresizes:true];
[[view webView] setDrawsBackground:false];
[view setBackgroundColor:[UIColor clearColor]];
- [self addSubview:view];
+ [content addSubview:view];
}
}
+ [content addSubview:layer];
+ DumpHierarchy(_window);
+
return self;
}
return self;
}
+- (NSString *) description {
+ return time_;
+}
+
WBDelegate(time_)
- (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
@end
/* }}} */
+MSHook(void, SBIcon$setAlpha$, SBIcon *self, SEL sel, float alpha) {
+ if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
+ alpha = [number floatValue];
+ return _SBIcon$setAlpha$(self, sel, alpha);
+}
+
MSHook(id, SBIconBadge$initWithBadge$, SBIconBadge *self, SEL sel, NSString *badge) {
if ((self = _SBIconBadge$initWithBadge$(self, sel, badge)) != nil) {
id &_badge(MSHookIvar<id>(self, "_badge"));
} return self;
}
-MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int id, int animation) {
+void SBStatusBarController$setStatusBarMode(int &mode) {
if (Debug_)
NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
if (mode < 100) // 104:hidden 105:glowing
if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
mode = [number intValue];
- return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, id, animation);
}
-MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
+/*MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int animation) {
+ NSLog(@"mode:%d orientation:%d duration:%f animation:%d", mode, orientation, duration, animation);
+ SBStatusBarController$setStatusBarMode(mode);
+ return _SBStatusBarController$setStatusBarMode$orientation$duration$animation$(self, sel, mode, orientation, duration, animation);
+}*/
+
+MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int fenceID, int animation) {
+ NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d", mode, orientation, duration, fenceID, animation);
+ SBStatusBarController$setStatusBarMode(mode);
+ return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, fenceID, animation);
+}
+
+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) {
+ NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d startTime:%f", mode, orientation, duration, fenceID, animation, startTime);
+ SBStatusBarController$setStatusBarMode(mode);
+ NSLog(@"mode=%u", mode);
+ return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$(self, sel, mode, orientation, duration, fenceID, animation, startTime);
+}
+
+/*MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
mode = [number intValue];
return _SBStatusBarContentsView$initWithStatusBar$mode$(self, sel, bar, mode);
-}
+}*/
MSHook(NSString *, SBStatusBarOperatorNameView$operatorNameStyle, SBStatusBarOperatorNameView *self, SEL sel) {
NSString *style(_SBStatusBarOperatorNameView$operatorNameStyle(self, sel));
MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
id &_label(MSHookIvar<id>(self, "_label"));
- if (![Info_ boolForKey:@"UndockedIconLabels"])
+ if (![Info_ wb$boolForKey:@"UndockedIconLabels"])
docked = true;
if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
[_label setInDock:docked];
NSLog(@"WB:Notice: WinterBoard");
- struct nlist nl[9];
+ _GSFontGetUseLegacyFontMetrics = reinterpret_cast<BOOL (*)()>(dlsym(RTLD_DEFAULT, "GSFontGetUseLegacyFontMetrics"));
+
+ struct nlist nl[8];
memset(nl, 0, sizeof(nl));
nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
nl[4].n_un.n_name = (char *) "__UIKitBundle";
- nl[5].n_un.n_name = (char *) "__UISharedImageInitialize";
- nl[6].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
- nl[7].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
+ nl[5].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
+ nl[6].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
nlist(UIKit, nl);
_UIImageRefAtPath = (CGImageRef (*)(NSString *, bool, UIImageOrientation *)) nl[2].n_value;
_UIImageWithNameInDomain = (UIImage *(*)(NSString *, NSString *)) nl[3].n_value;
_UIKitBundle = (NSBundle *(*)()) nl[4].n_value;
- _UISharedImageInitialize = (void (*)(bool)) nl[5].n_value;
- _UISharedImageNameGetIdentifier = (int (*)(NSString *)) nl[6].n_value;
- _UISharedImageWithIdentifier = (UIImage *(*)(int)) nl[7].n_value;
+ _UISharedImageNameGetIdentifier = (int (*)(NSString *)) nl[5].n_value;
+ _UISharedImageWithIdentifier = (UIImage *(*)(int)) nl[6].n_value;
MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
_UINavigationBar$setBarStyle$ = MSHookMessage($UINavigationBar, @selector(setBarStyle:), &$UINavigationBar$setBarStyle$);
_UIToolbar$setBarStyle$ = MSHookMessage($UIToolbar, @selector(setBarStyle:), &$UIToolbar$setBarStyle$);
- _UISharedImageInitialize(false);
-
Manager_ = [[NSFileManager defaultManager] retain];
UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
$SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
$SBButtonBar = objc_getClass("SBButtonBar");
$SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
- $SBContentLayer = objc_getClass("SBContentLayer");
+ $SBIcon = objc_getClass("SBIcon");
$SBIconBadge = objc_getClass("SBIconBadge");
$SBIconController = objc_getClass("SBIconController");
$SBIconLabel = objc_getClass("SBIconLabel");
$SBStatusBarController = objc_getClass("SBStatusBarController");
$SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
$SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
+ $SBUIController = objc_getClass("SBUIController");
$SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
WBRename(SBBookmarkIcon, icon, icon);
WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
- WBRename(SBContentLayer, initWithSize:, initWithSize$);
+ WBRename(SBIcon, setAlpha:, setAlpha$);
WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
+ WBRename(SBUIController, init, init);
WBRename(SBWidgetApplicationIcon, icon, icon);
WBRename(SBIconLabel, drawRect:, drawRect$);
WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
- WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
+ //WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
+ //WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
+ WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:startTime:, setStatusBarMode$orientation$duration$fenceID$animation$startTime$);
WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
WBRename(SBStatusBarTimeView, drawRect:, drawRect$);