for (NSString *file in files) {
path = [NSString stringWithFormat:@"%@/%@", theme, file];
if ([Manager_ fileExistsAtPath:path]) {
- if ([[Manager_ pathContentOfSymbolicLinkAtPath:path] isEqualToString:@"/"])
+ if ([[Manager_ destinationOfSymbolicLinkAtPath:path error:NULL] isEqualToString:@"/"])
path = nil;
goto set;
}
// }}}
// %hook _UIImageWithNameInDomain() {{{
MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
- NSString *key([NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name]);
+ NSString *key([NSString stringWithFormat:@"D:%zu%@%@", size_t([domain length]), domain, name]);
UIImage *image([PathImages_ objectForKey:key]);
if (image != nil)
return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image;
// }}}
#define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
-#define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
static bool GetFileNameForThisAction$(bool value, unsigned long a0, char *a1, unsigned long a2, bool &a3) {
if (Debug_)
- NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u, %u) = %u", a0, value ? a1 : NULL, a2, a3, value);
+ NSLog(@"WB:Debug:GetFileNameForThisAction(%lu, %s, %lu, %u) = %u", a0, value ? a1 : NULL, a2, a3, value);
if (value) {
NSString *path = [NSString stringWithUTF8String:a1];
function = reinterpret_cast<Type_>(MSFindSymbol(image, name));
}
+#define WBHookSymbol(image, function) \
+ msset(function, image, "_" #function)
+
template <typename Type_>
static void nlset(Type_ &function, struct nlist *nl, size_t index) {
struct nlist &name(nl[index]);
if (name == nil)
continue;
- NSString *theme(nil);
-
#define testForTheme(format...) \
- if (theme == nil) { \
+ { \
NSString *path = [NSString stringWithFormat:format]; \
if ([Manager_ fileExistsAtPath:path]) { \
[Themes_ addObject:path]; \
}
// }}}
// UIKit {{{
- if ([NSBundle bundleWithIdentifier:@"com.apple.UIKit"] != nil) {
+ if (MSImageRef image = MSGetImageByName("/System/Library/Frameworks/UIKit.framework/UIKit")) {
class_addMethod($NSString, @selector(drawAtPoint:withStyle:), (IMP) &NSString$drawAtPoint$withStyle$, "v20@0:4{CGPoint=ff}8@16");
class_addMethod($NSString, @selector(drawInRect:withStyle:), (IMP) &NSString$drawInRect$withStyle$, "v28@0:4{CGRect={CGSize=ff}{CGSize=ff}}8@24");
class_addMethod($NSString, @selector(sizeWithStyle:forWidth:), (IMP) &NSString$sizeWithStyle$forWidth$, "{CGSize=ff}16@0:4@8f12");
WBRename(UIImageTableArtwork, initWithName:inBundle:, initWithName$inBundle$);
WBRename(UIImageTableArtwork, imageNamed:device:, imageNamed$device$);
} else {
- struct nlist nl[6];
- memset(nl, 0, sizeof(nl));
- nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
- nl[1].n_un.n_name = (char *) "__UIImageWithNameInDomain";
- nl[2].n_un.n_name = (char *) "__UIKitBundle";
- nl[3].n_un.n_name = (char *) "__UIPackedImageTableGetIdentifierForName";
- nl[4].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
- nlist(UIKit, nl);
-
- nlset(_UIApplicationImageWithName, nl, 0);
- nlset(_UIImageWithNameInDomain, nl, 1);
- nlset(_UIKitBundle, nl, 2);
- nlset(_UIPackedImageTableGetIdentifierForName, nl, 3);
- nlset(_UISharedImageNameGetIdentifier, nl, 4);
+ WBHookSymbol(image, _UIApplicationImageWithName);
+ WBHookSymbol(image, _UIImageWithNameInDomain);
+ WBHookSymbol(image, _UIKitBundle);
+ WBHookSymbol(image, _UIPackedImageTableGetIdentifierForName);
+ WBHookSymbol(image, _UISharedImageNameGetIdentifier);
MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
#include "WBMarkup.h"
+#include <substrate.h>
+
@class WKView;
-extern "C" {
- void WebThreadLock();
- CGContextRef WKGetCurrentGraphicsContext();
- void WKViewLockFocus(WKView *);
- void WKViewUnlockFocus(WKView *);
- void WKViewDisplayRect(WKView *, CGRect);
-}
+extern "C" void WebThreadLock();
+extern "C" CGContextRef WKGetCurrentGraphicsContext();
+
+static void (*WKViewLockFocus$)(WKView *);
+static void (*WKViewUnlockFocus$)(WKView *);
+static void (*WKViewDisplayRect$)(WKView *, CGRect);
@interface DOMElement : NSObject
- (void) setInnerHTML:(NSString *)value;
@implementation WBMarkup
++ (void) initialize {
+ MSImageRef WebCore(MSGetImageByName("/System/Library/PrivateFrameworks/WebCore.framework/WebCore"));
+ MSHookSymbol(WKViewLockFocus$, "WKViewLockFocus", WebCore);
+ MSHookSymbol(WKViewUnlockFocus$, "WKViewUnlockFocus", WebCore);
+ MSHookSymbol(WKViewDisplayRect$, "WKViewDisplayRect", WebCore);
+}
+
+ (BOOL) isSharedMarkupCreated {
return SharedMarkup_ != nil;
}
[view_ _drawRect:draw context:context_ lockFocus:YES];
else {
WKView *view([view_ _viewRef]);
- WKViewLockFocus(view); {
- WKViewDisplayRect(view, draw);
- } WKViewUnlockFocus(view);
+ WKViewLockFocus$(view); {
+ WKViewDisplayRect$(view, draw);
+ } WKViewUnlockFocus$(view);
}
} CGContextRestoreGState(context_);
}
-ifndef PKG_TARG
-target :=
-else
-target := $(PKG_TARG)-
-endif
+cycc = cycc -i2.0 -o$@ -- -Iiphone-api
-substrate := -I../mobilesubstrate -L../mobilesubstrate -lsubstrate
+substrate := -I../substrate -L../substrate -lsubstrate
all: WinterBoard WinterBoard.dylib WinterBoardSettings Optimize
rm -f WinterBoard WinterBoard.dylib
WinterBoardSettings: Settings.mm makefile
- $(target)g++ -dynamiclib -g0 -O2 -Wall -o $@ $(filter %.mm,$^) -framework UIKit -framework CoreFoundation -framework Foundation -lobjc -framework CoreGraphics -framework Preferences -F$(PKG_ROOT)/System/Library/PrivateFrameworks
- ldid -S $@
+ $(cycc) -dynamiclib -g0 -O2 $(filter %.mm,$^) -framework UIKit -framework CoreFoundation -framework Foundation -lobjc -framework CoreGraphics -framework Preferences -F$(PKG_ROOT)/System/Library/PrivateFrameworks
-WinterBoard.dylib: Library.mm WBMarkup.mm WBMarkup.h makefile ../mobilesubstrate/substrate.h
- $(target)g++ -dynamiclib -g0 -O2 -Wall -o $@ $(filter %.mm,$^) -framework CoreFoundation -framework Foundation -lobjc -I/apl/inc/iPhoneOS-2.0 -framework CoreGraphics -framework ImageIO -framework GraphicsServices -framework Celestial $(substrate) -framework UIKit -framework WebCore -framework WebKit -F$(PKG_ROOT)/System/Library/PrivateFrameworks
- ldid -S $@
+WinterBoard.dylib: Library.mm WBMarkup.mm WBMarkup.h makefile ../substrate/substrate.h
+ $(cycc) -dynamiclib -g0 -O2 $(filter %.mm,$^) -framework CoreFoundation -framework Foundation -lobjc -I/apl/inc/iPhoneOS-2.0 -framework CoreGraphics -framework ImageIO -framework GraphicsServices -framework Celestial $(substrate) -framework UIKit -framework WebCore -framework WebKit -F$(PKG_ROOT)/System/Library/PrivateFrameworks
WinterBoard: Application.mm makefile
- $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc -framework CoreGraphics -I/apl/sdk -framework Preferences -F$(PKG_ROOT)/System/Library/PrivateFrameworks $(substrate)
- ldid -S $@
+ $(cycc) -g0 -O2 -Werror $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc -framework CoreGraphics -I/apl/sdk -framework Preferences -F$(PKG_ROOT)/System/Library/PrivateFrameworks $(substrate)
Optimize: Optimize.cpp makefile
- $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.cpp,$^)
- ldid -S $@
+ $(cycc) -g0 -O2 -Werror $(filter %.cpp,$^)
package: all
rm -rf winterboard