#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);
-}