]> git.saurik.com Git - winterboard.git/commitdiff
Fixed naming.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 1 May 2008 12:20:09 +0000 (12:20 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 1 May 2008 12:20:09 +0000 (12:20 +0000)
DevEngine.mm [new file with mode: 0644]
Info.plist [new file with mode: 0644]
Initialization.m [new file with mode: 0644]
make.sh [new file with mode: 0755]
makefile [new file with mode: 0644]

diff --git a/DevEngine.mm b/DevEngine.mm
new file mode 100644 (file)
index 0000000..e62a62c
--- /dev/null
@@ -0,0 +1,31 @@
+#include <unistd.h>
+#include <fcntl.h>
+
+#import <Foundation/Foundation.h>
+#import <BluetoothManager/BluetoothManager.h>
+#import <SpringBoard/SBBluetoothController.h>
+
+static unsigned connectedDevices_;
+
+@interface SBBluetoothController (_WinterBoard)
+- (void) wb_noteDevicesChanged;
+@end
+
+@implementation SBBluetoothController (WinterBoard)
+
+- (void) noteDevicesChanged {
+    if (NSArray *devices = [[BluetoothManager sharedInstance] pairedDevices]) {
+        connectedDevices_ = 0;
+        for (int i = 0, e = [devices count]; i != e; ++i)
+            if ([[devices objectAtIndex:i] connected])
+                ++connectedDevices_;
+        if (connectedDevices_ == 0)
+            unlink("/tmp/neuter");
+        else
+            close(open("/tmp/neuter", O_CREAT | O_TRUNC | O_WRONLY, 644));
+    }
+
+    [self wb_noteDevicesChanged];
+}
+
+@end
diff --git a/Info.plist b/Info.plist
new file mode 100644 (file)
index 0000000..3a0b6ea
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+
+<dict>
+    <key>CFBundleDevelopmentRegion</key>
+    <string>en</string>
+
+    <key>CFBundleExecutable</key>
+    <string>WinterBoard</string>
+
+    <key>CFBundleIdentifier</key>
+    <string>com.saurik.WinterBoard</string>
+
+    <key>CFBundleInfoDictionaryVersion</key>
+    <string>6.0</string>
+
+    <key>CFBundleName</key>
+    <string>WinterBoard</string>
+
+    <key>CFBundlePackageType</key>
+    <string>BNDL</string>
+
+    <key>CFBundleSignature</key>
+    <string>????</string>
+
+    <key>CFBundleVersion</key>
+    <string>0.9</string>
+
+    <key>NSPrincipalClass</key>
+    <string>WinterBoard</string>
+</dict>
+
+</plist>
diff --git a/Initialization.m b/Initialization.m
new file mode 100644 (file)
index 0000000..2ba6d8f
--- /dev/null
@@ -0,0 +1,34 @@
+#import <Foundation/Foundation.h>
+#include <objc/runtime.h>
+
+#define WBPrefix "wb_"
+
+void WBRename(const char *classname, const char *oldname) {
+    Class class = objc_getClass(classname);
+    size_t namelen = strlen(oldname);
+    char newname[sizeof(WBPrefix) + namelen];
+    memcpy(newname, WBPrefix, sizeof(WBPrefix) - 1);
+    memcpy(newname + sizeof(WBPrefix) - 1, oldname, namelen + 1);
+    Method method = class_getInstanceMethod(class, sel_getUid(oldname));
+    if (!class_addMethod(class, sel_registerName(newname), method->method_imp, method->method_types))
+        NSLog(@"WB: failed to rename %s::%s", classname, oldname);
+}
+
+void WBInitialize() {
+    if (NSClassFromString(@"SpringBoard") == nil)
+        return;
+
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    NSLog(@"WB: changing season");
+
+    WBRename("SBBluetoothController", "noteDevicesChanged");
+
+    NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/WinterBoard.framework"];
+    if (bundle == nil)
+        NSLog(@"WB: there is no Santa :(");
+    else if (![bundle load])
+        NSLog(@"WB: sleigh was too heavy");
+
+    [pool release];
+}
diff --git a/make.sh b/make.sh
new file mode 100755 (executable)
index 0000000..843df27
--- /dev/null
+++ b/make.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+PATH=/apl/n42/pre/bin:$PATH exec /apl/tel/exec.sh com.saurik.winterboard make "$@"
diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..2b58b06
--- /dev/null
+++ b/makefile
@@ -0,0 +1,18 @@
+ifndef PKG_TARG
+target :=
+else
+target := $(PKG_TARG)-
+endif
+
+all: WinterBoard WinterBoard.dylib
+
+clean:
+       rm -f WinterBoard.dylib
+
+WinterBoard: *.mm makefile
+       $(target)gcc -fobjc-call-cxx-cdtors -bundle -g3 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework CoreFoundation -framework Foundation -framework UIKit -lobjc -fobjc-exceptions -flat_namespace -undefined suppress -I../uicaboodle.m
+
+WinterBoard.dylib: Initialization.m makefile
+       $(target)gcc -dynamiclib -g3 -O2 -Wall -Werror -o $@ $(filter %.m,$^) -framework CoreFoundation -framework Foundation -lobjc -init _WBInitialize
+
+.PHONY: all clean