#import <SpringBoard/SBIconLabel.h>
#import <SpringBoard/SBIconList.h>
#import <SpringBoard/SBIconModel.h>
+#import <SpringBoard/SBImageCache.h>
#import <SpringBoard/SBStatusBarContentsView.h>
#import <SpringBoard/SBStatusBarController.h>
#import <SpringBoard/SBStatusBarOperatorNameView.h>
Class $SBIconLabel;
Class $SBIconList;
Class $SBIconModel;
+//Class $SBImageCache;
Class $SBStatusBarContentsView;
Class $SBStatusBarController;
Class $SBStatusBarOperatorNameView;
@end
-MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
- _SBIconModel$cacheImageForIcon$(self, sel, icon);
- NSString *key([icon displayIdentifier]);
+UIImage *$cacheForImage$(UIImage *image) {
+ CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
+ CGRect rect = {CGPointMake(1, 1), [image size]};
+ CGSize size = {rect.size.width + 2, rect.size.height + 2};
- if (UIImage *image = [icon icon]) {
- CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
- CGRect rect = {CGPointMake(1, 1), [image size]};
- CGSize size = {rect.size.width + 2, rect.size.height + 2};
+ CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
+ CGColorSpaceRelease(space);
- CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
- CGColorSpaceRelease(space);
+ CGContextDrawImage(context, rect, [image CGImage]);
+ CGImageRef ref(CGBitmapContextCreateImage(context));
+ CGContextRelease(context);
- CGContextDrawImage(context, rect, [image CGImage]);
- CGImageRef ref(CGBitmapContextCreateImage(context));
- CGContextRelease(context);
+ UIImage *cache([UIImage imageWithCGImage:ref]);
+ CGImageRelease(ref);
- UIImage *image([UIImage imageWithCGImage:ref]);
- CGImageRelease(ref);
+ return cache;
+}
+
+/*MSHook(id, SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$, SBImageCache *self, SEL sel, NSString *name, unsigned width, unsigned height, unsigned capacity) {
+ //if ([name isEqualToString:@"icons"]) return nil;
+ return _SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$(self, sel, name, width, height, capacity);
+}*/
+
+MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
+ NSString *key([icon displayIdentifier]);
- [Cache_ setObject:image forKey:key];
+ if (UIImage *image = [icon icon]) {
+ CGSize size = [image size];
+ if (size.width > 59 || size.height > 60) {
+ UIImage *cache($cacheForImage$(image));
+ [Cache_ setObject:cache forKey:key];
+ return;
+ }
}
+
+ _SBIconModel$cacheImageForIcon$(self, sel, icon);
}
MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
NSString *path = [NSString stringWithUTF8String:a1];
if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
NSString *file = [path substringFromIndex:31];
- NSLog(@"%@", file);
for (NSString *theme in themes_) {
NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
if ([Manager_ fileExistsAtPath:path]) {
Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
for (NSString *theme in themes_)
- if (NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
+ if (NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]]) {
+ [info autorelease];
for (NSString *key in [info allKeys])
if ([Info_ objectForKey:key] == nil)
[Info_ setObject:[info objectForKey:key] forKey:key];
+ }
if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
$SBIconLabel = objc_getClass("SBIconLabel");
$SBIconList = objc_getClass("SBIconList");
$SBIconModel = objc_getClass("SBIconModel");
+ //$SBImageCache = objc_getClass("SBImageCache");
$SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
$SBStatusBarController = objc_getClass("SBStatusBarController");
$SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
+ //WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
+
WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
- if (English_ != nil)
- English_ = [English_ retain];
-
Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
}
+ [pool release];
+ return;
+
Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)