X-Git-Url: https://git.saurik.com/winterboard.git/blobdiff_plain/ca13798d8bb053ba23e057d6b9e056bc747b61d2..8b94f6b063401add7b31f4d63840c9eadfd1f040:/UIImages.mm diff --git a/UIImages.mm b/UIImages.mm index 0e2272c..1463e34 100644 --- a/UIImages.mm +++ b/UIImages.mm @@ -1,21 +1,27 @@ #import #import -#import + +#import +#import extern "C" { #include } +extern "C" NSData *UIImagePNGRepresentation(UIImage *image); + int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - struct nlist nl[3]; + struct nlist nl[4]; memset(nl, 0, sizeof(nl)); nl[0].n_un.n_name = (char *) "___mappedImages"; nl[1].n_un.n_name = (char *) "__UISharedImageInitialize"; + nl[2].n_un.n_name = (char *) "_LoadMappedImageRef"; nlist("/System/Library/Frameworks/UIKit.framework/UIKit", nl); NSMutableDictionary **images = (id *) nl[0].n_value; void (*__UISharedImageInitialize)(bool) = (void (*)(bool)) nl[1].n_value; + CGImageRef (*_LoadMappedImageRef)(CFStringRef) = (CGImageRef (*)(CFStringRef)) nl[2].n_value; __UISharedImageInitialize(false); @@ -23,7 +29,11 @@ int main(int argc, char *argv[]) { for (int i(0), e([keys count]); i != e; ++i) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *key = [keys objectAtIndex:i]; - CGImageRef ref = (CGImageRef) [*images objectForKey:key]; + CGImageRef ref; + if (_LoadMappedImageRef == NULL) + ref = reinterpret_cast([*images objectForKey:key]); + else + ref = _LoadMappedImageRef(reinterpret_cast(key)); UIImage *image = [UIImage imageWithCGImage:ref]; NSData *data = UIImagePNGRepresentation(image); [data writeToFile:[NSString stringWithFormat:@"%@", key] atomically:YES];