From f8d8a1a9bf3e8cbbb8a04dacfcd3257f1d560b63 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 3 Sep 2008 00:10:40 +0000 Subject: [PATCH] Adding initial GraphicsServices work. --- GraphicsServices/GSWindow.h | 51 +++++++++ GraphicsServices/GraphicsServices.h | 166 ++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 GraphicsServices/GSWindow.h create mode 100644 GraphicsServices/GraphicsServices.h diff --git a/GraphicsServices/GSWindow.h b/GraphicsServices/GSWindow.h new file mode 100644 index 0000000..3faf98c --- /dev/null +++ b/GraphicsServices/GSWindow.h @@ -0,0 +1,51 @@ +/* iPhone Open SDK - Free Open Source Anti-Apple SDK + * Copyright (C) 2008 Jay Freeman (saurik) +*/ + +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef GRAPHICSSERVICS_GSWINDOW_H_ +#define GRAPHICSSERVICS_GSWINDOW_H_ + +#ifndef __plusplus +extern "C" { +#endif + +typedef struct __GSWindow *GSWindowRef; + +#ifndef __plusplus +} +#endif + +#endif/*GRAPHICSSERVICS_GSWINDOW_H_*/ diff --git a/GraphicsServices/GraphicsServices.h b/GraphicsServices/GraphicsServices.h new file mode 100644 index 0000000..64dda1b --- /dev/null +++ b/GraphicsServices/GraphicsServices.h @@ -0,0 +1,166 @@ +/* iPhone Open SDK - Free Open Source Anti-Apple SDK + * Copyright (C) 2008 Jay Freeman (saurik) +*/ + +/* + * Redistribution and use in source and binary + * forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the + * above copyright notice, this list of conditions + * and the following disclaimer. + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions + * and the following disclaimer in the documentation + * and/or other materials provided with the + * distribution. + * 3. The name of the author may not be used to endorse + * or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef GRAPHICSSERVICES_GRAPHICSSERVICS_H_ +#define GRAPHICSSERVICES_GRAPHICSSERVICS_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct GSPathInfo { + /*0x00*/ uint32_t x00; + /*0x04*/ uint32_t x04; + /*0x08*/ uint32_t x08; + /*0x0c*/ CGPoint position; + /*0x14*/ uint32_t x14; +}; + +struct GSEventRecord { + /*0x00:08*/ uint32_t type; + /*0x04:0c*/ uint32_t subType; + /*0x08:10*/ CGPoint locationOnScreen; + /*0x10:18*/ CGPoint locationInWindow; + /*0x18:20*/ uint64_t timestamp; //(GSCurrentEventTimestamp) + /*0x20:28*/ uint32_t zero; + /*0x24:2c*/ uint32_t modifierFlags; + /*0x28:30*/ uint16_t eventNumber; + /*0x2a:32*/ uint16_t x2a; + /*0x2c:34*/ uint32_t size; +}; + +struct GSEventHandInfo { + /*0x30:38:00:5c*/ uint32_t type; + /*0x34:3c:04:60*/ uint16_t x34; + /*0x38:3e:06:64*/ uint16_t x38; + /*0x3a:40:08:68*/ CGPoint x3a; + /*0x40:48:10:70*/ uint32_t x40; //handInfoScale scales +}; + +struct GSEventRecordInfo { + /*0x30:38:00:5c*/ struct GSEventHandInfo handInfo; + /*0x44:4c:14:74*/ uint32_t x44; + /*0x48:50:18:78*/ uint32_t x48; //handInfoScale scales + /*0x4c:54:1c:7c*/ uint32_t x4c; + /*0x50:58:20*/ uint8_t x50; + /*0x51:59:21*/ uint8_t pathPositions; + /*0x52:5a:22*/ uint16_t x52; + /*0x54:5c:24*/ struct GSPathInfo pathInfo[]; +}; + +/*struct __GSEvent { + struct CFRuntimeBase base_; + struct GSEventRecord record_; +};*/ + +typedef struct __GSEvent *GSEventRef; + +#define GSEventTypeKeyDown 0x000d + +#define GSEventTypeAccelerometer 0x0017 +#define GSEventTypeProximityStateChanged 0x0018 +#define GSEventTypeDeviceOrientationChanged 0x0032 +// 0x03c:loc_0018ac preferences + +#define GSEventTypeMenuButtonDown 0x03e8 +#define GSEventTypeMenuButtonUp 0x03e9 +#define GSEventTypeRingerChanged0 0x03f4 +#define GSEventTypeRingerChanged1 0x03f5 +#define GSEventTypeLockDevice 0x03f6 +#define GSEventTypeStatusBarMouseDown 0x03f7 +#define GSEventTypeStatusBarMouseDragged 0x03f8 +#define GSEventTypeStatusBarMouseUp 0x03f9 +#define GSEventTypeLockButtonDown 0x03f2 +#define GSEventTypeLockButtonUp 0x03f3 +#define GSEventTypeHeadsetButtonDown 0x03fa +#define GSEventTypeHeadsetButtonUp 0x03fb + +#define GSEventTypeVibrateForDuration 0x044c +#define GSEventTypeSetBacklightFactor 0x044e +#define GSEventTypeSetBacklightLevel 0x044f + +#define GSEventTypeApplicationStarted 0x07d0 +#define GSEventTypeAnotherApplicationFinishedLauncing 0x07d2 +#define GSEventTypeApplicationTerminateWithStatus 0x07d3 +#define GSEventTypeApplicationSuspended 0x07d4 +// 0x07d5:loc_000550 internal url +// 0x07d6:loc_000a20 external url +#define GSEventTypeApplicationExited 0x07d7 +#define GSEventTypeApplicationShowHideSettings 0x07d8 +#define GSEventTypeQuitTopApplication 0x07d9 +#define GSEventTypeOtherApplicationWillSuspend 0x07da +#define GSEventTypeApplicationSuspendedSettingsUpdated 0x07db + +#define GSEventTypeResetIdleTimer 0x0898 +#define GSEventTypeResetIdleDuration 0x0899 +#define GSEventTypeDumpUIHierarchy 0x09c4 +#define GSEventTypeDumpScreenContents 0x09c5 +#define GSEventTypeProcessScriptEvent 0x0a8c + +#define GSEventTypeMouse 0x0bb9 + +#define GSEventTypeAccessoryAvailabilityChanged 0x0fa0 +#define GSEventTypeAccessoryKeyStateChanged 0x0fa1 +#define GSEventTypeAccessory 0x0fa2 + +#define GSEventTypeOutOfLineDataRequest 0x1388 +#define GSEventTypeUrgentMemoryWarning 0x1770 +#define GSEventTypeOutOfLineDataResponse 0x10001 + +#define GSMouseEventTypeDown 0x1 +#define GSMouseEventTypeDragged 0x2 +#define GSMouseEventTypeUp 0x6 +#define GSMouseEventTypeCancel 0x8 + +#define _PurpleSystemEventPortName "PurpleSystemEventPort" + +struct GSEventHandInfo GSEventGetHandInfo(GSEventRef event); +mach_port_name_t GSCopyPurpleSystemEventPort(void); +mach_port_name_t GSGetPurpleNamedPort(CFStringRef name); +uint64_t GSCurrentEventTimestamp(void); +void GSSendSystemEvent(struct GSEventRecord *record); +void GSSendEvent(struct GSEventRecord *record, mach_port_name_t port); +GSPathInfo GSEventGetPathInfoAtIndex(GSEventRef event, unsigned index); + +#ifdef __cplusplus +} +#endif + +#endif//GRAPHICSSERVICES_GRAPHICSSERVICS_H_ -- 2.47.2