]> git.saurik.com Git - winterboard.git/blobdiff - Application.mm
Use @synchronized in getTheme.
[winterboard.git] / Application.mm
index b09de36615b953ae0787bad1a7ff8b9492c785bc..f033c3f5395344c144ed07e971f7c0b6d1f16835 100644 (file)
 #import <CoreGraphics/CGGeometry.h>
 #import <UIKit/UIKit.h>
 
+#include <objc/objc-runtime.h>
+
 #import <Preferences/PSRootController.h>
 #import <Preferences/PSViewController.h>
 #import <Preferences/PSListController.h>
 #import <Preferences/PSSpecifier.h>
 
+#include <substrate.h>
+#include <mach-o/dyld.h>
+
 static NSBundle *wbSettingsBundle;
 static Class $WBSettingsController;
 
@@ -134,13 +139,13 @@ static Class $WBSettingsController;
     }
 }
 
-- (id) _popController {
+- (void) _popController {
     // Pop the last controller = exit the application.
     // The only time the last controller should pop is when the user taps Respring/Cancel.
     // Which only gets displayed if the user has made changes.
     if ([self topViewController] == _rootListController)
         [[UIApplication sharedApplication] terminateWithSuccess];
-    return [super _popController];
+    [super _popController];
 }
 
 @end
@@ -168,7 +173,7 @@ static Class $WBSettingsController;
     $WBSettingsController = [wbSettingsBundle principalClass];
 
     CGRect applicationFrame(([UIDevice instancesRespondToSelector:@selector(isWildcat)]
-                         && [[UIDevice currentDevice] isWildcat])
+                         && [[UIDevice currentDevice] isWildcat]) || objc_getClass("UIStatusBar") != nil
                           ? [UIScreen mainScreen].bounds
                           : [UIScreen mainScreen].applicationFrame);
     UIWindow *window([[UIWindow alloc] initWithFrame:applicationFrame]);
@@ -179,9 +184,17 @@ static Class $WBSettingsController;
 
 @end
 
+MSHook(int32_t, NSVersionOfLinkTimeLibrary, const char *name) {
+    if (strcmp(name, "UIKit") == 0)
+        return 0x6400000;
+    return _NSVersionOfLinkTimeLibrary(name);
+}
+
 int main(int argc, char *argv[]) {
     NSAutoreleasePool *pool( [[NSAutoreleasePool alloc] init]);
 
+    MSHookFunction(NSVersionOfLinkTimeLibrary, MSHake(NSVersionOfLinkTimeLibrary));
+
     int value = UIApplicationMain(argc, argv, @"WBApplication", @"WBApplication");
 
     [pool release];