Skip to content

Instantly share code, notes, and snippets.

@tettoffensive
Forked from anthonya1999/IOMobileFramebuffer.h
Created December 11, 2015 21:46
Show Gist options
  • Save tettoffensive/f59448d9f6d889a72fb3 to your computer and use it in GitHub Desktop.
Save tettoffensive/f59448d9f6d889a72fb3 to your computer and use it in GitHub Desktop.
A recent disassembly of IOMobileFramebuffer framework
/* You may have to include your IOSurface header to compile, because of the GetLayerDefaultSurface function. If you do not have it, you may just uncomment the typedef to an IOSurface below. */
#include <stdio.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
#define kIOMobileFramebufferError 0xE0000000
typedef kern_return_t IOMobileFramebufferReturn;
typedef struct __IOMobileFramebuffer *IOMobileFramebufferConnection;
/* typedef struct __IOSurface *IOSurfaceRef */
typedef NS_ENUM(int, IOMobileFramebufferColorRemapMode) {
IOMobileFramebufferColorRemapModeNormal = 0,
IOMobileFramebufferColorRemapModeInverted = 1,
IOMobileFramebufferColorRemapModeGrayscale = 2,
IOMobileFramebufferColorRemapModeGrayscaleIncreaseContrast = 3,
IOMobileFramebufferColorRemapModeInvertedGrayscale = 4
};
IOMobileFramebufferReturn IOMobileFramebufferOpen(mach_port_t service, mach_port_t owningTask, unsigned int type, IOMobileFramebufferConnection *connection);
IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferConnection connection, int surface, IOSurfaceRef *buffer);
/* Use this instead of IOMobileFramebufferOpen, it is much more efficient and requires only this one function, rather getting the "AppleCLCD" and opening this service */
IOMobileFramebufferReturn IOMobileFramebufferGetMainDisplay(IOMobileFramebufferConnection *connection);
IOMobileFramebufferReturn IOMobileFramebufferSwapBegin(IOMobileFramebufferConnection connection, int *token);
IOMobileFramebufferReturn IOMobileFramebufferSwapEnd(IOMobileFramebufferConnection connection);
IOMobileFramebufferReturn IOMobileFramebufferSwapSetLayer(IOMobileFramebufferConnection connection, int layerid, IOSurfaceRef buffer);
IOMobileFramebufferReturn IOMobileFramebufferSwapWait(IOMobileFramebufferConnection connection, int token, int something);
IOMobileFramebufferReturn IOMobileFramebufferGetDisplayArea(IOMobileFramebufferConnection connection, CGFloat *displayArea);
IOMobileFramebufferReturn IOMobileFramebufferGetDisplaySize(IOMobileFramebufferConnection connection, CGSize *size);
IOMobileFramebufferReturn IOMobileFramebufferGetGammaTable(IOMobileFramebufferConnection connection, void *data);
IOMobileFramebufferReturn IOMobileFramebufferSetGammaTable(IOMobileFramebufferConnection connection, void *data);
IOMobileFramebufferReturn IOMobileFramebufferSetContrast(IOMobileFramebufferConnection connection, int level);
IOMobileFramebufferReturn IOMobileFramebufferGetColorRemapMode(IOMobileFramebufferConnection connection, IOMobileFramebufferColorRemapMode *mode);
IOMobileFramebufferReturn IOMobileFramebufferSetColorRemapMode(IOMobileFramebufferConnection connection, IOMobileFramebufferColorRemapMode mode);
IOMobileFramebufferReturn IOMobileFramebufferSetWhiteOnBlackMode(IOMobileFramebufferConnection connection, BOOL enabled);
/* This will make your display look broken. To fix, simply perform a reboot on the device. So feel free to experiment! */
IOMobileFramebufferReturn IOMobileFramebufferSetBrightnessCorrection(IOMobileFramebufferConnection connection, int level);
#ifdef __cplusplus
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment