#import <SpringBoard/SBIcon.h>
#import <SpringBoard/SBIconModel.h>
-MSHook(float, SBButtonBar$leftMarginForIconRowArray$, SBButtonBar *self, SEL sel, NSArray *row) {
- return [row indexOfObject:[NSNull null]] == NSNotFound ? 4 : _SBButtonBar$leftMarginForIconRowArray$(self, sel, row);
+MSHookClass(SBButtonBar)
+MSHookClass(SBIcon)
+MSHookClass(SBIconModel)
+
+MSHookMetaClass(SBIconModel)
+
+MSMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *row) {
+ return [row indexOfObject:[NSNull null]] == NSNotFound ? 4 : MSCall1(SBButtonBar, leftMarginForIconRowArray, row);
}
-static int $SBButtonBar$maxIconColumns(SBButtonBar *self, SEL sel) {
- return 5;
+MSMessageHook0(int, SBButtonBar, maxIconColumns) {
+ return 10;
}
static unsigned $SBButtonBar$count(SBButtonBar *self) {
- NSArray *&_iconMatrix(MSHookIvar<NSArray *>(self, "_iconMatrix"));
+ MSIvar(NSArray *, _iconMatrix);
NSArray *row([_iconMatrix objectAtIndex:0]);
unsigned count(0);
for (id icon in row)
return count;
}
-static float $SBButtonBar$topIconPadding(SBButtonBar *self, SEL sel) {
+MSMessageHook0(float, SBButtonBar, topIconPadding) {
return 313370 + $SBButtonBar$count(self);
}
-MSHook(void, SBIcon$setOrigin$, SBIcon *self, SEL sel, CGPoint origin) {
+MSMessageHook1(void, SBIcon, setOrigin, CGPoint origin) {
unsigned count(origin.y);
if (count < 313370)
goto set;
origin.y = 11;
set:
- _SBIcon$setOrigin$(self, sel, origin);
+ MSCall1(SBIcon, setOrigin, origin);
}
-MSHook(CGPoint, SBButtonBar$originForIconAtX$Y$, SBButtonBar *self, SEL sel, int x, int y) {
- CGPoint origin;//(_SBButtonBar$originForIconAtX$Y$(self, sel, x, y));
+MSMessageHook2(CGPoint, SBButtonBar, originForIconAtX,Y, int x, int y) {
+ CGPoint origin;//(_SBButtonBar$originForIconAtX$Y$(self, _cmd, x, y));
//NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y);
origin.y = 11;
return origin;
}
-static int $SBIconModel$maxIconListCount(SBIconModel *self, SEL sel) {
+MSMetaMessageHook0(int, SBIconModel, maxIconListCount) {
return 16;
}
-
-extern "C" void TweakInitialize() {
- Class $SBButtonBar(objc_getClass("SBButtonBar"));
- MSHookMessage($SBButtonBar, @selector(leftMarginForIconRowArray:), MSHake(SBButtonBar$leftMarginForIconRowArray$));
- MSHookMessage($SBButtonBar, @selector(maxIconColumns), &$SBButtonBar$maxIconColumns);
- MSHookMessage($SBButtonBar, @selector(topIconPadding), &$SBButtonBar$topIconPadding);
- MSHookMessage($SBButtonBar, @selector(originForIconAtX:Y:), MSHake(SBButtonBar$originForIconAtX$Y$));
-
- Class $SBIcon(objc_getClass("SBIcon"));
- MSHookMessage($SBIcon, @selector(setOrigin:), MSHake(SBIcon$setOrigin$));
-
- Class $SBIconModel(objc_getClass("SBIconModel"));
- Class $$SBIconModel(object_getClass($SBIconModel));
- MSHookMessage($$SBIconModel, @selector(maxIconListCount), &$SBIconModel$maxIconListCount);
-}
+++ /dev/null
-#import <Foundation/Foundation.h>
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <unistd.h>
-
-int main(int argc, const char *argv[]) {
- if (argc < 2 || strcmp(argv[1], "remove") != 0)
- return 0;
-
- struct passwd *passwd = getpwnam("mobile");
- if (passwd == NULL) {
- perror("getpwnam");
- return 0;
- }
-
- if (setregid(passwd->pw_gid, passwd->pw_gid) == -1) {
- perror("setregid");
- return 1;
- }
-
- if (setreuid(passwd->pw_uid, passwd->pw_uid) == -1) {
- perror("setreuid");
- return 1;
- }
-
- NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
-
- NSString *path([NSString stringWithFormat:@"%@/Library/Preferences/com.apple.springboard.plist", NSHomeDirectory()]);
-
- NSMutableDictionary *settings([[NSMutableDictionary alloc] initWithContentsOfFile:path]);
- if (settings == nil)
- return 0;
-
- NSMutableDictionary *iconState([settings objectForKey:@"iconState"]);
- if (iconState == nil)
- return 0;
-
- NSMutableDictionary *buttonBar([iconState objectForKey:@"buttonBar"]);
- if (buttonBar == nil)
- return 0;
-
- NSMutableArray *buttonBarIconMatrix([buttonBar objectForKey:@"iconMatrix"]);
- if (buttonBarIconMatrix == nil || [buttonBarIconMatrix count] == 0)
- return 0;
-
- NSMutableArray *buttonBarRow([buttonBarIconMatrix objectAtIndex:0]);
- if (buttonBarRow == nil || [buttonBarRow count] < 5)
- return 0;
-
- NSMutableDictionary *fifth([buttonBarRow objectAtIndex:4]);
-
- if (![fifth isEqual:[NSNumber numberWithInt:0]]) {
- NSMutableArray *iconLists([iconState objectForKey:@"iconLists"]);
- if (iconLists == nil)
- iconLists = [NSMutableArray arrayWithCapacity:1];
- else for (NSUInteger i(0), e([iconLists count]); i != e; ++i) {
- NSMutableDictionary *iconList([iconLists objectAtIndex:i]);
- NSMutableArray *iconMatrix([iconList objectForKey:@"iconMatrix"]);
- if (iconMatrix == nil)
- continue;
-
- for (NSUInteger i(0), e([iconMatrix count]); i != e; ++i) {
- NSMutableArray *row([iconMatrix objectAtIndex:i]);
- NSUInteger spot([row indexOfObject:[NSNumber numberWithInteger:0]]);
- if (spot != NSNotFound) {
- [row replaceObjectAtIndex:i withObject:fifth];
- goto save;
- }
- }
- }
-
- [iconLists addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- [NSArray arrayWithObjects:[NSArray arrayWithObject:fifth], nil], @"iconMatrix",
- nil]];
- }
-
- save:
- [buttonBarRow removeLastObject];
- bool saved([settings writeToFile:path atomically:YES]);
-
- [pool release];
-
- return saved ? 0 : 1;
-}