From da9f11b15541816c5740e5a2070e4f41a73c7725 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 28 Mar 2010 06:42:49 +0000 Subject: [PATCH] Remove the VNC cursor entirely, overwrite the upper-left corner, flush the CPU cache, and don't spin on Ashikase. --- Tweak.mm | 23 ++++++++++++++++++----- control | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Tweak.mm b/Tweak.mm index de862ab..d3aa654 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -62,6 +62,8 @@ #import #import +extern "C" void CoreSurfaceBufferFlushProcessorCaches(CoreSurfaceBufferRef buffer); + static size_t width_; static size_t height_; @@ -80,9 +82,16 @@ static CFMessagePortRef ashikase_; static bool cursor_; static bool Ashikase(bool always) { + if (!always && !cursor_) + return false; + if (ashikase_ == NULL) ashikase_ = CFMessagePortCreateRemote(kCFAllocatorDefault, CFSTR("jp.ashikase.mousesupport")); - return ashikase_ != NULL && (always || cursor_); + if (ashikase_ != NULL) + return true; + + cursor_ = false; + return false; } static CFDataRef cfTrue_; @@ -484,9 +493,7 @@ static void VNCSetup() { screen_->newClientHook = &VNCClient; screen_->passwordCheck = &VNCCheck; - char data[0], mask[0]; - rfbCursorPtr cursor = rfbMakeXCursor(0, 0, data, mask); - rfbSetCursor(screen_, cursor); + screen_->cursor = NULL; } static void VNCEnabled() { @@ -545,11 +552,17 @@ MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer, VNCBlack(); else { CoreSurfaceBufferLock(buffer, 2); - rfbPixel *data(reinterpret_cast(CoreSurfaceBufferGetBaseAddress(buffer))); + volatile rfbPixel *data(reinterpret_cast(CoreSurfaceBufferGetBaseAddress(buffer))); + + rfbPixel corner(data[0]); + data[0] = 0; + data[0] = corner; + screen_->frameBuffer = const_cast(reinterpret_cast(data)); CoreSurfaceBufferUnlock(buffer); } + //CoreSurfaceBufferFlushProcessorCaches(buffer); rfbMarkRectAsModified(screen_, 0, 0, width_, height_); } diff --git a/control b/control index 05fc751..ac534e8 100644 --- a/control +++ b/control @@ -5,7 +5,7 @@ Priority: optional Section: Networking Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.3145-1 +Version: 0.9.3146-1 Description: a VNC /server/ for the iPhone Name: Veency Depends: mobilesubstrate (>= 0.9.2966-1), libvncserver, com.saurik.iphone.ske, preferenceloader, jp.ashikase.mousesupport | firmware (<< 3.0) -- 2.50.0