From dbbe0f326ffd44963497e60fbd53311312ab43de Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 21 Dec 2008 06:14:10 +0000 Subject: Added MobilePaper and replaced RESETHAND. --- MobilePaper.jpg | Bin 0 -> 14827 bytes MobilePaper.png | Bin 0 -> 7411 bytes MobileSafety.mm | 39 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 MobilePaper.jpg create mode 100755 MobilePaper.png diff --git a/MobilePaper.jpg b/MobilePaper.jpg new file mode 100644 index 0000000..c60e725 Binary files /dev/null and b/MobilePaper.jpg differ diff --git a/MobilePaper.png b/MobilePaper.png new file mode 100755 index 0000000..9da2d93 Binary files /dev/null and b/MobilePaper.png differ diff --git a/MobileSafety.mm b/MobileSafety.mm index af17ccf..367d06e 100644 --- a/MobileSafety.mm +++ b/MobileSafety.mm @@ -46,6 +46,8 @@ #import #import +#import + #include @protocol MobileSubstrate @@ -143,16 +145,46 @@ static id SBContentLayer$initWithSize$(SBContentLayer *self, SE return self; } +/*MSHook(void, SBSlidingAlertDisplay$updateDesktopImage$, SBSlidingAlertDisplay *self, SEL sel, UIImage *image) { + NSString *text(@"\"Sad iPhone\" by Geoff Stearns"); + UIView *&_backgroundView(MSHookIvar(self, "_backgroundView")); + if (_backgroundView != nil) + text = nil; + _SBSlidingAlertDisplay$updateDesktopImage$(self, sel, image); + if (text != nil) { + UIFont *font([UIFont systemFontOfSize:12]); + CGRect rect([self frame]); + CGSize size([text sizeWithFont:font]); + rect.origin.y = 385 - 3 - 14;//size.height; + rect.size.height = size.height; + + UITextView *view([[UITextView alloc] initWithFrame:rect]); + [view setTextAlignment:UITextAlignmentCenter]; + [view setMarginTop:0]; + [view setFont:font]; + [view setText:text]; + [view setTextColor:[UIColor grayColor]]; + [view setBackgroundColor:[UIColor clearColor]]; + + [self insertSubview:view aboveSubview:_backgroundView]; + } +}*/ + +#define Paper_ "/Library/MobileSubstrate/MobilePaper.png" + +MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) { + return [UIImage imageWithContentsOfFile:@Paper_]; +} + MSHook(void, SBStatusBarTimeView$tile, SBStatusBarTimeView *self, SEL sel) { NSString *&_time(MSHookIvar(self, "_time")); CGRect &_textRect(MSHookIvar(self, "_textRect")); if (_time != nil) [_time release]; - _time = [@"Safe Mode, Click!" retain]; + _time = [@"Exit Safe Mode" retain]; GSFontRef font([self textFont]); CGSize size([_time sizeWithFont:(id)font]); CGRect frame([self frame]); - NSLog(@"%f:%f,%f:%f:%u", size.height, size.width, frame.size.height, frame.size.width, [[(id) objc_getClass("SBStatusBarController") sharedStatusBarController] statusBarOrientation]); _textRect.size = size; _textRect.origin.x = (frame.size.width - size.width) / 2; _textRect.origin.y = (frame.size.height - size.height) / 2; @@ -168,6 +200,9 @@ extern "C" void MSInitialize() { _SBStatusBar$mouseDown$ = MSHookMessage(objc_getClass("SBStatusBar"), @selector(mouseDown:), &$SBStatusBar$mouseDown$); _SBStatusBarTimeView$tile = MSHookMessage(objc_getClass("SBStatusBarTimeView"), @selector(tile), &$SBStatusBarTimeView$tile); + _UIImage$defaultDesktopImage = MSHookMessage(object_getClass(objc_getClass("UIImage")), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage); + //_SBSlidingAlertDisplay$updateDesktopImage$ = MSHookMessage(objc_getClass("SBSlidingAlertDisplay"), @selector(updateDesktopImage:), &$SBSlidingAlertDisplay$updateDesktopImage$); + char *dil = getenv("DYLD_INSERT_LIBRARIES"); if (dil == NULL) NSLog(@"MS:Error: DYLD_INSERT_LIBRARIES is unset?"); -- cgit v1.2.3