X-Git-Url: https://git.saurik.com/winterboard.git/blobdiff_plain/7bdacbbb1629d1dfb3cc7701f912d1c2d8879757..008ae666f2fe7c95881638bad38c6938bbe1f19e:/Library.mm?ds=sidebyside diff --git a/Library.mm b/Library.mm index 80001b2..0897249 100644 --- a/Library.mm +++ b/Library.mm @@ -1972,6 +1972,26 @@ MSHook(void *, CGImageReadCreateWithFile, NSString *path, int flag) { [pool release]; return value; } + +MSHook(void *, CGImageSourceCreateWithFile, NSString *path, NSDictionary *options) { + if (Debug_) + NSLog(@"WB:Debug: CGImageSourceCreateWithFile(%@, %@)", path, options); + NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); + void *value(_CGImageSourceCreateWithFile([path wb$themedPath], options)); + [pool release]; + return value; +} + +MSHook(void *, CGImageSourceCreateWithURL, NSURL *url, NSDictionary *options) { + if (Debug_) + NSLog(@"WB:Debug: CGImageSourceCreateWithURL(%@, %@)", url, options); + NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); + if ([url isFileURL]) + url = [NSURL fileURLWithPath:[[url path] wb$themedPath]]; + void *value(_CGImageSourceCreateWithURL(url, options)); + [pool release]; + return value; +} // }}} static void NSString$drawAtPoint$withStyle$(NSString *self, SEL _cmd, CGPoint point, NSString *style) { @@ -2136,6 +2156,16 @@ MSInitialize { void *(*CGImageReadCreateWithFile)(NSString *, int); msset(CGImageReadCreateWithFile, image, "_CGImageReadCreateWithFile"); MSHookFunction(CGImageReadCreateWithFile, MSHake(CGImageReadCreateWithFile)); + + if (CGImageReadCreateWithFile == NULL) { + void *(*CGImageSourceCreateWithFile)(NSString *, NSDictionary *); + msset(CGImageSourceCreateWithFile, image, "_CGImageSourceCreateWithFile"); + MSHookFunction(CGImageSourceCreateWithFile, MSHake(CGImageSourceCreateWithFile)); + + void *(*CGImageSourceCreateWithURL)(NSURL *, NSDictionary *); + msset(CGImageSourceCreateWithURL, image, "_CGImageSourceCreateWithURL"); + MSHookFunction(CGImageSourceCreateWithURL, MSHake(CGImageSourceCreateWithURL)); + } } // }}} // SpringBoard {{{