From: Jay Freeman (saurik) Date: Thu, 1 May 2008 12:20:09 +0000 (+0000) Subject: Fixed naming. X-Git-Tag: v0.9.3900~94 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/cf8bb1d42003ff0f116bac4db1ac2397bfa86bba?ds=inline Fixed naming. --- cf8bb1d42003ff0f116bac4db1ac2397bfa86bba diff --git a/DevEngine.mm b/DevEngine.mm new file mode 100644 index 0000000..e62a62c --- /dev/null +++ b/DevEngine.mm @@ -0,0 +1,31 @@ +#include +#include + +#import +#import +#import + +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 index 0000000..3a0b6ea --- /dev/null +++ b/Info.plist @@ -0,0 +1,34 @@ + + + + + + CFBundleDevelopmentRegion + en + + CFBundleExecutable + WinterBoard + + CFBundleIdentifier + com.saurik.WinterBoard + + CFBundleInfoDictionaryVersion + 6.0 + + CFBundleName + WinterBoard + + CFBundlePackageType + BNDL + + CFBundleSignature + ???? + + CFBundleVersion + 0.9 + + NSPrincipalClass + WinterBoard + + + diff --git a/Initialization.m b/Initialization.m new file mode 100644 index 0000000..2ba6d8f --- /dev/null +++ b/Initialization.m @@ -0,0 +1,34 @@ +#import +#include + +#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 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 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