X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/7b33d20196938812433b59a8b8d6ebaf4758df40..df27070399c61922ec227823602f0d7f06043726:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index 4737baf2..c072c267 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -123,6 +123,7 @@ extern "C" { #include "Menes/Menes.h" #include "CyteKit/PerlCompatibleRegEx.hpp" +#include "CyteKit/TableViewCell.h" #include "CyteKit/WebScriptObject-Cyte.h" #include "CyteKit/WebViewController.h" #include "CyteKit/stringWithUTF8Bytes.h" @@ -278,83 +279,6 @@ static const NSStringCompareOptions MatchCompareOptions_ = NSLiteralSearch | NSC static const NSStringCompareOptions LaxCompareOptions_ = NSNumericSearch | NSDiacriticInsensitiveSearch | NSWidthInsensitiveSearch | NSCaseInsensitiveSearch; static const CFStringCompareFlags LaxCompareFlags_ = kCFCompareCaseInsensitive | kCFCompareNonliteral | kCFCompareLocalized | kCFCompareNumerically | kCFCompareWidthInsensitive | kCFCompareForcedOrdering; -/* Radix Sort {{{ */ -typedef uint32_t (*SKRadixFunction)(id, void *); - -@interface NSMutableArray (Radix) -- (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument; -@end - -struct RadixItem_ { - size_t index; - uint32_t key; -}; - -@implementation NSMutableArray (Radix) - -- (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument { - size_t count([self count]); - struct RadixItem_ *swap(new RadixItem_[count * 2]); - - for (size_t i(0); i != count; ++i) { - RadixItem_ &item(swap[i]); - item.index = i; - - id object([self objectAtIndex:i]); - item.key = function(object, argument); - } - - struct RadixItem_ *lhs(swap), *rhs(swap + count); - - static const size_t width = 32; - static const size_t bits = 11; - static const size_t slots = 1 << bits; - static const size_t passes = (width + (bits - 1)) / bits; - - size_t *hist(new size_t[slots]); - - for (size_t pass(0); pass != passes; ++pass) { - memset(hist, 0, sizeof(size_t) * slots); - - for (size_t i(0); i != count; ++i) { - uint32_t key(lhs[i].key); - key >>= pass * bits; - key &= _not(uint32_t) >> width - bits; - ++hist[key]; - } - - size_t offset(0); - for (size_t i(0); i != slots; ++i) { - size_t local(offset); - offset += hist[i]; - hist[i] = local; - } - - for (size_t i(0); i != count; ++i) { - uint32_t key(lhs[i].key); - key >>= pass * bits; - key &= _not(uint32_t) >> width - bits; - rhs[hist[key]++] = lhs[i]; - } - - RadixItem_ *tmp(lhs); - lhs = rhs; - rhs = tmp; - } - - delete [] hist; - - const void **values(new const void *[count]); - for (size_t i(0); i != count; ++i) - values[i] = [self objectAtIndex:lhs[i].index]; - CFArrayReplaceValues((CFMutableArrayRef) self, CFRangeMake(0, count), values, count); - delete [] values; - - delete [] swap; -} - -@end -/* }}} */ /* Insertion Sort {{{ */ CFIndex SKBSearch_(const void *element, CFIndex elementSize, const void *list, CFIndex count, CFComparatorFunction comparator, void *context) { @@ -928,7 +852,7 @@ bool isSectionVisible(NSString *section) { return hidden == nil || ![hidden boolValue]; } -static id CYIOGetValue(const char *path, NSString *property) { +static NSObject *CYIOGetValue(const char *path, NSString *property) { io_registry_entry_t entry(IORegistryEntryFromPath(kIOMasterPortDefault, path)); if (entry == MACH_PORT_NULL) return nil; @@ -941,7 +865,7 @@ static id CYIOGetValue(const char *path, NSString *property) { return [(id) value autorelease]; } -static NSString *CYHex(NSData *data, bool reverse, bool capital) { +static NSString *CYHex(NSData *data, bool reverse = false) { if (data == nil) return nil; @@ -951,7 +875,7 @@ static NSString *CYHex(NSData *data, bool reverse, bool capital) { char string[length * 2 + 1]; for (size_t i(0); i != length; ++i) - sprintf(string + i * 2, capital ? "%.2X" : "%.2x", bytes[reverse ? length - i - 1 : i]); + sprintf(string + i * 2, "%.2x", bytes[reverse ? length - i - 1 : i]); return [NSString stringWithUTF8String:string]; } @@ -3112,6 +3036,15 @@ static NSString *Elision_; static NSString *Error_; static NSString *Warning_; +class CydiaLogCleaner : + public pkgArchiveCleaner +{ + protected: + virtual void Erase(const char *File, std::string Pkg, std::string Ver, struct stat &St) { + unlink(File); + } +}; + /* Database Implementation {{{ */ @implementation Database @@ -3507,9 +3440,9 @@ static NSString *Warning_; packages_ = [[NSArray alloc] initWithObjects:&packages.front() count:packages.size()]; _trace();*/ - [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(16)]; - [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(4)]; - [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(0)]; + [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(16)]; + [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(4)]; + [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackagePrefixRadix) withContext:reinterpret_cast(0)]; /*_trace(); PrintTimes(); @@ -3574,15 +3507,7 @@ static NSString *Warning_; pkgAcquire fetcher; fetcher.Clean(_config->FindDir("Dir::Cache::Archives")); - class LogCleaner : - public pkgArchiveCleaner - { - protected: - virtual void Erase(const char *File, std::string Pkg, std::string Ver, struct stat &St) { - unlink(File); - } - } cleaner; - + CydiaLogCleaner cleaner; if ([self popErrorWithTitle:title forOperation:cleaner.Go(_config->FindDir("Dir::Cache::Archives") + "partial/", cache_)]) return false; @@ -3713,13 +3638,13 @@ static NSString *Warning_; bool success(ListUpdate(status, list, PulseInterval_)); if (status.WasCancelled()) _error->Discard(); - else + else { [self popErrorWithTitle:title forOperation:success]; + [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"]; + Changed_ = true; + } [delegate_ performSelectorOnMainThread:@selector(releaseNetworkActivityIndicator) withObject:nil waitUntilDone:YES]; - - [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"]; - Changed_ = true; } - (void) setDelegate:(NSObject *)delegate { @@ -3955,6 +3880,8 @@ static _H Diversions_; return @"getKernelString"; else if (selector == @selector(getInstalledPackages)) return @"getInstalledPackages"; + else if (selector == @selector(getIORegistryEntry::)) + return @"getIORegistryEntry"; else if (selector == @selector(getLocaleIdentifier)) return @"getLocaleIdentifier"; else if (selector == @selector(getPreferredLanguages)) @@ -4057,6 +3984,16 @@ static _H Diversions_; return [NSString stringWithCString:value]; } +- (NSObject *) getIORegistryEntry:(NSString *)path :(NSString *)entry { + NSObject *value(CYIOGetValue([path UTF8String], entry)); + + if (value != nil) + if ([value isKindOfClass:[NSData class]]) + value = CYHex((NSData *) value); + + return value; +} + - (id) getSessionValue:(NSString *)key { @synchronized (SessionData_) { return [SessionData_ objectForKey:key]; @@ -5223,71 +5160,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ -/* Cell Content View {{{ */ -@protocol ContentDelegate -- (void) drawContentRect:(CGRect)rect; -@end - -@interface ContentView : UIView { - _transient id delegate_; -} - -@end - -@implementation ContentView - -- (id) initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame]) != nil) { - [self setNeedsDisplayOnBoundsChange:YES]; - } return self; -} - -- (void) setDelegate:(id)delegate { - delegate_ = delegate; -} - -- (void) drawRect:(CGRect)rect { - [super drawRect:rect]; - [delegate_ drawContentRect:rect]; -} - -@end -/* }}} */ -/* Cydia TableView Cell {{{ */ -@interface CYTableViewCell : UITableViewCell { - _H content_; - bool highlighted_; -} - -@end - -@implementation CYTableViewCell - -- (void) _updateHighlightColorsForView:(UIView *)view highlighted:(BOOL)highlighted { - //NSLog(@"_updateHighlightColorsForView:%@ highlighted:%s [content_=%@]", view, highlighted ? "YES" : "NO", content_); - - if (view == (UIView *) content_) { - //NSLog(@"_updateHighlightColorsForView:content_ highlighted:%s", highlighted ? "YES" : "NO", content_); - highlighted_ = highlighted; - } - - [super _updateHighlightColorsForView:view highlighted:highlighted]; -} - -- (void) setSelected:(BOOL)selected animated:(BOOL)animated { - //NSLog(@"setSelected:%s animated:%s", selected ? "YES" : "NO", animated ? "YES" : "NO"); - highlighted_ = selected; - - [super setSelected:selected animated:animated]; - [content_ setNeedsDisplay]; -} - -@end -/* }}} */ - /* Package Cell {{{ */ @interface PackageCell : CYTableViewCell < - ContentDelegate + CyteTableViewCellDelegate > { _H icon_; _H name_; @@ -5297,10 +5172,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _H badge_; _H package_; _H placard_; + bool summarized_; } - (PackageCell *) init; -- (void) setPackage:(Package *)package; +- (void) setPackage:(Package *)package asSummary:(bool)summary; - (void) drawContentRect:(CGRect)rect; @@ -5314,7 +5190,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { UIView *content([self contentView]); CGRect bounds([content bounds]); - content_ = [[[ContentView alloc] initWithFrame:bounds] autorelease]; + content_ = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; [content_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; [content addSubview:content_]; @@ -5327,7 +5203,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), (id) name_, (id) description_]; } -- (void) setPackage:(Package *)package { +- (void) setPackage:(Package *)package asSummary:(bool)summary { + summarized_ = summary; + icon_ = nil; name_ = nil; description_ = nil; @@ -5408,15 +5286,50 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [content_ setNeedsDisplay]; } -- (void) drawContentRect:(CGRect)rect { +- (void) drawSummaryContentRect:(CGRect)rect { bool highlighted(highlighted_); float width([self bounds].size.width); -#if 0 - CGContextRef context(UIGraphicsGetCurrentContext()); - [([[self selectedBackgroundView] superview] != nil ? [UIColor clearColor] : [self backgroundColor]) set]; - CGContextFillRect(context, rect); -#endif + if (icon_ != nil) { + CGRect rect; + rect.size = [(UIImage *) icon_ size]; + + rect.size.width /= 4; + rect.size.height /= 4; + + rect.origin.x = 14 - rect.size.width / 4; + rect.origin.y = 14 - rect.size.height / 4; + + [icon_ drawInRect:rect]; + } + + if (badge_ != nil) { + CGRect rect; + rect.size = [(UIImage *) badge_ size]; + + rect.size.width /= 4; + rect.size.height /= 4; + + rect.origin.x = 20 - rect.size.width / 4; + rect.origin.y = 20 - rect.size.height / 4; + + [badge_ drawInRect:rect]; + } + + if (highlighted) + UISetColor(White_); + + if (!highlighted) + UISetColor(commercial_ ? Purple_ : Black_); + [name_ drawAtPoint:CGPointMake(36, 8) forWidth:(width - (placard_ == nil ? 68 : 94)) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation]; + + if (placard_ != nil) + [placard_ drawAtPoint:CGPointMake(width - 52, 9)]; +} + +- (void) drawNormalContentRect:(CGRect)rect { + bool highlighted(highlighted_); + float width([self bounds].size.width); if (icon_ != nil) { CGRect rect; @@ -5460,11 +5373,18 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [placard_ drawAtPoint:CGPointMake(width - 52, 9)]; } +- (void) drawContentRect:(CGRect)rect { + if (summarized_) + [self drawSummaryContentRect:rect]; + else + [self drawNormalContentRect:rect]; +} + @end /* }}} */ /* Section Cell {{{ */ @interface SectionCell : CYTableViewCell < - ContentDelegate + CyteTableViewCellDelegate > { _H basic_; _H section_; @@ -5490,7 +5410,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { UIView *content([self contentView]); CGRect bounds([content bounds]); - content_ = [[[ContentView alloc] initWithFrame:bounds] autorelease]; + content_ = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; [content_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; [content addSubview:content_]; [content_ setBackgroundColor:[UIColor whiteColor]]; @@ -5891,6 +5811,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (id) initWithDatabase:(Database *)database title:(NSString *)title; - (void) setDelegate:(id)delegate; - (void) resetCursor; +- (void) clearData; @end @@ -5902,6 +5823,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [super dealloc]; } +- (bool) isSummarized { + return false; +} + - (void) deselectWithAnimation:(BOOL)animated { [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated]; } @@ -6021,7 +5946,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]); if (cell == nil) cell = [[[PackageCell alloc] init] autorelease]; - [cell setPackage:[self packageAtIndexPath:path]]; + [cell setPackage:[self packageAtIndexPath:path] asSummary:[self isSummarized]]; return cell; } @@ -6032,8 +5957,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (NSArray *) sectionIndexTitlesForTableView:(UITableView *)tableView { - // XXX: is 20 the most optimal number here? - return [packages_ count] > 20 ? index_ : nil; + if ([self isSummarized]) + return nil; + + return index_; } - (NSInteger) tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { @@ -6046,6 +5973,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return index; } +- (void) updateHeight { + [list_ setRowHeight:([self isSummarized] ? 38 : 73)]; +} + - (id) initWithDatabase:(Database *)database title:(NSString *)title { if ((self = [super init]) != nil) { database_ = database; @@ -6066,11 +5997,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { list_ = [[[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStylePlain] autorelease]; [list_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; - [list_ setRowHeight:73]; [[self view] addSubview:list_]; + // XXX: is 20 the most optimal number here? + [list_ setSectionIndexMinimumDisplayRowCount:20]; + [(UITableView *) list_ setDataSource:self]; [list_ setDelegate:self]; + + [self updateHeight]; } return self; } @@ -6150,6 +6085,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { { [index_ removeAllObjects]; + bool summary([self isSummarized]); + if (summary) { + section = [[[Section alloc] initWithName:nil localize:false] autorelease]; + [sections_ addObject:section]; + } + _profile(PackageTable$reloadData$Section) for (size_t offset(0), end([packages_ count]); offset != end; ++offset) { Package *package; @@ -6160,7 +6101,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { index = [package index]; _end - if (section == nil || [section index] != index) { + if (!summary && (section == nil || [section index] != index)) { _profile(PackageTable$reloadData$Section$Allocate) section = [[[Section alloc] initWithIndex:index row:offset] autorelease]; _end @@ -6178,7 +6119,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _end } + [self updateHeight]; + _profile(PackageTable$reloadData$List) + [(UITableView *) list_ setDataSource:self]; [list_ reloadData]; _end } @@ -6189,7 +6133,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) resetCursor { - [list_ scrollRectToVisible:CGRectMake(0, 0, 0, 0) animated:NO]; + [list_ scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO]; +} + +- (void) clearData { + [self updateHeight]; + + [list_ setDataSource:nil]; + [list_ reloadData]; + + [self resetCursor]; } @end @@ -6494,7 +6447,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { // XXX: ok, "updatedelegate_"?... _transient NSObject *updatedelegate_; - id root_; _H remembered_; _transient UIViewController *transient_; } @@ -6714,9 +6666,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { // Ensure bar has the proper width for our view, it might have changed barframe.size.width = viewframe.size.width; [refreshbar_ setFrame:barframe]; - - // XXX: fix Apple's layout bug - [[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation]; } - (void) raiseBar:(BOOL)animated { @@ -6739,18 +6688,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { if (animated) [UIView commitAnimations]; - - // XXX: fix Apple's layout bug - // SRK [[self selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation]; } -#if 0 -- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { - // XXX: fix Apple's layout bug - // SRK [[self selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation]; -} -#endif - - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { bool dropped(dropped_); @@ -6761,9 +6700,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { if (dropped) [self dropBar:NO]; - - // XXX: fix Apple's layout bug - // SRK [[self selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation]; } - (void) statusBarFrameChanged:(NSNotification *)notification { @@ -6884,6 +6820,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { Package *package([database packageWithName:path]); if (package == nil) goto fail; + [package parse]; UIImage *icon([package icon]); [self _returnPNGWithImage:icon forRequest:request]; } else if ([command isEqualToString:@"source-icon"]) { @@ -7228,7 +7165,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]); if (cell == nil) cell = [[[PackageCell alloc] init] autorelease]; - [cell setPackage:[self packageAtIndexPath:path]]; + [cell setPackage:[self packageAtIndexPath:path] asSummary:false]; return cell; } @@ -7293,7 +7230,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _end _trace(); _profile(ChangesController$_reloadPackages$radixSort) - [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackageChangesRadix) withContext:NULL]; + [(NSMutableArray *) packages_ radixSortUsingFunction:reinterpret_cast(&PackageChangesRadix) withContext:NULL]; _end _trace(); } @@ -7430,14 +7367,28 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://search/%@", [search_ text]]]; } +- (void) useSearch { + [self setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)]; + [self clearData]; + [self reloadData]; +} + +- (void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + if ([self filter] == @selector(isUnfilteredAndSelectedForBy:)) + [self useSearch]; +} + - (void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar { [self setObject:[search_ text] forFilter:@selector(isUnfilteredAndSelectedForBy:)]; + [self clearData]; + [self reloadData]; } - (void) searchBarButtonClicked:(UISearchBar *)searchBar { - [self setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)]; [search_ resignFirstResponder]; - [self reloadData]; + [self useSearch]; } - (void) searchBarCancelButtonClicked:(UISearchBar *)searchBar { @@ -7458,6 +7409,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [self filter] == @selector(isUnfilteredAndSearchedForBy:); } +- (bool) isSummarized { + return [self filter] == @selector(isUnfilteredAndSelectedForBy:); +} + - (id) initWithDatabase:(Database *)database query:(NSString *)query { if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:query])) { search_ = [[[UISearchBar alloc] init] autorelease]; @@ -7758,7 +7713,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { /* Source Cell {{{ */ @interface SourceCell : CYTableViewCell < - ContentDelegate + CyteTableViewCellDelegate > { _H icon_; _H origin_; @@ -7789,7 +7744,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { UIView *content([self contentView]); CGRect bounds([content bounds]); - content_ = [[[ContentView alloc] initWithFrame:bounds] autorelease]; + content_ = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; [content_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; [content_ setBackgroundColor:[UIColor whiteColor]]; [content addSubview:content_]; @@ -8243,7 +8198,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { ] autorelease]; [alert setContext:@"source"]; - [alert setTransform:CGAffineTransformTranslate([alert transform], 0.0, 100.0)]; [alert setNumberOfRows:1]; [alert addTextFieldWithValue:@"http://" label:@""]; @@ -9842,9 +9796,9 @@ int main(int argc, char *argv[]) { _pooled else Machine_ = machine; - SerialNumber_ = CYIOGetValue("IOService:/", @"IOPlatformSerialNumber"); - ChipID_ = CYHex(CYIOGetValue("IODeviceTree:/chosen", @"unique-chip-id"), true, true); - BBSNum_ = CYHex(CYIOGetValue("IOService:/AppleARMPE/baseband", @"snum"), false, false); + SerialNumber_ = (NSString *) CYIOGetValue("IOService:/", @"IOPlatformSerialNumber"); + ChipID_ = [CYHex((NSData *) CYIOGetValue("IODeviceTree:/chosen", @"unique-chip-id"), true) uppercaseString]; + BBSNum_ = CYHex((NSData *) CYIOGetValue("IOService:/AppleARMPE/baseband", @"snum"), false); UniqueID_ = [[UIDevice currentDevice] uniqueIdentifier];