small edits to sd og
This commit is contained in:
parent
8a7ae31775
commit
ac972bbedc
|
@ -0,0 +1,8 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface FrameUpdater : NSObject
|
||||||
|
@property (nonatomic, retain) NSTimer* myTimer;
|
||||||
|
@property (nonatomic) BOOL isEnabled;
|
||||||
|
- (void)startFrameLoop;
|
||||||
|
- (void)stopFrameLoop;
|
||||||
|
@end
|
|
@ -1,10 +1,8 @@
|
||||||
DEBUG=0
|
export THEOS_PACKAGE_SCHEME = rootless
|
||||||
FINALPACKAGE=1
|
export ARCHS = arm64 arm64e
|
||||||
|
export TARGET = iphone:16.5:14.0
|
||||||
THEOS_PACKAGE_SCHEME = rootless
|
export GO_EASY_ON_ME = 1
|
||||||
|
export COPYFILE_DISABLE=1
|
||||||
TARGET = iphone:14.5:14.5
|
|
||||||
ARCHS = arm64
|
|
||||||
|
|
||||||
include $(THEOS)/makefiles/common.mk
|
include $(THEOS)/makefiles/common.mk
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#include <errno.h>
|
#import <errno.h>
|
||||||
#include <substrate.h>
|
#import <substrate.h>
|
||||||
#include <rfb/rfb.h>
|
#import <rfb/rfb.h>
|
||||||
#include <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#include <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#import "FrameUpdater.h"
|
||||||
|
|
||||||
#define kSettingsPath @"/var/mobile/Library/Preferences/com.cosmosgenius.screendump.plist"
|
#define kSettingsPath @"/var/mobile/Library/Preferences/com.cosmosgenius.screendump.plist"
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ extern "C" IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(I
|
||||||
extern "C" IOMobileFramebufferReturn IOMobileFramebufferCopyLayerDisplayedSurface(IOMobileFramebufferRef pointer, int surface, IOSurfaceRef *buffer);
|
extern "C" IOMobileFramebufferReturn IOMobileFramebufferCopyLayerDisplayedSurface(IOMobileFramebufferRef pointer, int surface, IOSurfaceRef *buffer);
|
||||||
extern "C" IOMobileFramebufferReturn IOMobileFramebufferOpen(IOMobileFramebufferService service, mach_port_t owningTask, unsigned int type, IOMobileFramebufferRef *pointer);
|
extern "C" IOMobileFramebufferReturn IOMobileFramebufferOpen(IOMobileFramebufferService service, mach_port_t owningTask, unsigned int type, IOMobileFramebufferRef *pointer);
|
||||||
extern "C" IOMobileFramebufferReturn IOMobileFramebufferGetMainDisplay(IOMobileFramebufferRef *pointer);
|
extern "C" IOMobileFramebufferReturn IOMobileFramebufferGetMainDisplay(IOMobileFramebufferRef *pointer);
|
||||||
extern "C" mach_port_t mach_task_self(void);
|
extern "C" mach_port_t mach_task_self();
|
||||||
static IOSurfaceAcceleratorRef accelerator;
|
static IOSurfaceAcceleratorRef accelerator;
|
||||||
static IOSurfaceRef static_buffer;
|
static IOSurfaceRef static_buffer;
|
||||||
|
|
||||||
|
@ -72,8 +74,6 @@ static void VNCUpdateRunState(bool shouldStart);
|
||||||
static void handleVNCKeyboard(rfbBool down, rfbKeySym key, rfbClientPtr client);
|
static void handleVNCKeyboard(rfbBool down, rfbKeySym key, rfbClientPtr client);
|
||||||
static void handleVNCPointer(int buttons, int x, int y, rfbClientPtr client);
|
static void handleVNCPointer(int buttons, int x, int y, rfbClientPtr client);
|
||||||
|
|
||||||
static BOOL isLoopFrame;
|
|
||||||
|
|
||||||
static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size)
|
static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size)
|
||||||
{
|
{
|
||||||
NSString *password = reinterpret_cast<NSString *>(screen->authPasswdData);
|
NSString *password = reinterpret_cast<NSString *>(screen->authPasswdData);
|
||||||
|
@ -93,12 +93,6 @@ static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size)
|
||||||
static IOSurfaceRef screenSurface = NULL;
|
static IOSurfaceRef screenSurface = NULL;
|
||||||
static IOMobileFramebufferRef framebufferConnection = NULL;
|
static IOMobileFramebufferRef framebufferConnection = NULL;
|
||||||
|
|
||||||
@interface FrameUpdater : NSObject
|
|
||||||
@property (nonatomic, retain) NSTimer* myTimer;
|
|
||||||
- (void)startFrameLoop;
|
|
||||||
- (void)stopFrameLoop;
|
|
||||||
@end
|
|
||||||
|
|
||||||
static void VNCSetup()
|
static void VNCSetup()
|
||||||
{
|
{
|
||||||
if(!screenSurface) {
|
if(!screenSurface) {
|
||||||
|
@ -161,6 +155,7 @@ static void VNCSettings(bool shouldStart, NSString* password)
|
||||||
CCSPassword = password;
|
CCSPassword = password;
|
||||||
}
|
}
|
||||||
NSString *sEnabled = CCSisEnabled ? @"YES": @"NO";
|
NSString *sEnabled = CCSisEnabled ? @"YES": @"NO";
|
||||||
|
[[FrameUpdater shared] setIsEnabled:CCSisEnabled];
|
||||||
VNCUpdateRunState(CCSisEnabled);
|
VNCUpdateRunState(CCSisEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +167,6 @@ static void VNCUpdateRunState(bool shouldStart)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CCSPassword && CCSPassword.length) {
|
if (CCSPassword && CCSPassword.length) {
|
||||||
screen->authPasswdData = (void *) CCSPassword;
|
screen->authPasswdData = (void *) CCSPassword;
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,16 +178,9 @@ static void VNCUpdateRunState(bool shouldStart)
|
||||||
if (shouldStart) {
|
if (shouldStart) {
|
||||||
rfbInitServer(screen);
|
rfbInitServer(screen);
|
||||||
rfbRunEventLoop(screen, -1, true);
|
rfbRunEventLoop(screen, -1, true);
|
||||||
|
|
||||||
isLoopFrame = YES;
|
|
||||||
|
|
||||||
[[FrameUpdater shared] startFrameLoop];
|
[[FrameUpdater shared] startFrameLoop];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
isLoopFrame = NO;
|
|
||||||
|
|
||||||
[[FrameUpdater shared] stopFrameLoop];
|
[[FrameUpdater shared] stopFrameLoop];
|
||||||
|
|
||||||
rfbShutdownServer(screen, true);
|
rfbShutdownServer(screen, true);
|
||||||
}
|
}
|
||||||
isVNCRunning = shouldStart;
|
isVNCRunning = shouldStart;
|
||||||
|
@ -222,36 +209,43 @@ static void loadPrefs(void)
|
||||||
|
|
||||||
static uint32_t oldSeed;
|
static uint32_t oldSeed;
|
||||||
|
|
||||||
@implementation FrameUpdater
|
@implementation FrameUpdater {
|
||||||
{
|
NSOperationQueue *_q;
|
||||||
NSOperationQueue *q;
|
BOOL _isLoopFrame;
|
||||||
}
|
}
|
||||||
@synthesize myTimer;
|
@synthesize myTimer;
|
||||||
|
@synthesize isEnabled;
|
||||||
|
|
||||||
+(id)shared
|
+(id)shared
|
||||||
{
|
{
|
||||||
static __strong FrameUpdater* initFrame;
|
static dispatch_once_t onceToken = 0;
|
||||||
if(!initFrame) {
|
__strong static FrameUpdater* sharedInstance = nil;
|
||||||
initFrame = [[[self class] alloc] init];
|
dispatch_once(&onceToken, ^{
|
||||||
}
|
sharedInstance = [[self alloc] init];
|
||||||
return initFrame;
|
});
|
||||||
|
return sharedInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id)init
|
-(id)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
q = [[NSOperationQueue alloc] init];
|
_q = [[NSOperationQueue alloc] init];
|
||||||
|
_isLoopFrame = NO;
|
||||||
|
isEnabled = NO;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)_upFrameLoop
|
-(void)_upFrameLoop
|
||||||
{
|
{
|
||||||
if(isLoopFrame && CCSisEnabled) {
|
if (_isLoopFrame && isEnabled) {
|
||||||
//check if screen changed
|
//check if screen changed
|
||||||
uint32_t newSeed = IOSurfaceGetSeed(screenSurface);
|
uint32_t newSeed = IOSurfaceGetSeed(screenSurface);
|
||||||
|
|
||||||
if(oldSeed != newSeed && rfbIsActive(screen)) {
|
if(oldSeed != newSeed && rfbIsActive(screen)) {
|
||||||
oldSeed = newSeed;
|
oldSeed = newSeed;
|
||||||
[q addOperationWithBlock: ^{
|
[_q addOperationWithBlock: ^{
|
||||||
IOSurfaceAcceleratorTransferSurface(accelerator, screenSurface, static_buffer, NULL, NULL, NULL, NULL);
|
IOSurfaceAcceleratorTransferSurface(accelerator, screenSurface, static_buffer, NULL, NULL, NULL, NULL);
|
||||||
rfbMarkRectAsModified(screen, 0, 0, width, height);
|
rfbMarkRectAsModified(screen, 0, 0, width, height);
|
||||||
}];
|
}];
|
||||||
|
@ -260,30 +254,36 @@ static uint32_t oldSeed;
|
||||||
[self stopFrameLoop];
|
[self stopFrameLoop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)stopFrameLoop
|
-(void)stopFrameLoop
|
||||||
{
|
{
|
||||||
if(myTimer && [myTimer isValid]) {
|
if(myTimer && [myTimer isValid]) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||||
[myTimer invalidate];
|
[myTimer invalidate];
|
||||||
|
_isLoopFrame = NO;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)startFrameLoop
|
-(void)startFrameLoop
|
||||||
{
|
{
|
||||||
if(size_image == 0) {
|
if(size_image == 0) {
|
||||||
VNCSetup();
|
VNCSetup();
|
||||||
}
|
}
|
||||||
[self stopFrameLoop];
|
[self stopFrameLoop];
|
||||||
|
_isLoopFrame = YES;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||||
myTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_upFrameLoop) userInfo:nil repeats:YES];
|
myTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_upFrameLoop) userInfo:nil repeats:YES];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc
|
-(void)dealloc
|
||||||
{
|
{
|
||||||
[self stopFrameLoop];
|
[self stopFrameLoop];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
static void restartServer()
|
static void restartServer()
|
||||||
{
|
{
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -307,12 +307,12 @@ int main(int argc, const char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include <mach/mach.h>
|
#import <mach/mach.h>
|
||||||
#include <mach/mach_time.h>
|
#import <mach/mach_time.h>
|
||||||
#include <rfb/rfb.h>
|
#import <rfb/rfb.h>
|
||||||
#include <rfb/keysym.h>
|
#import <rfb/keysym.h>
|
||||||
#include "./include/IOKit/hid/IOHIDEventTypes.h"
|
#import "./include/IOKit/hid/IOHIDEventTypes.h"
|
||||||
#include "./include/IOKit/hidsystem/IOHIDUsageTables.h"
|
#import "./include/IOKit/hidsystem/IOHIDUsageTables.h"
|
||||||
|
|
||||||
typedef uint32_t IOHIDDigitizerTransducerType;
|
typedef uint32_t IOHIDDigitizerTransducerType;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue