Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0d4f80c
Showing
18 changed files
with
1,122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Generated by class-dump 3.1.2. | ||
* | ||
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard. | ||
*/ | ||
|
||
#import <Foundation/NSObject.h> | ||
|
||
@class NSLock, NSMutableDictionary, NSString; | ||
|
||
@interface CPDistributedMessagingCenter : NSObject | ||
{ | ||
NSString *_name; | ||
NSLock *_lock; | ||
unsigned int _sendPort; | ||
NSString *_requiredEntitlement; | ||
NSMutableDictionary *_callouts; | ||
BOOL _isServer; | ||
} | ||
|
||
+ (id)centerNamed:(id)fp8; | ||
- (id)_initWithServerName:(id)fp8; | ||
- (void)dealloc; | ||
- (id)name; | ||
- (unsigned int)_sendPort; | ||
- (BOOL)sendMessageName:(id)fp8 userInfo:(id)fp12; | ||
- (id)sendMessageAndReceiveReplyName:(id)fp8 userInfo:(id)fp12; | ||
- (BOOL)_sendMessage:(id)fp8 userInfo:(id)fp12 receiveReply:(id *)fp16; | ||
- (void)runServerOnCurrentThread; | ||
- (void)runServerOnCurrentThreadProtectedByEntitlement:(id)fp8; | ||
- (void)registerForMessageName:(id)fp8 target:(id)fp12 selector:(SEL)fp16; | ||
- (void)unregisterForMessageName:(id)fp8; | ||
- (BOOL)_dispatchMessageNamed:(id)fp8 userInfo:(id)fp12 auditToken:(id *)fp16 reply:(id *)fp20; | ||
- (BOOL)isTaskEntitled:(id *)fp8; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
#import "common.h" | ||
#import "defines.h" | ||
|
||
#define CLCLASS(cls) \ | ||
Class $ ## cls | ||
#include "classlist.h" | ||
#undef CLCLASS | ||
|
||
void Classes_Fetch() | ||
{ | ||
#define CLCLASS(cls) \ | ||
$ ## cls = objc_getClass(#cls) | ||
#include "classlist.h" | ||
#undef CLCLASS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
TWEAK_NAME = libstatusbar | ||
libstatusbar_OBJCC_FILES = libstatusbar.mm Classes.mm \ | ||
StatusBarItemClient.mm StatusBarItemServer.mm \ | ||
UIStatusBarCustomItem.mm UIStatusBarCustomItemView.mm | ||
libstatusbar_FRAMEWORKS = UIKit | ||
libstatusbar_PRIVATE_FRAMEWORKS = AppSupport | ||
|
||
|
||
#SYSROOT = /Wildcat7B367.dyld_cache | ||
GO_EASY_ON_ME =1 | ||
SDKVERSION = 4.0 | ||
|
||
ADDITIONAL_OBJCCFLAGS = -fvisibility=hidden | ||
ADDITIONAL_OBJCCFLAGS += -I/Users/public/decompile/iPhoneOS4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/ | ||
|
||
|
||
include framework/makefiles/common.mk | ||
include framework/makefiles/tweak.mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
@interface StatusBarItemClient : NSObject | ||
{ | ||
bool _isLocal; | ||
NSDictionary* _currentMessage; | ||
} | ||
|
||
+ (id) sharedInstance; | ||
|
||
- (id) init; | ||
|
||
- (void) retrieveCurrentMessage; | ||
- (void) processCurrentMessage; | ||
- (void) updateStatusBar; | ||
|
||
- (void) setProperties: (id) properties forItem: (NSString*) item; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
|
||
#define TESTING | ||
|
||
#import "common.h" | ||
#import "defines.h" | ||
|
||
#import "classes.h" | ||
#import "StatusBarItemClient.h" | ||
#import "StatusBarItemServer.h" | ||
#import "UIStatusBarCustomItem.h" | ||
|
||
void UpdateStatusBar(CFNotificationCenterRef center, StatusBarItemClient* client) | ||
{ | ||
SelLog(); | ||
[client updateStatusBar]; | ||
} | ||
|
||
@implementation StatusBarItemClient | ||
|
||
StatusBarItemClient* sharedItemClient; | ||
+ (id) sharedInstance | ||
{ | ||
if(!sharedItemClient) | ||
{ | ||
sharedItemClient = [[self alloc] init]; | ||
} | ||
return sharedItemClient; | ||
} | ||
|
||
- (id) init | ||
{ | ||
self = [super init]; | ||
if(self) | ||
{ | ||
_isLocal = $SpringBoard ? YES : NO; | ||
|
||
CFNotificationCenterRef darwin = CFNotificationCenterGetDarwinNotifyCenter(); | ||
CFNotificationCenterAddObserver(darwin, self, (CFNotificationCallback) UpdateStatusBar, (CFStringRef) @"libstatusbar_changed", NULL, NULL); | ||
|
||
[self updateStatusBar]; | ||
|
||
} | ||
return self; | ||
} | ||
|
||
|
||
- (void) retrieveCurrentMessage | ||
{ | ||
[_currentMessage release]; | ||
if(_isLocal) | ||
{ | ||
_currentMessage = [[[StatusBarItemServer sharedInstance] currentMessage] retain]; | ||
} | ||
else | ||
{ CPDistributedMessagingCenter* dmc = [CPDistributedMessagingCenter centerNamed: @"com.apple.springboard.libstatusbar"]; | ||
|
||
_currentMessage = [[dmc sendMessageAndReceiveReplyName: @"currentMessage" userInfo: nil] retain]; | ||
} | ||
NSDesc(_currentMessage); | ||
} | ||
|
||
- (void) processCurrentMessage | ||
{ | ||
NSMutableDictionary *processedMessage = [_currentMessage mutableCopy]; | ||
|
||
int keyidx = 22; | ||
|
||
for(int i=0; i<3; i++) | ||
{ | ||
extern NSMutableArray* customItems[3]; | ||
if(customItems[i]) | ||
{ | ||
for(UIStatusBarCustomItem* item in customItems[i]) | ||
{ | ||
NSString* indicatorName = [item indicatorName]; | ||
if(processedMessage==nil || [processedMessage objectForKey: indicatorName] == nil) | ||
{ | ||
NSLog(@"removing item: %@", indicatorName); | ||
[item removeAllViews]; | ||
[customItems[i] removeObject: item]; | ||
} | ||
else | ||
{ | ||
NSLog(@"keeping item: %@", indicatorName); | ||
[processedMessage removeObjectForKey: indicatorName]; | ||
int &type(MSHookIvar<int>(item, "_type")); | ||
if(type > keyidx) | ||
keyidx = type; | ||
|
||
} | ||
} | ||
} | ||
else | ||
{ | ||
NSLog(@"creating array"); | ||
|
||
customItems[i] = [[NSMutableArray alloc] init]; | ||
} | ||
} | ||
|
||
keyidx++; | ||
|
||
if(processedMessage) | ||
{ | ||
GETCLASS(UIStatusBarItem); | ||
for(NSString* key in processedMessage) | ||
//NSString* key = @"Pause"; | ||
{ | ||
NSLog(@"adding item: %@", key); | ||
[[$UIStatusBarItem itemWithType: keyidx++] setIndicatorName: key]; | ||
} | ||
} | ||
} | ||
|
||
- (void) updateStatusBar | ||
{ | ||
SelLog(); | ||
|
||
[self retrieveCurrentMessage]; | ||
[self processCurrentMessage]; | ||
|
||
// need a decent guard band because we call updateStatusBar before UIApp exists | ||
if(UIApp) | ||
{ | ||
UIStatusBarForegroundView* _foregroundView = MSHookIvar<UIStatusBarForegroundView*>([UIApp statusBar], "_foregroundView"); | ||
if(_foregroundView) | ||
{ | ||
[_foregroundView setStatusBarData: (StatusBarData*) [$UIStatusBarServer getStatusBarData] actions: 0 animated: YES]; | ||
} | ||
} | ||
} | ||
|
||
- (void) setProperties: (id) properties forItem: (NSString*) item | ||
{ | ||
SelLog(); | ||
if(item) | ||
{ | ||
if(_isLocal) | ||
{ | ||
[[StatusBarItemServer sharedInstance] setProperties: properties forItem: item]; | ||
} | ||
else | ||
{ | ||
NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys: | ||
item, @"item", | ||
properties, @"properties", | ||
nil]; | ||
|
||
CPDistributedMessagingCenter* dmc = [CPDistributedMessagingCenter centerNamed: @"com.apple.springboard.libstatusbar"]; | ||
|
||
[dmc sendMessageName: @"setProperties:userInfo:" userInfo: dict]; | ||
[dict release]; | ||
} | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
@interface StatusBarItemServer : NSObject | ||
{ | ||
CPDistributedMessagingCenter *_dmc; | ||
NSMutableDictionary* _currentMessage; | ||
} | ||
|
||
+ (id) sharedInstance; | ||
|
||
- (id) init; | ||
|
||
- (void) setProperties: (NSString*) message userInfo: (NSDictionary*) userInfo; | ||
- (void) setProperties: (id) properties forItem: (NSString*) item; | ||
|
||
- (NSMutableDictionary*) currentMessage; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
#import "common.h" | ||
#import "defines.h" | ||
|
||
#import "classes.h" | ||
//#import "StatusBarItemClient.h" | ||
#import "StatusBarItemServer.h" | ||
//#import "UIStatusBarCustomItem.h" | ||
|
||
@implementation StatusBarItemServer | ||
|
||
StatusBarItemServer* sharedItemServer; | ||
+ (id) sharedInstance | ||
{ | ||
if(!sharedItemServer) | ||
{ | ||
sharedItemServer = [[self alloc] init]; | ||
} | ||
return sharedItemServer; | ||
} | ||
|
||
|
||
- (id) init | ||
{ | ||
self = [super init]; | ||
if(self) | ||
{ | ||
_dmc = [CPDistributedMessagingCenter centerNamed: @"com.apple.springboard.libstatusbar"]; | ||
[_dmc runServerOnCurrentThread]; | ||
[_dmc registerForMessageName: @"currentMessage" target: self selector: @selector(currentMessage)]; | ||
[_dmc registerForMessageName: @"setProperties:userInfo:" target: self selector: @selector(setProperties:userInfo:)]; | ||
|
||
_currentMessage = [[NSMutableDictionary alloc] init]; | ||
|
||
|
||
} | ||
return self; | ||
} | ||
|
||
- (NSMutableDictionary*) currentMessage | ||
{ | ||
return _currentMessage; | ||
} | ||
|
||
- (void) setProperties: (id) properties forItem: (NSString*) item | ||
{ | ||
SelLog(); | ||
if(item) | ||
{ | ||
// use setValue instead of setObject | ||
[_currentMessage setValue: properties forKey: item]; | ||
} | ||
NSDesc(_currentMessage); | ||
notify_post("libstatusbar_changed"); | ||
|
||
} | ||
|
||
- (void) setProperties: (NSString*) message userInfo: (NSDictionary*) userInfo | ||
{ | ||
NSString* item = [userInfo objectForKey: @"item"]; | ||
NSDictionary* properties = [userInfo objectForKey: @"properties"]; | ||
|
||
[self setProperties: properties forItem: item]; | ||
|
||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
|
||
@interface UIApplication (libstatusbar) | ||
- (void) addStatusBarImageNamed: (NSString*) name removeOnExit: (BOOL) remove; | ||
- (void) addStatusBarImageNamed: (NSString*) name; | ||
- (void) removeStatusBarImageNamed: (NSString*) name; | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
@interface UIStatusBarCustomItem : UIStatusBarItem | ||
{ | ||
// NSString* _indicatorName; | ||
// CFMutableDictionaryRef _views; | ||
} | ||
|
||
- (UIStatusBarItemView*) viewForManager: (id) manager; | ||
- (void) setView: (UIStatusBarItemView*) view forManager: (id) manager; | ||
- (void) removeAllViews; | ||
|
||
- (void) setIndicatorName: (NSString*) name; | ||
|
||
@end | ||
|
||
void ClassCreate_UIStatusBarCustomItem(); |
Oops, something went wrong.