}
// }}}
// $pathForFile$inBundle$() {{{
-static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui) {
+static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui, bool use) {
NSString *identifier = [bundle bundleIdentifier];
NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
[names addObject:[NSString stringWithFormat:@"Fallback/%@", file]];
- if (NSString *path = $getTheme$($useScale$(names, ui)))
+ if (NSString *path = $getTheme$($useScale$(names, use)))
return path;
return nil;
if ([file hasPrefix:prefix]) {
NSUInteger length([prefix length]);
if (length != [file length])
- if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
+ if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false, false))
return path;
}
}
NSBundle *bundle = [NSBundle mainBundle];
if (Debug_)
NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
- if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
+ if (NSString *path = $pathForFile$inBundle$(name, bundle, false, false))
return CachedImageAtPath(path);
return __UIApplicationImageWithName(name);
}
NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
if (Debug_)
NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
- if (NSString *path = $pathForFile$inBundle$(file, self, false))
+ if (NSString *path = $pathForFile$inBundle$(file, self, false, false))
return path;
return MSOldCall(resource, type);
}
[view setBackgroundColor:[UIColor clearColor]];
[self insertSubview:view aboveSubview:_backgroundView];
+
+ if ($objc_setAssociatedObject != NULL)
+ $objc_setAssociatedObject(self, @selector(wb$widgetView), view, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
}
+MSHook(void, SBAwayView$_addSubview$positioned$relativeTo$, SBAwayView *self, SEL sel, UIView *view, int positioned, UIView *relative) {
+ UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
+ UIView *&_chargingView(MSHookIvar<UIView *>(self, "_chargingView"));
+ if (&_chargingView != NULL)
+ if (positioned == -2 && (relative == _backgroundView && _chargingView == nil || relative == _chargingView))
+ if ($objc_getAssociatedObject != NULL)
+ if (UIView *widget = $objc_getAssociatedObject(self, @selector(wb$widgetView)))
+ relative = widget;
+ return _SBAwayView$_addSubview$positioned$relativeTo$(self, sel, view, positioned, relative);
+}
+
/*extern "C" CGColorRef CGGStateGetSystemColor(void *);
extern "C" CGColorRef CGGStateGetFillColor(void *);
extern "C" CGColorRef CGGStateGetStrokeColor(void *);
return value;
} else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
language, file
- ], self, false)) {
+ ], self, false, false)) {
if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
[Strings_ setObject:[strings autorelease] forKey:name];
goto strings;
UIImage *image = [UIImages_ objectForKey:name];
if (image != nil)
return reinterpret_cast<id>(image) == [NSNull null] ? MSOldCall(name) : image;
- if (NSString *path = $pathForFile$inBundle$(name, bundle, true))
+ if (NSString *path = $pathForFile$inBundle$(name, bundle, true, true))
image = $getImage$(path);
[UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:name];
if (image != nil)
UIImage *image([UIImages_ objectForKey:key]);
if (image != nil)
return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithName(name) : image;
- if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true))
+ if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true, true))
image = $getImage$(path);
[UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
if (image != nil)
#define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
#define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
-bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
-
-MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
- if (Debug_)
- NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %p, %u)", a0, a1, a2);
- bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
+static bool GetFileNameForThisAction$(bool value, unsigned long a0, char *a1, unsigned long a2, bool &a3) {
if (Debug_)
- NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
+ NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u, %u) = %u", a0, value ? a1 : NULL, a2, a3, value);
if (value) {
NSString *path = [NSString stringWithUTF8String:a1];
return value;
}
+MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a3) {
+ bool value(__Z24GetFileNameForThisActionmPcRb(a0, a1, a3));
+ return GetFileNameForThisAction$(value, a0, a1, 0, a3);
+}
+
+MSHook(bool, _Z24GetFileNameForThisActionmPcmRb, unsigned long a0, char *a1, unsigned long a2, bool &a3) {
+ bool value(__Z24GetFileNameForThisActionmPcmRb(a0, a1, a2, a3));
+ return GetFileNameForThisAction$(value, a0, a1, a2, a3);
+}
+
static void ChangeWallpaper(
CFNotificationCenterRef center,
void *observer,
}
+MSHook(NSArray *, CPBitmapCreateImagesFromPath, NSString *path, NSDictionary **names, void *arg2, void *arg3) {
+ NSArray *images(_CPBitmapCreateImagesFromPath(path, names, arg2, arg3));
+ if (images != NULL && *names != nil && CFGetTypeID((CFTypeRef) *names) == CFDictionaryGetTypeID()) {
+ if (NSBundle *bundle = [NSBundle wb$bundleWithFile:path]) {
+ NSMutableArray *copy([images mutableCopy]);
+ [images release];
+ images = copy;
+
+ NSString *file([path stringByResolvingSymlinksInPath]);
+ NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
+ if ([file hasPrefix:prefix]) {
+ NSUInteger length([prefix length]);
+ if (length != [file length]) {
+ NSEnumerator *enumerator([*names keyEnumerator]);
+ while (NSString *name = [enumerator nextObject]) {
+ NSString *png([name stringByAppendingString:@".png"]);
+ if (NSString *themed = $pathForFile$inBundle$(png, bundle, false, true)) {
+ NSUInteger index([[*names objectForKey:name] intValue]);
+ UIImage *image($getImage$(themed));
+ CGImageRef cg([image CGImage]);
+ [copy replaceObjectAtIndex:index withObject:(id)cg];
+ }
+ }
+ }
+ }
+ }
+ } return images;
+}
+
+MSHook(void, BKSDisplayServicesSetSystemAppExitedImagePath, NSString *path) {
+ if (NSString *themed = $getTheme$($useScale$([NSArray arrayWithObject:@"SystemAppExited.png"])))
+ path = themed;
+ _BKSDisplayServicesSetSystemAppExitedImagePath(path);
+}
+
#define WBRename(name, sel, imp) \
MSHookMessage($ ## name, @selector(sel), &$ ## name ## $ ## imp, &_ ## name ## $ ## imp)
//WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
+ if (kCFCoreFoundationVersionNumber >= 700)
+ WBRename(SBAwayView, _addSubview:positioned:relativeTo:, _addSubview$positioned$relativeTo$);
+
WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
//WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
//WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
[Info_ setObject:[info objectForKey:key] forKey:key];
// }}}
+ // AppSupport {{{
+ if (MSImageRef image = MSGetImageByName("/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport")) {
+ NSArray *(*CPBitmapCreateImagesFromPath)(NSString *, NSDictionary **, void *, void *);
+ msset(CPBitmapCreateImagesFromPath, image, "_CPBitmapCreateImagesFromPath");
+ MSHookFunction(CPBitmapCreateImagesFromPath, MSHake(CPBitmapCreateImagesFromPath));
+ }
+ // }}}
// AudioToolbox {{{
if (MSImageRef image = MSGetImageByName(AudioToolbox)) {
+ bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long, char *, bool &);
msset(_Z24GetFileNameForThisActionmPcRb, image, "__Z24GetFileNameForThisActionmPcRb");
MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
+
+ bool (*_Z24GetFileNameForThisActionmPcmRb)(unsigned long, char *, unsigned long, bool &);
+ msset(_Z24GetFileNameForThisActionmPcmRb, image, "__Z24GetFileNameForThisActionmPcmRb");
+ MSHookFunction(_Z24GetFileNameForThisActionmPcmRb, &$_Z24GetFileNameForThisActionmPcmRb, &__Z24GetFileNameForThisActionmPcmRb);
+ }
+ // }}}
+ // BackBoardServices {{{
+ if (MSImageRef image = MSGetImageByName("/System/Library/PrivateFrameworks/BackBoardServices.framework/BackBoardServices")) {
+ void (*BKSDisplayServicesSetSystemAppExitedImagePath)(NSString *path);
+ msset(BKSDisplayServicesSetSystemAppExitedImagePath, image, "_BKSDisplayServicesSetSystemAppExitedImagePath");
+ MSHookFunction(BKSDisplayServicesSetSystemAppExitedImagePath, MSHake(BKSDisplayServicesSetSystemAppExitedImagePath));
}
// }}}
// GraphicsServices {{{
}
// }}}
// ImageIO {{{
- if (MSImageRef image = MSGetImageByName("/System/Library/Frameworks/ImageIO.framework/ImageIO")) {
+ MSImageRef imageio = MSGetImageByName("/System/Library/Frameworks/ImageIO.framework/ImageIO");
+ if (imageio == NULL)
+ imageio = MSGetImageByName("/System/Library/PrivateFrameworks/ImageIO.framework/ImageIO");
+ if (MSImageRef image = imageio) {
void *(*CGImageReadCreateWithFile)(NSString *, int);
msset(CGImageReadCreateWithFile, image, "_CGImageReadCreateWithFile");
MSHookFunction(CGImageReadCreateWithFile, MSHake(CGImageReadCreateWithFile));