]>
Commit | Line | Data |
---|---|---|
ca13798d JF |
1 | #import <Foundation/Foundation.h> |
2 | #import <CoreGraphics/CoreGraphics.h> | |
95a5777b JF |
3 | |
4 | #import <UIKit/UIKeyboard.h> | |
5 | #import <UIKit/UIImage.h> | |
ca13798d JF |
6 | |
7 | extern "C" { | |
8 | #include <mach-o/nlist.h> | |
9 | } | |
10 | ||
95a5777b JF |
11 | extern "C" NSData *UIImagePNGRepresentation(UIImage *image); |
12 | ||
ca13798d JF |
13 | int main(int argc, char *argv[]) { |
14 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
15 | ||
16 | struct nlist nl[3]; | |
17 | memset(nl, 0, sizeof(nl)); | |
18 | nl[0].n_un.n_name = (char *) "___mappedImages"; | |
19 | nl[1].n_un.n_name = (char *) "__UISharedImageInitialize"; | |
20 | nlist("/System/Library/Frameworks/UIKit.framework/UIKit", nl); | |
21 | NSMutableDictionary **images = (id *) nl[0].n_value; | |
22 | void (*__UISharedImageInitialize)(bool) = (void (*)(bool)) nl[1].n_value; | |
23 | ||
24 | __UISharedImageInitialize(false); | |
95a5777b | 25 | [UIKeyboard preheatArtwork]; |
ca13798d JF |
26 | |
27 | NSArray *keys = [*images allKeys]; | |
28 | for (int i(0), e([keys count]); i != e; ++i) { | |
29 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
30 | NSString *key = [keys objectAtIndex:i]; | |
31 | CGImageRef ref = (CGImageRef) [*images objectForKey:key]; | |
32 | UIImage *image = [UIImage imageWithCGImage:ref]; | |
33 | NSData *data = UIImagePNGRepresentation(image); | |
34 | [data writeToFile:[NSString stringWithFormat:@"%@", key] atomically:YES]; | |
35 | [pool release]; | |
36 | } | |
37 | ||
38 | [pool release]; | |
39 | return 0; | |
40 | } |