+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;
+}
+