#define remapResourceName(oldname, newname) \
else if ([file isEqualToString:(oldname)]) \
- [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
+ [names addObject:oldname ".png"];
bool summer(SpringBoard_ && SummerBoard_);
if (identifier == nil);
else if ([identifier isEqualToString:@"com.apple.uikit.Artwork"])
- $pathForFile$inBundle$(names, file, @"com.apple.UIKit", nil);
+ $pathForFile$inBundle$(names, file, @"com.apple.UIKit", @"UIKit.framework");
else if ([identifier isEqualToString:@"com.apple.uikit.LegacyArtwork"])
- $pathForFile$inBundle$(names, file, @"com.apple.UIKit", nil);
+ $pathForFile$inBundle$(names, file, @"com.apple.UIKit", @"UIKit.framework");
else if ([identifier isEqualToString:@"com.apple.UIKit"])
[names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
else if ([identifier isEqualToString:@"com.apple.chatkit"])
- $pathForFile$inBundle$(names, file, @"com.apple.MobileSMS", nil);
+ $pathForFile$inBundle$(names, file, @"com.apple.MobileSMS", @"MobileSMS.app");
else if ([identifier isEqualToString:@"com.apple.calculator"])
[names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
else if ([identifier isEqualToString:@"com.apple.Maps"] && [file isEqualToString:@"Icon-57@2x.png"])
- [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.Maps/icon.png"]];
+ $pathForFile$inBundle$(names, @"icon.png", identifier, folder);
else if (!summer);
remapResourceName(@"FSO_BG.png", @"StatusBar")
remapResourceName(Four_ ? @"SBDockBG-old.png" : @"SBDockBG.png", @"Dock")
if (subDirName != NULL)
file = [NSString stringWithFormat:@"%@/%@", subDirName, resourceType];
- if (Debug_)
- NSLog(@"WB:Debug: CFBundleCopyResourceURL(<%@>, \"%@\", \"%@\", \"%@\")", CFBundleGetIdentifier(bundle), resourceName, resourceType, subDirName);
- if (NSString *path = $pathForFile$inBundle$(file, bundle, false))
- return (CFURLRef) [[NSURL alloc] initFileURLWithPath:path];
+ if (![file hasSuffix:@".png"]) {
+ if (Debug_)
+ NSLog(@"WB:Debug: CFBundleCopyResourceURL(<%@>, \"%@\", \"%@\", \"%@\")", CFBundleGetIdentifier(bundle), resourceName, resourceType, subDirName);
+ if (NSString *path = $pathForFile$inBundle$(file, bundle, false))
+ return (CFURLRef) [[NSURL alloc] initFileURLWithPath:path];
+ }
+
return _CFBundleCopyResourceURL(bundle, resourceName, resourceType, subDirName);
}
// }}}
}
template <typename Original_, typename Modified_>
-_finline UIImage *WBCacheImage(const Original_ &original, const Modified_ &modified, NSString *key) {
+_finline UIImage *WBCacheImage(const Modified_ &modified, const Original_ &original, NSString *key) {
UIImage *image([Images_ objectForKey:key]);
if (image != nil)
return reinterpret_cast<id>(image) == [NSNull null] ? original() : image;
// }}}
template <typename Original_>
-static UIImage *WBCacheUIImage(NSBundle *bundle, const Original_ &original, NSString *name, NSString *key) {
+static UIImage *WBCacheImage(NSBundle *bundle, NSString *name, const Original_ &original, NSString *key) {
if (name == nil)
return original();
NSUInteger period([name rangeOfString:@"."].location);
if (period == NSNotFound || length < 4 || period > length - 4)
name = [name stringByAppendingString:@".png"];
- return WBCacheImage([bundle, &original, name](){
+ return WBCacheImage(
+ [=](){ return $pathForFile$inBundle$(name, bundle, true); },
+ [bundle, &original, name](){
UIImage *image(original());
if (image != nil && UIDebug_) {
NSString *path([@"/tmp/WBImages/" stringByAppendingString:[bundle bundleIdentifier]]);
if (![Manager_ fileExistsAtPath:path])
[UIImagePNGRepresentation(image) writeToFile:path atomically:YES];
} return image;
- }, [=](){ return $pathForFile$inBundle$(name, bundle, true); }, key);
+ },
+ key);
}
// %hook _UIImageWithName() {{{
return nil;
if (Debug_)
NSLog(@"WB:Debug: _UIImageWithName(\"%@\")", name);
- return WBCacheUIImage(_UIKitBundle(),
+ return WBCacheImage(_UIKitBundle(), name,
[=](){ return __UIImageWithName(name); },
- name, [NSString stringWithFormat:@"I:%@", name]);
+ [NSString stringWithFormat:@"I:%@", name]);
}
// }}}
// %hook _UIImageWithNameInDomain() {{{
if (Debug_)
NSLog(@"WB:Debug: _UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
return WBCacheImage(
- [=](){ return __UIImageWithNameInDomain(name, domain); },
[=](){ return $getTheme$($useScale$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])); },
+ [=](){ return __UIImageWithNameInDomain(name, domain); },
[NSString stringWithFormat:@"D:%zu:%@%@", size_t([domain length]), domain, name]);
}
// }}}
NSBundle *bundle($objc_getAssociatedObject(self, @selector(wb$bundle)));
if (Debug_)
NSLog(@"WB:Debug: -[UISharedArtwork(%@) imageNamed:@\"%@\" device:%li]", [bundle bundleIdentifier], name, (long) device);
- return WBCacheUIImage(bundle,
+ return WBCacheImage(bundle, name,
[=](){ return MSOldCall(name, device); },
- name, [NSString stringWithFormat:@"M:%p:%@:%li", self, name, (long) device]);
+ [NSString stringWithFormat:@"M:%p:%@:%li", self, name, (long) device]);
}
// }}}
// _UIAssetManager (iOS 7) {{{
bundle = [WBBundle bundleWithIdentifier:@"com.apple.uikit.LegacyArtwork"];
}
- return WBCacheUIImage(bundle,
+ return WBCacheImage(bundle, name,
[=](){ return MSOldCall(name, scale, idiom, subtype, caching); },
- name, [NSString stringWithFormat:@"M:%p:%@:%g:%li:%lu", self, name, scale, (long) idiom, (unsigned long) subtype]);
+ [NSString stringWithFormat:@"M:%p:%@:%g:%li:%lu", self, name, scale, (long) idiom, (unsigned long) subtype]);
}
// }}}
// _UIAssetManager (iOS 8) {{{
(long) size.first, (long) size.second,
attach ? "YES" : "NO"
);
- return WBCacheUIImage(bundle,
+ return WBCacheImage(bundle, name,
[=](){ return MSOldCall(name, scale, idiom, subtype, caching, size, attach); },
- name, [NSString stringWithFormat:@"M:%p:%@:%g:%li:%lu:%li:%li:%c", self, name, scale, (long) idiom, (unsigned long) subtype, (long) size.first, (long) size.second, attach ? 'Y' : 'N']);
+ [NSString stringWithFormat:@"M:%p:%@:%g:%li:%lu:%li:%li:%c", self, name, scale, (long) idiom, (unsigned long) subtype, (long) size.first, (long) size.second, attach ? 'Y' : 'N']);
}
// }}}
return GetFileNameForThisAction$(value, a0, a1, 0, a3);
}
+#ifdef __LP64__
+MSHook(bool, _Z24GetFileNameForThisActionjPcjRb, unsigned int a0, char *a1, unsigned int a2, bool &a3) {
+ bool value(__Z24GetFileNameForThisActionjPcjRb(a0, a1, a2, a3));
+ return GetFileNameForThisAction$(value, a0, a1, a2, a3);
+}
+#else
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);
}
+#endif
static void ChangeWallpaper(
CFNotificationCenterRef center,
if (NSString *themed = $pathForFile$inBundle$([name stringByAppendingString:@".png"], bundle, true)) {
if (indexes != nil)
index = [[indexes objectForKey:name] intValue];
- UIImage *image($getImage$(themed));
- CGImageRef cg([image CGImage]);
- [copy replaceObjectAtIndex:index withObject:(id)cg];
+ if (UIImage *image = $getImage$(themed))
+ [copy replaceObjectAtIndex:index withObject:(id)[image CGImage]];
}
return images;
msset(_Z24GetFileNameForThisActionmPcRb, image, "__Z24GetFileNameForThisActionmPcRb");
MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
+#ifdef __LP64__
+ bool (*_Z24GetFileNameForThisActionjPcjRb)(unsigned int, char *, unsigned int, bool &);
+ msset(_Z24GetFileNameForThisActionjPcjRb, image, "__Z24GetFileNameForThisActionjPcjRb");
+ MSHookFunction(_Z24GetFileNameForThisActionjPcjRb, &$_Z24GetFileNameForThisActionjPcjRb, &__Z24GetFileNameForThisActionjPcjRb);
+#else
bool (*_Z24GetFileNameForThisActionmPcmRb)(unsigned long, char *, unsigned long, bool &);
msset(_Z24GetFileNameForThisActionmPcmRb, image, "__Z24GetFileNameForThisActionmPcmRb");
MSHookFunction(_Z24GetFileNameForThisActionmPcmRb, &$_Z24GetFileNameForThisActionmPcmRb, &__Z24GetFileNameForThisActionmPcmRb);
+#endif
}
// }}}
// BackBoardServices {{{