]> git.saurik.com Git - veency.git/commitdiff
This version works.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 24 Aug 2008 23:53:20 +0000 (23:53 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 24 Aug 2008 23:53:20 +0000 (23:53 +0000)
iphonevnc/iPhoneVNC.mm
iphonevnc/makefile

index eac7e0f36ec550956b62b4854cd1657dfa23c980..aef6fc9e54b91dde450902f1a468179001c4ab0f 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <rfb/rfb.h>
 
-extern "C" UIImage *UIGetScreenImage();
+extern "C" CGImageRef UIGetScreenImage();
 
 static const size_t Width = 320;
 static const size_t Height = 480;
@@ -16,6 +16,9 @@ static const size_t Stride = Width * BytesPerPixel;
 static const size_t Size32 = Width * Height;
 static const size_t Size8 = Size32 * BytesPerPixel;
 
+extern "C" void *NSPushAutoreleasePool(void *);
+extern "C" void NSPopAutoreleasePool(void *);
+
 CGContextRef CreateContext() {
     uint8_t *buffer = (uint8_t *) malloc(Size8);
     if (buffer == NULL)
@@ -53,13 +56,13 @@ int main(int argc, char *argv[]) {
         uint8_t *buffer1 = (uint8_t *) CGBitmapContextGetData(context1);
         screen->frameBuffer = (char *) buffer0;
 
-        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+        void *pool = NSPushAutoreleasePool(0);
 
-        UIImageRef *image = UIGetScreenImage();
-        CGImageRef ref = [image CGImage];
-        CGContextDrawImage(context0, rect, ref);
+        CGImageRef image = UIGetScreenImage();
+        CGContextDrawImage(context0, rect, image);
+        CFRelease(image);
 
-        [pool release];
+        NSPopAutoreleasePool(pool);
 
         if (memcmp(buffer0, buffer1, Size8) != 0)
             rfbMarkRectAsModified(screen, 0, 0, Width, Height);
index 71d5a76a8afdd4438bb9744292553e9e2732e6e0..77aa29e657456639a67eade993fbf7ceb837d841 100644 (file)
@@ -11,6 +11,9 @@ iPhoneVNC: iPhoneVNC.mm makefile
             -lvncserver -lz \
            -framework CoreFoundation \
            -framework CoreGraphics \
-           -framework LayerKit
+           -framework UIKit \
+            -lobjc \
+            -framework Foundation
+       ldid -S iPhoneVNC
 
 .PHONY: all clean test