├── Resources ├── Icon.png ├── Default.png ├── snes-1.png ├── redButton.png ├── MainWindow.nib ├── grayButton.png ├── ConnectedIcon.png ├── NotConnectedIcon.png ├── SessionController.nib ├── SNESControllerViewController.nib ├── snes-1.txt ├── MainWindow.xib ├── TabController.xib └── SNESControllerViewController.xib ├── ControlPad_Prefix.pch ├── main.m ├── package-control.txt ├── README ├── Classes ├── SNESControllerAppDelegate.h ├── SNESControllerViewController.h ├── SessionController.h ├── SNESControllerAppDelegate.m ├── SessionController.m └── SNESControllerViewController.m ├── ControlPad-Info.plist ├── IOKit ├── hid │ ├── IOHIDUserDevice.h │ ├── IOHIDEventQueue.h │ ├── IOHIDNotification.h │ ├── IOHIDEventSystemClient.h │ ├── IOHIDEventSystem.h │ ├── IOHIDService.h │ ├── IOHIDDisplay.h │ ├── IOHIDSession.h │ ├── IOHIDEvent.h │ └── IOHIDEventTypes.h ├── OSMessageNotification.h ├── IOTypes.h ├── IOKitKeys.h └── IOReturn.h ├── Makefile ├── libkern └── OSTypes.h └── ControlPad.xcodeproj └── project.pbxproj /Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/Icon.png -------------------------------------------------------------------------------- /Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/Default.png -------------------------------------------------------------------------------- /Resources/snes-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/snes-1.png -------------------------------------------------------------------------------- /Resources/redButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/redButton.png -------------------------------------------------------------------------------- /Resources/MainWindow.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/MainWindow.nib -------------------------------------------------------------------------------- /Resources/grayButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/grayButton.png -------------------------------------------------------------------------------- /Resources/ConnectedIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/ConnectedIcon.png -------------------------------------------------------------------------------- /Resources/NotConnectedIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/NotConnectedIcon.png -------------------------------------------------------------------------------- /Resources/SessionController.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/SessionController.nib -------------------------------------------------------------------------------- /Resources/SNESControllerViewController.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WoozleWrangler/ControlPad/HEAD/Resources/SNESControllerViewController.nib -------------------------------------------------------------------------------- /ControlPad_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SNESController' target in the 'SNESController' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /Resources/snes-1.txt: -------------------------------------------------------------------------------- 1 | 0,204,50,71 2 | 50,195,92,81 3 | 135,207,79,59 4 | 0,126,76,81 5 | 124,129,92,81 6 | 0,57,58,73 7 | 52,57,92,81 8 | 142,59,73,73 9 | 176,256,67,59 10 | 254,256,114,59 11 | 0,0,92,53 12 | 383,0,92,53 13 | 0,0,0,0 14 | 268,192,78,62 15 | 341,169,80,86 16 | 419,193,56,61 17 | 268,115,88,81 18 | 404,115,71,81 19 | 269,66,74,56 20 | 339,66,80,81 21 | 416,67,59,56 22 | 98,0,79,53 23 | 300,0,79,53 -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/5/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /package-control.txt: -------------------------------------------------------------------------------- 1 | Package: com.wherethewoozlewasnt.snes-hd.controlpad 2 | Name: ControlPad (for SNES-HD) 3 | Version: 1.2-1 4 | Architecture: iphoneos-arm 5 | Description: This ControlPad app is designed to connect to SNES (HD). Up to four iPhones or iPod Touches can connect to a single emulator instance. 6 | Homepage: http://wherethewoozlewasnt.com/?page_id=12 7 | Maintainer: WoozleWrangler 8 | Author: Yusef Napora (WoozleWrangler) 9 | Section: Games 10 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ControlPad is an iPhone app designed to control the iPad Super Nintendo emulator SNES (HD). SNES (HD) is available in source form at http://github.com/WoozleWrangler/SNES--HD- and as a binary package via the Cydia repository http://wherethewoozlewasnt.com/cydia 2 | 3 | ControlPad is based in part on snes4iphone, ZodTTD's port of the popular Super Nintendo emulator Snes9x. In particular, the touch handling code in SNESControllerViewController.m is lifted more or less verbatim from Zod's NowPlayingViewController.m. Zod's source is available at http://github.com/zodttd/snes4iphone 4 | 5 | All GameKit related code was written by me (WoozleWrangler). I can be reached at wrangler@wherethewoozlewasnt.com though I'm not always johnny-on-the-spot about replying to email. I'll do my best :-) 6 | 7 | One neat feature I'm rather proud of is the ability to use the volume buttons on the iPhone as the L/R buttons on the SNES controller. I'm planning to make this optional soon, but haven't gotten around to actually writing the options screen. Once I have a minute I'll make it so the little "info" button in the corner actually does something... Until then the physical buttons are always enabled. 8 | -------------------------------------------------------------------------------- /Classes/SNESControllerAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SNESControllerAppDelegate.h 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/5/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #ifdef TARGET_OS_IPHONE 13 | 14 | #import 15 | #import 16 | #import 17 | 18 | #endif 19 | 20 | @class SNESControllerViewController; 21 | @class SessionController; 22 | 23 | @interface SNESControllerAppDelegate : NSObject { 24 | UIWindow *window; 25 | SNESControllerViewController *viewController; 26 | SessionController *sessionController; 27 | 28 | #ifdef TARGET_OS_IPHONE 29 | MPVolumeView *volumeView; 30 | IOHIDEventSystemRef ioEventSystem; 31 | #endif 32 | } 33 | 34 | @property (nonatomic, retain) IBOutlet UIWindow *window; 35 | @property (nonatomic, retain) IBOutlet SNESControllerViewController *viewController; 36 | @property (nonatomic, retain) SessionController *sessionController; 37 | 38 | - (void) autosendStatus:(NSTimer *)timer; 39 | 40 | @end 41 | 42 | extern SNESControllerAppDelegate *AppDelegate(); -------------------------------------------------------------------------------- /ControlPad-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ControlPad 9 | CFBundleExecutable 10 | ControlPad 11 | CFBundleIconFile 12 | Icon.png 13 | CFBundleIdentifier 14 | com.wherethewoozlewasnt.ControlPad 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ControlPad 19 | CFBundlePackageType 20 | APPL 21 | UIStatusBarHidden 22 | 23 | UISupportedInterfaceOrientations 24 | 25 | UIInterfaceOrientationLandscapeLeft 26 | UIInterfaceOrientationLandscapeRight 27 | 28 | UIInterfaceOrientation 29 | UIDeviceOrientationLandscapeLeft 30 | CFBundleSignature 31 | ???? 32 | UIPrerenderedIcon 33 | 34 | CFBundleVersion 35 | 1.0 36 | LSRequiresIPhoneOS 37 | 38 | NSMainNibFile 39 | MainWindow 40 | 41 | 42 | -------------------------------------------------------------------------------- /Classes/SNESControllerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SNESControllerViewController.h 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/5/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface SNESControllerViewController : UIViewController { 13 | UIImageView *imageView; 14 | UIButton *infoButton; 15 | UIButton *connectionButton; 16 | 17 | CGRect A; 18 | CGRect B; 19 | CGRect AB; 20 | CGRect Up; 21 | CGRect Left; 22 | CGRect Down; 23 | CGRect Right; 24 | CGRect UpLeft; 25 | CGRect DownLeft; 26 | CGRect UpRight; 27 | CGRect DownRight; 28 | CGRect Select; 29 | CGRect Start; 30 | CGRect LPad; 31 | CGRect RPad; 32 | CGRect LPad2; 33 | CGRect RPad2; 34 | CGRect Menu; 35 | CGRect ButtonUp; 36 | CGRect ButtonLeft; 37 | CGRect ButtonDown; 38 | CGRect ButtonRight; 39 | CGRect ButtonUpLeft; 40 | CGRect ButtonDownLeft; 41 | CGRect ButtonUpRight; 42 | CGRect ButtonDownRight; 43 | 44 | 45 | } 46 | 47 | @property (nonatomic, retain) IBOutlet UIImageView *imageView; 48 | @property (nonatomic, retain) IBOutlet UIButton *infoButton; 49 | @property (nonatomic, retain) IBOutlet UIButton *connectionButton; 50 | 51 | - (IBAction) buttonPressed:(id)sender; 52 | - (void) getControllerCoords; 53 | - (void) updateConnectionStatus; 54 | - (void) showDisconnectionAlert; 55 | 56 | 57 | @end 58 | 59 | -------------------------------------------------------------------------------- /Classes/SessionController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SessionController.h 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/17/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface SessionController : UIViewController { 14 | GKSession *gkSession; 15 | NSString *serverPeerID; 16 | NSString *serverName; 17 | NSMutableArray *availableServers; 18 | 19 | UILabel *statusLabel; 20 | UIActivityIndicatorView *spinner; 21 | UITableView *serverListView; 22 | UIButton *cancelButton; 23 | UIButton *disconnectButton; 24 | } 25 | 26 | @property (nonatomic, retain) GKSession *gkSession; 27 | @property (nonatomic, readonly) BOOL isConnected; 28 | @property (nonatomic, readonly) BOOL serversAvailable; 29 | 30 | @property (nonatomic, retain) IBOutlet UILabel *statusLabel; 31 | @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *spinner; 32 | @property (nonatomic, retain) IBOutlet UITableView *serverListView; 33 | @property (nonatomic, retain) IBOutlet UIButton *cancelButton; 34 | @property (nonatomic, retain) IBOutlet UIButton *disconnectButton; 35 | 36 | - (void) searchForEmulators; 37 | - (void) stopSearching; 38 | - (void) connectToServerAtIndex:(NSUInteger)serverIndex; 39 | - (void) disconnect; 40 | 41 | - (void) updateView; 42 | 43 | - (void) showModal; 44 | - (void) dismissView; 45 | 46 | - (IBAction) buttonPressed:(id)sender; 47 | 48 | - (void) sendPadStatus:(unsigned long)status; 49 | @end 50 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDUserDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @APPLE_LICENSE_HEADER_START@ 4 | * 5 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | * 22 | * @APPLE_LICENSE_HEADER_END@ 23 | */ 24 | 25 | #ifndef _IOKIT_HID_IOHIDUSERDEVICE_USER_H 26 | #define _IOKIT_HID_IOHIDUSERDEVICE_USER_H 27 | 28 | #include 29 | #include 30 | 31 | __BEGIN_DECLS 32 | 33 | typedef struct __IOHIDUserDevice * IOHIDUserDeviceRef; 34 | 35 | /*! 36 | @function IOHIDUserDeviceGetTypeID 37 | @abstract Returns the type identifier of all IOHIDUserDevice instances. 38 | */ 39 | CF_EXPORT 40 | CFTypeID IOHIDUserDeviceGetTypeID(void); 41 | 42 | /*! 43 | @function IOHIDUserDeviceCreate 44 | @abstract Creates an virtual IOHIDDevice in the kernel. 45 | @discussion The io_service_t passed in this method must reference an object 46 | in the kernel of type IOHIDUserDevice. 47 | @param allocator Allocator to be used during creation. 48 | @param properties CFDictionaryRef containing device properties index by keys defined in IOHIDKeys.h. 49 | @result Returns a new IOHIDUserDeviceRef. 50 | */ 51 | CF_EXPORT 52 | IOHIDUserDeviceRef IOHIDUserDeviceCreate( 53 | CFAllocatorRef allocator, 54 | CFDictionaryRef properties); 55 | 56 | 57 | /*! 58 | @function IOHIDUserDeviceHandleReport 59 | @abstract Dispatch a report to the IOHIDUserDevice. 60 | */ 61 | CF_EXPORT 62 | IOReturn IOHIDUserDeviceHandleReport( 63 | IOHIDUserDeviceRef device, 64 | uint8_t * report, 65 | CFIndex reportLength); 66 | 67 | __END_DECLS 68 | 69 | #endif /* _IOKIT_HID_IOHIDUSERDEVICE_USER_H */ 70 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION=3.0 2 | 3 | BUNDLE=ControlPad.app 4 | RESOURCE_DIR=Resources 5 | PACKAGE_DIR=package-dir 6 | PACKAGE_CONTROL=package-control.txt 7 | PACKAGE_FILE=ControlPad.deb 8 | 9 | NIB_FILES = $(RESOURCE_DIR)/MainWindow.nib $(RESOURCE_DIR)/SNESControllerViewController.nib $(RESOURCE_DIR)/SessionController.nib 10 | RESOURCES = $(wildcard $(RESOURCE_DIR)/*.png) $(wildcard $(RESOURCE_DIR)/snes-*.txt) $(wildcard $(RESOURCE_DIR)/*.plist) $(NIB_FILES) 11 | PLIST_FILE = ControlPad-Info.plist 12 | OBJS = Classes/SessionController.o Classes/SNESControllerAppDelegate.o Classes/SNESControllerViewController.o main.o 13 | 14 | 15 | COPT = -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/Frameworks -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/System/Library/PrivateFrameworks -I. -I./Classes/ -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/gcc/arm-apple-darwin9/4.2.1/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${VERSION}.sdk/usr/lib 16 | COPT += -march=armv6 -miphoneos-version-min=${VERSION} -O3 17 | 18 | GCC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 19 | GXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-g++-4.2.1 20 | STRIP = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip 21 | IBTOOL = ibtool 22 | LDID = /usr/local/bin/ldid 23 | DPKG_DEB = /opt/local/bin/dpkg-deb 24 | 25 | 26 | 27 | # Inopia's menu system, hacked for the GP2X under rlyeh's sdk 28 | PRELIBS = -multiply_defined suppress -lobjc -fobjc-exceptions \ 29 | -framework CoreFoundation \ 30 | -framework CoreGraphics \ 31 | -framework Foundation \ 32 | -framework UIKit \ 33 | -framework AVFoundation \ 34 | -framework MediaPlayer \ 35 | -lIOKit \ 36 | -framework GameKit \ 37 | -allow_stack_execute 38 | 39 | all: bundle 40 | clean: tidy 41 | 42 | 43 | 44 | %.o: %.m 45 | $(GCC) ${COPT} -c $< -o $@ 46 | 47 | %.nib: %.xib 48 | $(IBTOOL) --compile $@ $< 49 | 50 | ControlPad: $(OBJS) 51 | $(GXX) $(COPT) $(OBJS) $(PRELIBS) -o $@ 52 | 53 | bundle: ControlPad $(NIB_FILES) 54 | mkdir -p $(BUNDLE) 55 | $(STRIP) ControlPad -o $(BUNDLE)/ControlPad 56 | $(LDID) -S $(BUNDLE)/ControlPad 57 | cp logwrapper.sh $(BUNDLE) 58 | cp $(RESOURCES) $(BUNDLE) 59 | cp $(PLIST_FILE) $(BUNDLE)/Info.plist 60 | 61 | package: bundle 62 | mkdir -p $(PACKAGE_DIR)/Applications 63 | mkdir -p $(PACKAGE_DIR)/DEBIAN 64 | cp -r $(BUNDLE) $(PACKAGE_DIR)/Applications 65 | cp $(PACKAGE_CONTROL) $(PACKAGE_DIR)/DEBIAN/control 66 | export COPYFILE_DISABLE 67 | export COPY_EXTENDED_ATTRIBUTES_DISABLE 68 | $(DPKG_DEB) -b $(PACKAGE_DIR) $(PACKAGE_FILE) 69 | 70 | tidy: 71 | rm -f *.o Classes/*.o 72 | rm -rf $(BUNDLE) 73 | rm -rf $(PACKAGE_DIR) 74 | rm -f ControlPad 75 | rm -f ControlPad.deb 76 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDEventQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDEventQueue.h ... Header for IOHIDEventQueue*** functions. 4 | 5 | Copyright (c) 2009 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef IOKIT_HID_IOHIDEVENTQUEUE_H 34 | #define IOKIT_HID_IOHIDEVENTQUEUE_H 1 35 | 36 | #include 37 | #include "IOHIDEvent.h" 38 | 39 | #if __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | typedef struct __IOHIDEventQueue 44 | #if 0 45 | { 46 | CFRuntimeBase base; // 0, 4 47 | IODataQueueMemory* queue; // 8 48 | size_t queueSize; // c 49 | int notificationPortType; // 10, 0 -> associate to hidSystem, 1 -> associate to data queue. 50 | uint32_t token; // 14 51 | int topBitOfToken; // 18, = token >> 31 52 | } 53 | #endif 54 | * IOHIDEventQueueRef; 55 | 56 | #pragma mark - 57 | #pragma mark Creators 58 | 59 | CFTypeID IOHIDEventQueueGetTypeID(void); 60 | 61 | // Token must be nonzero. 62 | IOHIDEventQueueRef IOHIDEventQueueCreateWithToken(CFAllocatorRef allocator, uint32_t token); 63 | IOHIDEventQueueRef IOHIDEventQueueCreate(CFAllocatorRef allocator, int notificationPortType, uint32_t token); 64 | 65 | #pragma mark - 66 | #pragma mark Accessors 67 | 68 | uint32_t IOHIDEventQueueGetToken(IOHIDEventQueueRef queue); 69 | 70 | void IOHIDEventQueueSetNotificationPort(IOHIDEventQueueRef queue, mach_port_t port); 71 | 72 | #pragma mark - 73 | #pragma mark Actions 74 | 75 | IOHIDEventRef IOHIDEventQueueDequeueCopy(IOHIDEventQueueRef queue); 76 | void IOHIDEventQueueEnqueue(IOHIDEventQueueRef queue, IOHIDEventRef event); // will send a message to the "tickle port" as well. 77 | 78 | #if __cplusplus 79 | } 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDNotification ... I/O Kit HID Notifications 4 | 5 | Copyright (c) 2009 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef IOHID_NOTIFICATION_H 34 | #define IOHID_NOTIFICATION_H 35 | 36 | #include 37 | 38 | #if __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | typedef void(*IOHIDNotificationCallback)(void* target, void* refcon); 43 | 44 | typedef struct __IOHIDNotification 45 | #if 0 46 | { 47 | CFRuntimeBase _base; // 0, 4 48 | IOHIDNotificationCallback clientCallback; // 8 49 | void* clientTarget; // c 50 | void* clientRefcon; // 10 51 | IOHIDNotificationCallback ownerCallback; // 14 52 | void* ownerTarget; // 18 53 | void* ownerRefcon; // 1c 54 | } 55 | #endif 56 | * IOHIDNotificationRef; 57 | 58 | #pragma mark - 59 | #pragma mark Creators 60 | 61 | CFTypeID IOHIDNotificationGetTypeID(); 62 | 63 | IOHIDNotificationRef IOHIDNotificationCreate(CFAllocatorRef allocator, 64 | IOHIDNotificationCallback ownerCallback, void* ownerTarget, void* ownerRefcon, 65 | IOHIDNotificationCallback clientCallback, void* clientTarget, void* clientRefcon); 66 | 67 | #pragma mark - 68 | #pragma mark Accessors 69 | 70 | IOHIDNotificationCallback IOHIDNotificationGetClientCallback(IOHIDNotificationRef notification); 71 | void* IOHIDNotificationGetClientTarget(IOHIDNotificationRef notification); 72 | void* IOHIDNotificationGetClientRefcon(IOHIDNotificationRef notification); 73 | IOHIDNotificationCallback IOHIDNotificationGetOwnerCallback(IOHIDNotificationRef notification); 74 | void* IOHIDNotificationGetOwnerTarget(IOHIDNotificationRef notification); 75 | void* IOHIDNotificationGetOwnerRefcon(IOHIDNotificationRef notification); 76 | 77 | #if __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDEventSystemClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDEventSystemClient.h ... I/O Kit HID Event System Client 4 | 5 | Copyright (c) 2010 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | // With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h 34 | 35 | #ifndef IOHID_EVENT_SYSTEM_CLIENT_H 36 | #define IOHID_EVENT_SYSTEM_CLIENT_H 37 | 38 | #include 39 | #include "IOHIDEventQueue.h" 40 | #include "IOHIDEvent.h" 41 | 42 | #if __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | typedef struct __IOHIDEventSystemClient 47 | #if 0 48 | { 49 | void* x00; 50 | CFMachPortRef serverPort; // 4 51 | CFRunLoopSourceRef serverSource; // 8 52 | IOHIDEventSystemClientEventCallback callback; // c 53 | void* target; // 10 54 | void* refcon; // 14 55 | CFMachPortRef queuePort; // 18 56 | CFRunLoopSourceRef queueSource; // 1c 57 | CFRunLoopSourceRef source2; // 24 58 | CFRunLoopTimerRef timer; // 28 59 | IOHIDEventQueueRef queue; // 2c 60 | CFRunLoopRef runloop; // 34 61 | CFStringRef mode; // 38 62 | } 63 | #endif 64 | * IOHIDEventSystemClientRef; 65 | 66 | typedef void(*IOHIDEventSystemClientEventCallback)(void* target, void* refcon, IOHIDEventQueueRef queue, IOHIDEventRef event); 67 | 68 | void IOHIDEventSystemClientRegisterEventCallback(IOHIDEventSystemClientRef client, IOHIDEventSystemClientEventCallback callback, void* target, void* refcon); 69 | void IOHIDEventSystemClientUnregisterEventCallback(IOHIDEventSystemClientRef client); 70 | 71 | void IOHIDEventSystemClientUnscheduleWithRunLoop(IOHIDEventSystemClientRef client, CFRunLoopRef runloop, CFStringRef mode); 72 | void IOHIDEventSystemClientScheduleWithRunLoop(IOHIDEventSystemClientRef client, CFRunLoopRef runloop, CFStringRef mode); 73 | 74 | CFPropertyListRef IOHIDEventSystemClientCopyProperty(IOHIDEventSystemClientRef client, CFStringRef property); 75 | Boolean IOHIDEventSystemClientSetProperty(IOHIDEventSystemClientRef client, CFStringRef property, CFPropertyListRef value); 76 | 77 | IOHIDEventSystemClientRef IOHIDEventSystemClient(void); 78 | 79 | #if __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | 85 | -------------------------------------------------------------------------------- /Classes/SNESControllerAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SNESControllerAppDelegate.m 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/5/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import "SNESControllerAppDelegate.h" 10 | #import "SNESControllerViewController.h" 11 | #import "SessionController.h" 12 | 13 | #define SNES_CONTROLLER_SESSION_ID @"com.snes4iphone.controller" 14 | 15 | SNESControllerAppDelegate *AppDelegate() 16 | { 17 | return (SNESControllerAppDelegate *)[[UIApplication sharedApplication] delegate]; 18 | } 19 | 20 | #ifdef TARGET_OS_IPHONE 21 | 22 | extern unsigned long gp2x_pad_status; 23 | 24 | #define VOL_BUTTON_UP 0xe9 25 | #define VOL_BUTTON_DOWN 0xea 26 | 27 | #define L_BUTTON (1<<10) 28 | #define R_BUTTON (1<<11) 29 | 30 | void handle_event (void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event) { 31 | // handle the events here. 32 | //NSLog(@"Received event of type %2d from service %p.", IOHIDEventGetType(event), service); 33 | IOHIDEventType type = IOHIDEventGetType(event); 34 | if (type == kIOHIDEventTypeKeyboard) 35 | { 36 | NSLog(@"button event"); 37 | 38 | int usagePage = IOHIDEventGetIntegerValue(event, kIOHIDEventFieldKeyboardUsagePage); 39 | if (usagePage == 12) { 40 | int usage = IOHIDEventGetIntegerValue(event, kIOHIDEventFieldKeyboardUsage); 41 | int down = IOHIDEventGetIntegerValue(event, kIOHIDEventFieldKeyboardDown); 42 | 43 | unsigned long buttonMask = 0; 44 | if (usage == VOL_BUTTON_UP) { 45 | buttonMask = R_BUTTON; 46 | } else if (usage == VOL_BUTTON_DOWN) { 47 | buttonMask = L_BUTTON; 48 | } 49 | 50 | if (buttonMask != 0) { 51 | if (down) { 52 | gp2x_pad_status |= buttonMask; 53 | } else { 54 | gp2x_pad_status &= ~buttonMask; 55 | } 56 | [AppDelegate().sessionController sendPadStatus:gp2x_pad_status]; 57 | } 58 | } 59 | } 60 | } 61 | 62 | #endif // TARGET_IPHONE_SIMULATOR 63 | 64 | 65 | @implementation SNESControllerAppDelegate 66 | 67 | @synthesize window; 68 | @synthesize viewController; 69 | @synthesize sessionController; 70 | 71 | 72 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 73 | 74 | #ifdef TARGET_OS_IPHONE 75 | NSLog(@"Setting up event handler"); 76 | // register our event handler callback 77 | ioEventSystem = IOHIDEventSystemCreate(NULL); 78 | IOHIDEventSystemOpen(ioEventSystem, handle_event, NULL, NULL, NULL); 79 | 80 | // set the audio session category and activate it 81 | AVAudioSession *session = [AVAudioSession sharedInstance]; 82 | [session setCategory:AVAudioSessionCategoryAmbient error:nil]; 83 | [session setActive:YES error:nil]; 84 | 85 | // create a hidden MPVolumeView and add it to our window. 86 | // this disables the standard volume overlay display 87 | volumeView = [[MPVolumeView alloc] initWithFrame:window.bounds]; 88 | volumeView.hidden = YES; 89 | [window addSubview:volumeView]; 90 | 91 | // Add a timer to send the pad status every 25ms, whether there's any input or not 92 | [NSTimer scheduledTimerWithTimeInterval:0.025 target:self selector:@selector(autosendStatus:) userInfo:nil repeats:YES]; 93 | 94 | #endif 95 | 96 | sessionController = [[SessionController alloc] initWithNibName:@"SessionController" bundle:nil]; 97 | 98 | 99 | [window addSubview:viewController.view]; 100 | [window makeKeyAndVisible]; 101 | 102 | 103 | return YES; 104 | } 105 | 106 | - (void) autosendStatus:(NSTimer *)timer 107 | { 108 | //[self.sessionController sendPadStatus:gp2x_pad_status]; 109 | } 110 | 111 | #ifdef TARGET_OS_IPHONE 112 | - (void) applicationWillTerminate:(UIApplication *)application 113 | { 114 | // clean up our event handler 115 | IOHIDEventSystemClose(ioEventSystem, NULL); 116 | CFRelease(ioEventSystem); 117 | } 118 | #endif 119 | 120 | - (void)dealloc { 121 | [viewController release]; 122 | [window release]; 123 | [super dealloc]; 124 | } 125 | 126 | 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /libkern/OSTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 30 | * 31 | * HISTORY 32 | * 33 | */ 34 | 35 | #ifndef _OS_OSTYPES_H 36 | #define _OS_OSTYPES_H 37 | 38 | #define OSTYPES_K64_REV 2 39 | 40 | typedef unsigned int UInt; 41 | typedef signed int SInt; 42 | 43 | #ifndef __MACTYPES__ /* CF MacTypes.h */ 44 | #ifndef __TYPES__ /* guess... Mac Types.h */ 45 | 46 | typedef unsigned char UInt8; 47 | typedef unsigned short UInt16; 48 | #if __LP64__ 49 | typedef unsigned int UInt32; 50 | #else 51 | typedef unsigned long UInt32; 52 | #endif 53 | typedef unsigned long long UInt64; 54 | #if defined(__BIG_ENDIAN__) 55 | typedef struct UnsignedWide { 56 | UInt32 hi; 57 | UInt32 lo; 58 | } UnsignedWide; 59 | #elif defined(__LITTLE_ENDIAN__) 60 | typedef struct UnsignedWide { 61 | UInt32 lo; 62 | UInt32 hi; 63 | } UnsignedWide; 64 | #else 65 | #error Unknown endianess. 66 | #endif 67 | 68 | typedef signed char SInt8; 69 | typedef signed short SInt16; 70 | #if __LP64__ 71 | typedef signed int SInt32; 72 | #else 73 | typedef signed long SInt32; 74 | #endif 75 | typedef signed long long SInt64; 76 | #if defined(__BIG_ENDIAN__) 77 | typedef struct wide { 78 | SInt32 hi; 79 | UInt32 lo; 80 | } wide; 81 | #elif defined(__LITTLE_ENDIAN__) 82 | typedef struct wide { 83 | UInt32 lo; 84 | SInt32 hi; 85 | } wide; 86 | #else 87 | #error Unknown endianess. 88 | #endif 89 | 90 | typedef SInt32 OSStatus; 91 | 92 | #if defined(__LP64__) && defined(KERNEL) 93 | #ifndef ABSOLUTETIME_SCALAR_TYPE 94 | #define ABSOLUTETIME_SCALAR_TYPE 1 95 | #endif 96 | typedef UInt64 AbsoluteTime; 97 | #else 98 | typedef UnsignedWide AbsoluteTime; 99 | #endif 100 | 101 | typedef UInt32 OptionBits; 102 | 103 | #if defined(KERNEL) && defined(__LP64__) 104 | /* 105 | * Use intrinsic boolean types for the LP64 kernel, otherwise maintain 106 | * source and binary backward compatibility. This attempts to resolve 107 | * the "(x == true)" vs. "(x)" conditional issue. 108 | */ 109 | #ifdef __cplusplus 110 | typedef bool Boolean; 111 | #else /* !__cplusplus */ 112 | #if defined(__STDC_VERSION__) && ((__STDC_VERSION__ - 199901L) > 0L) 113 | /* only use this if we are sure we are using a c99 compiler */ 114 | typedef _Bool Boolean; 115 | #else /* !c99 */ 116 | /* Fall back to previous definition unless c99 */ 117 | typedef unsigned char Boolean; 118 | #endif /* !c99 */ 119 | #endif /* !__cplusplus */ 120 | #else /* !(KERNEL && __LP64__) */ 121 | typedef unsigned char Boolean; 122 | #endif /* !(KERNEL && __LP64__) */ 123 | 124 | #endif /* __TYPES__ */ 125 | #endif /* __MACTYPES__ */ 126 | 127 | #if !defined(OS_INLINE) 128 | # define OS_INLINE static inline 129 | #endif 130 | 131 | #endif /* _OS_OSTYPES_H */ 132 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDEventSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDEventSystem.h ... I/O Kit HID Event System 4 | 5 | Copyright (c) 2010 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | // With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h 34 | 35 | #ifndef IOHID_EVENT_SYSTEM_H 36 | #define IOHID_EVENT_SYSTEM_H 37 | 38 | #include 39 | #include "IOHIDNotification.h" 40 | #include "IOHIDService.h" 41 | #include "IOHIDEvent.h" 42 | #include "IOHIDEventQueue.h" 43 | 44 | #if __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | typedef struct ___IOHIDEventSystem 49 | #if 0 50 | { 51 | CFRuntimeBase _base; // 0, 4 52 | CFMutableSetRef services; // 8 53 | CFMutableSetRef x0c; // c 54 | CFMutableSetRef x10; // 10 55 | CFMutableSetRef matchNotifications; // 14 56 | IONotificationPortRef serviceMatchPort; // 18 57 | IONotificationPortRef x1c; // 1c 58 | void* x20; // 20 59 | IOHIDEventSystemCallback callback; // 24 60 | IOHIDSessionRef session; // 28 61 | pthread_mutex_t mutex; // 2c 62 | CFRunLoopSourceRef migMachSource; // 58 63 | CFMutableSetRef queues; // 5c 64 | } 65 | #endif 66 | * IOHIDEventSystemRef; 67 | 68 | typedef void(*IOHIDEventSystemCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event); 69 | 70 | CFTypeID IOHIDEventSystemGetTypeID(void); 71 | IOHIDEventSystemRef IOHIDEventSystemCreate(CFAllocatorRef allocator); 72 | 73 | CFArrayRef IOHIDEventSystemCopyMatchingServices(IOHIDEventSystemRef system, CFDictionaryRef propertyTable, 74 | IOHIDNotificationCallback matchCallback, void* matchTarget, void* matchRefcon, IOHIDNotificationRef* matchNotif); 75 | void IOHIDEventSystemRegisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue); 76 | void IOHIDEventSystemUnregisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue); 77 | 78 | IOHIDEventRef IOHIDEventSystemCopyEvent(IOHIDEventSystemRef system, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options); 79 | 80 | CFTypeRef IOHIDEventSystemGetProperty(IOHIDEventSystemRef system, CFStringRef property); 81 | Boolean IOHIDEventSystemSetProperty(IOHIDEventSystemRef system, CFStringRef property, CFTypeRef value); 82 | 83 | Boolean IOHIDEventSystemOpen(IOHIDEventSystemRef system, IOHIDEventSystemCallback callback, void* target, void* refcon, void* unused); 84 | void IOHIDEventSystemClose(IOHIDEventSystemRef system, void* unused); 85 | 86 | #if 0 87 | dlfun("IOHIDEventSystemGetTypeID", "I"); 88 | dlfun("IOHIDEventSystemCreate", "@@"); 89 | dlfun("IOHIDEventSystemCopyMatchingServices", "@@^v^v^v^@"); 90 | dlfun("IOHIDEventSystemRegisterQueue", "v@@"); 91 | dlfun("IOHIDEventSystemUnregisterQueue", "v@@"); 92 | dlfun("IOHIDEventSystemCopyEvent", "@@I@I"); 93 | dlfun("IOHIDEventSystemGetProperty", "@@@"); 94 | dlfun("IOHIDEventSystemSetProperty", "c@@@"); 95 | dlfun("IOHIDEventSystemOpen", "c@^v^v^v^v"); 96 | dlfun("IOHIDEventSystemClose", "v@^v"); 97 | #endif 98 | 99 | #if __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | 105 | -------------------------------------------------------------------------------- /IOKit/OSMessageNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 30 | * 31 | * HISTORY 32 | * 33 | */ 34 | 35 | #ifndef __OS_OSMESSAGENOTIFICATION_H 36 | #define __OS_OSMESSAGENOTIFICATION_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | enum { 47 | kFirstIOKitNotificationType = 100, 48 | kIOServicePublishNotificationType = 100, 49 | kIOServiceMatchedNotificationType = 101, 50 | kIOServiceTerminatedNotificationType = 102, 51 | kIOAsyncCompletionNotificationType = 150, 52 | kIOServiceMessageNotificationType = 160, 53 | kLastIOKitNotificationType = 199 54 | }; 55 | 56 | enum { 57 | kOSNotificationMessageID = 53, 58 | kOSAsyncCompleteMessageID = 57, 59 | kMaxAsyncArgs = 16 60 | }; 61 | 62 | enum { 63 | kIOAsyncReservedIndex = 0, 64 | kIOAsyncReservedCount, 65 | 66 | kIOAsyncCalloutFuncIndex = kIOAsyncReservedCount, 67 | kIOAsyncCalloutRefconIndex, 68 | kIOAsyncCalloutCount, 69 | 70 | kIOMatchingCalloutFuncIndex = kIOAsyncReservedCount, 71 | kIOMatchingCalloutRefconIndex, 72 | kIOMatchingCalloutCount, 73 | 74 | kIOInterestCalloutFuncIndex = kIOAsyncReservedCount, 75 | kIOInterestCalloutRefconIndex, 76 | kIOInterestCalloutServiceIndex, 77 | kIOInterestCalloutCount 78 | }; 79 | 80 | 81 | 82 | // -------------- 83 | enum { 84 | kOSAsyncRef64Count = 8, 85 | kOSAsyncRef64Size = kOSAsyncRef64Count * ((int) sizeof(io_user_reference_t)) 86 | }; 87 | typedef io_user_reference_t OSAsyncReference64[kOSAsyncRef64Count]; 88 | 89 | struct OSNotificationHeader64 { 90 | mach_msg_size_t size; /* content size */ 91 | natural_t type; 92 | OSAsyncReference64 reference; 93 | 94 | #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 95 | unsigned char content[]; 96 | #else 97 | unsigned char content[0]; 98 | #endif 99 | }; 100 | 101 | #pragma pack(4) 102 | struct IOServiceInterestContent64 { 103 | natural_t messageType; 104 | io_user_reference_t messageArgument[1]; 105 | }; 106 | #pragma pack() 107 | // -------------- 108 | 109 | #if !KERNEL_USER32 110 | 111 | enum { 112 | kOSAsyncRefCount = 8, 113 | kOSAsyncRefSize = 32 114 | }; 115 | typedef natural_t OSAsyncReference[kOSAsyncRefCount]; 116 | 117 | struct OSNotificationHeader { 118 | mach_msg_size_t size; /* content size */ 119 | natural_t type; 120 | OSAsyncReference reference; 121 | 122 | #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 123 | unsigned char content[]; 124 | #else 125 | unsigned char content[0]; 126 | #endif 127 | }; 128 | 129 | #pragma pack(4) 130 | struct IOServiceInterestContent { 131 | natural_t messageType; 132 | void * messageArgument[1]; 133 | }; 134 | #pragma pack() 135 | 136 | #endif /* KERNEL_USER32 */ 137 | 138 | struct IOAsyncCompletionContent { 139 | IOReturn result; 140 | #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 141 | void * args[] __attribute__ ((packed)); 142 | #else 143 | void * args[0] __attribute__ ((packed)); 144 | #endif 145 | }; 146 | 147 | #ifndef __cplusplus 148 | typedef struct OSNotificationHeader OSNotificationHeader; 149 | typedef struct IOServiceInterestContent IOServiceInterestContent; 150 | typedef struct IOAsyncCompletionContent IOAsyncCompletionContent; 151 | #endif 152 | 153 | #ifdef __cplusplus 154 | } 155 | #endif 156 | 157 | #endif /* __OS_OSMESSAGENOTIFICATION_H */ 158 | 159 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDService.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDService.h ... I/O Kit HID Service 4 | 5 | Copyright (c) 2009 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | // With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h 34 | 35 | #ifndef IOHID_SERVICE_H 36 | #define IOHID_SERVICE_H 37 | 38 | #include 39 | #include 40 | #include "IOHIDEvent.h" 41 | #include "IOHIDNotification.h" 42 | 43 | #if __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef struct __IOHIDService 48 | #if 0 49 | { 50 | CFRuntimeBase _base; // 0, 4 51 | CFTypeRef client; // 8 52 | io_service_t service; // c 53 | void** pluginInterface1; // 10; GUID = D12C833F-B15B-11DA-902D-0014519758EF 54 | void** pluginInterface2; // 14; 55 | IOCFPlugInInterface** interface; // 18 56 | CFRunLoopRef runloop; // 1c 57 | CFStringRef mode; // 20 58 | IONotificationPortRef notify; // 24 59 | CFMutableSetRef removalNotifications; // 2c 60 | void* eventTarget; // 30 61 | void* eventRefcon; // 34 62 | IOHIDServiceEventCallback eventCallback; // 38 63 | uint32_t previousButtonMask; // 3c 64 | } 65 | #endif 66 | * IOHIDServiceRef; 67 | 68 | typedef void(*IOHIDServiceEventCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event); 69 | 70 | /* 71 | metaObject-> 72 | [0] = NULL 73 | [4] = IOHIDIUnknown::genericQueryInterface(void*, CFUUIDBytes, void**) 74 | [8] = IOHIDIUnknown::genericAddRef(void*) 75 | [0x0c] = IOHIDIUnknown::genericRelease(void*) 76 | [0x10] = IOHIDEventServiceClass::_open(void*, unsigned long) 77 | [0x14] = IOHIDEventServiceClass::_close(void*, unsigned long) 78 | [0x18] = IOHIDEventServiceClass::_getProperty(void*, __CFString const*) 79 | [0x1c] = IOHIDEventServiceClass::_setProperty(void*, __CFString const*, void const*) 80 | [0x20] = IOHIDEventServiceClass::_setEventCallback(void*, void (*)(void*, void*, void*, __IOHIDEvent*, unsigned long), void*, void*) 81 | [0x24] = IOHIDEventServiceClass::_scheduleWithRunLoop(void*, __CFRunLoop*, __CFString const*) 82 | [0x28] = IOHIDEventServiceClass::_unscheduleFromRunLoop(void*, __CFRunLoop*, __CFString const*) 83 | [0x2c] = IOHIDEventServiceClass::_copyEvent(void*, unsigned int, __IOHIDEvent*, unsigned long) 84 | */ 85 | 86 | #pragma mark - 87 | #pragma mark Creators 88 | 89 | CFTypeID IOHIDServiceGetTypeID(void); 90 | IOHIDServiceRef _IOHIDServiceCreate(CFAllocatorRef allocator, io_service_t service); 91 | 92 | #pragma mark - 93 | #pragma mark Accessors 94 | 95 | CFTypeRef IOHIDServiceGetProperty(IOHIDServiceRef service, CFStringRef property); 96 | Boolean IOHIDServiceSetProperty(IOHIDServiceRef service, CFStringRef property, CFTypeRef value); 97 | 98 | CFTypeRef _IOHIDServiceGetClient(IOHIDServiceRef service); 99 | Boolean _IOHIDServiceMatchPropertyTable(IOHIDServiceRef service, CFDictionaryRef propertyTable); 100 | 101 | IOHIDEventRef IOHIDServiceCopyEvent(IOHIDServiceRef service, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options); 102 | 103 | void _IOHIDServiceSetEventCallback(IOHIDServiceRef service, IOHIDServiceEventCallback eventCallback, void* target, void* refcon); 104 | 105 | #pragma mark - 106 | #pragma mark Actions 107 | 108 | void _IOHIDServiceScheduleWithRunLoop(IOHIDServiceRef service, CFRunLoopRef runloop, CFStringRef mode); 109 | void _IOHIDServiceUnscheduleWithRunLoop(IOHIDServiceRef service); 110 | 111 | IOHIDNotificationRef IOHIDServiceCreateRemovalNotification(IOHIDServiceRef display, IOHIDNotificationCallback callback, void* target, void* refcon); 112 | 113 | Boolean _IOHIDServiceOpen(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options); 114 | Boolean _IOHIDServiceClose(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options); 115 | 116 | 117 | #if __cplusplus 118 | } 119 | #endif 120 | 121 | #endif 122 | 123 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDDisplay.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDDisplay.h ... I/O Kit HID Display 4 | 5 | Copyright (c) 2009 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef IOHID_DISPLAY_H 34 | #define IOHID_DISPLAY_H 35 | 36 | #include 37 | #include 38 | #include "IOHIDNotification.h" 39 | 40 | #if __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef struct __IOHIDDisplay 45 | #if 0 46 | { 47 | CFRuntimeBase _base; // 0, 4 48 | void* client; // 8 49 | io_service_t service; // c 50 | CFRunLoopRef runloop; // 10 51 | CFStringRef mode; // 14, *not retained* 52 | IONotificationPortRef port; // 18 53 | io_object_t notification; // 1c 54 | CFMutableSetRef removalNotifications; // 20, set of IOHIDNotification's 55 | CFMutableDictionaryRef properties; // 24 56 | int logLevel; // 28 57 | float brightness; // 34 58 | float brightnessMin; // 38 59 | float brightnessMax; // 3c 60 | float brightnessFactor; // 40; 61 | float x44; // 44 62 | float ambient; // 4c 63 | float brightnessAutoWeightMin; // 54 64 | float brightnessAutoWeightMax; // 58 65 | float x60; // 60 66 | float x64; // 64 67 | float x68; // 68 68 | float x70; // 70 69 | float x74; // 74 70 | int x78; // 78 71 | int x80; // 80 72 | CFTimeInterval fadePeriod; // 84 73 | } 74 | #endif 75 | * IOHIDDisplayRef; 76 | 77 | #pragma mark - 78 | #pragma mark Creators 79 | 80 | CFTypeID IOHIDDisplayGetTypeID(void); 81 | IOHIDDisplayRef _IOHIDDisplayCreate(CFAllocatorRef allocator, io_service_t service); 82 | 83 | #pragma mark - 84 | #pragma mark Accessors 85 | 86 | float _IOHIDDisplayGetAmbient(IOHIDDisplayRef display); 87 | void _IOHIDDisplaySetAmbient(IOHIDDisplayRef display, float ambient); 88 | 89 | float _IOHIDDisplayGetBrightness(IOHIDDisplayRef display); 90 | void _IOHIDDisplaySetBrightness(IOHIDDisplayRef display, float brightness); 91 | void _IOHIDDisplaySetBrightnessMax(IOHIDDisplayRef display, float brightnessMax); 92 | 93 | void _IOHIDDisplaySetBrightnessFactor(IOHIDDisplayRef display, float factor); 94 | float _IOHIDDisplayGetBrightnessFactor(IOHIDDisplayRef display); 95 | 96 | void IOHIDDisplaySetProperty(IOHIDDisplayRef display, CFStringRef property, CFTypeRef value); 97 | CFTypeRef IOHIDDisplayGetProperty(IOHIDDisplayRef display, CFStringRef property); 98 | 99 | CFTypeRef _IOHIDDisplayGetClient(IOHIDDisplayRef display); 100 | 101 | #pragma mark - 102 | #pragma mark Actions 103 | 104 | void _IOHIDDisplayUnscheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode); 105 | void _IOHIDDisplayScheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode); 106 | 107 | IOHIDNotificationRef IOHIDDisplayCreateRemovalNotification(IOHIDDisplayRef display, IOHIDNotificationCallback callback, void* target, void* refcon); 108 | 109 | Boolean _IOHIDDisplayOpen(IOHIDDisplayRef display, CFTypeRef client); 110 | void _IOHIDDisplayClose(IOHIDDisplayRef display, CFTypeRef client); 111 | 112 | #pragma mark - 113 | #pragma mark Constants 114 | 115 | static const CFStringRef kIOHIDDisplayPropertyBrightness = CFSTR("DisplayBrightness"); // float 116 | static const CFStringRef kIOHIDDisplayPropertyBrightnessAuto = CFSTR("DisplayBrightnessAuto"); // boolean 117 | static const CFStringRef kIOHIDDisplayPropertyBrightnessMin = CFSTR("DisplayBrightnessMin"); // float 118 | static const CFStringRef kIOHIDDisplayPropertyBrightnessMax = CFSTR("DisplayBrightnessMax"); // float 119 | static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMax = CFSTR("DisplayBrightnessAutoWeightMax"); // float 120 | static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMin = CFSTR("DisplayBrightnessAutoWeightMin"); // float 121 | static const CFStringRef kIOHIDDisplayPropertyBrightnessFactor = CFSTR("DisplayBrightnessFactor"); // float 122 | static const CFStringRef kIOHIDDisplayPropertyBrightnessFactorWithFade = CFSTR("DisplayBrightnessFactorWithFade"); // float 123 | static const CFStringRef kIOHIDDisplayPropertyBrightnessFadePeriod = CFSTR("DisplayBrightnessFadePeriod"); // float 124 | static const CFStringRef kIOHIDDisplayPropertyLogLevel = CFSTR("LogLevel"); // int 125 | 126 | #if __cplusplus 127 | } 128 | #endif 129 | 130 | #endif 131 | 132 | -------------------------------------------------------------------------------- /IOKit/IOTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2006 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | #ifndef __IOKIT_IOTYPES_H 29 | #define __IOKIT_IOTYPES_H 30 | 31 | #ifndef IOKIT 32 | #define IOKIT 1 33 | #endif /* !IOKIT */ 34 | 35 | #if KERNEL 36 | #include 37 | #else 38 | #include 39 | #include 40 | #endif 41 | 42 | #include 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | #ifndef NULL 49 | #if defined (__cplusplus) 50 | #define NULL 0 51 | #else 52 | #define NULL ((void *)0) 53 | #endif 54 | #endif 55 | 56 | /* 57 | * Simple data types. 58 | */ 59 | #ifndef __MACTYPES__ /* CF MacTypes.h */ 60 | #ifndef __TYPES__ /* guess... Mac Types.h */ 61 | 62 | #include 63 | #include 64 | 65 | #endif /* __TYPES__ */ 66 | #endif /* __MACTYPES__ */ 67 | 68 | #if KERNEL 69 | #include 70 | #endif 71 | 72 | typedef UInt32 IOOptionBits; 73 | typedef SInt32 IOFixed; 74 | typedef UInt32 IOVersion; 75 | typedef UInt32 IOItemCount; 76 | typedef UInt32 IOCacheMode; 77 | 78 | typedef UInt32 IOByteCount32; 79 | typedef UInt64 IOByteCount64; 80 | 81 | typedef UInt32 IOPhysicalAddress32; 82 | typedef UInt64 IOPhysicalAddress64; 83 | typedef UInt32 IOPhysicalLength32; 84 | typedef UInt64 IOPhysicalLength64; 85 | 86 | #ifdef __LP64__ 87 | typedef mach_vm_address_t IOVirtualAddress; 88 | #else 89 | typedef vm_address_t IOVirtualAddress; 90 | #endif 91 | 92 | #if defined(__LP64__) && defined(KERNEL) 93 | typedef IOByteCount64 IOByteCount; 94 | #else 95 | typedef IOByteCount32 IOByteCount; 96 | #endif 97 | 98 | typedef IOVirtualAddress IOLogicalAddress; 99 | 100 | #if defined(__LP64__) && defined(KERNEL) 101 | 102 | typedef IOPhysicalAddress64 IOPhysicalAddress; 103 | typedef IOPhysicalLength64 IOPhysicalLength; 104 | #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32)) 105 | #define IOPhysSize 64 106 | 107 | #else 108 | 109 | typedef IOPhysicalAddress32 IOPhysicalAddress; 110 | typedef IOPhysicalLength32 IOPhysicalLength; 111 | #define IOPhysical32( hi, lo ) (lo) 112 | #define IOPhysSize 32 113 | 114 | #endif 115 | 116 | 117 | typedef struct 118 | { 119 | IOPhysicalAddress address; 120 | IOByteCount length; 121 | } IOPhysicalRange; 122 | 123 | typedef struct 124 | { 125 | IOVirtualAddress address; 126 | IOByteCount length; 127 | } IOVirtualRange; 128 | 129 | #ifdef __LP64__ 130 | typedef IOVirtualRange IOAddressRange; 131 | #else /* !__LP64__ */ 132 | typedef struct 133 | { 134 | mach_vm_address_t address; 135 | mach_vm_size_t length; 136 | } IOAddressRange; 137 | #endif /* !__LP64__ */ 138 | 139 | /* 140 | * Map between #defined or enum'd constants and text description. 141 | */ 142 | typedef struct { 143 | int value; 144 | const char *name; 145 | } IONamedValue; 146 | 147 | 148 | /* 149 | * Memory alignment -- specified as a power of two. 150 | */ 151 | typedef unsigned int IOAlignment; 152 | 153 | #define IO_NULL_VM_TASK ((vm_task_t)0) 154 | 155 | 156 | /* 157 | * Pull in machine specific stuff. 158 | */ 159 | 160 | //#include 161 | 162 | #ifndef MACH_KERNEL 163 | 164 | #ifndef __IOKIT_PORTS_DEFINED__ 165 | #define __IOKIT_PORTS_DEFINED__ 166 | #ifdef KERNEL 167 | typedef struct OSObject * io_object_t; 168 | #else /* KERNEL */ 169 | typedef mach_port_t io_object_t; 170 | #endif /* KERNEL */ 171 | #endif /* __IOKIT_PORTS_DEFINED__ */ 172 | 173 | #include 174 | 175 | typedef io_object_t io_connect_t; 176 | typedef io_object_t io_enumerator_t; 177 | typedef io_object_t io_iterator_t; 178 | typedef io_object_t io_registry_entry_t; 179 | typedef io_object_t io_service_t; 180 | 181 | #define IO_OBJECT_NULL ((io_object_t) 0) 182 | 183 | #endif /* MACH_KERNEL */ 184 | 185 | // IOConnectMapMemory memoryTypes 186 | enum { 187 | kIODefaultMemoryType = 0 188 | }; 189 | 190 | enum { 191 | kIODefaultCache = 0, 192 | kIOInhibitCache = 1, 193 | kIOWriteThruCache = 2, 194 | kIOCopybackCache = 3, 195 | kIOWriteCombineCache = 4 196 | }; 197 | 198 | // IOMemory mapping options 199 | enum { 200 | kIOMapAnywhere = 0x00000001, 201 | 202 | kIOMapCacheMask = 0x00000700, 203 | kIOMapCacheShift = 8, 204 | kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift, 205 | kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift, 206 | kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift, 207 | kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift, 208 | kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift, 209 | 210 | kIOMapUserOptionsMask = 0x00000fff, 211 | 212 | kIOMapReadOnly = 0x00001000, 213 | 214 | kIOMapStatic = 0x01000000, 215 | kIOMapReference = 0x02000000, 216 | kIOMapUnique = 0x04000000 217 | #ifdef XNU_KERNEL_PRIVATE 218 | , kIOMap64Bit = 0x08000000 219 | #endif 220 | }; 221 | 222 | /*! @enum Scale Factors 223 | @discussion Used when a scale_factor parameter is required to define a unit of time. 224 | @constant kNanosecondScale Scale factor for nanosecond based times. 225 | @constant kMicrosecondScale Scale factor for microsecond based times. 226 | @constant kMillisecondScale Scale factor for millisecond based times. 227 | @constant kTickScale Scale factor for the standard (100Hz) tick. 228 | @constant kSecondScale Scale factor for second based times. */ 229 | 230 | enum { 231 | kNanosecondScale = 1, 232 | kMicrosecondScale = 1000, 233 | kMillisecondScale = 1000 * 1000, 234 | kSecondScale = 1000 * 1000 * 1000, 235 | kTickScale = (kSecondScale / 100) 236 | }; 237 | 238 | /* compatibility types */ 239 | 240 | #ifndef KERNEL 241 | 242 | typedef unsigned int IODeviceNumber; 243 | 244 | #endif 245 | 246 | #ifdef __cplusplus 247 | } 248 | #endif 249 | 250 | #endif /* ! __IOKIT_IOTYPES_H */ 251 | -------------------------------------------------------------------------------- /IOKit/IOKitKeys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 30 | * 31 | * Common symbol definitions for IOKit. 32 | * 33 | * HISTORY 34 | * 35 | */ 36 | 37 | 38 | #ifndef _IOKIT_IOKITKEYS_H 39 | #define _IOKIT_IOKITKEYS_H 40 | 41 | // properties found in the registry root 42 | #define kIOKitBuildVersionKey "IOKitBuildVersion" 43 | #define kIOKitDiagnosticsKey "IOKitDiagnostics" 44 | // a dictionary keyed by plane name 45 | #define kIORegistryPlanesKey "IORegistryPlanes" 46 | #define kIOCatalogueKey "IOCatalogue" 47 | 48 | // registry plane names 49 | #define kIOServicePlane "IOService" 50 | #define kIOPowerPlane "IOPower" 51 | #define kIODeviceTreePlane "IODeviceTree" 52 | #define kIOAudioPlane "IOAudio" 53 | #define kIOFireWirePlane "IOFireWire" 54 | #define kIOUSBPlane "IOUSB" 55 | 56 | // registry ID number 57 | #define kIORegistryEntryIDKey "IORegistryEntryID" 58 | 59 | // IOService class name 60 | #define kIOServiceClass "IOService" 61 | 62 | // IOResources class name 63 | #define kIOResourcesClass "IOResources" 64 | 65 | // IOService driver probing property names 66 | #define kIOClassKey "IOClass" 67 | #define kIOProbeScoreKey "IOProbeScore" 68 | #define kIOKitDebugKey "IOKitDebug" 69 | 70 | // IOService matching property names 71 | #define kIOProviderClassKey "IOProviderClass" 72 | #define kIONameMatchKey "IONameMatch" 73 | #define kIOPropertyMatchKey "IOPropertyMatch" 74 | #define kIOPathMatchKey "IOPathMatch" 75 | #define kIOLocationMatchKey "IOLocationMatch" 76 | #define kIOParentMatchKey "IOParentMatch" 77 | #define kIOResourceMatchKey "IOResourceMatch" 78 | #define kIOMatchedServiceCountKey "IOMatchedServiceCountMatch" 79 | 80 | #define kIONameMatchedKey "IONameMatched" 81 | 82 | #define kIOMatchCategoryKey "IOMatchCategory" 83 | #define kIODefaultMatchCategoryKey "IODefaultMatchCategory" 84 | 85 | // IOService default user client class, for loadable user clients 86 | #define kIOUserClientClassKey "IOUserClientClass" 87 | 88 | // key to find IOMappers 89 | #define kIOMapperIDKey "IOMapperID" 90 | 91 | #define kIOUserClientCrossEndianKey "IOUserClientCrossEndian" 92 | #define kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible" 93 | #define kIOUserClientSharedInstanceKey "IOUserClientSharedInstance" 94 | // diagnostic string describing the creating task 95 | #define kIOUserClientCreatorKey "IOUserClientCreator" 96 | 97 | // IOService notification types 98 | #define kIOPublishNotification "IOServicePublish" 99 | #define kIOFirstPublishNotification "IOServiceFirstPublish" 100 | #define kIOMatchedNotification "IOServiceMatched" 101 | #define kIOFirstMatchNotification "IOServiceFirstMatch" 102 | #define kIOTerminatedNotification "IOServiceTerminate" 103 | 104 | // IOService interest notification types 105 | #define kIOGeneralInterest "IOGeneralInterest" 106 | #define kIOBusyInterest "IOBusyInterest" 107 | #define kIOAppPowerStateInterest "IOAppPowerStateInterest" 108 | #define kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest" 109 | 110 | #define kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage" 111 | 112 | // IOService interest notification types 113 | #define kIOCFPlugInTypesKey "IOCFPlugInTypes" 114 | 115 | // properties found in services that implement command pooling 116 | #define kIOCommandPoolSizeKey "IOCommandPoolSize" // (OSNumber) 117 | 118 | // properties found in services that have transfer constraints 119 | #define kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" // (OSNumber) 120 | #define kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" // (OSNumber) 121 | #define kIOMaximumByteCountReadKey "IOMaximumByteCountRead" // (OSNumber) 122 | #define kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" // (OSNumber) 123 | #define kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" // (OSNumber) 124 | #define kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" // (OSNumber) 125 | #define kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" // (OSNumber) 126 | #define kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" // (OSNumber) 127 | #define kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" // (OSNumber) 128 | #define kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" // (OSNumber) 129 | 130 | // properties found in services that wish to describe an icon 131 | // 132 | // IOIcon = 133 | // { 134 | // CFBundleIdentifier = "com.example.driver.example"; 135 | // IOBundleResourceFile = "example.icns"; 136 | // }; 137 | // 138 | // where IOBundleResourceFile is the filename of the resource 139 | 140 | #define kIOIconKey "IOIcon" // (OSDictionary) 141 | #define kIOBundleResourceFileKey "IOBundleResourceFile" // (OSString) 142 | 143 | #define kIOBusBadgeKey "IOBusBadge" // (OSDictionary) 144 | #define kIODeviceIconKey "IODeviceIcon" // (OSDictionary) 145 | 146 | // property of root that describes the machine's serial number as a string 147 | #define kIOPlatformSerialNumberKey "IOPlatformSerialNumber" // (OSString) 148 | 149 | // property of root that describes the machine's UUID as a string 150 | #define kIOPlatformUUIDKey "IOPlatformUUID" // (OSString) 151 | 152 | // IODTNVRAM property keys 153 | #define kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY" 154 | #define kIODTNVRAMPanicInfoKey "aapl,panic-info" 155 | 156 | // keys for complex boot information 157 | #define kIOBootDeviceKey "IOBootDevice" // dict | array of dicts 158 | #define kIOBootDevicePathKey "IOBootDevicePath" // arch-neutral OSString 159 | #define kIOBootDeviceSizeKey "IOBootDeviceSize" // OSNumber of bytes 160 | 161 | // keys for OS Version information 162 | #define kOSBuildVersionKey "OS Build Version" 163 | 164 | #endif /* ! _IOKIT_IOKITKEYS_H */ 165 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDSession.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDSession.h ... I/O Kit HID Session 4 | 5 | Copyright (c) 2010 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef IOHID_NOTIFICATION_H 34 | #define IOHID_NOTIFICATION_H 35 | 36 | #include 37 | #include "IOHIDDisplay.h" 38 | #include "IOHIDService.h" 39 | #include "IOHIDEvent.h" 40 | 41 | #if __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef struct IOHIDSessionWorkSpace { 46 | uint64_t value; 47 | } IOHIDSessionWorkSpace; 48 | 49 | typedef struct __IOHIDSession 50 | #if 0 51 | { 52 | CFRuntimeBase _base; // 0, 4 53 | int isOpen; // 8 54 | CFTypeRef client; // c 55 | IOHIDSessionCallback callback; // 10 56 | void* refcon; // 14 57 | IOHIDSessionWorkSpace workSpace; // 18, 1c 58 | CFRunLoopRef runloop; // 20 59 | pthread_mutex_t lock; // 24 60 | pthread_cond_t cond; // 50 61 | pthread_mutexattr_t attr; // 6c 62 | CFMutableSetRef services; // 78 63 | CFMutableSetRef displays; // 7c 64 | CFMutableSetRef ALSStates; // 80 65 | CFMutableDictionaryRef properties; // 84 66 | Boolean displayStatus; // 88, initially = true 67 | float factor; // brightnessFactor. 8c, initially = 1 68 | float deviceAmbient; // 94, initially = 0.5 69 | float interval; // displayInternval. 98, initially = 0.402 70 | float ALSIntPeriod; // 9c, initially = 5.5 71 | float xa4; // a4, initially = 0 72 | float xa8; // a8, initially = 5.5 73 | float xac; // ac, initially = -1 74 | float xb0; // b0, initially = 1 75 | float backlight; // b4, initially = 1 76 | CFTypeRef xe0; // e0 77 | int displayOrientation; // e8, initially = 1 78 | Boolean orientationEnabled; // ec, initially = false 79 | Boolean ALSIntPeriodOrientationEnabled; // ed, initially = false 80 | float ALSIntPeriodOrientationPortrait; // f0, initially = 5.5 81 | float ALSIntPeriodOrientationPortraitInv; // f4, initially = 0 82 | float ALSIntPeriodOrientationLandscape; // f8, initially = 0 83 | int lockStateToken; // fc. (for the "com.apple.springboard.lockstate" Darwin notification) 84 | uint64_t lockState; // 100, 104 85 | mach_port_t lockStateNotifyPort; // 108 (leads to __IOHIDSessionLockCallback) 86 | int bootedCleanlyToken; // 10c (for the "com.apple.springboard.bootedcleanly" Darwin notification) 87 | mach_port_t bootedCleanlyNotifyPort; // 118 (leads to __IOHIDSessionBootCallback) 88 | int displayStatusToken; // 11c (for the "com.apple.iokit.hid.displayStatus" Darwin notification) 89 | int substantialTransitionToken; // 12c (for the "com.apple.mobile.SubstantialTransition" Darwin notification) 90 | mach_port_t substantialTransitionNotifyPort; // 130 (leads to __IOHIDSessionTransitionCallback) 91 | int thermalNotificationToken; // 134 (for the kOSThermalNotificationName Darwin notification) 92 | mach_port_t thermalNotificationNotifyPort; // 138 (leads to __IOHIDSessionThermalCallback) 93 | int thermalLevel; // 13c, initially = OSThermalNotificationCurrentLevel() 94 | int logLevel; // 144, initially = 6 95 | } 96 | #endif 97 | * IOHIDSessionRef; 98 | 99 | typedef void(*IOHIDSessionCallback)(CFTypeRef client, void* refcon, IOHIDServiceRef service, IOHIDEventRef event); 100 | 101 | #pragma mark - 102 | #pragma mark Creators 103 | 104 | CFTypeID IOHIDSessionGetTypeID(void); 105 | IOHIDSessionRef IOHIDSessionCreate(CFAllocatorRef allocator); 106 | 107 | #pragma mark - 108 | #pragma mark Accessors 109 | 110 | CFTypeRef IOHIDSessionGetProperty(IOHIDSessionRef session, CFStringRef key); 111 | Boolean IOHIDSessionSetProperty(IOHIDSessionRef session, CFStringRef key, CFTypeRef value); 112 | 113 | IOHIDSessionWorkSpace IOHIDSessionGetWorkSpace(IOHIDSessionRef session); 114 | void IOHIDSessionSetWorkSpace(IOHIDSessionRef session, IOHIDSessionWorkSpace workSpace); 115 | 116 | Boolean IOHIDSessionGetLockState(IOHIDSessionRef session); 117 | void IOHIDSessionSetLockState(IOHIDSessionRef session, Boolean lockState); 118 | 119 | #pragma mark - 120 | #pragma mark Actions 121 | 122 | Boolean IOHIDSessionOpen(IOHIDSessionRef session, CFTypeRef client, IOHIDSessionCallback callback, void* refcon) 123 | void IOHIDSessionClose(IOHIDSessionRef session, CFTypeRef client); 124 | 125 | void IOHIDSessionAddService(IOHIDSessionRef, IOHIDServiceRef service); 126 | void IOHIDSessionRemoveService(IOHIDSessionRef, IOHIDServiceRef service); 127 | 128 | void IOHIDSessionAddDisplay(IOHIDSessionRef, IOHIDDisplayRef display); 129 | void IOHIDSessionRemoveDisplay(IOHIDSessionRef session, IOHIDDisplayRef display); 130 | 131 | IOHIDEventRef IOHIDSessionCopyEvent(IOHIDSessionRef session, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options); 132 | 133 | #pragma mark - 134 | #pragma mark Constants 135 | 136 | static const CFStringRef kIOHIDSessionPropertyDisplayOrientation = CFSTR("DisplayOrientation"); 137 | static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactor = CFSTR("DisplayBrightnessFactor"); 138 | static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactorWithFade = CFSTR("DisplayBrightnessFactorWithFade"); 139 | static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactorPending = CFSTR("DisplayBrightnessFactorPending"); 140 | static const CFStringRef kIOHIDSessionPropertyLogLevel = CFSTR("LogLevel"); 141 | static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationEnabled = CFSTR("ALSIntPeriodOrientationEnabled"); 142 | static const CFStringRef kIOHIDSessionPropertyALSIntPeriod = CFSTR("ALSIntPeriod"); 143 | static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationPortrait = CFSTR("ALSIntPeriodOrientationPortrait"); 144 | static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationPortraitInv = CFSTR("ALSIntPeriodOrientationPortraitInv"); 145 | static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationLandscape = CFSTR("ALSIntPeriodOrientationLandscape"); 146 | 147 | #if __cplusplus 148 | } 149 | #endif 150 | 151 | #endif 152 | 153 | -------------------------------------------------------------------------------- /IOKit/IOReturn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * HISTORY 30 | */ 31 | 32 | /* 33 | * Core IOReturn values. Others may be family defined. 34 | */ 35 | 36 | #ifndef __IOKIT_IORETURN_H 37 | #define __IOKIT_IORETURN_H 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | #include 44 | 45 | typedef kern_return_t IOReturn; 46 | 47 | #ifndef sys_iokit 48 | #define sys_iokit err_system(0x38) 49 | #endif /* sys_iokit */ 50 | #define sub_iokit_common err_sub(0) 51 | #define sub_iokit_usb err_sub(1) 52 | #define sub_iokit_firewire err_sub(2) 53 | #define sub_iokit_block_storage err_sub(4) 54 | #define sub_iokit_graphics err_sub(5) 55 | #define sub_iokit_networking err_sub(6) 56 | #define sub_iokit_bluetooth err_sub(8) 57 | #define sub_iokit_pmu err_sub(9) 58 | #define sub_iokit_acpi err_sub(10) 59 | #define sub_iokit_smbus err_sub(11) 60 | #define sub_iokit_ahci err_sub(12) 61 | #define sub_iokit_powermanagement err_sub(13) 62 | //#define sub_iokit_hidsystem err_sub(14) 63 | #define sub_iokit_scsi err_sub(16) 64 | //#define sub_iokit_pccard err_sub(21) 65 | 66 | #define sub_iokit_vendor_specific err_sub(-2) 67 | #define sub_iokit_reserved err_sub(-1) 68 | 69 | #define iokit_common_err(return) (sys_iokit|sub_iokit_common|return) 70 | #define iokit_family_err(sub,return) (sys_iokit|sub|return) 71 | #define iokit_vendor_specific_err(return) (sys_iokit|sub_iokit_vendor_specific|return) 72 | 73 | #define kIOReturnSuccess KERN_SUCCESS // OK 74 | #define kIOReturnError iokit_common_err(0x2bc) // general error 75 | #define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory 76 | #define kIOReturnNoResources iokit_common_err(0x2be) // resource shortage 77 | #define kIOReturnIPCError iokit_common_err(0x2bf) // error during IPC 78 | #define kIOReturnNoDevice iokit_common_err(0x2c0) // no such device 79 | #define kIOReturnNotPrivileged iokit_common_err(0x2c1) // privilege violation 80 | #define kIOReturnBadArgument iokit_common_err(0x2c2) // invalid argument 81 | #define kIOReturnLockedRead iokit_common_err(0x2c3) // device read locked 82 | #define kIOReturnLockedWrite iokit_common_err(0x2c4) // device write locked 83 | #define kIOReturnExclusiveAccess iokit_common_err(0x2c5) // exclusive access and 84 | // device already open 85 | #define kIOReturnBadMessageID iokit_common_err(0x2c6) // sent/received messages 86 | // had different msg_id 87 | #define kIOReturnUnsupported iokit_common_err(0x2c7) // unsupported function 88 | #define kIOReturnVMError iokit_common_err(0x2c8) // misc. VM failure 89 | #define kIOReturnInternalError iokit_common_err(0x2c9) // internal error 90 | #define kIOReturnIOError iokit_common_err(0x2ca) // General I/O error 91 | //#define kIOReturn???Error iokit_common_err(0x2cb) // ??? 92 | #define kIOReturnCannotLock iokit_common_err(0x2cc) // can't acquire lock 93 | #define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open 94 | #define kIOReturnNotReadable iokit_common_err(0x2ce) // read not supported 95 | #define kIOReturnNotWritable iokit_common_err(0x2cf) // write not supported 96 | #define kIOReturnNotAligned iokit_common_err(0x2d0) // alignment error 97 | #define kIOReturnBadMedia iokit_common_err(0x2d1) // Media Error 98 | #define kIOReturnStillOpen iokit_common_err(0x2d2) // device(s) still open 99 | #define kIOReturnRLDError iokit_common_err(0x2d3) // rld failure 100 | #define kIOReturnDMAError iokit_common_err(0x2d4) // DMA failure 101 | #define kIOReturnBusy iokit_common_err(0x2d5) // Device Busy 102 | #define kIOReturnTimeout iokit_common_err(0x2d6) // I/O Timeout 103 | #define kIOReturnOffline iokit_common_err(0x2d7) // device offline 104 | #define kIOReturnNotReady iokit_common_err(0x2d8) // not ready 105 | #define kIOReturnNotAttached iokit_common_err(0x2d9) // device not attached 106 | #define kIOReturnNoChannels iokit_common_err(0x2da) // no DMA channels left 107 | #define kIOReturnNoSpace iokit_common_err(0x2db) // no space for data 108 | //#define kIOReturn???Error iokit_common_err(0x2dc) // ??? 109 | #define kIOReturnPortExists iokit_common_err(0x2dd) // port already exists 110 | #define kIOReturnCannotWire iokit_common_err(0x2de) // can't wire down 111 | // physical memory 112 | #define kIOReturnNoInterrupt iokit_common_err(0x2df) // no interrupt attached 113 | #define kIOReturnNoFrames iokit_common_err(0x2e0) // no DMA frames enqueued 114 | #define kIOReturnMessageTooLarge iokit_common_err(0x2e1) // oversized msg received 115 | // on interrupt port 116 | #define kIOReturnNotPermitted iokit_common_err(0x2e2) // not permitted 117 | #define kIOReturnNoPower iokit_common_err(0x2e3) // no power to device 118 | #define kIOReturnNoMedia iokit_common_err(0x2e4) // media not present 119 | #define kIOReturnUnformattedMedia iokit_common_err(0x2e5)// media not formatted 120 | #define kIOReturnUnsupportedMode iokit_common_err(0x2e6) // no such mode 121 | #define kIOReturnUnderrun iokit_common_err(0x2e7) // data underrun 122 | #define kIOReturnOverrun iokit_common_err(0x2e8) // data overrun 123 | #define kIOReturnDeviceError iokit_common_err(0x2e9) // the device is not working properly! 124 | #define kIOReturnNoCompletion iokit_common_err(0x2ea) // a completion routine is required 125 | #define kIOReturnAborted iokit_common_err(0x2eb) // operation aborted 126 | #define kIOReturnNoBandwidth iokit_common_err(0x2ec) // bus bandwidth would be exceeded 127 | #define kIOReturnNotResponding iokit_common_err(0x2ed) // device not responding 128 | #define kIOReturnIsoTooOld iokit_common_err(0x2ee) // isochronous I/O request for distant past! 129 | #define kIOReturnIsoTooNew iokit_common_err(0x2ef) // isochronous I/O request for distant future 130 | #define kIOReturnNotFound iokit_common_err(0x2f0) // data was not found 131 | #define kIOReturnInvalid iokit_common_err(0x1) // should never be seen 132 | 133 | #ifdef __cplusplus 134 | } 135 | #endif 136 | 137 | #endif /* ! __IOKIT_IORETURN_H */ 138 | -------------------------------------------------------------------------------- /Classes/SessionController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SessionController.m 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/17/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SessionController.h" 10 | #import "SNESControllerAppDelegate.h" 11 | #import "SNESControllerViewController.h" 12 | 13 | #define SESSION_ID @"com.snes-hd.controller" 14 | #define CONNECT_TIMEOUT 30 15 | 16 | @implementation SessionController 17 | 18 | @synthesize gkSession, statusLabel, serverListView, spinner, cancelButton, disconnectButton; 19 | 20 | - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle 21 | { 22 | if (self = [super initWithNibName:nibName bundle:nibBundle]) 23 | { 24 | gkSession = [[GKSession alloc] initWithSessionID:SESSION_ID displayName:nil sessionMode:GKSessionModeClient]; 25 | gkSession.delegate = self; 26 | 27 | availableServers = [[NSMutableArray alloc] init]; 28 | } 29 | return self; 30 | } 31 | 32 | - (void) dealloc 33 | { 34 | [super dealloc]; 35 | [gkSession release]; 36 | [availableServers release]; 37 | [serverPeerID release]; 38 | [statusLabel release]; 39 | [serverListView release]; 40 | [cancelButton release]; 41 | } 42 | 43 | 44 | - (void) viewDidLoad 45 | { 46 | [cancelButton setBackgroundImage:[[UIImage imageNamed:@"grayButton.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0] 47 | forState:UIControlStateNormal]; 48 | [disconnectButton setBackgroundImage:[[UIImage imageNamed:@"grayButton.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0] 49 | forState:UIControlStateNormal]; 50 | } 51 | 52 | - (void) searchForEmulators 53 | { 54 | gkSession.available = YES; 55 | } 56 | 57 | - (void) stopSearching 58 | { 59 | gkSession.available = NO; 60 | } 61 | 62 | - (BOOL) isConnected 63 | { 64 | return (serverPeerID != nil); 65 | } 66 | 67 | - (BOOL) serversAvailable 68 | { 69 | return ([availableServers count] > 0 && ![self isConnected]); 70 | } 71 | 72 | 73 | - (void) viewWillAppear:(BOOL)animated 74 | { 75 | [super viewWillAppear:animated]; 76 | [self updateView]; 77 | } 78 | 79 | - (void) updateView 80 | { 81 | if (self.isConnected) { 82 | statusLabel.text = [NSString stringWithFormat:@"Connected to %@", serverName]; 83 | serverListView.hidden = YES; 84 | cancelButton.hidden = NO; 85 | disconnectButton.hidden = NO; 86 | [spinner stopAnimating]; 87 | } else { 88 | [self searchForEmulators]; 89 | if (self.serversAvailable) { 90 | statusLabel.text = @"Tap to connect:"; 91 | serverListView.hidden = NO; 92 | cancelButton.hidden = NO; 93 | disconnectButton.hidden = YES; 94 | [serverListView reloadData]; 95 | [spinner stopAnimating]; 96 | } else { 97 | statusLabel.text = @"Searching for SNES (HD)"; 98 | serverListView.hidden = YES; 99 | [spinner startAnimating]; 100 | cancelButton.hidden = NO; 101 | disconnectButton.hidden = YES; 102 | } 103 | } 104 | } 105 | 106 | 107 | 108 | - (IBAction) buttonPressed:(id)sender 109 | { 110 | if (sender == cancelButton) 111 | { 112 | [self stopSearching]; 113 | [self dismissView]; 114 | } else if (sender == disconnectButton) { 115 | [self disconnect]; 116 | [self dismissView]; 117 | } 118 | } 119 | 120 | - (void) connectToServerAtIndex:(NSUInteger)serverIndex 121 | { 122 | NSString *peerID = [availableServers objectAtIndex:serverIndex]; 123 | [gkSession connectToPeer:peerID withTimeout:30]; 124 | } 125 | 126 | - (void) disconnect 127 | { 128 | [gkSession disconnectFromAllPeers]; 129 | [serverPeerID release]; 130 | [serverName release]; 131 | serverPeerID = nil; 132 | serverName = nil; 133 | [availableServers removeAllObjects]; 134 | [self updateView]; 135 | } 136 | 137 | 138 | - (void) sendPadStatus:(unsigned long)status 139 | { 140 | if (!gkSession || !serverPeerID) 141 | return; 142 | 143 | NSData *message = [NSData dataWithBytes:&status length:sizeof(status)]; 144 | NSError *error = nil; 145 | [gkSession sendDataToAllPeers:message withDataMode:GKSendDataUnreliable error:&error]; 146 | if (error) 147 | { 148 | NSLog(@"Error sending pad status: %@", error); 149 | } 150 | } 151 | 152 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 153 | // Return YES for supported orientations 154 | return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 155 | interfaceOrientation == UIInterfaceOrientationLandscapeRight); 156 | } 157 | 158 | 159 | // Use this to show the modal view (pops-up from the bottom)` 160 | - (void) showModal 161 | { 162 | UIView* padView = AppDelegate().viewController.view; 163 | CGPoint middleCenter = CGPointMake(240, 160); 164 | CGSize screenSize = [UIScreen mainScreen].bounds.size; 165 | CGSize offSize = CGSizeMake(screenSize.height, screenSize.width); 166 | CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5); 167 | self.view.center = offScreenCenter; // we start off-screen 168 | [self updateView]; 169 | [padView addSubview:self.view]; 170 | 171 | // Show it with a transition effect 172 | [UIView beginAnimations:nil context:nil]; 173 | [UIView setAnimationDuration:0.7]; // animation duration in seconds 174 | self.view.center = middleCenter; 175 | [UIView commitAnimations]; 176 | } 177 | 178 | - (void) dismissView 179 | { 180 | CGSize screenSize = [UIScreen mainScreen].bounds.size; 181 | CGSize offSize = CGSizeMake(screenSize.height, screenSize.width); 182 | CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5); 183 | [UIView beginAnimations:nil context:nil]; 184 | [UIView setAnimationDuration:0.7]; 185 | [UIView setAnimationDelegate:self]; 186 | [UIView setAnimationDidStopSelector:@selector(dismissViewEnded:finished:context:)]; 187 | self.view.center = offScreenCenter; 188 | [UIView commitAnimations]; 189 | } 190 | 191 | - (void) dismissViewEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context 192 | { 193 | [self.view removeFromSuperview]; 194 | } 195 | 196 | 197 | #pragma mark - 198 | #pragma mark GKSession Delegate methods 199 | - (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state { 200 | switch (state) { 201 | case GKPeerStateAvailable: 202 | if (![availableServers containsObject:peerID]) 203 | { 204 | [availableServers addObject:peerID]; 205 | [self updateView]; 206 | } 207 | break; 208 | case GKPeerStateConnected: 209 | serverPeerID = [peerID retain]; 210 | serverName = [[session displayNameForPeer:peerID] retain]; 211 | [self stopSearching]; 212 | [self dismissView]; 213 | [AppDelegate().viewController updateConnectionStatus]; 214 | break; 215 | case GKPeerStateDisconnected: 216 | [self disconnect]; 217 | [self dismissView]; 218 | [AppDelegate().viewController updateConnectionStatus]; 219 | [AppDelegate().viewController showDisconnectionAlert]; 220 | break; 221 | 222 | default: 223 | break; 224 | } 225 | } 226 | 227 | #pragma mark - 228 | #pragma mark UITableView Data Source methods 229 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView 230 | { 231 | return 1; 232 | } 233 | 234 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 235 | return [availableServers count]; 236 | } 237 | 238 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 239 | { 240 | UITableViewCell* cell; 241 | 242 | cell = [tableView dequeueReusableCellWithIdentifier:@"labelCell"]; 243 | if (cell == nil) 244 | { 245 | cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"labelCell"] autorelease]; 246 | cell.textLabel.numberOfLines = 1; 247 | cell.textLabel.adjustsFontSizeToFitWidth = YES; 248 | cell.textLabel.minimumFontSize = 9.0f; 249 | cell.textLabel.lineBreakMode = UILineBreakModeMiddleTruncation; 250 | } 251 | 252 | cell.accessoryType = UITableViewCellAccessoryNone; 253 | if ([availableServers count] <= 0 || indexPath.row >= [availableServers count]) 254 | { 255 | cell.textLabel.text = @""; 256 | return cell; 257 | } 258 | 259 | cell.textLabel.text = [gkSession displayNameForPeer:[availableServers objectAtIndex:indexPath.row]]; 260 | return cell; 261 | } 262 | 263 | #pragma mark - 264 | #pragma mark Table View delegate methods 265 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 266 | { 267 | if([availableServers count] <= 0) 268 | { 269 | return; 270 | } 271 | 272 | [self connectToServerAtIndex:indexPath.row]; 273 | } 274 | 275 | 276 | 277 | @end 278 | -------------------------------------------------------------------------------- /Resources/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10D540 6 | 760 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 81 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | SNESControllerViewController 45 | 46 | IBCocoaTouchFramework 47 | 48 | 49 | 50 | 292 51 | {320, 480} 52 | 53 | 1 54 | MSAxIDEAA 55 | 56 | NO 57 | NO 58 | 59 | IBCocoaTouchFramework 60 | YES 61 | 62 | 63 | 64 | 65 | YES 66 | 67 | 68 | delegate 69 | 70 | 71 | 72 | 4 73 | 74 | 75 | 76 | viewController 77 | 78 | 79 | 80 | 11 81 | 82 | 83 | 84 | window 85 | 86 | 87 | 88 | 14 89 | 90 | 91 | 92 | 93 | YES 94 | 95 | 0 96 | 97 | 98 | 99 | 100 | 101 | -1 102 | 103 | 104 | File's Owner 105 | 106 | 107 | 3 108 | 109 | 110 | SNESController App Delegate 111 | 112 | 113 | -2 114 | 115 | 116 | 117 | 118 | 10 119 | 120 | 121 | 122 | 123 | 12 124 | 125 | 126 | 127 | 128 | 129 | 130 | YES 131 | 132 | YES 133 | -1.CustomClassName 134 | -2.CustomClassName 135 | 10.CustomClassName 136 | 10.IBEditorWindowLastContentRect 137 | 10.IBPluginDependency 138 | 12.IBEditorWindowLastContentRect 139 | 12.IBPluginDependency 140 | 3.CustomClassName 141 | 3.IBPluginDependency 142 | 143 | 144 | YES 145 | UIApplication 146 | UIResponder 147 | SNESControllerViewController 148 | {{234, 376}, {320, 480}} 149 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 150 | {{525, 346}, {320, 480}} 151 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 152 | SNESControllerAppDelegate 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | 155 | 156 | 157 | YES 158 | 159 | 160 | YES 161 | 162 | 163 | 164 | 165 | YES 166 | 167 | 168 | YES 169 | 170 | 171 | 172 | 14 173 | 174 | 175 | 176 | YES 177 | 178 | SNESControllerAppDelegate 179 | NSObject 180 | 181 | YES 182 | 183 | YES 184 | viewController 185 | window 186 | 187 | 188 | YES 189 | SNESControllerViewController 190 | UIWindow 191 | 192 | 193 | 194 | IBProjectSource 195 | Classes/SNESControllerAppDelegate.h 196 | 197 | 198 | 199 | SNESControllerAppDelegate 200 | NSObject 201 | 202 | IBUserSource 203 | 204 | 205 | 206 | 207 | SNESControllerViewController 208 | UIViewController 209 | 210 | IBProjectSource 211 | Classes/SNESControllerViewController.h 212 | 213 | 214 | 215 | 216 | 0 217 | IBCocoaTouchFramework 218 | 219 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 220 | 221 | 222 | YES 223 | SNESController.xcodeproj 224 | 3 225 | 81 226 | 227 | 228 | -------------------------------------------------------------------------------- /Classes/SNESControllerViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SNESControllerViewController.m 3 | // SNESController 4 | // 5 | // Created by Yusef Napora on 5/5/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import "SNESControllerAppDelegate.h" 10 | #import "SNESControllerViewController.h" 11 | #import "SessionController.h" 12 | 13 | 14 | #define DefaultControllerImage @"snes-1.png" 15 | 16 | unsigned long gp2x_pad_status; 17 | static unsigned long newtouches[10]; 18 | static unsigned long oldtouches[10]; 19 | 20 | enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40, 21 | GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11, 22 | GP2X_A=1<<12, GP2X_B=1<<13, GP2X_X=1<<14, GP2X_Y=1<<15, 23 | GP2X_VOL_UP=1<<23, GP2X_VOL_DOWN=1<<22, GP2X_PUSH=1<<27 }; 24 | 25 | @implementation SNESControllerViewController 26 | @synthesize imageView; 27 | @synthesize infoButton; 28 | @synthesize connectionButton; 29 | 30 | 31 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | 35 | self.view.multipleTouchEnabled = YES; 36 | self.imageView.image = [UIImage imageNamed:DefaultControllerImage]; 37 | [self getControllerCoords]; 38 | } 39 | 40 | 41 | - (void) viewDidAppear:(BOOL)animated 42 | { 43 | if (! AppDelegate().sessionController.isConnected) 44 | { 45 | [AppDelegate().sessionController showModal]; 46 | } 47 | } 48 | 49 | 50 | 51 | 52 | // Override to allow orientations other than the default portrait orientation. 53 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 54 | // Return YES for supported orientations 55 | return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 56 | interfaceOrientation == UIInterfaceOrientationLandscapeRight); 57 | } 58 | 59 | 60 | - (void)didReceiveMemoryWarning { 61 | // Releases the view if it doesn't have a superview. 62 | [super didReceiveMemoryWarning]; 63 | 64 | // Release any cached data, images, etc that aren't in use. 65 | } 66 | 67 | - (void)viewDidUnload { 68 | // Release any retained subviews of the main view. 69 | // e.g. self.myOutlet = nil; 70 | } 71 | 72 | 73 | - (void)dealloc { 74 | [super dealloc]; 75 | } 76 | 77 | - (IBAction) buttonPressed:(id)sender 78 | { 79 | if (sender == connectionButton) { 80 | [AppDelegate().sessionController showModal]; 81 | } else if (sender == infoButton) { 82 | NSLog(@"Info button pressed"); 83 | } 84 | } 85 | 86 | - (void) updateConnectionStatus 87 | { 88 | if (AppDelegate().sessionController.isConnected) { 89 | [connectionButton setBackgroundImage:[UIImage imageNamed:@"ConnectedIcon.png"] forState:UIControlStateNormal]; 90 | } else { 91 | [connectionButton setBackgroundImage:[UIImage imageNamed:@"NotConnectedIcon.png"] forState:UIControlStateNormal]; 92 | } 93 | } 94 | 95 | - (void) showDisconnectionAlert 96 | { 97 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Disconnected" 98 | message:@"Disconnected from server" 99 | delegate:self 100 | cancelButtonTitle:@"Ignore" 101 | otherButtonTitles:@"Reconnect",nil]; 102 | [alert show]; 103 | } 104 | 105 | - (void) alertViewCancel:(UIAlertView *)alertView 106 | { 107 | [self updateConnectionStatus]; 108 | [alertView dismissWithClickedButtonIndex:-1 animated:YES]; 109 | } 110 | 111 | - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 112 | { 113 | if (buttonIndex == [alertView firstOtherButtonIndex]) 114 | { 115 | [alertView dismissWithClickedButtonIndex:buttonIndex animated:YES]; 116 | [AppDelegate().sessionController showModal]; 117 | } 118 | } 119 | 120 | #define MyCGRectContainsPoint(rect, point) \ 121 | (((point.x >= rect.origin.x) && \ 122 | (point.y >= rect.origin.y) && \ 123 | (point.x <= rect.origin.x + rect.size.width) && \ 124 | (point.y <= rect.origin.y + rect.size.height)) ? 1 : 0) 125 | 126 | 127 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 128 | { 129 | int touchstate[10]; 130 | //Get all the touches. 131 | int i; 132 | NSSet *allTouches = [event allTouches]; 133 | int touchcount = [allTouches count]; 134 | 135 | for (i = 0; i < 10; i++) 136 | { 137 | touchstate[i] = 0; 138 | oldtouches[i] = newtouches[i]; 139 | } 140 | 141 | for (i = 0; i < touchcount; i++) 142 | { 143 | UITouch *touch = [[allTouches allObjects] objectAtIndex:i]; 144 | 145 | if( touch != nil && 146 | ( touch.phase == UITouchPhaseBegan || 147 | touch.phase == UITouchPhaseMoved || 148 | touch.phase == UITouchPhaseStationary) ) 149 | { 150 | struct CGPoint point; 151 | point = [touch locationInView:self.view]; 152 | 153 | touchstate[i] = 1; 154 | 155 | if (MyCGRectContainsPoint(Left, point)) 156 | { 157 | gp2x_pad_status |= GP2X_LEFT; 158 | newtouches[i] = GP2X_LEFT; 159 | } 160 | else if (MyCGRectContainsPoint(Right, point)) 161 | { 162 | gp2x_pad_status |= GP2X_RIGHT; 163 | newtouches[i] = GP2X_RIGHT; 164 | } 165 | else if (MyCGRectContainsPoint(Up, point)) 166 | { 167 | gp2x_pad_status |= GP2X_UP; 168 | newtouches[i] = GP2X_UP; 169 | } 170 | else if (MyCGRectContainsPoint(Down, point)) 171 | { 172 | gp2x_pad_status |= GP2X_DOWN; 173 | newtouches[i] = GP2X_DOWN; 174 | } 175 | else if (MyCGRectContainsPoint(ButtonLeft, point)) 176 | { 177 | gp2x_pad_status |= GP2X_A; 178 | newtouches[i] = GP2X_A; 179 | } 180 | else if (MyCGRectContainsPoint(ButtonRight, point)) 181 | { 182 | gp2x_pad_status |= GP2X_B; 183 | newtouches[i] = GP2X_B; 184 | } 185 | else if (MyCGRectContainsPoint(ButtonUp, point)) 186 | { 187 | gp2x_pad_status |= GP2X_Y; 188 | newtouches[i] = GP2X_Y; 189 | } 190 | else if (MyCGRectContainsPoint(ButtonDown, point)) 191 | { 192 | gp2x_pad_status |= GP2X_X; 193 | newtouches[i] = GP2X_X; 194 | } 195 | else if (MyCGRectContainsPoint(ButtonUpLeft, point)) 196 | { 197 | gp2x_pad_status |= GP2X_A | GP2X_Y; 198 | newtouches[i] = GP2X_A | GP2X_Y; 199 | } 200 | else if (MyCGRectContainsPoint(ButtonDownLeft, point)) 201 | { 202 | gp2x_pad_status |= GP2X_X | GP2X_A; 203 | newtouches[i] = GP2X_X | GP2X_A; 204 | } 205 | else if (MyCGRectContainsPoint(ButtonUpRight, point)) 206 | { 207 | gp2x_pad_status |= GP2X_B | GP2X_Y; 208 | newtouches[i] = GP2X_B | GP2X_Y; 209 | } 210 | else if (MyCGRectContainsPoint(ButtonDownRight, point)) 211 | { 212 | gp2x_pad_status |= GP2X_X | GP2X_B; 213 | newtouches[i] = GP2X_X | GP2X_B; 214 | } 215 | else if (MyCGRectContainsPoint(UpLeft, point)) 216 | { 217 | gp2x_pad_status |= GP2X_UP | GP2X_LEFT; 218 | newtouches[i] = GP2X_UP | GP2X_LEFT; 219 | } 220 | else if (MyCGRectContainsPoint(DownLeft, point)) 221 | { 222 | gp2x_pad_status |= GP2X_DOWN | GP2X_LEFT; 223 | newtouches[i] = GP2X_DOWN | GP2X_LEFT; 224 | } 225 | else if (MyCGRectContainsPoint(UpRight, point)) 226 | { 227 | gp2x_pad_status |= GP2X_UP | GP2X_RIGHT; 228 | newtouches[i] = GP2X_UP | GP2X_RIGHT; 229 | } 230 | else if (MyCGRectContainsPoint(DownRight, point)) 231 | { 232 | gp2x_pad_status |= GP2X_DOWN | GP2X_RIGHT; 233 | newtouches[i] = GP2X_DOWN | GP2X_RIGHT; 234 | } 235 | else if (MyCGRectContainsPoint(LPad, point)) 236 | { 237 | gp2x_pad_status |= GP2X_L; 238 | newtouches[i] = GP2X_L; 239 | } 240 | else if (MyCGRectContainsPoint(RPad, point)) 241 | { 242 | gp2x_pad_status |= GP2X_R; 243 | newtouches[i] = GP2X_R; 244 | } 245 | else if (MyCGRectContainsPoint(LPad2, point)) 246 | { 247 | gp2x_pad_status |= GP2X_VOL_DOWN; 248 | newtouches[i] = GP2X_VOL_DOWN; 249 | } 250 | else if (MyCGRectContainsPoint(RPad2, point)) 251 | { 252 | gp2x_pad_status |= GP2X_VOL_UP; 253 | newtouches[i] = GP2X_VOL_UP; 254 | } 255 | else if (MyCGRectContainsPoint(Select, point)) 256 | { 257 | gp2x_pad_status |= GP2X_SELECT; 258 | newtouches[i] = GP2X_SELECT; 259 | } 260 | else if (MyCGRectContainsPoint(Start, point)) 261 | { 262 | gp2x_pad_status |= GP2X_START; 263 | newtouches[i] = GP2X_START; 264 | } 265 | else if (MyCGRectContainsPoint(Menu, point)) 266 | { 267 | NSLog(@"menu button pressed"); 268 | } 269 | 270 | if(oldtouches[i] != newtouches[i]) 271 | { 272 | gp2x_pad_status &= ~(oldtouches[i]); 273 | } 274 | } 275 | } 276 | 277 | for (i = 0; i < 10; i++) 278 | { 279 | if(touchstate[i] == 0) 280 | { 281 | gp2x_pad_status &= ~(newtouches[i]); 282 | newtouches[i] = 0; 283 | oldtouches[i] = 0; 284 | } 285 | } 286 | 287 | [AppDelegate().sessionController sendPadStatus:gp2x_pad_status]; 288 | } 289 | 290 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 291 | [self touchesBegan:touches withEvent:event]; 292 | } 293 | 294 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 295 | [self touchesBegan:touches withEvent:event]; 296 | } 297 | 298 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 299 | [self touchesBegan:touches withEvent:event]; 300 | } 301 | 302 | 303 | - (void)getControllerCoords { 304 | char string[256]; 305 | FILE *fp; 306 | 307 | NSString *filepath = [[NSBundle mainBundle] pathForResource:@"snes-1" ofType:@"txt"]; 308 | fp = fopen([filepath UTF8String], "r"); 309 | 310 | if (fp) 311 | { 312 | int i = 0; 313 | while(fgets(string, 256, fp) != NULL && i < 24) { 314 | char* result = strtok(string, ","); 315 | int coords[4]; 316 | int i2 = 1; 317 | while( result != NULL && i2 < 5 ) 318 | { 319 | coords[i2 - 1] = atoi(result); 320 | result = strtok(NULL, ","); 321 | i2++; 322 | } 323 | 324 | switch(i) 325 | { 326 | case 0: DownLeft = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 327 | case 1: Down = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 328 | case 2: DownRight = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 329 | case 3: Left = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 330 | case 4: Right = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 331 | case 5: UpLeft = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 332 | case 6: Up = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 333 | case 7: UpRight = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 334 | case 8: Select = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 335 | case 9: Start = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 336 | case 10: LPad = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 337 | case 11: RPad = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 338 | case 12: Menu = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 339 | case 13: ButtonDownLeft = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 340 | case 14: ButtonDown = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 341 | case 15: ButtonDownRight = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 342 | case 16: ButtonLeft = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 343 | case 17: ButtonRight = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 344 | case 18: ButtonUpLeft = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 345 | case 19: ButtonUp = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 346 | case 20: ButtonUpRight = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 347 | case 21: LPad2 = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 348 | case 22: RPad2 = CGRectMake( coords[0], coords[1], coords[2], coords[3] ); break; 349 | } 350 | i++; 351 | } 352 | fclose(fp); 353 | } 354 | } 355 | 356 | @end 357 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | IOHIDEvent.h ... Header for IOHIDEvent*** functions. 4 | 5 | Copyright (c) 2009 KennyTM~ 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * Neither the name of the KennyTM~ nor the names of its contributors may be 17 | used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | // With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-308/IOHIDFamily/IOHIDEvent.h . 34 | 35 | #ifndef IOKIT_HID_IOHIDEVENT_H 36 | #define IOKIT_HID_IOHIDEVENT_H 1 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #if __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | typedef struct __IOHIDEvent 49 | #if 0 50 | { 51 | CFRuntimeBase base; // 0, 4 52 | AbsoluteTime _timeStamp; // 8, c 53 | int x10; // 10 54 | int x14; // 14 55 | IOOptionBits _options; // 18 56 | unsigned _typeMask; // 1c 57 | CFMutableArrayRef _children; // 20 58 | struct __IOHIDEvent* _parent; // 24 59 | 60 | size_t recordSize; // 28 61 | void record[]; 62 | } 63 | #endif 64 | * IOHIDEventRef; 65 | 66 | #pragma mark - 67 | #pragma mark GetTypeID 68 | 69 | /*! @function IOHIDEventGetTypeID */ 70 | CFTypeID IOHIDEventGetTypeID(void); 71 | 72 | #pragma mark - 73 | #pragma mark Generic creation functions 74 | 75 | IOHIDEventRef IOHIDEventCreateCopy(CFAllocatorRef allocator, IOHIDEventRef event); 76 | /*! @function IOHIDEventCreate 77 | @abstract Create an IOHIDEvent. 78 | @discussion All event-specific parameters are zeroed. */ 79 | IOHIDEventRef IOHIDEventCreate(CFAllocatorRef allocator, IOHIDEventType type, AbsoluteTime timeStamp, IOOptionBits options); 80 | 81 | CFMutableDataRef IOHIDEventCreateData(CFAllocatorRef allocator, IOHIDEventRef event); 82 | IOHIDEventRef IOHIDEventCreateWithData(CFAllocatorRef allocator, CFDataRef data); 83 | 84 | #pragma mark - 85 | #pragma mark Predefined creation functions 86 | 87 | IOHIDEventRef IOHIDEventCreateProgressEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, 88 | uint32_t eventType, IOHIDFloat level, IOOptionBits options); 89 | IOHIDEventRef IOHIDEventCreateVendorDefinedEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, 90 | uint16_t usagePage, uint16_t usage, uint32_t version, const uint8_t* data, uint32_t length, IOOptionBits options); 91 | IOHIDEventRef IOHIDEventCreateSwipeEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDSwipeMask swipeMask, IOOptionBits options); 92 | 93 | /*! @function IOHIDEventCreateDigitizerEvent 94 | @abstract Create a digitizer event. You should use the more specialized methods instead. */ 95 | IOHIDEventRef IOHIDEventCreateDigitizerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDDigitizerTransducerType type, 96 | uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask, 97 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure, 98 | Boolean range, Boolean touch, IOOptionBits options); 99 | IOHIDEventRef IOHIDEventCreateDigitizerFingerEventWithQuality(CFAllocatorRef allocator, AbsoluteTime timeStamp, 100 | uint32_t index, uint32_t identity, uint32_t eventMask, 101 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist, 102 | IOHIDFloat minorRadius, IOHIDFloat majorRadius, IOHIDFloat quality, IOHIDFloat density, IOHIDFloat irregularity, 103 | Boolean range, Boolean touch, IOOptionBits options); 104 | /*! @function IOHIDEventCreateDigitizerFingerEvent 105 | @abstract Create a finger digitizer event with default qualities. 106 | @discussion The default qualities are: 107 | - minorRadius = 5 mm, 108 | - majorRadius = 5 mm, 109 | - quality = 1, 110 | - density = 1, 111 | - irregularity = 1. */ 112 | IOHIDEventRef IOHIDEventCreateDigitizerFingerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, 113 | uint32_t index, uint32_t identity, uint32_t eventMask, 114 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist, 115 | Boolean range, Boolean touch, IOOptionBits options); 116 | IOHIDEventRef IOHIDEventCreateDigitizerStylusEventWithPolarOrientation(CFAllocatorRef allocator, AbsoluteTime timeStamp, 117 | uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask, 118 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure, 119 | IOHIDFloat twist, IOHIDFloat altitude, IOHIDFloat azimuth, 120 | Boolean range, Boolean invert, IOOptionBits options); 121 | /*! @function IOHIDEventCreateDigitizerStylusEvent 122 | @discussion Same as IOHIDEventCreateDigitizerStylusEventWithPolarOrientation? */ 123 | IOHIDEventRef IOHIDEventCreateDigitizerStylusEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, 124 | uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask, 125 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure, 126 | IOHIDFloat twist, IOHIDFloat altitude, IOHIDFloat azimuth, 127 | Boolean range, Boolean invert, IOOptionBits options); 128 | 129 | IOHIDEventRef IOHIDEventCreateProximtyEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDProximityDetectionMask detectionMask, IOOptionBits options); 130 | #define IOHIDEventCreateProximityEvent IOHIDEventCreateProximtyEvent 131 | IOHIDEventRef IOHIDEventCreateAmbientLightSensorEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat level, IOOptionBits options); 132 | 133 | /*! @function IOHIDEventCreateMouseEvent 134 | @abstract Create an mouse event, with pressure of 1.0. */ 135 | IOHIDEventRef IOHIDEventCreateMouseEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, 136 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, uint32_t buttonMask, IOOptionBits options); 137 | /*! @function IOHIDEventCreateMouseEventWithPressure 138 | @abstract Create an mouse event with pressure. 139 | @discussion The mouse is considered clicked when the pressure is > 0.15. */ 140 | IOHIDEventRef IOHIDEventCreateMouseEventWithPressure(CFAllocatorRef allocator, AbsoluteTime timeStamp, 141 | IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, uint32_t buttonMask, IOHIDFloat pressure, IOOptionBits options); 142 | /*! @function IOHIDEventCreateButtonEvent 143 | @abstract Create an button event, with pressure of 1.0. */ 144 | IOHIDEventRef IOHIDEventCreateButtonEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t buttonMask, IOOptionBits options); 145 | /*! @function IOHIDEventCreateButtonEventWithPressure 146 | @abstract Create an button event with pressure. 147 | @discussion The button is considered pressed when the pressure is > 0.15. */ 148 | IOHIDEventRef IOHIDEventCreateButtonEventWithPressure(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t buttonMask, IOHIDFloat pressure, IOOptionBits options); 149 | 150 | IOHIDEventRef IOHIDEventCreateKeyboardEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint16_t usagePage, uint16_t usage, Boolean down, IOHIDEventOptionBits flags); 151 | 152 | IOHIDEventRef IOHIDEventCreateAccelerometerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 153 | IOHIDEventRef IOHIDEventCreatePolarOrientationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 154 | IOHIDEventRef IOHIDEventCreateOrientationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 155 | IOHIDEventRef IOHIDEventCreateVelocityEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 156 | IOHIDEventRef IOHIDEventCreateScaleEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 157 | IOHIDEventRef IOHIDEventCreateScrollEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 158 | IOHIDEventRef IOHIDEventCreateRotationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 159 | IOHIDEventRef IOHIDEventCreateTranslationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options); 160 | 161 | #pragma mark - 162 | #pragma mark Accessors 163 | 164 | IOHIDEventType IOHIDEventGetType(IOHIDEventRef event); 165 | 166 | AbsoluteTime IOHIDEventGetTimeStamp(IOHIDEventRef event); 167 | void IOHIDEventSetTimeStamp(IOHIDEventRef event, AbsoluteTime timeStamp); 168 | 169 | uint32_t IOHIDEventGetEventFlags(IOHIDEventRef event); 170 | void IOHIDEventSetEventFlags(IOHIDEventRef event, uint32_t eventFlags); 171 | Boolean IOHIDEventIsAbsolute(IOHIDEventRef event); 172 | 173 | IOHIDEventRef IOHIDEventGetParent(IOHIDEventRef event); 174 | CFArrayRef IOHIDEventGetChildren(IOHIDEventRef event); 175 | 176 | void IOHIDEventGetVendorDefinedData(IOHIDEventRef event, uint32_t* length, uint8_t** data); 177 | 178 | #pragma mark - 179 | #pragma mark Subevents 180 | 181 | /*! @function IOHIDEventGetEventWithOptions 182 | @abstract Get the deepest event that bears the specified type and matches the options. 183 | @discussion If any of the top 4 bits of options is set (i.e. (options & 0xF0000000) != 0), the children of this event will not be checked. */ 184 | IOHIDEventRef IOHIDEventGetEventWithOptions(IOHIDEventRef event, IOHIDEventType type, IOOptionBits options); 185 | /*! @function IOHIDEventGetEvent 186 | @abstract Get the event that bears the specified type. 187 | @discussion Equivalent to IOHIDEventGetEventWithOptions(event, type, 0xF0000000); */ 188 | IOHIDEventRef IOHIDEventGetEvent(IOHIDEventRef event, IOHIDEventType type); 189 | 190 | void IOHIDEventSetFloatValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOHIDFloat value, IOOptionBits options); 191 | void IOHIDEventSetFloatValue(IOHIDEventRef event, IOHIDEventField field, IOHIDFloat value); 192 | void IOHIDEventSetIntegerValueWithOptions(IOHIDEventRef event, IOHIDEventField field, int value, IOOptionBits options); 193 | void IOHIDEventSetIntegerValue(IOHIDEventRef event, IOHIDEventField field, int value); 194 | void IOHIDEventSetPositionWithOptions(IOHIDEventRef event, IOHIDEventField field, IOHID3DPoint position, IOOptionBits options); 195 | void IOHIDEventSetPosition(IOHIDEventRef event, IOHIDEventField field, IOHID3DPoint position); 196 | 197 | IOHIDFloat IOHIDEventGetFloatValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options); 198 | IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef event, IOHIDEventField field); 199 | int IOHIDEventGetIntegerValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options); 200 | int IOHIDEventGetIntegerValue(IOHIDEventRef event, IOHIDEventField field); 201 | IOHID3DPoint IOHIDEventGetPositionWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options); 202 | IOHID3DPoint IOHIDEventGetPosition(IOHIDEventRef event, IOHIDEventField field); 203 | 204 | /*! @function IOHIDEventConformsToWithOptions 205 | @abstract Returns if the event or any of its children bears the specified type and options. 206 | @discussion If any of the top 4 bits of options is set (i.e. (options & 0xF0000000) != 0), the children of this event will not be checked. */ 207 | Boolean IOHIDEventConformsToWithOptions(IOHIDEventRef event, IOHIDEventType type, IOOptionBits options); 208 | /*! @function IOHIDEventConformsTo 209 | @abstract Returns if the event bears the specified type. 210 | @discussion Equivalent to IOHIDEventConformsToWithOptions(event, type, 0xF0000000); */ 211 | Boolean IOHIDEventConformsTo(IOHIDEventRef event, IOHIDEventType type); 212 | 213 | void IOHIDEventRemoveEvent(IOHIDEventRef event, IOHIDEventRef childEvent); 214 | void IOHIDEventAppendEvent(IOHIDEventRef event, IOHIDEventRef childEvent); 215 | 216 | #if __cplusplus 217 | } 218 | #endif 219 | 220 | #endif 221 | -------------------------------------------------------------------------------- /IOKit/hid/IOHIDEventTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @APPLE_LICENSE_HEADER_START@ 4 | * 5 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | * 22 | * @APPLE_LICENSE_HEADER_END@ 23 | */ 24 | 25 | #ifndef _IOKIT_HID_IOHIDEVENTTYPES_H 26 | #define _IOKIT_HID_IOHIDEVENTTYPES_H 27 | 28 | #include 29 | 30 | #define IOHIDEventTypeMask(type) (1< 308 | Please Note: 309 | If you append a child digitizer event to a parent digitizer event, appropriate state will be transfered on to the parent. 310 | @constant kIOHIDDigitizerEventRange Issued when the range state has changed. 311 | @constant kIOHIDDigitizerEventTouch Issued when the touch state has changed. 312 | @constant kIOHIDDigitizerEventPosition Issued when the position has changed. 313 | @constant kIOHIDDigitizerEventStop Issued when motion has achieved a state of calculated non-movement. 314 | @constant kIOHIDDigitizerEventPeak Issues when new maximum values have been detected. 315 | @constant kIOHIDDigitizerEventIdentity Issued when the identity has changed. 316 | @constant kIOHIDDigitizerEventAttribute Issued when an attribute has changed. 317 | @constant kIOHIDDigitizerEventUpSwipe Issued when an up swipe has been detected. 318 | @constant kIOHIDDigitizerEventDownSwipe Issued when an down swipe has been detected. 319 | @constant kIOHIDDigitizerEventLeftSwipe Issued when an left swipe has been detected. 320 | @constant kIOHIDDigitizerEventRightSwipe Issued when an right swipe has been detected. 321 | @constant kIOHIDDigitizerEventSwipeMask Mask used to gather swipe events. 322 | */ 323 | enum { 324 | kIOHIDDigitizerEventRange = 0x00000001, 325 | kIOHIDDigitizerEventTouch = 0x00000002, 326 | kIOHIDDigitizerEventPosition = 0x00000004, 327 | kIOHIDDigitizerEventStop = 0x00000008, 328 | kIOHIDDigitizerEventPeak = 0x00000010, 329 | kIOHIDDigitizerEventIdentity = 0x00000020, 330 | kIOHIDDigitizerEventAttribute = 0x00000040, 331 | kIOHIDDigitizerEventCancel = 0x00000080, 332 | kIOHIDDigitizerEventStart = 0x00000100, 333 | kIOHIDDigitizerEventResting = 0x00000200, 334 | kIOHIDDigitizerEventSwipeUp = 0x01000000, 335 | kIOHIDDigitizerEventSwipeDown = 0x02000000, 336 | kIOHIDDigitizerEventSwipeLeft = 0x04000000, 337 | kIOHIDDigitizerEventSwipeRight = 0x08000000, 338 | kIOHIDDigitizerEventSwipeMask = 0xFF000000, 339 | }; 340 | typedef uint32_t IOHIDDigitizerEventMask; 341 | 342 | enum { 343 | kIOHIDEventOptionIsAbsolute = 0x00000001, 344 | kIOHIDEventOptionIsCollection = 0x00000002, 345 | kIOHIDEventOptionPixelUnits = 0x00000004 346 | }; 347 | typedef uint32_t IOHIDEventOptionBits; 348 | 349 | #ifndef KERNEL 350 | /*! 351 | @typedef IOHIDFloat 352 | */ 353 | #ifdef __LP64__ 354 | typedef double IOHIDFloat; 355 | #else 356 | typedef float IOHIDFloat; 357 | #endif 358 | /*! 359 | @typedef IOHID3DPoint 360 | */ 361 | typedef struct _IOHID3DPoint { 362 | IOHIDFloat x; 363 | IOHIDFloat y; 364 | IOHIDFloat z; 365 | } IOHID3DPoint; 366 | #endif 367 | 368 | #endif /* _IOKIT_HID_IOHIDEVENTTYPES_H */ -------------------------------------------------------------------------------- /ControlPad.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* SNESControllerAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* SNESControllerAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 28D7ACF80DDB3853001CB0EB /* SNESControllerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* SNESControllerViewController.m */; }; 16 | CE0B34D011AB4AB4006CE96F /* coordinates.plist in Resources */ = {isa = PBXBuildFile; fileRef = CE0B34CF11AB4AB4006CE96F /* coordinates.plist */; }; 17 | CE23586411A2092600593C86 /* SessionController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE23586311A2092600593C86 /* SessionController.m */; }; 18 | CE235A1511A23FC400593C86 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE235A1411A23FC400593C86 /* AVFoundation.framework */; }; 19 | CE7759F811A8BB10001D542F /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE7759F711A8BB10001D542F /* MediaPlayer.framework */; }; 20 | CE775A1A11A8BDB7001D542F /* IOKit in Resources */ = {isa = PBXBuildFile; fileRef = CE775A0211A8BDB7001D542F /* IOKit */; }; 21 | CE775A1B11A8BDB7001D542F /* libkern in Resources */ = {isa = PBXBuildFile; fileRef = CE775A1711A8BDB7001D542F /* libkern */; }; 22 | CE775A3C11A8C28A001D542F /* libIOKit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CE775A3B11A8C28A001D542F /* libIOKit.dylib */; }; 23 | CEC613FA1192516E00431552 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC613F91192516E00431552 /* GameKit.framework */; }; 24 | CEE8572611AA050C00784F8D /* ConnectedIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571A11AA050C00784F8D /* ConnectedIcon.png */; }; 25 | CEE8572711AA050C00784F8D /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571B11AA050C00784F8D /* Default.png */; }; 26 | CEE8572811AA050C00784F8D /* grayButton.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571C11AA050C00784F8D /* grayButton.png */; }; 27 | CEE8572911AA050C00784F8D /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571D11AA050C00784F8D /* Icon.png */; }; 28 | CEE8572A11AA050C00784F8D /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571E11AA050C00784F8D /* MainWindow.xib */; }; 29 | CEE8572B11AA050C00784F8D /* NotConnectedIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8571F11AA050C00784F8D /* NotConnectedIcon.png */; }; 30 | CEE8572C11AA050C00784F8D /* redButton.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572011AA050C00784F8D /* redButton.png */; }; 31 | CEE8572D11AA050C00784F8D /* SessionController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572111AA050C00784F8D /* SessionController.xib */; }; 32 | CEE8572E11AA050C00784F8D /* snes-1.png in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572211AA050C00784F8D /* snes-1.png */; }; 33 | CEE8572F11AA050C00784F8D /* snes-1.txt in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572311AA050C00784F8D /* snes-1.txt */; }; 34 | CEE8573011AA050C00784F8D /* SNESControllerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572411AA050C00784F8D /* SNESControllerViewController.xib */; }; 35 | CEE8573111AA050C00784F8D /* TabController.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEE8572511AA050C00784F8D /* TabController.xib */; }; 36 | /* End PBXBuildFile section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 40 | 1D3623240D0F684500981E51 /* SNESControllerAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNESControllerAppDelegate.h; sourceTree = ""; }; 41 | 1D3623250D0F684500981E51 /* SNESControllerAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNESControllerAppDelegate.m; sourceTree = ""; }; 42 | 1D6058910D05DD3D006BFB54 /* ControlPad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ControlPad.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 44 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 45 | 28D7ACF60DDB3853001CB0EB /* SNESControllerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNESControllerViewController.h; sourceTree = ""; }; 46 | 28D7ACF70DDB3853001CB0EB /* SNESControllerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNESControllerViewController.m; sourceTree = ""; }; 47 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 32CA4F630368D1EE00C91783 /* ControlPad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPad_Prefix.pch; sourceTree = ""; }; 49 | CE0B34CF11AB4AB4006CE96F /* coordinates.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = coordinates.plist; sourceTree = ""; }; 50 | CE23586211A2092600593C86 /* SessionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionController.h; sourceTree = ""; }; 51 | CE23586311A2092600593C86 /* SessionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SessionController.m; sourceTree = ""; }; 52 | CE235A1411A23FC400593C86 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 53 | CE7759F711A8BB10001D542F /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; 54 | CE775A0211A8BDB7001D542F /* IOKit */ = {isa = PBXFileReference; lastKnownFileType = folder; path = IOKit; sourceTree = ""; }; 55 | CE775A1711A8BDB7001D542F /* libkern */ = {isa = PBXFileReference; lastKnownFileType = folder; path = libkern; sourceTree = ""; }; 56 | CE775A3B11A8C28A001D542F /* libIOKit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libIOKit.dylib; path = usr/lib/libIOKit.dylib; sourceTree = SDKROOT; }; 57 | CEC613F91192516E00431552 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; }; 58 | CEE8571A11AA050C00784F8D /* ConnectedIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ConnectedIcon.png; sourceTree = ""; }; 59 | CEE8571B11AA050C00784F8D /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 60 | CEE8571C11AA050C00784F8D /* grayButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grayButton.png; sourceTree = ""; }; 61 | CEE8571D11AA050C00784F8D /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; 62 | CEE8571E11AA050C00784F8D /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 63 | CEE8571F11AA050C00784F8D /* NotConnectedIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = NotConnectedIcon.png; sourceTree = ""; }; 64 | CEE8572011AA050C00784F8D /* redButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = redButton.png; sourceTree = ""; }; 65 | CEE8572111AA050C00784F8D /* SessionController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SessionController.xib; sourceTree = ""; }; 66 | CEE8572211AA050C00784F8D /* snes-1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "snes-1.png"; sourceTree = ""; }; 67 | CEE8572311AA050C00784F8D /* snes-1.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "snes-1.txt"; sourceTree = ""; }; 68 | CEE8572411AA050C00784F8D /* SNESControllerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SNESControllerViewController.xib; sourceTree = ""; }; 69 | CEE8572511AA050C00784F8D /* TabController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TabController.xib; sourceTree = ""; }; 70 | CEE8573211AA051600784F8D /* ControlPad-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ControlPad-Info.plist"; sourceTree = SOURCE_ROOT; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 79 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 80 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 81 | CEC613FA1192516E00431552 /* GameKit.framework in Frameworks */, 82 | CE235A1511A23FC400593C86 /* AVFoundation.framework in Frameworks */, 83 | CE7759F811A8BB10001D542F /* MediaPlayer.framework in Frameworks */, 84 | CE775A3C11A8C28A001D542F /* libIOKit.dylib in Frameworks */, 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | /* End PBXFrameworksBuildPhase section */ 89 | 90 | /* Begin PBXGroup section */ 91 | 080E96DDFE201D6D7F000001 /* Classes */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 1D3623240D0F684500981E51 /* SNESControllerAppDelegate.h */, 95 | 1D3623250D0F684500981E51 /* SNESControllerAppDelegate.m */, 96 | 28D7ACF60DDB3853001CB0EB /* SNESControllerViewController.h */, 97 | 28D7ACF70DDB3853001CB0EB /* SNESControllerViewController.m */, 98 | CE23586211A2092600593C86 /* SessionController.h */, 99 | CE23586311A2092600593C86 /* SessionController.m */, 100 | ); 101 | path = Classes; 102 | sourceTree = ""; 103 | }; 104 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 1D6058910D05DD3D006BFB54 /* ControlPad.app */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 080E96DDFE201D6D7F000001 /* Classes */, 116 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 117 | CEE8571911AA050C00784F8D /* Resources */, 118 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 119 | 19C28FACFE9D520D11CA2CBB /* Products */, 120 | ); 121 | name = CustomTemplate; 122 | sourceTree = ""; 123 | }; 124 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | CE775A0211A8BDB7001D542F /* IOKit */, 128 | CE775A1711A8BDB7001D542F /* libkern */, 129 | 32CA4F630368D1EE00C91783 /* ControlPad_Prefix.pch */, 130 | 29B97316FDCFA39411CA2CEA /* main.m */, 131 | ); 132 | name = "Other Sources"; 133 | sourceTree = ""; 134 | }; 135 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | CEC613F91192516E00431552 /* GameKit.framework */, 139 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 140 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 141 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 142 | CE235A1411A23FC400593C86 /* AVFoundation.framework */, 143 | CE7759F711A8BB10001D542F /* MediaPlayer.framework */, 144 | CE775A3B11A8C28A001D542F /* libIOKit.dylib */, 145 | ); 146 | name = Frameworks; 147 | sourceTree = ""; 148 | }; 149 | CEE8571911AA050C00784F8D /* Resources */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | CE0B34CF11AB4AB4006CE96F /* coordinates.plist */, 153 | CEE8573211AA051600784F8D /* ControlPad-Info.plist */, 154 | CEE8571A11AA050C00784F8D /* ConnectedIcon.png */, 155 | CEE8571B11AA050C00784F8D /* Default.png */, 156 | CEE8571C11AA050C00784F8D /* grayButton.png */, 157 | CEE8571D11AA050C00784F8D /* Icon.png */, 158 | CEE8571E11AA050C00784F8D /* MainWindow.xib */, 159 | CEE8571F11AA050C00784F8D /* NotConnectedIcon.png */, 160 | CEE8572011AA050C00784F8D /* redButton.png */, 161 | CEE8572111AA050C00784F8D /* SessionController.xib */, 162 | CEE8572211AA050C00784F8D /* snes-1.png */, 163 | CEE8572311AA050C00784F8D /* snes-1.txt */, 164 | CEE8572411AA050C00784F8D /* SNESControllerViewController.xib */, 165 | CEE8572511AA050C00784F8D /* TabController.xib */, 166 | ); 167 | path = Resources; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXGroup section */ 171 | 172 | /* Begin PBXNativeTarget section */ 173 | 1D6058900D05DD3D006BFB54 /* ControlPad */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "ControlPad" */; 176 | buildPhases = ( 177 | 1D60588D0D05DD3D006BFB54 /* Resources */, 178 | 1D60588E0D05DD3D006BFB54 /* Sources */, 179 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = ControlPad; 186 | productName = SNESController; 187 | productReference = 1D6058910D05DD3D006BFB54 /* ControlPad.app */; 188 | productType = "com.apple.product-type.application"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 194 | isa = PBXProject; 195 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ControlPad" */; 196 | compatibilityVersion = "Xcode 3.1"; 197 | hasScannedForEncodings = 1; 198 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 1D6058900D05DD3D006BFB54 /* ControlPad */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | CE775A1A11A8BDB7001D542F /* IOKit in Resources */, 213 | CE775A1B11A8BDB7001D542F /* libkern in Resources */, 214 | CEE8572611AA050C00784F8D /* ConnectedIcon.png in Resources */, 215 | CEE8572711AA050C00784F8D /* Default.png in Resources */, 216 | CEE8572811AA050C00784F8D /* grayButton.png in Resources */, 217 | CEE8572911AA050C00784F8D /* Icon.png in Resources */, 218 | CEE8572A11AA050C00784F8D /* MainWindow.xib in Resources */, 219 | CEE8572B11AA050C00784F8D /* NotConnectedIcon.png in Resources */, 220 | CEE8572C11AA050C00784F8D /* redButton.png in Resources */, 221 | CEE8572D11AA050C00784F8D /* SessionController.xib in Resources */, 222 | CEE8572E11AA050C00784F8D /* snes-1.png in Resources */, 223 | CEE8572F11AA050C00784F8D /* snes-1.txt in Resources */, 224 | CEE8573011AA050C00784F8D /* SNESControllerViewController.xib in Resources */, 225 | CEE8573111AA050C00784F8D /* TabController.xib in Resources */, 226 | CE0B34D011AB4AB4006CE96F /* coordinates.plist in Resources */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXResourcesBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 238 | 1D3623260D0F684500981E51 /* SNESControllerAppDelegate.m in Sources */, 239 | 28D7ACF80DDB3853001CB0EB /* SNESControllerViewController.m in Sources */, 240 | CE23586411A2092600593C86 /* SessionController.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXSourcesBuildPhase section */ 245 | 246 | /* Begin XCBuildConfiguration section */ 247 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | COPY_PHASE_STRIP = NO; 252 | FRAMEWORK_SEARCH_PATHS = ( 253 | "$(inherited)", 254 | "\"$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", 255 | ); 256 | GCC_DYNAMIC_NO_PIC = NO; 257 | GCC_OPTIMIZATION_LEVEL = 0; 258 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 259 | GCC_PREFIX_HEADER = ControlPad_Prefix.pch; 260 | INFOPLIST_FILE = "ControlPad-Info.plist"; 261 | PRODUCT_NAME = ControlPad; 262 | }; 263 | name = Debug; 264 | }; 265 | 1D6058950D05DD3E006BFB54 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | COPY_PHASE_STRIP = YES; 270 | FRAMEWORK_SEARCH_PATHS = ( 271 | "$(inherited)", 272 | "\"$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", 273 | ); 274 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 275 | GCC_PREFIX_HEADER = ControlPad_Prefix.pch; 276 | INFOPLIST_FILE = "ControlPad-Info.plist"; 277 | PRODUCT_NAME = ControlPad; 278 | VALIDATE_PRODUCT = YES; 279 | }; 280 | name = Release; 281 | }; 282 | C01FCF4F08A954540054247B /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 286 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 287 | FRAMEWORK_SEARCH_PATHS = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/; 288 | GCC_C_LANGUAGE_STANDARD = c99; 289 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 290 | GCC_WARN_UNUSED_VARIABLE = YES; 291 | HEADER_SEARCH_PATHS = .; 292 | PREBINDING = NO; 293 | SDKROOT = iphoneos3.0; 294 | }; 295 | name = Debug; 296 | }; 297 | C01FCF5008A954540054247B /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 301 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 302 | FRAMEWORK_SEARCH_PATHS = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/; 303 | GCC_C_LANGUAGE_STANDARD = c99; 304 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | HEADER_SEARCH_PATHS = .; 307 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 308 | PREBINDING = NO; 309 | SDKROOT = iphoneos3.0; 310 | }; 311 | name = Release; 312 | }; 313 | /* End XCBuildConfiguration section */ 314 | 315 | /* Begin XCConfigurationList section */ 316 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "ControlPad" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 1D6058940D05DD3E006BFB54 /* Debug */, 320 | 1D6058950D05DD3E006BFB54 /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ControlPad" */ = { 326 | isa = XCConfigurationList; 327 | buildConfigurations = ( 328 | C01FCF4F08A954540054247B /* Debug */, 329 | C01FCF5008A954540054247B /* Release */, 330 | ); 331 | defaultConfigurationIsVisible = 0; 332 | defaultConfigurationName = Release; 333 | }; 334 | /* End XCConfigurationList section */ 335 | }; 336 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 337 | } 338 | -------------------------------------------------------------------------------- /Resources/TabController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 768 5 | 10C540 6 | 762 7 | 1038.25 8 | 458.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 87 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 43 | 44 | 3 45 | 46 | IBCocoaTouchFramework 47 | YES 48 | 49 | About 50 | 51 | About 52 | IBCocoaTouchFramework 53 | 54 | 55 | 56 | 57 | 58 | 1 59 | 60 | IBCocoaTouchFramework 61 | NO 62 | 63 | 64 | YES 65 | 66 | Options 67 | 68 | Options 69 | IBCocoaTouchFramework 70 | 71 | 72 | 73 | 74 | 1 75 | 76 | IBCocoaTouchFramework 77 | NO 78 | 79 | 80 | Connection 81 | 82 | Connection 83 | IBCocoaTouchFramework 84 | 85 | 86 | 87 | 88 | 1 89 | 90 | IBCocoaTouchFramework 91 | NO 92 | 93 | 94 | 95 | 96 | 97 | 266 98 | {{129, 330}, {163, 49}} 99 | 100 | 3 101 | MCAwAA 102 | 103 | IBCocoaTouchFramework 104 | 105 | 106 | 107 | 108 | 109 | YES 110 | 111 | 112 | 113 | YES 114 | 115 | 0 116 | 117 | 118 | 119 | 120 | 121 | -1 122 | 123 | 124 | File's Owner 125 | 126 | 127 | -2 128 | 129 | 130 | 131 | 132 | 2 133 | 134 | 135 | YES 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 3 145 | 146 | 147 | 148 | 149 | 4 150 | 151 | 152 | YES 153 | 154 | 155 | 156 | 157 | 158 | 5 159 | 160 | 161 | YES 162 | 163 | 164 | 165 | 166 | 167 | 6 168 | 169 | 170 | 171 | 172 | 7 173 | 174 | 175 | 176 | 177 | 8 178 | 179 | 180 | YES 181 | 182 | 183 | 184 | 185 | 186 | 9 187 | 188 | 189 | 190 | 191 | 192 | 193 | YES 194 | 195 | YES 196 | -2.CustomClassName 197 | 2.IBEditorWindowLastContentRect 198 | 2.IBPluginDependency 199 | 3.IBPluginDependency 200 | 4.IBPluginDependency 201 | 5.IBPluginDependency 202 | 6.IBPluginDependency 203 | 7.IBPluginDependency 204 | 205 | 206 | YES 207 | UIResponder 208 | {{397, 322}, {480, 320}} 209 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 210 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 211 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 212 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 213 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 214 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 215 | 216 | 217 | 218 | YES 219 | 220 | 221 | YES 222 | 223 | 224 | 225 | 226 | YES 227 | 228 | 229 | YES 230 | 231 | 232 | 233 | 9 234 | 235 | 236 | 237 | YES 238 | 239 | NSObject 240 | 241 | IBFrameworkSource 242 | Foundation.framework/Headers/NSError.h 243 | 244 | 245 | 246 | NSObject 247 | 248 | IBFrameworkSource 249 | Foundation.framework/Headers/NSFileManager.h 250 | 251 | 252 | 253 | NSObject 254 | 255 | IBFrameworkSource 256 | Foundation.framework/Headers/NSKeyValueCoding.h 257 | 258 | 259 | 260 | NSObject 261 | 262 | IBFrameworkSource 263 | Foundation.framework/Headers/NSKeyValueObserving.h 264 | 265 | 266 | 267 | NSObject 268 | 269 | IBFrameworkSource 270 | Foundation.framework/Headers/NSKeyedArchiver.h 271 | 272 | 273 | 274 | NSObject 275 | 276 | IBFrameworkSource 277 | Foundation.framework/Headers/NSNetServices.h 278 | 279 | 280 | 281 | NSObject 282 | 283 | IBFrameworkSource 284 | Foundation.framework/Headers/NSObject.h 285 | 286 | 287 | 288 | NSObject 289 | 290 | IBFrameworkSource 291 | Foundation.framework/Headers/NSPort.h 292 | 293 | 294 | 295 | NSObject 296 | 297 | IBFrameworkSource 298 | Foundation.framework/Headers/NSRunLoop.h 299 | 300 | 301 | 302 | NSObject 303 | 304 | IBFrameworkSource 305 | Foundation.framework/Headers/NSStream.h 306 | 307 | 308 | 309 | NSObject 310 | 311 | IBFrameworkSource 312 | Foundation.framework/Headers/NSThread.h 313 | 314 | 315 | 316 | NSObject 317 | 318 | IBFrameworkSource 319 | Foundation.framework/Headers/NSURL.h 320 | 321 | 322 | 323 | NSObject 324 | 325 | IBFrameworkSource 326 | Foundation.framework/Headers/NSURLConnection.h 327 | 328 | 329 | 330 | NSObject 331 | 332 | IBFrameworkSource 333 | Foundation.framework/Headers/NSXMLParser.h 334 | 335 | 336 | 337 | NSObject 338 | 339 | IBFrameworkSource 340 | UIKit.framework/Headers/UIAccessibility.h 341 | 342 | 343 | 344 | NSObject 345 | 346 | IBFrameworkSource 347 | UIKit.framework/Headers/UINibLoading.h 348 | 349 | 350 | 351 | NSObject 352 | 353 | IBFrameworkSource 354 | UIKit.framework/Headers/UIResponder.h 355 | 356 | 357 | 358 | UIBarItem 359 | NSObject 360 | 361 | IBFrameworkSource 362 | UIKit.framework/Headers/UIBarItem.h 363 | 364 | 365 | 366 | UIResponder 367 | NSObject 368 | 369 | 370 | 371 | UISearchBar 372 | UIView 373 | 374 | IBFrameworkSource 375 | UIKit.framework/Headers/UISearchBar.h 376 | 377 | 378 | 379 | UISearchDisplayController 380 | NSObject 381 | 382 | IBFrameworkSource 383 | UIKit.framework/Headers/UISearchDisplayController.h 384 | 385 | 386 | 387 | UITabBar 388 | UIView 389 | 390 | IBFrameworkSource 391 | UIKit.framework/Headers/UITabBar.h 392 | 393 | 394 | 395 | UITabBarController 396 | UIViewController 397 | 398 | IBFrameworkSource 399 | UIKit.framework/Headers/UITabBarController.h 400 | 401 | 402 | 403 | UITabBarItem 404 | UIBarItem 405 | 406 | IBFrameworkSource 407 | UIKit.framework/Headers/UITabBarItem.h 408 | 409 | 410 | 411 | UIView 412 | 413 | IBFrameworkSource 414 | UIKit.framework/Headers/UITextField.h 415 | 416 | 417 | 418 | UIView 419 | UIResponder 420 | 421 | IBFrameworkSource 422 | UIKit.framework/Headers/UIView.h 423 | 424 | 425 | 426 | UIViewController 427 | 428 | IBFrameworkSource 429 | UIKit.framework/Headers/UINavigationController.h 430 | 431 | 432 | 433 | UIViewController 434 | 435 | 436 | 437 | UIViewController 438 | UIResponder 439 | 440 | IBFrameworkSource 441 | UIKit.framework/Headers/UIViewController.h 442 | 443 | 444 | 445 | 446 | 0 447 | IBCocoaTouchFramework 448 | 449 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 450 | 451 | 452 | 453 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 454 | 455 | 456 | YES 457 | 458 | 3 459 | 87 460 | 461 | 462 | -------------------------------------------------------------------------------- /Resources/SNESControllerViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 768 5 | 10C540 6 | 762 7 | 1038.25 8 | 458.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 87 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {480, 320} 49 | 50 | NO 51 | IBCocoaTouchFramework 52 | 53 | 54 | 55 | 292 56 | {{442, 281}, {18, 19}} 57 | 58 | NO 59 | IBCocoaTouchFramework 60 | 0 61 | 0 62 | 63 | Helvetica-Bold 64 | 15 65 | 16 66 | 67 | 3 68 | YES 69 | 70 | 3 71 | MQA 72 | 73 | 74 | 1 75 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 76 | 77 | 78 | 3 79 | MC41AA 80 | 81 | 82 | 83 | 84 | 292 85 | {{19, 281}, {20, 20}} 86 | 87 | NO 88 | IBCocoaTouchFramework 89 | 0 90 | 0 91 | 92 | 93 | 94 | 1 95 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 96 | 97 | 98 | 99 | NSImage 100 | NotConnectedIcon.png 101 | 102 | 103 | 104 | {480, 320} 105 | 106 | 107 | 3 108 | MC43NQA 109 | 110 | 2 111 | 112 | 113 | NO 114 | 115 | 3 116 | 117 | IBCocoaTouchFramework 118 | 119 | 120 | 121 | 122 | YES 123 | 124 | 125 | view 126 | 127 | 128 | 129 | 7 130 | 131 | 132 | 133 | imageView 134 | 135 | 136 | 137 | 9 138 | 139 | 140 | 141 | infoButton 142 | 143 | 144 | 145 | 11 146 | 147 | 148 | 149 | connectionButton 150 | 151 | 152 | 153 | 14 154 | 155 | 156 | 157 | buttonPressed: 158 | 159 | 160 | 7 161 | 162 | 16 163 | 164 | 165 | 166 | buttonPressed: 167 | 168 | 169 | 7 170 | 171 | 17 172 | 173 | 174 | 175 | 176 | YES 177 | 178 | 0 179 | 180 | 181 | 182 | 183 | 184 | -1 185 | 186 | 187 | File's Owner 188 | 189 | 190 | -2 191 | 192 | 193 | 194 | 195 | 6 196 | 197 | 198 | YES 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 8 207 | 208 | 209 | 210 | 211 | 10 212 | 213 | 214 | 215 | 216 | 13 217 | 218 | 219 | 220 | 221 | 222 | 223 | YES 224 | 225 | YES 226 | -1.CustomClassName 227 | -2.CustomClassName 228 | 10.IBPluginDependency 229 | 13.IBPluginDependency 230 | 6.IBEditorWindowLastContentRect 231 | 6.IBPluginDependency 232 | 8.IBPluginDependency 233 | 234 | 235 | YES 236 | SNESControllerViewController 237 | UIResponder 238 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 239 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 240 | {{414, 424}, {480, 320}} 241 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 242 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 243 | 244 | 245 | 246 | YES 247 | 248 | 249 | YES 250 | 251 | 252 | 253 | 254 | YES 255 | 256 | 257 | YES 258 | 259 | 260 | 261 | 17 262 | 263 | 264 | 265 | YES 266 | 267 | SNESControllerViewController 268 | UIViewController 269 | 270 | buttonPressed: 271 | id 272 | 273 | 274 | YES 275 | 276 | YES 277 | connectionButton 278 | imageView 279 | infoButton 280 | 281 | 282 | YES 283 | UIButton 284 | UIImageView 285 | UIButton 286 | 287 | 288 | 289 | IBProjectSource 290 | Classes/SNESControllerViewController.h 291 | 292 | 293 | 294 | 295 | YES 296 | 297 | NSObject 298 | 299 | IBFrameworkSource 300 | Foundation.framework/Headers/NSError.h 301 | 302 | 303 | 304 | NSObject 305 | 306 | IBFrameworkSource 307 | Foundation.framework/Headers/NSFileManager.h 308 | 309 | 310 | 311 | NSObject 312 | 313 | IBFrameworkSource 314 | Foundation.framework/Headers/NSKeyValueCoding.h 315 | 316 | 317 | 318 | NSObject 319 | 320 | IBFrameworkSource 321 | Foundation.framework/Headers/NSKeyValueObserving.h 322 | 323 | 324 | 325 | NSObject 326 | 327 | IBFrameworkSource 328 | Foundation.framework/Headers/NSKeyedArchiver.h 329 | 330 | 331 | 332 | NSObject 333 | 334 | IBFrameworkSource 335 | Foundation.framework/Headers/NSNetServices.h 336 | 337 | 338 | 339 | NSObject 340 | 341 | IBFrameworkSource 342 | Foundation.framework/Headers/NSObject.h 343 | 344 | 345 | 346 | NSObject 347 | 348 | IBFrameworkSource 349 | Foundation.framework/Headers/NSPort.h 350 | 351 | 352 | 353 | NSObject 354 | 355 | IBFrameworkSource 356 | Foundation.framework/Headers/NSRunLoop.h 357 | 358 | 359 | 360 | NSObject 361 | 362 | IBFrameworkSource 363 | Foundation.framework/Headers/NSStream.h 364 | 365 | 366 | 367 | NSObject 368 | 369 | IBFrameworkSource 370 | Foundation.framework/Headers/NSThread.h 371 | 372 | 373 | 374 | NSObject 375 | 376 | IBFrameworkSource 377 | Foundation.framework/Headers/NSURL.h 378 | 379 | 380 | 381 | NSObject 382 | 383 | IBFrameworkSource 384 | Foundation.framework/Headers/NSURLConnection.h 385 | 386 | 387 | 388 | NSObject 389 | 390 | IBFrameworkSource 391 | Foundation.framework/Headers/NSXMLParser.h 392 | 393 | 394 | 395 | NSObject 396 | 397 | IBFrameworkSource 398 | UIKit.framework/Headers/UIAccessibility.h 399 | 400 | 401 | 402 | NSObject 403 | 404 | IBFrameworkSource 405 | UIKit.framework/Headers/UINibLoading.h 406 | 407 | 408 | 409 | NSObject 410 | 411 | IBFrameworkSource 412 | UIKit.framework/Headers/UIResponder.h 413 | 414 | 415 | 416 | UIButton 417 | UIControl 418 | 419 | IBFrameworkSource 420 | UIKit.framework/Headers/UIButton.h 421 | 422 | 423 | 424 | UIControl 425 | UIView 426 | 427 | IBFrameworkSource 428 | UIKit.framework/Headers/UIControl.h 429 | 430 | 431 | 432 | UIImageView 433 | UIView 434 | 435 | IBFrameworkSource 436 | UIKit.framework/Headers/UIImageView.h 437 | 438 | 439 | 440 | UIResponder 441 | NSObject 442 | 443 | 444 | 445 | UISearchBar 446 | UIView 447 | 448 | IBFrameworkSource 449 | UIKit.framework/Headers/UISearchBar.h 450 | 451 | 452 | 453 | UISearchDisplayController 454 | NSObject 455 | 456 | IBFrameworkSource 457 | UIKit.framework/Headers/UISearchDisplayController.h 458 | 459 | 460 | 461 | UIView 462 | 463 | IBFrameworkSource 464 | UIKit.framework/Headers/UITextField.h 465 | 466 | 467 | 468 | UIView 469 | UIResponder 470 | 471 | IBFrameworkSource 472 | UIKit.framework/Headers/UIView.h 473 | 474 | 475 | 476 | UIViewController 477 | 478 | IBFrameworkSource 479 | UIKit.framework/Headers/UINavigationController.h 480 | 481 | 482 | 483 | UIViewController 484 | 485 | IBFrameworkSource 486 | UIKit.framework/Headers/UITabBarController.h 487 | 488 | 489 | 490 | UIViewController 491 | UIResponder 492 | 493 | IBFrameworkSource 494 | UIKit.framework/Headers/UIViewController.h 495 | 496 | 497 | 498 | 499 | 0 500 | IBCocoaTouchFramework 501 | 502 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 503 | 504 | 505 | 506 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 507 | 508 | 509 | YES 510 | SNESController.xcodeproj 511 | 3 512 | 513 | NotConnectedIcon.png 514 | {16, 16} 515 | 516 | 87 517 | 518 | 519 | --------------------------------------------------------------------------------