MSClassHook(NSString)
MSClassHook(UIImage)
+MSMetaClassHook(UIImage)
MSClassHook(UINavigationBar)
MSClassHook(UIToolbar)
//MSClassHook(SBImageCache)
MSClassHook(SBSearchView)
MSClassHook(SBSearchTableViewCell)
+MSClassHook(SBSlidingAlertDisplay)
MSClassHook(SBStatusBarContentsView)
MSClassHook(SBStatusBarController)
MSClassHook(SBStatusBarOperatorNameView)
MSClassHook(SBStatusBarTimeView)
MSClassHook(SBUIController)
+MSClassHook(SBWallpaperView)
MSClassHook(SBWidgetApplicationIcon)
extern "C" void WKSetCurrentGraphicsContext(CGContextRef);
if (Scale_ == 1)
return files;
- NSMutableArray *scaled([NSMutableArray arrayWithCapacity:([files count] * 2)]);
+ NSString *idiom(IsWild_ ? @"ipad" : @"iphone");
+
+ NSMutableArray *scaled([NSMutableArray arrayWithCapacity:([files count] * 4)]);
for (NSString *file in files) {
- if (use && Scale_ == 2)
- [scaled addObject:[NSString stringWithFormat:@"%@@2x.%@", [file stringByDeletingPathExtension], [file pathExtension]]];
- if ([file hasSuffix:@"@2x~iphone.png"])
- [scaled addObject:[[file substringWithRange:NSMakeRange(0, [file length] - 11)] stringByAppendingPathExtension:@"png"]];
- [scaled addObject:file];
+ NSString *base([file stringByDeletingPathExtension]);
+ NSString *extension([file pathExtension]);
+
+ if (use) {
+ if (Scale_ == 2) {
+ [scaled addObject:[NSString stringWithFormat:@"%@@2x~%@.%@", base, idiom, extension]];
+ if (!IsWild_)
+ [scaled addObject:[NSString stringWithFormat:@"%@@2x.%@", base, extension]];
+ }
+
+ [scaled addObject:[NSString stringWithFormat:@"%@~%@.%@", base, idiom, extension]];
+
+ // if (!IsWild_) <- support old themes
+ [scaled addObject:file];
+ } else if ([base hasSuffix: @"@2x"]) {
+ [scaled addObject:[NSString stringWithFormat:@"%@~iphone.%@", base, extension]];
+ [scaled addObject:file];
+
+ NSString *rest([base substringWithRange:NSMakeRange(0, [base length] - 3)]);
+ [scaled addObject:[NSString stringWithFormat:@"%@~iphone.%@", rest, extension]];
+ [scaled addObject:[rest stringByAppendingPathExtension:extension]];
+ } else {
+ // XXX: this code isn't really complete
+
+ [scaled addObject:file];
+
+ if ([base hasSuffix:@"~iphone"])
+ [scaled addObject:[[base substringWithRange:NSMakeRange(0, [base length] - 7)] stringByAppendingPathExtension:extension]];
+ }
}
return scaled;
_SBStatusBarContentsView$didMoveToSuperview(self, sel);
}
-MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) {
- if (Debug_)
- NSLog(@"WB:Debug:DefaultDesktopImage");
- if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
- return [UIImage imageWithContentsOfFile:path];
- return _UIImage$defaultDesktopImage(self, sel);
-}
-
static NSArray *Wallpapers_;
static bool Papered_;
static bool Docked_;
return image;
}
+static UIImage *$getDefaultDesktopImage$() {
+ if (NSString *path = $getTheme$($useScale$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil])))
+ return $getImage$(path);
+ return nil;
+}
+
+MSClassMessageHook0(UIImage *, UIImage, defaultDesktopImage) {
+ return $getDefaultDesktopImage$() ?: MSOldCall();
+}
+
+MSInstanceMessageHook0(UIImage *, SBSlidingAlertDisplay, _defaultDesktopImage) {
+ return $getDefaultDesktopImage$() ?: MSOldCall();
+}
+
+MSInstanceMessageHook0(void, SBWallpaperView, resetCurrentImageToWallpaper) {
+ for (UIView *parent([self superview]); parent != nil; parent = [parent superview])
+ if ([parent isKindOfClass:$SBSlidingAlertDisplay]) {
+ if (UIImage *image = $getDefaultDesktopImage$()) {
+ [self setImage:image];
+ return;
+ }
+
+ break;
+ }
+
+ MSOldCall();
+}
+
// %hook -[SBUIController init] {{{
MSInstanceMessageHook0(id, SBUIController, init) {
self = MSOldCall();
class_addMethod($NSString, @selector(drawAtPoint:withStyle:), (IMP) &NSString$drawAtPoint$withStyle$, "v20@0:4{CGPoint=ff}8@16");
class_addMethod($NSString, @selector(sizeWithStyle:forWidth:), (IMP) &NSString$sizeWithStyle$forWidth$, "{CGSize=ff}16@0:4@8f12");
- _UIImage$defaultDesktopImage = MSHookMessage(object_getClass($UIImage), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage);
-
if (SummerBoard_) {
WBRename(SBApplication, pathForIcon, pathForIcon);
WBRename(SBApplicationIcon, icon, icon);