From cd5829877589c2c6da511e33d6dd856bd3986c41 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 15 Aug 2009 08:00:48 +0000 Subject: [PATCH] Fixed nlist() UIImages on Thumb. --- UIImages.mm | 22 +++++++++++++++++++--- control | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/UIImages.mm b/UIImages.mm index 1463e34..f83b772 100644 --- a/UIImages.mm +++ b/UIImages.mm @@ -10,18 +10,34 @@ extern "C" { extern "C" NSData *UIImagePNGRepresentation(UIImage *image); +template +static void nlset(Type_ &function, struct nlist *nl, size_t index) { + struct nlist &name(nl[index]); + uintptr_t value(name.n_value); + if ((name.n_desc & N_ARM_THUMB_DEF) != 0) + value |= 0x00000001; + function = reinterpret_cast(value); +} + int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; struct nlist nl[4]; + memset(nl, 0, sizeof(nl)); nl[0].n_un.n_name = (char *) "___mappedImages"; nl[1].n_un.n_name = (char *) "__UISharedImageInitialize"; nl[2].n_un.n_name = (char *) "_LoadMappedImageRef"; nlist("/System/Library/Frameworks/UIKit.framework/UIKit", nl); - NSMutableDictionary **images = (id *) nl[0].n_value; - void (*__UISharedImageInitialize)(bool) = (void (*)(bool)) nl[1].n_value; - CGImageRef (*_LoadMappedImageRef)(CFStringRef) = (CGImageRef (*)(CFStringRef)) nl[2].n_value; + + NSMutableDictionary **images; + nlset(images, nl, 0); + + void (*__UISharedImageInitialize)(bool); + nlset(__UISharedImageInitialize, nl, 1); + + CGImageRef (*_LoadMappedImageRef)(CFStringRef); + nlset(_LoadMappedImageRef, nl, 2); __UISharedImageInitialize(false); diff --git a/control b/control index 18abfa0..a6bd3b7 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: optional Section: System Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.2992-1 +Version: 0.9.2993-1 Description: more powerful, open-source SummerBoard Name: WinterBoard Depends: mobilesubstrate (>= 0.9.2958-1), killall -- 2.45.2